Remove usage of grep-not script
[oota-llvm.git] / test / Transforms / InstCombine / shift.ll
1 ; This test makes sure that these instructions are properly eliminated.
2 ;
3
4 ; RUN: as < %s | opt -instcombine | dis | not grep sh
5
6 implementation
7
8 int %test1(int %A) {
9         %B = shl int %A, ubyte 0
10         ret int %B
11 }
12
13 int %test2(ubyte %A) {
14         %B = shl int 0, ubyte %A
15         ret int %B
16 }
17
18 int %test3(int %A) {
19         %B = shr int %A, ubyte 0
20         ret int %B
21 }
22
23 int %test4(ubyte %A) {
24         %B = shr int 0, ubyte %A
25         ret int %B
26 }
27
28 uint %test5(uint %A) {
29         %B = shr uint %A, ubyte 32  ;; shift all bits out
30         ret uint %B
31 }
32
33 uint %test5a(uint %A) {
34         %B = shl uint %A, ubyte 32  ;; shift all bits out
35         ret uint %B
36 }
37
38 uint %test6(uint %A) {
39         %B = shl uint %A, ubyte 1   ;; convert to an add instruction
40         ret uint %B
41 }
42
43 int %test7(ubyte %A) {
44         %B = shr int -1, ubyte %A   ;; Always equal to -1
45         ret int %B
46 }
47
48 ubyte %test8(ubyte %A) {              ;; (A << 5) << 3 === A << 8 == 0
49         %B = shl ubyte %A, ubyte 5
50         %C = shl ubyte %B, ubyte 3
51         ret ubyte %C
52 }
53
54 ubyte %test9(ubyte %A) {              ;; (A << 7) >> 7 === A & 1
55         %B = shl ubyte %A, ubyte 7
56         %C = shr ubyte %B, ubyte 7
57         ret ubyte %C
58 }
59
60 ubyte %test10(ubyte %A) {              ;; (A >> 7) << 7 === A & 128
61         %B = shr ubyte %A, ubyte 7
62         %C = shl ubyte %B, ubyte 7
63         ret ubyte %C
64 }
65
66 ubyte %test11(ubyte %A) {              ;; (A >> 3) << 4 == (A & 0x1F) << 1
67         %B = shr ubyte %A, ubyte 3
68         %C = shl ubyte %B, ubyte 4
69         ret ubyte %C
70 }
71