Reid Spencer | 2341c22 | 2007-02-02 02:16:23 +0000 | [diff] [blame] | 1 | ; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | \ |
Reid Spencer | 91948d4 | 2007-04-14 20:13:02 +0000 | [diff] [blame] | 2 | ; RUN: not grep {(and\|xor\|add\|shl\|shr)} |
Reid Spencer | ede8c3b | 2007-04-15 07:38:21 +0000 | [diff] [blame] | 3 | ; END. |
Chris Lattner | 04d4a72 | 2005-09-24 23:42:18 +0000 | [diff] [blame] | 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 | } |