[llvm] [Transforms] Resolve FIXME: No Lowering of FNeg to FMul unless it is safe (PR #85252)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 15 01:16:20 PDT 2024
================
@@ -578,3 +578,61 @@ define float @test18(float %A, float %B) {
%Z = fadd fast float %Y, 1.200000e+01
ret float %Z
}
+
+; Do not fneg fast float unless it has nnan
+
+define float @scalar(float %a) {
+; CHECK-LABEL: @scalar(
+; CHECK-NEXT: entry:
+; CHECK-NEXT: [[NEG:%.*]] = fmul fast float [[A:%.*]], 2.000000e+00
+; CHECK-NEXT: [[MUL:%.*]] = fmul fast float [[NEG]], [[A]]
+; CHECK-NEXT: ret float [[MUL]]
+;
+entry:
+ %b = fmul fast float %a, -2.0
+ %neg = fneg fast float %a
+ %mul = fmul fast float %neg, %b
----------------
arsenm wrote:
Don't need the full set of fast flags. Also don't need it on every instruction. Should target testing missing specific flags contexts
https://github.com/llvm/llvm-project/pull/85252
More information about the llvm-commits
mailing list