From 8b23b2bbd9622c5f079a71c7078d167052f6a70c Mon Sep 17 00:00:00 2001 From: Craig Topper Date: Mon, 30 Dec 2019 13:24:08 -0800 Subject: [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 --- clang/test/CodeGen/fp-contract-pragma.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'clang/test/CodeGen/fp-contract-pragma.cpp') 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; +} -- cgit v1.2.3