[x86] replace integer 'or' ops with packed SSE FP 'or' ops when operating on FP scalars
authorSanjay Patel <spatel@rotateright.com>
Wed, 23 Sep 2015 18:19:07 +0000 (18:19 +0000)
committerSanjay Patel <spatel@rotateright.com>
Wed, 23 Sep 2015 18:19:07 +0000 (18:19 +0000)
Turn this:

movd %xmm0, %eax
movd %xmm1, %ecx
orl %eax, %ecx
movd %ecx, %xmm0

into this:

orps %xmm1, %xmm0

This is related to, but does not solve:
https://llvm.org/bugs/show_bug.cgi?id=22428

This is an extension of:
http://reviews.llvm.org/rL248395

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

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

index c0f74c18e18d532b6dd4ff766734bb5627e8b375..a8a4672606100295efaacb93377530f8898ffcb8 100644 (file)
@@ -24542,6 +24542,9 @@ static SDValue PerformOrCombine(SDNode *N, SelectionDAG &DAG,
   if (SDValue R = CMPEQCombine(N, DAG, DCI, Subtarget))
     return R;
 
+  if (SDValue FPLogic = convertIntLogicToFPLogic(N, DAG, Subtarget))
+    return FPLogic;
+
   SDValue N0 = N->getOperand(0);
   SDValue N1 = N->getOperand(1);
   EVT VT = N->getValueType(0);
index 0b714ffe36f0b25b680f547226738c97bf647bc9..95f15789789fbb3662475d9350c88c8888efbbc0 100644 (file)
@@ -170,10 +170,7 @@ define float @f10(float %x, float %y) {
 define float @or(float %x, float %y) {
 ; CHECK-LABEL: or:
 ; CHECK:       # BB#0:
-; CHECK-NEXT:    movd %xmm0, %eax
-; CHECK-NEXT:    movd %xmm1, %ecx
-; CHECK-NEXT:    orl %eax, %ecx
-; CHECK-NEXT:    movd %ecx, %xmm0
+; CHECK-NEXT:    orps %xmm1, %xmm0
 ; CHECK-NEXT:    retq
 
   %bc1 = bitcast float %x to i32