Dan Gohman | 1224c38 | 2009-07-20 21:19:07 +0000 | [diff] [blame] | 1 | ; RUN: llvm-as < %s | llvm-dis | FileCheck %s |
Duncan P. N. Exon Smith | 13f5c58 | 2014-08-19 21:08:27 +0000 | [diff] [blame] | 2 | ; RUN: verify-uselistorder %s |
Dan Gohman | 1224c38 | 2009-07-20 21:19:07 +0000 | [diff] [blame] | 3 | |
| 4 | @addr = external global i64 |
| 5 | |
Dan Gohman | 1224c38 | 2009-07-20 21:19:07 +0000 | [diff] [blame] | 6 | define i64 @add_unsigned(i64 %x, i64 %y) { |
Dan Gohman | 59858cf | 2009-07-27 16:11:46 +0000 | [diff] [blame] | 7 | ; CHECK: %z = add nuw i64 %x, %y |
| 8 | %z = add nuw i64 %x, %y |
Dan Gohman | 1224c38 | 2009-07-20 21:19:07 +0000 | [diff] [blame] | 9 | ret i64 %z |
| 10 | } |
| 11 | |
| 12 | define i64 @sub_unsigned(i64 %x, i64 %y) { |
Dan Gohman | 59858cf | 2009-07-27 16:11:46 +0000 | [diff] [blame] | 13 | ; CHECK: %z = sub nuw i64 %x, %y |
| 14 | %z = sub nuw i64 %x, %y |
Dan Gohman | 1224c38 | 2009-07-20 21:19:07 +0000 | [diff] [blame] | 15 | ret i64 %z |
| 16 | } |
| 17 | |
| 18 | define i64 @mul_unsigned(i64 %x, i64 %y) { |
Dan Gohman | 59858cf | 2009-07-27 16:11:46 +0000 | [diff] [blame] | 19 | ; CHECK: %z = mul nuw i64 %x, %y |
| 20 | %z = mul nuw i64 %x, %y |
Dan Gohman | 08d012e | 2009-07-22 22:44:56 +0000 | [diff] [blame] | 21 | ret i64 %z |
| 22 | } |
| 23 | |
| 24 | define i64 @add_signed(i64 %x, i64 %y) { |
Dan Gohman | 59858cf | 2009-07-27 16:11:46 +0000 | [diff] [blame] | 25 | ; CHECK: %z = add nsw i64 %x, %y |
| 26 | %z = add nsw i64 %x, %y |
Dan Gohman | 08d012e | 2009-07-22 22:44:56 +0000 | [diff] [blame] | 27 | ret i64 %z |
| 28 | } |
| 29 | |
| 30 | define i64 @sub_signed(i64 %x, i64 %y) { |
Dan Gohman | 59858cf | 2009-07-27 16:11:46 +0000 | [diff] [blame] | 31 | ; CHECK: %z = sub nsw i64 %x, %y |
| 32 | %z = sub nsw i64 %x, %y |
Dan Gohman | 08d012e | 2009-07-22 22:44:56 +0000 | [diff] [blame] | 33 | ret i64 %z |
| 34 | } |
| 35 | |
| 36 | define i64 @mul_signed(i64 %x, i64 %y) { |
Dan Gohman | 59858cf | 2009-07-27 16:11:46 +0000 | [diff] [blame] | 37 | ; CHECK: %z = mul nsw i64 %x, %y |
| 38 | %z = mul nsw i64 %x, %y |
Dan Gohman | 1224c38 | 2009-07-20 21:19:07 +0000 | [diff] [blame] | 39 | ret i64 %z |
| 40 | } |
| 41 | |
| 42 | define i64 @add_plain(i64 %x, i64 %y) { |
| 43 | ; CHECK: %z = add i64 %x, %y |
| 44 | %z = add i64 %x, %y |
| 45 | ret i64 %z |
| 46 | } |
| 47 | |
| 48 | define i64 @sub_plain(i64 %x, i64 %y) { |
| 49 | ; CHECK: %z = sub i64 %x, %y |
| 50 | %z = sub i64 %x, %y |
| 51 | ret i64 %z |
| 52 | } |
| 53 | |
| 54 | define i64 @mul_plain(i64 %x, i64 %y) { |
| 55 | ; CHECK: %z = mul i64 %x, %y |
| 56 | %z = mul i64 %x, %y |
| 57 | ret i64 %z |
| 58 | } |
| 59 | |
| 60 | define i64 @add_both(i64 %x, i64 %y) { |
Dan Gohman | 59858cf | 2009-07-27 16:11:46 +0000 | [diff] [blame] | 61 | ; CHECK: %z = add nuw nsw i64 %x, %y |
| 62 | %z = add nuw nsw i64 %x, %y |
Dan Gohman | 1224c38 | 2009-07-20 21:19:07 +0000 | [diff] [blame] | 63 | ret i64 %z |
| 64 | } |
| 65 | |
| 66 | define i64 @sub_both(i64 %x, i64 %y) { |
Dan Gohman | 59858cf | 2009-07-27 16:11:46 +0000 | [diff] [blame] | 67 | ; CHECK: %z = sub nuw nsw i64 %x, %y |
| 68 | %z = sub nuw nsw i64 %x, %y |
Dan Gohman | 1224c38 | 2009-07-20 21:19:07 +0000 | [diff] [blame] | 69 | ret i64 %z |
| 70 | } |
| 71 | |
| 72 | define i64 @mul_both(i64 %x, i64 %y) { |
Dan Gohman | 59858cf | 2009-07-27 16:11:46 +0000 | [diff] [blame] | 73 | ; CHECK: %z = mul nuw nsw i64 %x, %y |
| 74 | %z = mul nuw nsw i64 %x, %y |
Dan Gohman | 1224c38 | 2009-07-20 21:19:07 +0000 | [diff] [blame] | 75 | ret i64 %z |
| 76 | } |
| 77 | |
| 78 | define i64 @add_both_reversed(i64 %x, i64 %y) { |
Dan Gohman | 59858cf | 2009-07-27 16:11:46 +0000 | [diff] [blame] | 79 | ; CHECK: %z = add nuw nsw i64 %x, %y |
| 80 | %z = add nsw nuw i64 %x, %y |
Dan Gohman | 1224c38 | 2009-07-20 21:19:07 +0000 | [diff] [blame] | 81 | ret i64 %z |
| 82 | } |
| 83 | |
| 84 | define i64 @sub_both_reversed(i64 %x, i64 %y) { |
Dan Gohman | 59858cf | 2009-07-27 16:11:46 +0000 | [diff] [blame] | 85 | ; CHECK: %z = sub nuw nsw i64 %x, %y |
| 86 | %z = sub nsw nuw i64 %x, %y |
Dan Gohman | 1224c38 | 2009-07-20 21:19:07 +0000 | [diff] [blame] | 87 | ret i64 %z |
| 88 | } |
| 89 | |
| 90 | define i64 @mul_both_reversed(i64 %x, i64 %y) { |
Dan Gohman | 59858cf | 2009-07-27 16:11:46 +0000 | [diff] [blame] | 91 | ; CHECK: %z = mul nuw nsw i64 %x, %y |
| 92 | %z = mul nsw nuw i64 %x, %y |
Dan Gohman | 1224c38 | 2009-07-20 21:19:07 +0000 | [diff] [blame] | 93 | ret i64 %z |
| 94 | } |
| 95 | |
Chris Lattner | f067d58 | 2011-02-07 16:40:21 +0000 | [diff] [blame] | 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 |
| 99 | ret i64 %z |
| 100 | } |
| 101 | |
Dan Gohman | 1224c38 | 2009-07-20 21:19:07 +0000 | [diff] [blame] | 102 | define i64 @sdiv_exact(i64 %x, i64 %y) { |
Dan Gohman | 59858cf | 2009-07-27 16:11:46 +0000 | [diff] [blame] | 103 | ; CHECK: %z = sdiv exact i64 %x, %y |
| 104 | %z = sdiv exact i64 %x, %y |
Dan Gohman | 1224c38 | 2009-07-20 21:19:07 +0000 | [diff] [blame] | 105 | ret i64 %z |
| 106 | } |
| 107 | |
| 108 | define i64 @sdiv_plain(i64 %x, i64 %y) { |
| 109 | ; CHECK: %z = sdiv i64 %x, %y |
| 110 | %z = sdiv i64 %x, %y |
| 111 | ret i64 %z |
| 112 | } |
| 113 | |
Chris Lattner | 35bda89 | 2011-02-06 21:44:57 +0000 | [diff] [blame] | 114 | define i64 @udiv_exact(i64 %x, i64 %y) { |
| 115 | ; CHECK: %z = udiv exact i64 %x, %y |
| 116 | %z = udiv exact i64 %x, %y |
| 117 | ret i64 %z |
| 118 | } |
| 119 | |
| 120 | define i64 @udiv_plain(i64 %x, i64 %y) { |
| 121 | ; CHECK: %z = udiv i64 %x, %y |
| 122 | %z = udiv i64 %x, %y |
| 123 | ret i64 %z |
| 124 | } |
| 125 | |
Chris Lattner | f067d58 | 2011-02-07 16:40:21 +0000 | [diff] [blame] | 126 | define i64 @ashr_plain(i64 %x, i64 %y) { |
| 127 | ; CHECK: %z = ashr i64 %x, %y |
| 128 | %z = ashr i64 %x, %y |
| 129 | ret i64 %z |
| 130 | } |
| 131 | |
| 132 | define i64 @ashr_exact(i64 %x, i64 %y) { |
| 133 | ; CHECK: %z = ashr exact i64 %x, %y |
| 134 | %z = ashr exact i64 %x, %y |
| 135 | ret i64 %z |
| 136 | } |
| 137 | |
| 138 | define i64 @lshr_plain(i64 %x, i64 %y) { |
| 139 | ; CHECK: %z = lshr i64 %x, %y |
| 140 | %z = lshr i64 %x, %y |
| 141 | ret i64 %z |
| 142 | } |
| 143 | |
| 144 | define i64 @lshr_exact(i64 %x, i64 %y) { |
| 145 | ; CHECK: %z = lshr exact i64 %x, %y |
| 146 | %z = lshr exact i64 %x, %y |
| 147 | ret i64 %z |
| 148 | } |
Chris Lattner | 35bda89 | 2011-02-06 21:44:57 +0000 | [diff] [blame] | 149 | |
Dan Gohman | dd8004d | 2009-07-27 21:53:46 +0000 | [diff] [blame] | 150 | define i64* @gep_nw(i64* %p, i64 %x) { |
David Blaikie | 198d8ba | 2015-02-27 19:29:02 +0000 | [diff] [blame] | 151 | ; CHECK: %z = getelementptr inbounds i64, i64* %p, i64 %x |
| 152 | %z = getelementptr inbounds i64, i64* %p, i64 %x |
Dan Gohman | dd8004d | 2009-07-27 21:53:46 +0000 | [diff] [blame] | 153 | ret i64* %z |
| 154 | } |
| 155 | |
| 156 | define i64* @gep_plain(i64* %p, i64 %x) { |
David Blaikie | 198d8ba | 2015-02-27 19:29:02 +0000 | [diff] [blame] | 157 | ; CHECK: %z = getelementptr i64, i64* %p, i64 %x |
| 158 | %z = getelementptr i64, i64* %p, i64 %x |
Dan Gohman | dd8004d | 2009-07-27 21:53:46 +0000 | [diff] [blame] | 159 | ret i64* %z |
| 160 | } |
| 161 | |
Dan Gohman | 1224c38 | 2009-07-20 21:19:07 +0000 | [diff] [blame] | 162 | define i64 @add_both_ce() { |
Dan Gohman | 59858cf | 2009-07-27 16:11:46 +0000 | [diff] [blame] | 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) |
Dan Gohman | 1224c38 | 2009-07-20 21:19:07 +0000 | [diff] [blame] | 165 | } |
| 166 | |
| 167 | define i64 @sub_both_ce() { |
Dan Gohman | 59858cf | 2009-07-27 16:11:46 +0000 | [diff] [blame] | 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) |
Dan Gohman | 1224c38 | 2009-07-20 21:19:07 +0000 | [diff] [blame] | 170 | } |
| 171 | |
| 172 | define i64 @mul_both_ce() { |
Dan Gohman | 59858cf | 2009-07-27 16:11:46 +0000 | [diff] [blame] | 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) |
Dan Gohman | 1224c38 | 2009-07-20 21:19:07 +0000 | [diff] [blame] | 175 | } |
| 176 | |
| 177 | define i64 @sdiv_exact_ce() { |
Dan Gohman | 59858cf | 2009-07-27 16:11:46 +0000 | [diff] [blame] | 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) |
Dan Gohman | 1224c38 | 2009-07-20 21:19:07 +0000 | [diff] [blame] | 180 | } |
Dan Gohman | dd8004d | 2009-07-27 21:53:46 +0000 | [diff] [blame] | 181 | |
Chris Lattner | 35bda89 | 2011-02-06 21:44:57 +0000 | [diff] [blame] | 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) |
| 185 | } |
| 186 | |
Chris Lattner | f067d58 | 2011-02-07 16:40:21 +0000 | [diff] [blame] | 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) |
| 190 | } |
| 191 | |
| 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) |
| 195 | } |
| 196 | |
Dan Gohman | dd8004d | 2009-07-27 21:53:46 +0000 | [diff] [blame] | 197 | define i64* @gep_nw_ce() { |
David Blaikie | 5a70dd1 | 2015-03-13 18:20:45 +0000 | [diff] [blame] | 198 | ; CHECK: ret i64* getelementptr inbounds (i64, i64* @addr, i64 171) |
| 199 | ret i64* getelementptr inbounds (i64, i64* @addr, i64 171) |
Dan Gohman | dd8004d | 2009-07-27 21:53:46 +0000 | [diff] [blame] | 200 | } |
| 201 | |
Dan Gohman | f8dbee7 | 2009-09-07 23:54:19 +0000 | [diff] [blame] | 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) |
| 205 | } |
Dan Gohman | dd8004d | 2009-07-27 21:53:46 +0000 | [diff] [blame] | 206 | |
Dan Gohman | f8dbee7 | 2009-09-07 23:54:19 +0000 | [diff] [blame] | 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) |
| 210 | } |
| 211 | |
| 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) |
| 215 | } |
| 216 | |
| 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) |
| 220 | } |
| 221 | |
| 222 | define i64* @gep_plain_ce() { |
David Blaikie | 5a70dd1 | 2015-03-13 18:20:45 +0000 | [diff] [blame] | 223 | ; CHECK: ret i64* getelementptr (i64, i64* @addr, i64 171) |
| 224 | ret i64* getelementptr (i64, i64* @addr, i64 171) |
Dan Gohman | f8dbee7 | 2009-09-07 23:54:19 +0000 | [diff] [blame] | 225 | } |
| 226 | |
| 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) |
| 230 | } |
| 231 | |
| 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) |
| 235 | } |
| 236 | |
| 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) |
| 240 | } |
| 241 | |
| 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) |
| 245 | } |
| 246 | |
| 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) |
| 250 | } |
| 251 | |
| 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) |
| 255 | } |
| 256 | |
Chris Lattner | f067d58 | 2011-02-07 16:40:21 +0000 | [diff] [blame] | 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) |
| 260 | } |
| 261 | |
| 262 | |
Dan Gohman | f8dbee7 | 2009-09-07 23:54:19 +0000 | [diff] [blame] | 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) |
| 266 | } |
| 267 | |
| 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) |
| 271 | } |
| 272 | |
| 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) |
| 276 | } |
Chris Lattner | 35bda89 | 2011-02-06 21:44:57 +0000 | [diff] [blame] | 277 | |