Add test case for testing InstCombine with arbitrary precision integer
[oota-llvm.git] / test / Transforms / InstCombine / apint-select.ll
1 ; This test makes sure that these instructions are properly eliminated.
2
3 ; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep select &&
4 ; RUN: llvm-as < %s | opt -instcombine -disable-output
5
6 implementation
7
8 define i41 @test1(i1 %C) {
9         %V = select i1 %C, i41 1, i41 0  ; V = C
10         ret i41 %V
11 }
12
13 define i999 @test2(i1 %C) {
14         %V = select i1 %C, i999 0, i999 1  ; V = C
15         ret i999 %V
16 }
17
18 define i41 @test3(i41 %X) {
19     ;; (x <s 0) ? -1 : 0 -> ashr x, 31
20     %t = icmp slt i41 %X, 0
21     %V = select i1 %t, i41 -1, i41 0
22     ret i41 %V
23 }
24
25 define i1023 @test4(i1023 %X) {
26     ;; (x <s 0) ? -1 : 0 -> ashr x, 31
27     %t = icmp slt i1023 %X, 0
28     %V = select i1 %t, i1023 -1, i1023 0
29     ret i1023 %V
30 }
31
32 define i41 @test5(i41 %X) {
33     ;; ((X & 27) ? 27 : 0)
34     %Y = and i41 %X, 32
35     %t = icmp ne i41 %Y, 0
36     %V = select i1 %t, i41 32, i41 0
37     ret i41 %V
38 }
39
40 define i1023 @test6(i1023 %X) {
41     ;; ((X & 27) ? 27 : 0)
42     %Y = and i1023 %X, 64 
43     %t = icmp ne i1023 %Y, 0
44     %V = select i1 %t, i1023 64, i1023 0
45     ret i1023 %V
46 }