blob: f69cbc007245ddd0af273bf94fa513af7743ffe8 [file] [log] [blame]
Reid Spencer2341c222007-02-02 02:16:23 +00001; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | \
Reid Spencer91948d42007-04-14 20:13:02 +00002; RUN: not grep {(and\|xor\|add\|shl\|shr)}
Reid Spencerede8c3b2007-04-15 07:38:21 +00003; END.
Chris Lattner04d4a722005-09-24 23:42:18 +00004
5int %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
12int %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
19int %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
26uint %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
33int %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
40int %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}