add FP logic test cases to show current codegen (PR22428)
authorSanjay Patel <spatel@rotateright.com>
Mon, 26 Oct 2015 23:52:42 +0000 (23:52 +0000)
committerSanjay Patel <spatel@rotateright.com>
Mon, 26 Oct 2015 23:52:42 +0000 (23:52 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251370 91177308-0d34-0410-b5e6-96231b3b80d8

test/CodeGen/X86/fp-logic.ll

index e45e48dfa985a683f25cf2fb1fb313055cd57684..6494d4967c35e791bda007b45bd32282a30f8dab 100644 (file)
@@ -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 %y) {
   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
+}
+