1 ; This test makes sure that these instructions are properly eliminated.
4 ; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep sh
9 %B = shl int %A, ubyte 0
13 int %test2(ubyte %A) {
14 %B = shl int 0, ubyte %A
19 %B = shr int %A, ubyte 0
23 int %test4(ubyte %A) {
24 %B = shr int 0, ubyte %A
28 uint %test5(uint %A) {
29 %B = shr uint %A, ubyte 32 ;; shift all bits out
33 uint %test5a(uint %A) {
34 %B = shl uint %A, ubyte 32 ;; shift all bits out
38 uint %test6(uint %A) {
39 %B = shl uint %A, ubyte 1 ;; convert to an mul instruction
44 int %test7(ubyte %A) {
45 %B = shr int -1, ubyte %A ;; Always equal to -1
49 ubyte %test8(ubyte %A) { ;; (A << 5) << 3 === A << 8 == 0
50 %B = shl ubyte %A, ubyte 5
51 %C = shl ubyte %B, ubyte 3
55 ubyte %test9(ubyte %A) { ;; (A << 7) >> 7 === A & 1
56 %B = shl ubyte %A, ubyte 7
57 %C = shr ubyte %B, ubyte 7
61 ubyte %test10(ubyte %A) { ;; (A >> 7) << 7 === A & 128
62 %B = shr ubyte %A, ubyte 7
63 %C = shl ubyte %B, ubyte 7
67 ubyte %test11(ubyte %A) { ;; (A >> 3) << 4 === (A & 0x1F) << 1
69 %B = shr ubyte %a, ubyte 3
70 %C = shl ubyte %B, ubyte 4
75 %B = shr int %A, ubyte 8 ;; (A >> 8) << 8 === A & -256
76 %C = shl int %B, ubyte 8
80 sbyte %test13(sbyte %A) { ;; (A >> 3) << 4 === (A & -8) * 2
82 %B = shr sbyte %a, ubyte 3
83 %C = shl sbyte %B, ubyte 4
87 uint %test14(uint %A) {
88 %B = shr uint %A, ubyte 4
90 %D = shl uint %C, ubyte 4 ;; D = ((B | 1234) << 4) === ((B << 4)|(1234 << 4)
93 uint %test14a(uint %A) {
94 %B = shl uint %A, ubyte 4
95 %C = and uint %B, 1234
96 %D = shr uint %C, ubyte 4 ;; D = ((B | 1234) << 4) === ((B << 4)|(1234 << 4)