1 ; Test that elimination of logical operators works with
2 ; arbitrary precision integers.
4 ; RUN: llvm-as < %s | opt -instcombine -disable-output &&
5 ; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \
6 ; RUN: not grep '(and\|xor\|add\|shl\|shr)'
8 define i33 @test1(i33 %x) {
9 %tmp.1 = and i33 %x, 65535 ; <i33> [#uses=1]
10 %tmp.2 = xor i33 %tmp.1, -32768 ; <i33> [#uses=1]
11 %tmp.3 = add i33 %tmp.2, 32768 ; <i33> [#uses=1]
15 define i33 @test2(i33 %x) {
16 %tmp.1 = and i33 %x, 65535 ; <i33> [#uses=1]
17 %tmp.2 = xor i33 %tmp.1, 32768 ; <i33> [#uses=1]
18 %tmp.3 = add i33 %tmp.2, -32768 ; <i33> [#uses=1]
22 define i33 @test3(i16 %P) {
23 %tmp.1 = zext i16 %P to i33 ; <i33> [#uses=1]
24 %tmp.4 = xor i33 %tmp.1, 32768 ; <i33> [#uses=1]
25 %tmp.5 = add i33 %tmp.4, -32768 ; <i33> [#uses=1]
29 define i33 @test5(i33 %x) {
30 %tmp.1 = and i33 %x, 254
31 %tmp.2 = xor i33 %tmp.1, 128
32 %tmp.3 = add i33 %tmp.2, -128
36 define i33 @test6(i33 %x) {
37 %tmp.2 = shl i33 %x, 16 ; <i33> [#uses=1]
38 %tmp.4 = lshr i33 %tmp.2, 16 ; <i33> [#uses=1]