__arithmetic_fence enforces ordering on expression evaluation when fast-math
is enabled. In fast math mode some floating-point optimizations are performed such as reassociation and distribution. For example, the compiler may transform (a+b)+c into a+(b+c). Although these two expressions are equivalent in integer arithmetic, they may not be in floating-point arithmetic. The builtin tells the compiler that the expression in parenthesis can’t be re-associated or distributed. __arithmetic_fence(a+b)+c is not equivalent to a+(b+c). This patch adds the support of the builtin to SPIR target. Differential Revision: https://reviews.llvm.org/D142583
parent
42e371b1
Please register or sign in to comment