]> granicus.if.org Git - llvm/commitdiff
[x86] enable bitcasted fabs/fneg transforms
authorSanjay Patel <spatel@rotateright.com>
Fri, 10 Jun 2016 20:33:50 +0000 (20:33 +0000)
committerSanjay Patel <spatel@rotateright.com>
Fri, 10 Jun 2016 20:33:50 +0000 (20:33 +0000)
The vector cases don't change because we already have folds in X86ISelLowering
to look through and remove bitcasts.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272427 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/X86/X86ISelLowering.h
test/CodeGen/X86/fp-logic.ll

index c6733467a4a32e0ce5b502672710992e8f91fd74..fd6d5f5ae8d1b76c20e865c1f1b6573d4e0ffadc 100644 (file)
@@ -758,6 +758,10 @@ namespace llvm {
 
     bool isCheapToSpeculateCtlz() const override;
 
+    bool hasBitPreservingFPLogic(EVT VT) const override {
+      return VT == MVT::f32 || VT == MVT::f64 || VT.isVector();
+    }
+
     bool hasAndNotCompare(SDValue Y) const override;
 
     /// Return the value type to use for ISD::SETCC.
index b5f1349cada145c914706bde25247bc473d61a77..9ab6751d65483477971ac2f981520bb0636d2ffd 100644 (file)
@@ -265,8 +265,7 @@ define float @movmsk(float %x) {
 define double @bitcast_fabs(double %x) {
 ; CHECK-LABEL: bitcast_fabs:
 ; CHECK:       # BB#0:
-; CHECK-NEXT:    movsd {{.*#+}} xmm1 = mem[0],zero
-; CHECK-NEXT:    andpd %xmm1, %xmm0
+; CHECK-NEXT:    andpd {{.*}}(%rip), %xmm0
 ; CHECK-NEXT:    retq
 ;
   %bc1 = bitcast double %x to i64
@@ -278,8 +277,7 @@ define double @bitcast_fabs(double %x) {
 define float @bitcast_fneg(float %x) {
 ; CHECK-LABEL: bitcast_fneg:
 ; CHECK:       # BB#0:
-; CHECK-NEXT:    movss {{.*#+}} xmm1 = mem[0],zero,zero,zero
-; CHECK-NEXT:    xorps %xmm1, %xmm0
+; CHECK-NEXT:    xorps {{.*}}(%rip), %xmm0
 ; CHECK-NEXT:    retq
 ;
   %bc1 = bitcast float %x to i32