Fix InstCombine/2007-10-31-StringCrash.ll by removing an obvious
[oota-llvm.git] / test / Transforms / InstCombine / signext.ll
1 ; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | \
2 ; RUN:    not grep {(and\|xor\|add\|shl\|shr)}
3 ; END.
4
5 int %test1(int %x) {
6         %tmp.1 = and int %x, 65535              ; <int> [#uses=1]
7         %tmp.2 = xor int %tmp.1, -32768         ; <int> [#uses=1]
8         %tmp.3 = add int %tmp.2, 32768          ; <int> [#uses=1]
9         ret int %tmp.3
10 }
11
12 int %test2(int %x) {
13         %tmp.1 = and int %x, 65535              ; <int> [#uses=1]
14         %tmp.2 = xor int %tmp.1, 32768          ; <int> [#uses=1]
15         %tmp.3 = add int %tmp.2, -32768         ; <int> [#uses=1]
16         ret int %tmp.3
17 }
18
19 int %test3(ushort %P) {
20         %tmp.1 = cast ushort %P to int          ; <int> [#uses=1]
21         %tmp.4 = xor int %tmp.1, 32768          ; <int> [#uses=1]
22         %tmp.5 = add int %tmp.4, -32768         ; <int> [#uses=1]
23         ret int %tmp.5
24 }
25
26 uint %test4(ushort %P) {
27         %tmp.1 = cast ushort %P to uint         ; <uint> [#uses=1]
28         %tmp.4 = xor uint %tmp.1, 32768         ; <uint> [#uses=1]
29         %tmp.5 = add uint %tmp.4, 4294934528            ; <uint> [#uses=1]
30         ret uint %tmp.5
31 }
32
33 int %test5(int %x) {
34         %tmp.1 = and int %x, 254
35         %tmp.2 = xor int %tmp.1, 128
36         %tmp.3 = add int %tmp.2, -128
37         ret int %tmp.3
38 }
39
40 int %test6(int %x) {
41         %tmp.2 = shl int %x, ubyte 16           ; <int> [#uses=1]
42         %tmp.4 = shr int %tmp.2, ubyte 16               ; <int> [#uses=1]
43         ret int %tmp.4
44 }