Dan Gohman | 1224c38 | 2009-07-20 21:19:07 +0000 | [diff] [blame] | 1 | ; RUN: llvm-as < %s | llvm-dis | FileCheck %s |
| 2 | |
| 3 | @addr = external global i64 |
| 4 | |
Dan Gohman | 1224c38 | 2009-07-20 21:19:07 +0000 | [diff] [blame] | 5 | define i64 @add_unsigned(i64 %x, i64 %y) { |
Dan Gohman | 59858cf | 2009-07-27 16:11:46 +0000 | [diff] [blame] | 6 | ; CHECK: %z = add nuw i64 %x, %y |
| 7 | %z = add nuw i64 %x, %y |
Dan Gohman | 1224c38 | 2009-07-20 21:19:07 +0000 | [diff] [blame] | 8 | ret i64 %z |
| 9 | } |
| 10 | |
| 11 | define i64 @sub_unsigned(i64 %x, i64 %y) { |
Dan Gohman | 59858cf | 2009-07-27 16:11:46 +0000 | [diff] [blame] | 12 | ; CHECK: %z = sub nuw i64 %x, %y |
| 13 | %z = sub nuw i64 %x, %y |
Dan Gohman | 1224c38 | 2009-07-20 21:19:07 +0000 | [diff] [blame] | 14 | ret i64 %z |
| 15 | } |
| 16 | |
| 17 | define i64 @mul_unsigned(i64 %x, i64 %y) { |
Dan Gohman | 59858cf | 2009-07-27 16:11:46 +0000 | [diff] [blame] | 18 | ; CHECK: %z = mul nuw i64 %x, %y |
| 19 | %z = mul nuw i64 %x, %y |
Dan Gohman | 08d012e | 2009-07-22 22:44:56 +0000 | [diff] [blame] | 20 | ret i64 %z |
| 21 | } |
| 22 | |
| 23 | define i64 @add_signed(i64 %x, i64 %y) { |
Dan Gohman | 59858cf | 2009-07-27 16:11:46 +0000 | [diff] [blame] | 24 | ; CHECK: %z = add nsw i64 %x, %y |
| 25 | %z = add nsw i64 %x, %y |
Dan Gohman | 08d012e | 2009-07-22 22:44:56 +0000 | [diff] [blame] | 26 | ret i64 %z |
| 27 | } |
| 28 | |
| 29 | define i64 @sub_signed(i64 %x, i64 %y) { |
Dan Gohman | 59858cf | 2009-07-27 16:11:46 +0000 | [diff] [blame] | 30 | ; CHECK: %z = sub nsw i64 %x, %y |
| 31 | %z = sub nsw i64 %x, %y |
Dan Gohman | 08d012e | 2009-07-22 22:44:56 +0000 | [diff] [blame] | 32 | ret i64 %z |
| 33 | } |
| 34 | |
| 35 | define i64 @mul_signed(i64 %x, i64 %y) { |
Dan Gohman | 59858cf | 2009-07-27 16:11:46 +0000 | [diff] [blame] | 36 | ; CHECK: %z = mul nsw i64 %x, %y |
| 37 | %z = mul nsw i64 %x, %y |
Dan Gohman | 1224c38 | 2009-07-20 21:19:07 +0000 | [diff] [blame] | 38 | ret i64 %z |
| 39 | } |
| 40 | |
| 41 | define i64 @add_plain(i64 %x, i64 %y) { |
| 42 | ; CHECK: %z = add i64 %x, %y |
| 43 | %z = add i64 %x, %y |
| 44 | ret i64 %z |
| 45 | } |
| 46 | |
| 47 | define i64 @sub_plain(i64 %x, i64 %y) { |
| 48 | ; CHECK: %z = sub i64 %x, %y |
| 49 | %z = sub i64 %x, %y |
| 50 | ret i64 %z |
| 51 | } |
| 52 | |
| 53 | define i64 @mul_plain(i64 %x, i64 %y) { |
| 54 | ; CHECK: %z = mul i64 %x, %y |
| 55 | %z = mul i64 %x, %y |
| 56 | ret i64 %z |
| 57 | } |
| 58 | |
| 59 | define i64 @add_both(i64 %x, i64 %y) { |
Dan Gohman | 59858cf | 2009-07-27 16:11:46 +0000 | [diff] [blame] | 60 | ; CHECK: %z = add nuw nsw i64 %x, %y |
| 61 | %z = add nuw nsw i64 %x, %y |
Dan Gohman | 1224c38 | 2009-07-20 21:19:07 +0000 | [diff] [blame] | 62 | ret i64 %z |
| 63 | } |
| 64 | |
| 65 | define i64 @sub_both(i64 %x, i64 %y) { |
Dan Gohman | 59858cf | 2009-07-27 16:11:46 +0000 | [diff] [blame] | 66 | ; CHECK: %z = sub nuw nsw i64 %x, %y |
| 67 | %z = sub nuw nsw i64 %x, %y |
Dan Gohman | 1224c38 | 2009-07-20 21:19:07 +0000 | [diff] [blame] | 68 | ret i64 %z |
| 69 | } |
| 70 | |
| 71 | define i64 @mul_both(i64 %x, i64 %y) { |
Dan Gohman | 59858cf | 2009-07-27 16:11:46 +0000 | [diff] [blame] | 72 | ; CHECK: %z = mul nuw nsw i64 %x, %y |
| 73 | %z = mul nuw nsw i64 %x, %y |
Dan Gohman | 1224c38 | 2009-07-20 21:19:07 +0000 | [diff] [blame] | 74 | ret i64 %z |
| 75 | } |
| 76 | |
| 77 | define i64 @add_both_reversed(i64 %x, i64 %y) { |
Dan Gohman | 59858cf | 2009-07-27 16:11:46 +0000 | [diff] [blame] | 78 | ; CHECK: %z = add nuw nsw i64 %x, %y |
| 79 | %z = add nsw nuw i64 %x, %y |
Dan Gohman | 1224c38 | 2009-07-20 21:19:07 +0000 | [diff] [blame] | 80 | ret i64 %z |
| 81 | } |
| 82 | |
| 83 | define i64 @sub_both_reversed(i64 %x, i64 %y) { |
Dan Gohman | 59858cf | 2009-07-27 16:11:46 +0000 | [diff] [blame] | 84 | ; CHECK: %z = sub nuw nsw i64 %x, %y |
| 85 | %z = sub nsw nuw i64 %x, %y |
Dan Gohman | 1224c38 | 2009-07-20 21:19:07 +0000 | [diff] [blame] | 86 | ret i64 %z |
| 87 | } |
| 88 | |
| 89 | define i64 @mul_both_reversed(i64 %x, i64 %y) { |
Dan Gohman | 59858cf | 2009-07-27 16:11:46 +0000 | [diff] [blame] | 90 | ; CHECK: %z = mul nuw nsw i64 %x, %y |
| 91 | %z = mul nsw nuw i64 %x, %y |
Dan Gohman | 1224c38 | 2009-07-20 21:19:07 +0000 | [diff] [blame] | 92 | ret i64 %z |
| 93 | } |
| 94 | |
| 95 | define i64 @sdiv_exact(i64 %x, i64 %y) { |
Dan Gohman | 59858cf | 2009-07-27 16:11:46 +0000 | [diff] [blame] | 96 | ; CHECK: %z = sdiv exact i64 %x, %y |
| 97 | %z = sdiv exact i64 %x, %y |
Dan Gohman | 1224c38 | 2009-07-20 21:19:07 +0000 | [diff] [blame] | 98 | ret i64 %z |
| 99 | } |
| 100 | |
| 101 | define i64 @sdiv_plain(i64 %x, i64 %y) { |
| 102 | ; CHECK: %z = sdiv i64 %x, %y |
| 103 | %z = sdiv i64 %x, %y |
| 104 | ret i64 %z |
| 105 | } |
| 106 | |
Chris Lattner | 35bda89 | 2011-02-06 21:44:57 +0000 | [diff] [blame^] | 107 | define i64 @udiv_exact(i64 %x, i64 %y) { |
| 108 | ; CHECK: %z = udiv exact i64 %x, %y |
| 109 | %z = udiv exact i64 %x, %y |
| 110 | ret i64 %z |
| 111 | } |
| 112 | |
| 113 | define i64 @udiv_plain(i64 %x, i64 %y) { |
| 114 | ; CHECK: %z = udiv i64 %x, %y |
| 115 | %z = udiv i64 %x, %y |
| 116 | ret i64 %z |
| 117 | } |
| 118 | |
| 119 | |
Dan Gohman | dd8004d | 2009-07-27 21:53:46 +0000 | [diff] [blame] | 120 | define i64* @gep_nw(i64* %p, i64 %x) { |
| 121 | ; CHECK: %z = getelementptr inbounds i64* %p, i64 %x |
| 122 | %z = getelementptr inbounds i64* %p, i64 %x |
| 123 | ret i64* %z |
| 124 | } |
| 125 | |
| 126 | define i64* @gep_plain(i64* %p, i64 %x) { |
| 127 | ; CHECK: %z = getelementptr i64* %p, i64 %x |
| 128 | %z = getelementptr i64* %p, i64 %x |
| 129 | ret i64* %z |
| 130 | } |
| 131 | |
Dan Gohman | 1224c38 | 2009-07-20 21:19:07 +0000 | [diff] [blame] | 132 | define i64 @add_both_ce() { |
Dan Gohman | 59858cf | 2009-07-27 16:11:46 +0000 | [diff] [blame] | 133 | ; CHECK: ret i64 add nuw nsw (i64 ptrtoint (i64* @addr to i64), i64 91) |
| 134 | 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] | 135 | } |
| 136 | |
| 137 | define i64 @sub_both_ce() { |
Dan Gohman | 59858cf | 2009-07-27 16:11:46 +0000 | [diff] [blame] | 138 | ; CHECK: ret i64 sub nuw nsw (i64 ptrtoint (i64* @addr to i64), i64 91) |
| 139 | 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] | 140 | } |
| 141 | |
| 142 | define i64 @mul_both_ce() { |
Dan Gohman | 59858cf | 2009-07-27 16:11:46 +0000 | [diff] [blame] | 143 | ; CHECK: ret i64 mul nuw nsw (i64 ptrtoint (i64* @addr to i64), i64 91) |
| 144 | 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] | 145 | } |
| 146 | |
| 147 | define i64 @sdiv_exact_ce() { |
Dan Gohman | 59858cf | 2009-07-27 16:11:46 +0000 | [diff] [blame] | 148 | ; CHECK: ret i64 sdiv exact (i64 ptrtoint (i64* @addr to i64), i64 91) |
| 149 | ret i64 sdiv exact (i64 ptrtoint (i64* @addr to i64), i64 91) |
Dan Gohman | 1224c38 | 2009-07-20 21:19:07 +0000 | [diff] [blame] | 150 | } |
Dan Gohman | dd8004d | 2009-07-27 21:53:46 +0000 | [diff] [blame] | 151 | |
Chris Lattner | 35bda89 | 2011-02-06 21:44:57 +0000 | [diff] [blame^] | 152 | define i64 @udiv_exact_ce() { |
| 153 | ; CHECK: ret i64 udiv exact (i64 ptrtoint (i64* @addr to i64), i64 91) |
| 154 | ret i64 udiv exact (i64 ptrtoint (i64* @addr to i64), i64 91) |
| 155 | } |
| 156 | |
Dan Gohman | dd8004d | 2009-07-27 21:53:46 +0000 | [diff] [blame] | 157 | define i64* @gep_nw_ce() { |
| 158 | ; CHECK: ret i64* getelementptr inbounds (i64* @addr, i64 171) |
| 159 | ret i64* getelementptr inbounds (i64* @addr, i64 171) |
| 160 | } |
| 161 | |
Dan Gohman | f8dbee7 | 2009-09-07 23:54:19 +0000 | [diff] [blame] | 162 | define i64 @add_plain_ce() { |
| 163 | ; CHECK: ret i64 add (i64 ptrtoint (i64* @addr to i64), i64 91) |
| 164 | ret i64 add (i64 ptrtoint (i64* @addr to i64), i64 91) |
| 165 | } |
Dan Gohman | dd8004d | 2009-07-27 21:53:46 +0000 | [diff] [blame] | 166 | |
Dan Gohman | f8dbee7 | 2009-09-07 23:54:19 +0000 | [diff] [blame] | 167 | define i64 @sub_plain_ce() { |
| 168 | ; CHECK: ret i64 sub (i64 ptrtoint (i64* @addr to i64), i64 91) |
| 169 | ret i64 sub (i64 ptrtoint (i64* @addr to i64), i64 91) |
| 170 | } |
| 171 | |
| 172 | define i64 @mul_plain_ce() { |
| 173 | ; CHECK: ret i64 mul (i64 ptrtoint (i64* @addr to i64), i64 91) |
| 174 | ret i64 mul (i64 ptrtoint (i64* @addr to i64), i64 91) |
| 175 | } |
| 176 | |
| 177 | define i64 @sdiv_plain_ce() { |
| 178 | ; CHECK: ret i64 sdiv (i64 ptrtoint (i64* @addr to i64), i64 91) |
| 179 | ret i64 sdiv (i64 ptrtoint (i64* @addr to i64), i64 91) |
| 180 | } |
| 181 | |
| 182 | define i64* @gep_plain_ce() { |
| 183 | ; CHECK: ret i64* getelementptr (i64* @addr, i64 171) |
| 184 | ret i64* getelementptr (i64* @addr, i64 171) |
| 185 | } |
| 186 | |
| 187 | define i64 @add_both_reversed_ce() { |
| 188 | ; CHECK: ret i64 add nuw nsw (i64 ptrtoint (i64* @addr to i64), i64 91) |
| 189 | ret i64 add nsw nuw (i64 ptrtoint (i64* @addr to i64), i64 91) |
| 190 | } |
| 191 | |
| 192 | define i64 @sub_both_reversed_ce() { |
| 193 | ; CHECK: ret i64 sub nuw nsw (i64 ptrtoint (i64* @addr to i64), i64 91) |
| 194 | ret i64 sub nsw nuw (i64 ptrtoint (i64* @addr to i64), i64 91) |
| 195 | } |
| 196 | |
| 197 | define i64 @mul_both_reversed_ce() { |
| 198 | ; CHECK: ret i64 mul nuw nsw (i64 ptrtoint (i64* @addr to i64), i64 91) |
| 199 | ret i64 mul nsw nuw (i64 ptrtoint (i64* @addr to i64), i64 91) |
| 200 | } |
| 201 | |
| 202 | define i64 @add_signed_ce() { |
| 203 | ; CHECK: ret i64 add nsw (i64 ptrtoint (i64* @addr to i64), i64 91) |
| 204 | ret i64 add nsw (i64 ptrtoint (i64* @addr to i64), i64 91) |
| 205 | } |
| 206 | |
| 207 | define i64 @sub_signed_ce() { |
| 208 | ; CHECK: ret i64 sub nsw (i64 ptrtoint (i64* @addr to i64), i64 91) |
| 209 | ret i64 sub nsw (i64 ptrtoint (i64* @addr to i64), i64 91) |
| 210 | } |
| 211 | |
| 212 | define i64 @mul_signed_ce() { |
| 213 | ; CHECK: ret i64 mul nsw (i64 ptrtoint (i64* @addr to i64), i64 91) |
| 214 | ret i64 mul nsw (i64 ptrtoint (i64* @addr to i64), i64 91) |
| 215 | } |
| 216 | |
| 217 | define i64 @add_unsigned_ce() { |
| 218 | ; CHECK: ret i64 add nuw (i64 ptrtoint (i64* @addr to i64), i64 91) |
| 219 | ret i64 add nuw (i64 ptrtoint (i64* @addr to i64), i64 91) |
| 220 | } |
| 221 | |
| 222 | define i64 @sub_unsigned_ce() { |
| 223 | ; CHECK: ret i64 sub nuw (i64 ptrtoint (i64* @addr to i64), i64 91) |
| 224 | ret i64 sub nuw (i64 ptrtoint (i64* @addr to i64), i64 91) |
| 225 | } |
| 226 | |
| 227 | define i64 @mul_unsigned_ce() { |
| 228 | ; CHECK: ret i64 mul nuw (i64 ptrtoint (i64* @addr to i64), i64 91) |
| 229 | ret i64 mul nuw (i64 ptrtoint (i64* @addr to i64), i64 91) |
| 230 | } |
Chris Lattner | 35bda89 | 2011-02-06 21:44:57 +0000 | [diff] [blame^] | 231 | |