[llvm] r272427 - [x86] enable bitcasted fabs/fneg transforms
Sanjay Patel via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 10 13:33:50 PDT 2016
Author: spatel
Date: Fri Jun 10 15:33:50 2016
New Revision: 272427
URL: http://llvm.org/viewvc/llvm-project?rev=272427&view=rev
Log:
[x86] enable bitcasted fabs/fneg transforms
The vector cases don't change because we already have folds in X86ISelLowering
to look through and remove bitcasts.
Modified:
llvm/trunk/lib/Target/X86/X86ISelLowering.h
llvm/trunk/test/CodeGen/X86/fp-logic.ll
Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.h?rev=272427&r1=272426&r2=272427&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86ISelLowering.h (original)
+++ llvm/trunk/lib/Target/X86/X86ISelLowering.h Fri Jun 10 15:33:50 2016
@@ -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.
Modified: llvm/trunk/test/CodeGen/X86/fp-logic.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/fp-logic.ll?rev=272427&r1=272426&r2=272427&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/fp-logic.ll (original)
+++ llvm/trunk/test/CodeGen/X86/fp-logic.ll Fri Jun 10 15:33:50 2016
@@ -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
More information about the llvm-commits
mailing list