blob: c6a341f454f46bd8f2c9cef24ab499492ff6be22 [file] [log] [blame]
Chris Lattner74e95472002-05-06 05:43:36 +00001; This test makes sure that these instructions are properly eliminated.
2;
3
Chris Lattnerf6f95d02002-08-02 19:27:58 +00004; RUN: if as < %s | opt -instcombine | dis | grep sh
Chris Lattner74e95472002-05-06 05:43:36 +00005; RUN: then exit 1
6; RUN: else exit 0
7; RUN: fi
8
9implementation
10
11int "test1"(int %A) {
12 %B = shl int %A, ubyte 0
13 ret int %B
14}
15
16int "test2"(ubyte %A) {
17 %B = shl int 0, ubyte %A
18 ret int %B
19}
20
21int "test3"(int %A) {
22 %B = shr int %A, ubyte 0
23 ret int %B
24}
25
26int "test4"(ubyte %A) {
27 %B = shr int 0, ubyte %A
28 ret int %B
29}
30
Chris Lattnerbcb81382002-05-06 16:11:31 +000031uint "test5"(uint %A) {
32 %B = shr uint %A, ubyte 32 ;; shift all bits out
33 ret uint %B
Chris Lattner74e95472002-05-06 05:43:36 +000034}
35
Chris Lattner025e58d2002-09-10 23:03:10 +000036uint %test6(uint %A) {
37 %B = shl uint %A, ubyte 1 ;; convert to an add instruction
38 ret uint %B
39}