1 ; RUN: llvm-as < %s | llvm-dis | FileCheck %s
2 ; RUN: verify-uselistorder %s
4 @addr = external global i64
6 define i64 @add_unsigned(i64 %x, i64 %y) {
7 ; CHECK: %z = add nuw i64 %x, %y
8 %z = add nuw i64 %x, %y
12 define i64 @sub_unsigned(i64 %x, i64 %y) {
13 ; CHECK: %z = sub nuw i64 %x, %y
14 %z = sub nuw i64 %x, %y
18 define i64 @mul_unsigned(i64 %x, i64 %y) {
19 ; CHECK: %z = mul nuw i64 %x, %y
20 %z = mul nuw i64 %x, %y
24 define i64 @add_signed(i64 %x, i64 %y) {
25 ; CHECK: %z = add nsw i64 %x, %y
26 %z = add nsw i64 %x, %y
30 define i64 @sub_signed(i64 %x, i64 %y) {
31 ; CHECK: %z = sub nsw i64 %x, %y
32 %z = sub nsw i64 %x, %y
36 define i64 @mul_signed(i64 %x, i64 %y) {
37 ; CHECK: %z = mul nsw i64 %x, %y
38 %z = mul nsw i64 %x, %y
42 define i64 @add_plain(i64 %x, i64 %y) {
43 ; CHECK: %z = add i64 %x, %y
48 define i64 @sub_plain(i64 %x, i64 %y) {
49 ; CHECK: %z = sub i64 %x, %y
54 define i64 @mul_plain(i64 %x, i64 %y) {
55 ; CHECK: %z = mul i64 %x, %y
60 define i64 @add_both(i64 %x, i64 %y) {
61 ; CHECK: %z = add nuw nsw i64 %x, %y
62 %z = add nuw nsw i64 %x, %y
66 define i64 @sub_both(i64 %x, i64 %y) {
67 ; CHECK: %z = sub nuw nsw i64 %x, %y
68 %z = sub nuw nsw i64 %x, %y
72 define i64 @mul_both(i64 %x, i64 %y) {
73 ; CHECK: %z = mul nuw nsw i64 %x, %y
74 %z = mul nuw nsw i64 %x, %y
78 define i64 @add_both_reversed(i64 %x, i64 %y) {
79 ; CHECK: %z = add nuw nsw i64 %x, %y
80 %z = add nsw nuw i64 %x, %y
84 define i64 @sub_both_reversed(i64 %x, i64 %y) {
85 ; CHECK: %z = sub nuw nsw i64 %x, %y
86 %z = sub nsw nuw i64 %x, %y
90 define i64 @mul_both_reversed(i64 %x, i64 %y) {
91 ; CHECK: %z = mul nuw nsw i64 %x, %y
92 %z = mul nsw nuw i64 %x, %y
96 define i64 @shl_both(i64 %x, i64 %y) {
97 ; CHECK: %z = shl nuw nsw i64 %x, %y
98 %z = shl nuw nsw i64 %x, %y
102 define i64 @sdiv_exact(i64 %x, i64 %y) {
103 ; CHECK: %z = sdiv exact i64 %x, %y
104 %z = sdiv exact i64 %x, %y
108 define i64 @sdiv_plain(i64 %x, i64 %y) {
109 ; CHECK: %z = sdiv i64 %x, %y
114 define i64 @udiv_exact(i64 %x, i64 %y) {
115 ; CHECK: %z = udiv exact i64 %x, %y
116 %z = udiv exact i64 %x, %y
120 define i64 @udiv_plain(i64 %x, i64 %y) {
121 ; CHECK: %z = udiv i64 %x, %y
126 define i64 @ashr_plain(i64 %x, i64 %y) {
127 ; CHECK: %z = ashr i64 %x, %y
132 define i64 @ashr_exact(i64 %x, i64 %y) {
133 ; CHECK: %z = ashr exact i64 %x, %y
134 %z = ashr exact i64 %x, %y
138 define i64 @lshr_plain(i64 %x, i64 %y) {
139 ; CHECK: %z = lshr i64 %x, %y
144 define i64 @lshr_exact(i64 %x, i64 %y) {
145 ; CHECK: %z = lshr exact i64 %x, %y
146 %z = lshr exact i64 %x, %y
150 define i64* @gep_nw(i64* %p, i64 %x) {
151 ; CHECK: %z = getelementptr inbounds i64, i64* %p, i64 %x
152 %z = getelementptr inbounds i64, i64* %p, i64 %x
156 define i64* @gep_plain(i64* %p, i64 %x) {
157 ; CHECK: %z = getelementptr i64, i64* %p, i64 %x
158 %z = getelementptr i64, i64* %p, i64 %x
162 define i64 @add_both_ce() {
163 ; CHECK: ret i64 add nuw nsw (i64 ptrtoint (i64* @addr to i64), i64 91)
164 ret i64 add nsw nuw (i64 ptrtoint (i64* @addr to i64), i64 91)
167 define i64 @sub_both_ce() {
168 ; CHECK: ret i64 sub nuw nsw (i64 ptrtoint (i64* @addr to i64), i64 91)
169 ret i64 sub nsw nuw (i64 ptrtoint (i64* @addr to i64), i64 91)
172 define i64 @mul_both_ce() {
173 ; CHECK: ret i64 mul nuw nsw (i64 ptrtoint (i64* @addr to i64), i64 91)
174 ret i64 mul nuw nsw (i64 ptrtoint (i64* @addr to i64), i64 91)
177 define i64 @sdiv_exact_ce() {
178 ; CHECK: ret i64 sdiv exact (i64 ptrtoint (i64* @addr to i64), i64 91)
179 ret i64 sdiv exact (i64 ptrtoint (i64* @addr to i64), i64 91)
182 define i64 @udiv_exact_ce() {
183 ; CHECK: ret i64 udiv exact (i64 ptrtoint (i64* @addr to i64), i64 91)
184 ret i64 udiv exact (i64 ptrtoint (i64* @addr to i64), i64 91)
187 define i64 @ashr_exact_ce() {
188 ; CHECK: ret i64 ashr exact (i64 ptrtoint (i64* @addr to i64), i64 9)
189 ret i64 ashr exact (i64 ptrtoint (i64* @addr to i64), i64 9)
192 define i64 @lshr_exact_ce() {
193 ; CHECK: ret i64 lshr exact (i64 ptrtoint (i64* @addr to i64), i64 9)
194 ret i64 lshr exact (i64 ptrtoint (i64* @addr to i64), i64 9)
197 define i64* @gep_nw_ce() {
198 ; CHECK: ret i64* getelementptr inbounds (i64, i64* @addr, i64 171)
199 ret i64* getelementptr inbounds (i64, i64* @addr, i64 171)
202 define i64 @add_plain_ce() {
203 ; CHECK: ret i64 add (i64 ptrtoint (i64* @addr to i64), i64 91)
204 ret i64 add (i64 ptrtoint (i64* @addr to i64), i64 91)
207 define i64 @sub_plain_ce() {
208 ; CHECK: ret i64 sub (i64 ptrtoint (i64* @addr to i64), i64 91)
209 ret i64 sub (i64 ptrtoint (i64* @addr to i64), i64 91)
212 define i64 @mul_plain_ce() {
213 ; CHECK: ret i64 mul (i64 ptrtoint (i64* @addr to i64), i64 91)
214 ret i64 mul (i64 ptrtoint (i64* @addr to i64), i64 91)
217 define i64 @sdiv_plain_ce() {
218 ; CHECK: ret i64 sdiv (i64 ptrtoint (i64* @addr to i64), i64 91)
219 ret i64 sdiv (i64 ptrtoint (i64* @addr to i64), i64 91)
222 define i64* @gep_plain_ce() {
223 ; CHECK: ret i64* getelementptr (i64, i64* @addr, i64 171)
224 ret i64* getelementptr (i64, i64* @addr, i64 171)
227 define i64 @add_both_reversed_ce() {
228 ; CHECK: ret i64 add nuw nsw (i64 ptrtoint (i64* @addr to i64), i64 91)
229 ret i64 add nsw nuw (i64 ptrtoint (i64* @addr to i64), i64 91)
232 define i64 @sub_both_reversed_ce() {
233 ; CHECK: ret i64 sub nuw nsw (i64 ptrtoint (i64* @addr to i64), i64 91)
234 ret i64 sub nsw nuw (i64 ptrtoint (i64* @addr to i64), i64 91)
237 define i64 @mul_both_reversed_ce() {
238 ; CHECK: ret i64 mul nuw nsw (i64 ptrtoint (i64* @addr to i64), i64 91)
239 ret i64 mul nsw nuw (i64 ptrtoint (i64* @addr to i64), i64 91)
242 define i64 @add_signed_ce() {
243 ; CHECK: ret i64 add nsw (i64 ptrtoint (i64* @addr to i64), i64 91)
244 ret i64 add nsw (i64 ptrtoint (i64* @addr to i64), i64 91)
247 define i64 @sub_signed_ce() {
248 ; CHECK: ret i64 sub nsw (i64 ptrtoint (i64* @addr to i64), i64 91)
249 ret i64 sub nsw (i64 ptrtoint (i64* @addr to i64), i64 91)
252 define i64 @mul_signed_ce() {
253 ; CHECK: ret i64 mul nsw (i64 ptrtoint (i64* @addr to i64), i64 91)
254 ret i64 mul nsw (i64 ptrtoint (i64* @addr to i64), i64 91)
257 define i64 @shl_signed_ce() {
258 ; CHECK: ret i64 shl nsw (i64 ptrtoint (i64* @addr to i64), i64 17)
259 ret i64 shl nsw (i64 ptrtoint (i64* @addr to i64), i64 17)
263 define i64 @add_unsigned_ce() {
264 ; CHECK: ret i64 add nuw (i64 ptrtoint (i64* @addr to i64), i64 91)
265 ret i64 add nuw (i64 ptrtoint (i64* @addr to i64), i64 91)
268 define i64 @sub_unsigned_ce() {
269 ; CHECK: ret i64 sub nuw (i64 ptrtoint (i64* @addr to i64), i64 91)
270 ret i64 sub nuw (i64 ptrtoint (i64* @addr to i64), i64 91)
273 define i64 @mul_unsigned_ce() {
274 ; CHECK: ret i64 mul nuw (i64 ptrtoint (i64* @addr to i64), i64 91)
275 ret i64 mul nuw (i64 ptrtoint (i64* @addr to i64), i64 91)