From 10e6427e7a5d9bd8f7cd65be55502b0cac969563 Mon Sep 17 00:00:00 2001 From: Michael Berg Date: Thu, 14 Jun 2018 20:54:13 +0000 Subject: [PATCH] easing the constraint for isNegatibleForFree and GetNegatedExpression Summary: Here we relax the old constraint which utilized unsafe with the TargetOption flag HonorSignDependentRoundingFPMathOption, with the assertion that unsafe is no longer needed or never was required for correctness on FDIV/FMUL. Reviewers: spatel, hfinkel, wristow, arsenm, javed.absar Reviewed By: spatel Subscribers: efriedma, wdng, tpr Differential Revision: https://reviews.llvm.org/D48057 llvm-svn: 334769 --- lib/CodeGen/SelectionDAG/DAGCombiner.cpp | 4 ---- test/CodeGen/ARM/fnmul.ll | 12 +++++------- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/lib/CodeGen/SelectionDAG/DAGCombiner.cpp index 33821c33bb7..1b32870cd79 100644 --- a/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ b/lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -729,8 +729,6 @@ static char isNegatibleForFree(SDValue Op, bool LegalOperations, case ISD::FMUL: case ISD::FDIV: - if (Options->HonorSignDependentRoundingFPMath()) return 0; - // fold (fneg (fmul X, Y)) -> (fmul (fneg X), Y) or (fmul X, (fneg Y)) if (char V = isNegatibleForFree(Op.getOperand(0), LegalOperations, TLI, Options, Depth + 1)) @@ -792,8 +790,6 @@ static SDValue GetNegatedExpression(SDValue Op, SelectionDAG &DAG, case ISD::FMUL: case ISD::FDIV: - assert(!Options.HonorSignDependentRoundingFPMath()); - // fold (fneg (fmul X, Y)) -> (fmul (fneg X), Y) if (isNegatibleForFree(Op.getOperand(0), LegalOperations, DAG.getTargetLoweringInfo(), &Options, Depth+1)) diff --git a/test/CodeGen/ARM/fnmul.ll b/test/CodeGen/ARM/fnmul.ll index e14e5baeb8a..b021de8b7ad 100644 --- a/test/CodeGen/ARM/fnmul.ll +++ b/test/CodeGen/ARM/fnmul.ll @@ -1,17 +1,15 @@ -; RUN: llc -mtriple=arm-eabi -mattr=+v6,+vfp2 %s -o - | FileCheck %s - -; RUN: llc -mtriple=arm-eabi -mattr=+v6,+vfp2 -enable-sign-dependent-rounding-fp-math %s -o - \ -; RUN: | FileCheck %s -check-prefix CHECK-ROUNDING - +; RUN: llc -mtriple=arm-eabi -mattr=+v6,+vfp2 %s -o - | FileCheck %s -check-prefix STRICT +; RUN: llc -mtriple=arm-eabi -mattr=+v6,+vfp2 -enable-unsafe-fp-math %s -o - | FileCheck %s -check-prefix UNSAFE define double @t1(double %a, double %b) { +; STRICT: vnmul.f64 +; +; UNSAFE: vnmul.f64 entry: %tmp2 = fsub double -0.000000e+00, %a ; [#uses=1] %tmp4 = fmul double %tmp2, %b ; [#uses=1] ret double %tmp4 } -; CHECK: vnmul.f64 -; CHECK-ROUNDING: vmul.f64