[InstCombine] Split off SSE4a tests.
[oota-llvm.git] / test / Transforms / InstCombine / zext.ll
index c926a65065350fdfd23e4b00682826322431cfdc..b62c626c95c0bdf5b445885e7dd9a9dae2d1e2df 100644 (file)
@@ -1,33 +1,45 @@
 ; Tests to make sure elimination of casts is working correctly
-; RUN: opt %s -instcombine -S | \
-; RUN:   notcast {} {%c1.*}
+; RUN: opt < %s -instcombine -S | FileCheck %s
 
 define i64 @test_sext_zext(i16 %A) {
         %c1 = zext i16 %A to i32                ; <i32> [#uses=1]
         %c2 = sext i32 %c1 to i64               ; <i64> [#uses=1]
         ret i64 %c2
+
+; CHECK-LABEL: @test_sext_zext
+; CHECK-NOT: %c1
+; CHECK: %c2 = zext i16 %A to i64
+; CHECK: ret i64 %c2
 }
 
-; PR3599
-define i32 @test2(i64 %tmp) nounwind readnone {
-entry:
-       %tmp5 = trunc i64 %tmp to i8            ; <i8> [#uses=1]
-       %tmp7 = lshr i64 %tmp, 8                ; <i64> [#uses=1]
-       %tmp8 = trunc i64 %tmp7 to i8           ; <i8> [#uses=1]
-       %tmp10 = lshr i64 %tmp, 16              ; <i64> [#uses=1]
-       %tmp11 = trunc i64 %tmp10 to i8         ; <i8> [#uses=1]
-       %tmp13 = lshr i64 %tmp, 24              ; <i64> [#uses=1]
-       %tmp14 = trunc i64 %tmp13 to i8         ; <i8> [#uses=1]
-       %tmp1 = zext i8 %tmp5 to i32            ; <i32> [#uses=1]
-       %tmp2 = zext i8 %tmp8 to i32            ; <i32> [#uses=1]
-       %tmp3 = shl i32 %tmp2, 8                ; <i32> [#uses=1]
-       %tmp4 = zext i8 %tmp11 to i32           ; <i32> [#uses=1]
-       %tmp6 = shl i32 %tmp4, 16               ; <i32> [#uses=1]
-       %tmp9 = zext i8 %tmp14 to i32           ; <i32> [#uses=1]
-       %tmp12 = shl i32 %tmp9, 24              ; <i32> [#uses=1]
-       %tmp15 = or i32 %tmp12, %tmp1           ; <i32> [#uses=1]
-       %tmp16 = or i32 %tmp15, %tmp6           ; <i32> [#uses=1]
-       %tmp17 = or i32 %tmp16, %tmp3           ; <i32> [#uses=1]
-       ret i32 %tmp17
+define <2 x i64> @test2(<2 x i1> %A) {
+  %xor = xor <2 x i1> %A, <i1 true, i1 true>
+  %zext = zext <2 x i1> %xor to <2 x i64>
+  ret <2 x i64> %zext
+
+; CHECK-LABEL: @test2
+; CHECK-NEXT: zext <2 x i1> %A to <2 x i64>
+; CHECK-NEXT: xor <2 x i64> %1, <i64 1, i64 1>
 }
 
+define <2 x i64> @test3(<2 x i64> %A) {
+  %trunc = trunc <2 x i64> %A to <2 x i32>
+  %and = and <2 x i32> %trunc, <i32 23, i32 42>
+  %zext = zext <2 x i32> %and to <2 x i64>
+  ret <2 x i64> %zext
+
+; CHECK-LABEL: @test3
+; CHECK-NEXT: and <2 x i64> %A, <i64 23, i64 42>
+}
+
+define <2 x i64> @test4(<2 x i64> %A) {
+  %trunc = trunc <2 x i64> %A to <2 x i32>
+  %and = and <2 x i32> %trunc, <i32 23, i32 42>
+  %xor = xor <2 x i32> %and, <i32 23, i32 42>
+  %zext = zext <2 x i32> %xor to <2 x i64>
+  ret <2 x i64> %zext
+
+; CHECK-LABEL: @test4
+; CHECK-NEXT: xor <2 x i64> %A, <i64 4294967295, i64 4294967295>
+; CHECK-NEXT: and <2 x i64> %1, <i64 23, i64 42>
+}