about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src
diff options
context:
space:
mode:
authorJubilee Young <workingjubilee@gmail.com>2021-04-14 15:07:36 -0700
committerJubilee Young <workingjubilee@gmail.com>2021-04-14 15:25:06 -0700
commit003b8eadd7a476c51956fe447894532d6e21937e (patch)
tree534e1c1251277093d01106f6990a33505b5fb312 /compiler/rustc_codegen_llvm/src
parentd0695c9081b16077d0aed368bccaf437d77ff497 (diff)
downloadrust-003b8eadd7a476c51956fe447894532d6e21937e.tar.gz
rust-003b8eadd7a476c51956fe447894532d6e21937e.zip
Add more SIMD math.h intrinsics
LLVM supports many functions from math.h in its IR. Many of these have
single-instruction variants on various platforms. So, let's add them so
std::arch can use them.

Yes, exact comparison is intentional: rounding must always return a
valid integer-equal value, except for inf/NAN.
Diffstat (limited to 'compiler/rustc_codegen_llvm/src')
-rw-r--r--compiler/rustc_codegen_llvm/src/intrinsic.rs8
1 files changed, 6 insertions, 2 deletions
diff --git a/compiler/rustc_codegen_llvm/src/intrinsic.rs b/compiler/rustc_codegen_llvm/src/intrinsic.rs
index af366f93b91..52fab2ea17d 100644
--- a/compiler/rustc_codegen_llvm/src/intrinsic.rs
+++ b/compiler/rustc_codegen_llvm/src/intrinsic.rs
@@ -1057,8 +1057,10 @@ fn generic_simd_intrinsic(
             sym::simd_fsin => ("sin", bx.type_func(&[vec_ty], vec_ty)),
             sym::simd_fcos => ("cos", bx.type_func(&[vec_ty], vec_ty)),
             sym::simd_fabs => ("fabs", bx.type_func(&[vec_ty], vec_ty)),
-            sym::simd_floor => ("floor", bx.type_func(&[vec_ty], vec_ty)),
             sym::simd_ceil => ("ceil", bx.type_func(&[vec_ty], vec_ty)),
+            sym::simd_floor => ("floor", bx.type_func(&[vec_ty], vec_ty)),
+            sym::simd_round => ("round", bx.type_func(&[vec_ty], vec_ty)),
+            sym::simd_trunc => ("trunc", bx.type_func(&[vec_ty], vec_ty)),
             sym::simd_fexp => ("exp", bx.type_func(&[vec_ty], vec_ty)),
             sym::simd_fexp2 => ("exp2", bx.type_func(&[vec_ty], vec_ty)),
             sym::simd_flog10 => ("log10", bx.type_func(&[vec_ty], vec_ty)),
@@ -1083,8 +1085,10 @@ fn generic_simd_intrinsic(
             | sym::simd_fsin
             | sym::simd_fcos
             | sym::simd_fabs
-            | sym::simd_floor
             | sym::simd_ceil
+            | sym::simd_floor
+            | sym::simd_round
+            | sym::simd_trunc
             | sym::simd_fexp
             | sym::simd_fexp2
             | sym::simd_flog10