1 ; Tests to make sure elimination of casts is working correctly
2 ; RUN: opt < %s -instcombine -S | FileCheck %s
4 define i64 @test_sext_zext(i16 %A) {
5 %c1 = zext i16 %A to i32 ; <i32> [#uses=1]
6 %c2 = sext i32 %c1 to i64 ; <i64> [#uses=1]
9 ; CHECK-LABEL: @test_sext_zext
11 ; CHECK: %c2 = zext i16 %A to i64
15 define <2 x i64> @test2(<2 x i1> %A) {
16 %xor = xor <2 x i1> %A, <i1 true, i1 true>
17 %zext = zext <2 x i1> %xor to <2 x i64>
21 ; CHECK-NEXT: zext <2 x i1> %A to <2 x i64>
22 ; CHECK-NEXT: xor <2 x i64> %1, <i64 1, i64 1>
25 define <2 x i64> @test3(<2 x i64> %A) {
26 %trunc = trunc <2 x i64> %A to <2 x i32>
27 %and = and <2 x i32> %trunc, <i32 23, i32 42>
28 %zext = zext <2 x i32> %and to <2 x i64>
32 ; CHECK-NEXT: and <2 x i64> %A, <i64 23, i64 42>
35 define <2 x i64> @test4(<2 x i64> %A) {
36 %trunc = trunc <2 x i64> %A to <2 x i32>
37 %and = and <2 x i32> %trunc, <i32 23, i32 42>
38 %xor = xor <2 x i32> %and, <i32 23, i32 42>
39 %zext = zext <2 x i32> %xor to <2 x i64>
43 ; CHECK-NEXT: xor <2 x i64> %A, <i64 4294967295, i64 4294967295>
44 ; CHECK-NEXT: and <2 x i64> %1, <i64 23, i64 42>