1 ; This test makes sure that these instructions are properly eliminated.
4 ; RUN: as < %s | opt -instcombine | 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 add instruction
43 int %test7(ubyte %A) {
44 %B = shr int -1, ubyte %A ;; Always equal to -1
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
54 ubyte %test9(ubyte %A) { ;; (A << 7) >> 7 === A & 1
55 %B = shl ubyte %A, ubyte 7
56 %C = shr ubyte %B, ubyte 7
60 ubyte %test10(ubyte %A) { ;; (A >> 7) << 7 === A & 128
61 %B = shr ubyte %A, ubyte 7
62 %C = shl ubyte %B, ubyte 7
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