Add intrinsics for float arithmetic with fast
flag enabled
`fast` a.k.a UnsafeAlgebra is the flag for enabling all "unsafe" (according to llvm) float optimizations. See LangRef for more information http://llvm.org/docs/LangRef.html#fast-math-flags Providing these operations with less precise associativity rules (for example) is useful to numerical applications. For example, the summation loop: let sum = 0.; for element in data { sum += *element; } Using the default floating point semantics, this loop expresses the floats must be added in a sequence, one after another. This constraint is usually completely unintended, and it means that no autovectorization is possible.
This commit is contained in:
parent
235d77457d
commit
2dbac1fb8e
9 changed files with 261 additions and 0 deletions
|
@ -164,6 +164,11 @@ extern "C" void LLVMRemoveFunctionAttrString(LLVMValueRef fn, unsigned index, co
|
|||
to_remove));
|
||||
}
|
||||
|
||||
// enable fpmath flag UnsafeAlgebra
|
||||
extern "C" void LLVMRustSetHasUnsafeAlgebra(LLVMValueRef Instr) {
|
||||
unwrap<Instruction>(Instr)->setHasUnsafeAlgebra(true);
|
||||
}
|
||||
|
||||
extern "C" LLVMValueRef LLVMBuildAtomicLoad(LLVMBuilderRef B,
|
||||
LLVMValueRef source,
|
||||
const char* Name,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue