aboutsummaryrefslogtreecommitdiff
path: root/src/llvm_backend_utility.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/llvm_backend_utility.cpp')
-rw-r--r--src/llvm_backend_utility.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/llvm_backend_utility.cpp b/src/llvm_backend_utility.cpp
index 0f5d7fb43..2c80f9c6a 100644
--- a/src/llvm_backend_utility.cpp
+++ b/src/llvm_backend_utility.cpp
@@ -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) {
x = lb_emit_conv(p, x, 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.
// -0.0 is considered to be less than +0.0 for this intrinsic.
// 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) {
x = lb_emit_conv(p, x, 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.
// -0.0 is considered to be less than +0.0 for this intrinsic.
// These semantics are specified by IEEE 754-2019.