diff options
author | Craig Topper <craig.topper@intel.com> | 2019-12-30 13:24:08 -0800 |
---|---|---|
committer | Craig Topper <craig.topper@intel.com> | 2019-12-30 13:24:11 -0800 |
commit | 8b23b2bbd9622c5f079a71c7078d167052f6a70c (patch) | |
tree | b57c221f85f31a6f8bbe64e5ff5892ac48a85ab4 /clang/test/CodeGen/fp-contract-pragma.cpp | |
parent | 07be32961a694670885626e72faca6f0007f14c9 (diff) | |
download | bcm5719-llvm-8b23b2bbd9622c5f079a71c7078d167052f6a70c.tar.gz bcm5719-llvm-8b23b2bbd9622c5f079a71c7078d167052f6a70c.zip |
[CodeGen] Use CreateFNeg in buildFMulAdd
We have an fneg instruction now and should use it instead of the fsub -0.0 idiom. Looks like we had no test that showed that we handled the negation cases here so I've added new tests.
Differential Revision: https://reviews.llvm.org/D72010
Diffstat (limited to 'clang/test/CodeGen/fp-contract-pragma.cpp')
-rw-r--r-- | clang/test/CodeGen/fp-contract-pragma.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/clang/test/CodeGen/fp-contract-pragma.cpp b/clang/test/CodeGen/fp-contract-pragma.cpp index 1c5921a53f9..805cc5d9c29 100644 --- a/clang/test/CodeGen/fp-contract-pragma.cpp +++ b/clang/test/CodeGen/fp-contract-pragma.cpp @@ -74,3 +74,18 @@ float fp_contract_7(float a, float b, float c) { return (a = 2 * b) - c; } +float fp_contract_8(float a, float b, float c) { +// CHECK: _Z13fp_contract_8fff +// CHECK: fneg float %c +// CHECK: tail call float @llvm.fmuladd + #pragma STDC FP_CONTRACT ON + return a * b - c; +} + +float fp_contract_9(float a, float b, float c) { +// CHECK: _Z13fp_contract_9fff +// CHECK: fneg float %a +// CHECK: tail call float @llvm.fmuladd + #pragma STDC FP_CONTRACT ON + return c - a * b; +} |