mirror of
https://github.com/Ed94/Odin.git
synced 2026-06-20 12:44:59 -07:00
Unify min/max semantics for simd_(min|max)
This commit is contained in:
@@ -1399,8 +1399,7 @@ gb_internal lbValue lb_build_builtin_simd_proc(lbProcedure *p, Ast *expr, TypeAn
|
||||
return res;
|
||||
case BuiltinProc_simd_min:
|
||||
if (is_float) {
|
||||
LLVMValueRef cond = LLVMBuildFCmp(p->builder, LLVMRealOLT, arg0.value, arg1.value, "");
|
||||
res.value = LLVMBuildSelect(p->builder, cond, arg0.value, arg1.value, "");
|
||||
return lb_emit_min(p, res.type, arg0, arg1);
|
||||
} else {
|
||||
LLVMValueRef cond = LLVMBuildICmp(p->builder, is_signed ? LLVMIntSLT : LLVMIntULT, arg0.value, arg1.value, "");
|
||||
res.value = LLVMBuildSelect(p->builder, cond, arg0.value, arg1.value, "");
|
||||
@@ -1408,8 +1407,7 @@ gb_internal lbValue lb_build_builtin_simd_proc(lbProcedure *p, Ast *expr, TypeAn
|
||||
return res;
|
||||
case BuiltinProc_simd_max:
|
||||
if (is_float) {
|
||||
LLVMValueRef cond = LLVMBuildFCmp(p->builder, LLVMRealOGT, arg0.value, arg1.value, "");
|
||||
res.value = LLVMBuildSelect(p->builder, cond, arg0.value, arg1.value, "");
|
||||
return lb_emit_max(p, res.type, arg0, arg1);
|
||||
} else {
|
||||
LLVMValueRef cond = LLVMBuildICmp(p->builder, is_signed ? LLVMIntSGT : LLVMIntUGT, arg0.value, arg1.value, "");
|
||||
res.value = LLVMBuildSelect(p->builder, cond, arg0.value, arg1.value, "");
|
||||
|
||||
Reference in New Issue
Block a user