[llvm] r251370 - add FP logic test cases to show current codegen (PR22428)

Sanjay Patel via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 26 16:52:42 PDT 2015


Author: spatel
Date: Mon Oct 26 18:52:42 2015
New Revision: 251370

URL: http://llvm.org/viewvc/llvm-project?rev=251370&view=rev
Log:
add FP logic test cases to show current codegen (PR22428)

Modified:
    llvm/trunk/test/CodeGen/X86/fp-logic.ll

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=251370&r1=251369&r2=251370&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/fp-logic.ll (original)
+++ llvm/trunk/test/CodeGen/X86/fp-logic.ll Mon Oct 26 18:52:42 2015
@@ -193,6 +193,34 @@ define float @xor(float %x, float %y) {
   ret float %bc3
 }
 
+define float @f7_or(float %x) {
+; CHECK-LABEL: f7_or:
+; CHECK:       # BB#0:
+; CHECK-NEXT:    movd %xmm0, %eax
+; CHECK-NEXT:    orl $3, %eax
+; CHECK-NEXT:    movd %eax, %xmm0
+; CHECK-NEXT:    retq
+
+  %bc1 = bitcast float %x to i32
+  %and = or i32 %bc1, 3
+  %bc2 = bitcast i32 %and to float
+  ret float %bc2
+}
+
+define float @f7_xor(float %x) {
+; CHECK-LABEL: f7_xor:
+; CHECK:       # BB#0:
+; CHECK-NEXT:    movd %xmm0, %eax
+; CHECK-NEXT:    xorl $3, %eax
+; CHECK-NEXT:    movd %eax, %xmm0
+; CHECK-NEXT:    retq
+
+  %bc1 = bitcast float %x to i32
+  %and = xor i32 %bc1, 3
+  %bc2 = bitcast i32 %and to float
+  ret float %bc2
+}
+
 ; Make sure that doubles work too.
 
 define double @doubles(double %x, double %y) {
@@ -208,3 +236,35 @@ define double @doubles(double %x, double
   ret double %bc3
 }
 
+define double @f7_double(double %x) {
+; CHECK-LABEL: f7_double:
+; CHECK:       # BB#0:
+; CHECK-NEXT:    movd %xmm0, %rax
+; CHECK-NEXT:    andl $3, %eax
+; CHECK-NEXT:    movd %rax, %xmm0
+; CHECK-NEXT:    retq
+
+  %bc1 = bitcast double %x to i64
+  %and = and i64 %bc1, 3
+  %bc2 = bitcast i64 %and to double
+  ret double %bc2
+}
+
+; Grabbing the sign bit is a special case that could be handled
+; by movmskps/movmskpd, but if we're not shifting it over, then
+; a simple FP logic op is cheaper.
+
+define float @movmsk(float %x) {
+; CHECK-LABEL: movmsk:
+; CHECK:       # BB#0:
+; CHECK-NEXT:    movmskps %xmm0, %eax
+; CHECK-NEXT:    shll $31, %eax
+; CHECK-NEXT:    movd %eax, %xmm0
+; CHECK-NEXT:    retq
+
+  %bc1 = bitcast float %x to i32
+  %and = and i32 %bc1, 2147483648
+  %bc2 = bitcast i32 %and to float
+  ret float %bc2
+}
+




More information about the llvm-commits mailing list