about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2021-04-15 21:00:11 +0000
committerbors <bors@rust-lang.org>2021-04-15 21:00:11 +0000
commit7af1f55ae359e731c2c303f5d98e42a1a8163af0 (patch)
tree1f17eb3cf15e1790a83498344208544a2758aee1 /compiler/rustc_codegen_llvm/src
parent60158f4a7cf3e3063df6127d3f0d206921d285b0 (diff)
parent003b8eadd7a476c51956fe447894532d6e21937e (diff)
downloadrust-7af1f55ae359e731c2c303f5d98e42a1a8163af0.tar.gz
rust-7af1f55ae359e731c2c303f5d98e42a1a8163af0.zip
Auto merge of #84205 - workingjubilee:more-simd-intrin, r=bjorn3
Add simd_{round,trunc} intrinsics

LLVM supports many functions from math.h in its IR. Many of these
have SIMD instructions on various platforms. So, let's add round and
trunc 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