summaryrefslogtreecommitdiffstats
path: root/llvm/test/CodeGen/PowerPC/no-extra-fp-conv-ldst.ll
diff options
context:
space:
mode:
authorSanjay Patel <spatel@rotateright.com>2018-06-27 18:16:40 +0000
committerSanjay Patel <spatel@rotateright.com>2018-06-27 18:16:40 +0000
commitd052de856d83095bf687755fb0c7c47e916956c8 (patch)
treef386aa2189c05ee1d68b025e95dea63eb6e82f7e /llvm/test/CodeGen/PowerPC/no-extra-fp-conv-ldst.ll
parent7e7b13d016f6f216c83dde5b925a937ef4cf3072 (diff)
downloadbcm5719-llvm-d052de856d83095bf687755fb0c7c47e916956c8.tar.gz
bcm5719-llvm-d052de856d83095bf687755fb0c7c47e916956c8.zip
[DAGCombiner] restrict (float)((int) f) --> ftrunc with no-signed-zeros
As noted in the D44909 review, the transform from (fptosi+sitofp) to ftrunc can produce -0.0 where the original code does not: #include <stdio.h> int main(int argc) { float x; x = -0.8 * argc; printf("%f\n", (float)((int)x)); return 0; } $ clang -O0 -mavx fp.c ; ./a.out 0.000000 $ clang -O1 -mavx fp.c ; ./a.out -0.000000 Ideally, we'd use IR/node flags to predicate the transform, but the IR parser doesn't currently allow fast-math-flags on the cast instructions. So for now, just use the function attribute that corresponds to clang's "-fno-signed-zeros" option. Differential Revision: https://reviews.llvm.org/D48085 llvm-svn: 335761
Diffstat (limited to 'llvm/test/CodeGen/PowerPC/no-extra-fp-conv-ldst.ll')
-rw-r--r--llvm/test/CodeGen/PowerPC/no-extra-fp-conv-ldst.ll2
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/test/CodeGen/PowerPC/no-extra-fp-conv-ldst.ll b/llvm/test/CodeGen/PowerPC/no-extra-fp-conv-ldst.ll
index 0bbaf3493fd..2ae1d32e78e 100644
--- a/llvm/test/CodeGen/PowerPC/no-extra-fp-conv-ldst.ll
+++ b/llvm/test/CodeGen/PowerPC/no-extra-fp-conv-ldst.ll
@@ -76,5 +76,5 @@ entry:
; CHECK: blr
}
-attributes #0 = { nounwind readonly }
+attributes #0 = { nounwind readonly "no-signed-zeros-fp-math"="true" }
OpenPOWER on IntegriCloud