summary refs log tree commit diff
path: root/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
diff options
context:
space:
mode:
authorRalf Jung <post@ralfj.de>2024-02-18 23:10:34 +0100
committerRalf Jung <post@ralfj.de>2024-02-21 16:28:20 +0100
commit3dc631a61a7333123ece4f21b0d44e43cdff0980 (patch)
tree04241cb9bd6271fd03f938ee5dc9db0df918b868 /compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
parent25fe3cc69d3f14d3985aa053ed8962cffcbdc842 (diff)
downloadrust-3dc631a61a7333123ece4f21b0d44e43cdff0980.tar.gz
rust-3dc631a61a7333123ece4f21b0d44e43cdff0980.zip
make simd_reduce_{mul,add}_unordered use only the 'reassoc' flag, not all fast-math flags
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp')
-rw-r--r--compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp b/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
index 7326f2e8e2a..664d2adbdc1 100644
--- a/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
+++ b/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
@@ -418,11 +418,17 @@ extern "C" LLVMAttributeRef LLVMRustCreateMemoryEffectsAttr(LLVMContextRef C,
   }
 }
 
+<<<<<<< HEAD
 // Enable all fast-math flags, including those which will cause floating-point operations
 // to return poison for some well-defined inputs. This function can only be used to build
 // unsafe Rust intrinsics. That unsafety does permit additional optimizations, but at the
 // time of writing, their value is not well-understood relative to those enabled by
 // LLVMRustSetAlgebraicMath.
+||||||| parent of 019019d83e2 (make simd_reduce_{mul,add}_unordered use only the 'reassoc' flag, not all fast-math flags)
+// Enable a fast-math flag
+=======
+// Enable all fast-math flags
+>>>>>>> 019019d83e2 (make simd_reduce_{mul,add}_unordered use only the 'reassoc' flag, not all fast-math flags)
 //
 // https://llvm.org/docs/LangRef.html#fast-math-flags
 extern "C" void LLVMRustSetFastMath(LLVMValueRef V) {
@@ -450,6 +456,15 @@ extern "C" void LLVMRustSetAlgebraicMath(LLVMValueRef V) {
   }
 }
 
+// Enable the reassoc fast-math flag
+//
+// https://llvm.org/docs/LangRef.html#fast-math-flags
+extern "C" void LLVMRustSetAllowReassoc(LLVMValueRef V) {
+  if (auto I = dyn_cast<Instruction>(unwrap<Value>(V))) {
+    I->setHasAllowReassoc(true);
+  }
+}
+
 extern "C" LLVMValueRef
 LLVMRustBuildAtomicLoad(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef Source,
                         const char *Name, LLVMAtomicOrdering Order) {