1 ; RUN: llvm-as < %s | llvm-dis | FileCheck %s 2 ; RUN: verify-uselistorder %s 3 4 @addr = external global i64 5 6 define i64 @add_unsigned(i64 %x, i64 %y) { 7 ; CHECK: %z = add nuw i64 %x, %y 8 %z = add nuw i64 %x, %y 9 ret i64 %z 10 } 11 12 define i64 @sub_unsigned(i64 %x, i64 %y) { 13 ; CHECK: %z = sub nuw i64 %x, %y 14 %z = sub nuw i64 %x, %y 15 ret i64 %z 16 } 17 18 define i64 @mul_unsigned(i64 %x, i64 %y) { 19 ; CHECK: %z = mul nuw i64 %x, %y 20 %z = mul nuw i64 %x, %y 21 ret i64 %z 22 } 23 24 define i64 @add_signed(i64 %x, i64 %y) { 25 ; CHECK: %z = add nsw i64 %x, %y 26 %z = add nsw i64 %x, %y 27 ret i64 %z 28 } 29 30 define i64 @sub_signed(i64 %x, i64 %y) { 31 ; CHECK: %z = sub nsw i64 %x, %y 32 %z = sub nsw i64 %x, %y 33 ret i64 %z 34 } 35 36 define i64 @mul_signed(i64 %x, i64 %y) { 37 ; CHECK: %z = mul nsw i64 %x, %y 38 %z = mul nsw i64 %x, %y 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) { 61 ; CHECK: %z = add nuw nsw i64 %x, %y 62 %z = add nuw nsw i64 %x, %y 63 ret i64 %z 64 } 65 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 69 ret i64 %z 70 } 71 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 75 ret i64 %z 76 } 77 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 81 ret i64 %z 82 } 83 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 87 ret i64 %z 88 } 89 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 93 ret i64 %z 94 } 95 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 102 define i64 @sdiv_exact(i64 %x, i64 %y) { 103 ; CHECK: %z = sdiv exact i64 %x, %y 104 %z = sdiv exact i64 %x, %y 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 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 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 } 149 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 153 ret i64* %z 154 } 155 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 159 ret i64* %z 160 } 161 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) 165 } 166 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) 170 } 171 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) 175 } 176 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) 180 } 181 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 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 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) 200 } 201 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 } 206 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() { 223 ; CHECK: ret i64* getelementptr (i64, i64* @addr, i64 171) 224 ret i64* getelementptr (i64, i64* @addr, i64 171) 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 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 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 } 277 278