1 ; This test makes sure that these instructions are properly eliminated.
4 ; RUN: if as < %s | opt -instcombine | dis | grep sh
12 %B = shl int %A, ubyte 0
16 int %test2(ubyte %A) {
17 %B = shl int 0, ubyte %A
22 %B = shr int %A, ubyte 0
26 int %test4(ubyte %A) {
27 %B = shr int 0, ubyte %A
31 uint %test5(uint %A) {
32 %B = shr uint %A, ubyte 32 ;; shift all bits out
36 uint %test5a(uint %A) {
37 %B = shl uint %A, ubyte 32 ;; shift all bits out
41 uint %test6(uint %A) {
42 %B = shl uint %A, ubyte 1 ;; convert to an add instruction
46 int %test7(ubyte %A) {
47 %B = shr int -1, ubyte %A ;; Always equal to -1
51 ubyte %test8(ubyte %A) { ;; (A << 5) << 3 === A << 8 == 0
52 %B = shl ubyte %A, ubyte 5
53 %C = shl ubyte %B, ubyte 3
57 ubyte %test9(ubyte %A) { ;; (A << 7) >> 7 === A & 1
58 %B = shl ubyte %A, ubyte 7
59 %C = shr ubyte %B, ubyte 7
63 ubyte %test10(ubyte %A) { ;; (A >> 7) << 7 === A & 128
64 %B = shr ubyte %A, ubyte 7
65 %C = shl ubyte %B, ubyte 7
69 ubyte %test11(ubyte %A) { ;; (A >> 3) << 4 == (A & 0x1F) << 1
70 %B = shr ubyte %A, ubyte 3
71 %C = shl ubyte %B, ubyte 4