blob: cd883f64a6ba6f4dc151e3e2356c70620e936401 [file] [log] [blame]
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001;test all the shifted and signextending adds and subs with and without consts
2;
Dan Gohmanda594cf2009-09-09 00:09:15 +00003; RUN: llc < %s -march=alpha -o %t.s
Dan Gohman8c89a502007-08-15 13:36:28 +00004; RUN: grep { addl} %t.s | count 2
5; RUN: grep { addq} %t.s | count 2
6; RUN: grep { subl} %t.s | count 2
Chris Lattner14b85832010-03-01 22:09:11 +00007; RUN: grep { subq} %t.s | count 2
Dan Gohmanf17a25c2007-07-18 16:29:46 +00008;
Dan Gohman8c89a502007-08-15 13:36:28 +00009; RUN: grep {s4addl} %t.s | count 2
10; RUN: grep {s8addl} %t.s | count 2
11; RUN: grep {s4addq} %t.s | count 2
12; RUN: grep {s8addq} %t.s | count 2
Dan Gohmanf17a25c2007-07-18 16:29:46 +000013;
Dan Gohman8c89a502007-08-15 13:36:28 +000014; RUN: grep {s4subl} %t.s | count 2
15; RUN: grep {s8subl} %t.s | count 2
16; RUN: grep {s4subq} %t.s | count 2
17; RUN: grep {s8subq} %t.s | count 2
Dan Gohmanf17a25c2007-07-18 16:29:46 +000018
19
Reid Spencerf234bed2007-07-19 23:13:04 +000020define i32 @al(i32 signext %x.s, i32 signext %y.s) signext {
Dan Gohmanf17a25c2007-07-18 16:29:46 +000021entry:
22 %tmp.3.s = add i32 %y.s, %x.s ; <i32> [#uses=1]
23 ret i32 %tmp.3.s
24}
25
Reid Spencerf234bed2007-07-19 23:13:04 +000026define i32 @ali(i32 signext %x.s) signext {
Dan Gohmanf17a25c2007-07-18 16:29:46 +000027entry:
28 %tmp.3.s = add i32 100, %x.s ; <i32> [#uses=1]
29 ret i32 %tmp.3.s
30}
31
Reid Spencerf234bed2007-07-19 23:13:04 +000032define i64 @aq(i64 signext %x.s, i64 signext %y.s) signext {
Dan Gohmanf17a25c2007-07-18 16:29:46 +000033entry:
34 %tmp.3.s = add i64 %y.s, %x.s ; <i64> [#uses=1]
35 ret i64 %tmp.3.s
36}
37
38define i64 @aqi(i64 %x.s) {
39entry:
40 %tmp.3.s = add i64 100, %x.s ; <i64> [#uses=1]
41 ret i64 %tmp.3.s
42}
43
Reid Spencerf234bed2007-07-19 23:13:04 +000044define i32 @sl(i32 signext %x.s, i32 signext %y.s) signext {
Dan Gohmanf17a25c2007-07-18 16:29:46 +000045entry:
46 %tmp.3.s = sub i32 %y.s, %x.s ; <i32> [#uses=1]
47 ret i32 %tmp.3.s
48}
49
Reid Spencerf234bed2007-07-19 23:13:04 +000050define i32 @sli(i32 signext %x.s) signext {
Dan Gohmanf17a25c2007-07-18 16:29:46 +000051entry:
52 %tmp.3.s = sub i32 %x.s, 100 ; <i32> [#uses=1]
53 ret i32 %tmp.3.s
54}
55
56define i64 @sq(i64 %x.s, i64 %y.s) {
57entry:
58 %tmp.3.s = sub i64 %y.s, %x.s ; <i64> [#uses=1]
59 ret i64 %tmp.3.s
60}
61
62define i64 @sqi(i64 %x.s) {
63entry:
64 %tmp.3.s = sub i64 %x.s, 100 ; <i64> [#uses=1]
65 ret i64 %tmp.3.s
66}
67
Reid Spencerf234bed2007-07-19 23:13:04 +000068define i32 @a4l(i32 signext %x.s, i32 signext %y.s) signext {
Dan Gohmanf17a25c2007-07-18 16:29:46 +000069entry:
70 %tmp.1.s = shl i32 %y.s, 2 ; <i32> [#uses=1]
71 %tmp.3.s = add i32 %tmp.1.s, %x.s ; <i32> [#uses=1]
72 ret i32 %tmp.3.s
73}
74
Reid Spencerf234bed2007-07-19 23:13:04 +000075define i32 @a8l(i32 signext %x.s, i32 signext %y.s) signext {
Dan Gohmanf17a25c2007-07-18 16:29:46 +000076entry:
77 %tmp.1.s = shl i32 %y.s, 3 ; <i32> [#uses=1]
78 %tmp.3.s = add i32 %tmp.1.s, %x.s ; <i32> [#uses=1]
79 ret i32 %tmp.3.s
80}
81
82define i64 @a4q(i64 %x.s, i64 %y.s) {
83entry:
84 %tmp.1.s = shl i64 %y.s, 2 ; <i64> [#uses=1]
85 %tmp.3.s = add i64 %tmp.1.s, %x.s ; <i64> [#uses=1]
86 ret i64 %tmp.3.s
87}
88
89define i64 @a8q(i64 %x.s, i64 %y.s) {
90entry:
91 %tmp.1.s = shl i64 %y.s, 3 ; <i64> [#uses=1]
92 %tmp.3.s = add i64 %tmp.1.s, %x.s ; <i64> [#uses=1]
93 ret i64 %tmp.3.s
94}
95
Reid Spencerf234bed2007-07-19 23:13:04 +000096define i32 @a4li(i32 signext %y.s) signext {
Dan Gohmanf17a25c2007-07-18 16:29:46 +000097entry:
98 %tmp.1.s = shl i32 %y.s, 2 ; <i32> [#uses=1]
99 %tmp.3.s = add i32 100, %tmp.1.s ; <i32> [#uses=1]
100 ret i32 %tmp.3.s
101}
102
Reid Spencerf234bed2007-07-19 23:13:04 +0000103define i32 @a8li(i32 signext %y.s) signext {
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000104entry:
105 %tmp.1.s = shl i32 %y.s, 3 ; <i32> [#uses=1]
106 %tmp.3.s = add i32 100, %tmp.1.s ; <i32> [#uses=1]
107 ret i32 %tmp.3.s
108}
109
110define i64 @a4qi(i64 %y.s) {
111entry:
112 %tmp.1.s = shl i64 %y.s, 2 ; <i64> [#uses=1]
113 %tmp.3.s = add i64 100, %tmp.1.s ; <i64> [#uses=1]
114 ret i64 %tmp.3.s
115}
116
117define i64 @a8qi(i64 %y.s) {
118entry:
119 %tmp.1.s = shl i64 %y.s, 3 ; <i64> [#uses=1]
120 %tmp.3.s = add i64 100, %tmp.1.s ; <i64> [#uses=1]
121 ret i64 %tmp.3.s
122}
123
Reid Spencerf234bed2007-07-19 23:13:04 +0000124define i32 @s4l(i32 signext %x.s, i32 signext %y.s) signext {
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000125entry:
126 %tmp.1.s = shl i32 %y.s, 2 ; <i32> [#uses=1]
127 %tmp.3.s = sub i32 %tmp.1.s, %x.s ; <i32> [#uses=1]
128 ret i32 %tmp.3.s
129}
130
Reid Spencerf234bed2007-07-19 23:13:04 +0000131define i32 @s8l(i32 signext %x.s, i32 signext %y.s) signext {
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000132entry:
133 %tmp.1.s = shl i32 %y.s, 3 ; <i32> [#uses=1]
134 %tmp.3.s = sub i32 %tmp.1.s, %x.s ; <i32> [#uses=1]
135 ret i32 %tmp.3.s
136}
137
138define i64 @s4q(i64 %x.s, i64 %y.s) {
139entry:
140 %tmp.1.s = shl i64 %y.s, 2 ; <i64> [#uses=1]
141 %tmp.3.s = sub i64 %tmp.1.s, %x.s ; <i64> [#uses=1]
142 ret i64 %tmp.3.s
143}
144
145define i64 @s8q(i64 %x.s, i64 %y.s) {
146entry:
147 %tmp.1.s = shl i64 %y.s, 3 ; <i64> [#uses=1]
148 %tmp.3.s = sub i64 %tmp.1.s, %x.s ; <i64> [#uses=1]
149 ret i64 %tmp.3.s
150}
151
Reid Spencerf234bed2007-07-19 23:13:04 +0000152define i32 @s4li(i32 signext %y.s) signext {
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000153entry:
154 %tmp.1.s = shl i32 %y.s, 2 ; <i32> [#uses=1]
155 %tmp.3.s = sub i32 %tmp.1.s, 100 ; <i32> [#uses=1]
156 ret i32 %tmp.3.s
157}
158
Reid Spencerf234bed2007-07-19 23:13:04 +0000159define i32 @s8li(i32 signext %y.s) signext {
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000160entry:
161 %tmp.1.s = shl i32 %y.s, 3 ; <i32> [#uses=1]
162 %tmp.3.s = sub i32 %tmp.1.s, 100 ; <i32> [#uses=1]
163 ret i32 %tmp.3.s
164}
165
166define i64 @s4qi(i64 %y.s) {
167entry:
168 %tmp.1.s = shl i64 %y.s, 2 ; <i64> [#uses=1]
169 %tmp.3.s = sub i64 %tmp.1.s, 100 ; <i64> [#uses=1]
170 ret i64 %tmp.3.s
171}
172
173define i64 @s8qi(i64 %y.s) {
174entry:
175 %tmp.1.s = shl i64 %y.s, 3 ; <i64> [#uses=1]
176 %tmp.3.s = sub i64 %tmp.1.s, 100 ; <i64> [#uses=1]
177 ret i64 %tmp.3.s
178}