|
@@ -124,7 +124,8 @@ gb_internal lbValue lb_emit_select(lbProcedure *p, lbValue cond, lbValue x, lbVa
|
|
gb_internal lbValue lb_emit_min(lbProcedure *p, Type *t, lbValue x, lbValue y) {
|
|
gb_internal lbValue lb_emit_min(lbProcedure *p, Type *t, lbValue x, lbValue y) {
|
|
x = lb_emit_conv(p, x, t);
|
|
x = lb_emit_conv(p, x, t);
|
|
y = lb_emit_conv(p, y, t);
|
|
y = lb_emit_conv(p, y, t);
|
|
- if (is_type_float(t)) {
|
|
|
|
|
|
+ bool use_llvm_intrinsic = is_type_float(t) || (is_type_simd_vector(t) && is_type_float(base_array_type(t)));
|
|
|
|
+ if (use_llvm_intrinsic) {
|
|
// NOTE(bill): f either operand is a NaN, returns NaN. Otherwise returns the lesser of the two arguments.
|
|
// NOTE(bill): f either operand is a NaN, returns NaN. Otherwise returns the lesser of the two arguments.
|
|
// -0.0 is considered to be less than +0.0 for this intrinsic.
|
|
// -0.0 is considered to be less than +0.0 for this intrinsic.
|
|
// These semantics are specified by IEEE 754-2019.
|
|
// These semantics are specified by IEEE 754-2019.
|
|
@@ -138,7 +139,8 @@ gb_internal lbValue lb_emit_min(lbProcedure *p, Type *t, lbValue x, lbValue y) {
|
|
gb_internal lbValue lb_emit_max(lbProcedure *p, Type *t, lbValue x, lbValue y) {
|
|
gb_internal lbValue lb_emit_max(lbProcedure *p, Type *t, lbValue x, lbValue y) {
|
|
x = lb_emit_conv(p, x, t);
|
|
x = lb_emit_conv(p, x, t);
|
|
y = lb_emit_conv(p, y, t);
|
|
y = lb_emit_conv(p, y, t);
|
|
- if (is_type_float(t)) {
|
|
|
|
|
|
+ bool use_llvm_intrinsic = is_type_float(t) || (is_type_simd_vector(t) && is_type_float(base_array_type(t)));
|
|
|
|
+ if (use_llvm_intrinsic) {
|
|
// NOTE(bill): If either operand is a NaN, returns NaN. Otherwise returns the greater of the two arguments.
|
|
// NOTE(bill): If either operand is a NaN, returns NaN. Otherwise returns the greater of the two arguments.
|
|
// -0.0 is considered to be less than +0.0 for this intrinsic.
|
|
// -0.0 is considered to be less than +0.0 for this intrinsic.
|
|
// These semantics are specified by IEEE 754-2019.
|
|
// These semantics are specified by IEEE 754-2019.
|