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 | 08d012e | 2009-07-22 22:44:56 +0000 | [diff] [blame^] | 6 | ; CHECK: %z = nuw add i64 %x, %y |
| 7 | %z = nuw add 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 | 08d012e | 2009-07-22 22:44:56 +0000 | [diff] [blame^] | 12 | ; CHECK: %z = nuw sub i64 %x, %y |
| 13 | %z = nuw sub 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 | 08d012e | 2009-07-22 22:44:56 +0000 | [diff] [blame^] | 18 | ; CHECK: %z = nuw mul i64 %x, %y |
| 19 | %z = nuw mul i64 %x, %y |
| 20 | ret i64 %z |
| 21 | } |
| 22 | |
| 23 | define i64 @add_signed(i64 %x, i64 %y) { |
| 24 | ; CHECK: %z = nsw add i64 %x, %y |
| 25 | %z = nsw add i64 %x, %y |
| 26 | ret i64 %z |
| 27 | } |
| 28 | |
| 29 | define i64 @sub_signed(i64 %x, i64 %y) { |
| 30 | ; CHECK: %z = nsw sub i64 %x, %y |
| 31 | %z = nsw sub i64 %x, %y |
| 32 | ret i64 %z |
| 33 | } |
| 34 | |
| 35 | define i64 @mul_signed(i64 %x, i64 %y) { |
| 36 | ; CHECK: %z = nsw mul i64 %x, %y |
| 37 | %z = nsw mul 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 | 08d012e | 2009-07-22 22:44:56 +0000 | [diff] [blame^] | 60 | ; CHECK: %z = nuw nsw add i64 %x, %y |
| 61 | %z = nuw nsw add 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 | 08d012e | 2009-07-22 22:44:56 +0000 | [diff] [blame^] | 66 | ; CHECK: %z = nuw nsw sub i64 %x, %y |
| 67 | %z = nuw nsw sub 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 | 08d012e | 2009-07-22 22:44:56 +0000 | [diff] [blame^] | 72 | ; CHECK: %z = nuw nsw mul i64 %x, %y |
| 73 | %z = nuw nsw mul 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 | 08d012e | 2009-07-22 22:44:56 +0000 | [diff] [blame^] | 78 | ; CHECK: %z = nuw nsw add i64 %x, %y |
| 79 | %z = nsw nuw add 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 | 08d012e | 2009-07-22 22:44:56 +0000 | [diff] [blame^] | 84 | ; CHECK: %z = nuw nsw sub i64 %x, %y |
| 85 | %z = nsw nuw sub 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 | 08d012e | 2009-07-22 22:44:56 +0000 | [diff] [blame^] | 90 | ; CHECK: %z = nuw nsw mul i64 %x, %y |
| 91 | %z = nsw nuw mul 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) { |
| 96 | ; CHECK: %z = exact sdiv i64 %x, %y |
| 97 | %z = exact sdiv i64 %x, %y |
| 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 | |
| 107 | define i64 @add_both_ce() { |
Dan Gohman | 08d012e | 2009-07-22 22:44:56 +0000 | [diff] [blame^] | 108 | ; CHECK: ret i64 nuw nsw add (i64 ptrtoint (i64* @addr to i64), i64 91) |
| 109 | ret i64 nsw nuw add (i64 ptrtoint (i64* @addr to i64), i64 91) |
Dan Gohman | 1224c38 | 2009-07-20 21:19:07 +0000 | [diff] [blame] | 110 | } |
| 111 | |
| 112 | define i64 @sub_both_ce() { |
Dan Gohman | 08d012e | 2009-07-22 22:44:56 +0000 | [diff] [blame^] | 113 | ; CHECK: ret i64 nuw nsw sub (i64 ptrtoint (i64* @addr to i64), i64 91) |
| 114 | ret i64 nsw nuw sub (i64 ptrtoint (i64* @addr to i64), i64 91) |
Dan Gohman | 1224c38 | 2009-07-20 21:19:07 +0000 | [diff] [blame] | 115 | } |
| 116 | |
| 117 | define i64 @mul_both_ce() { |
Dan Gohman | 08d012e | 2009-07-22 22:44:56 +0000 | [diff] [blame^] | 118 | ; CHECK: ret i64 nuw nsw mul (i64 ptrtoint (i64* @addr to i64), i64 91) |
| 119 | ret i64 nuw nsw mul (i64 ptrtoint (i64* @addr to i64), i64 91) |
Dan Gohman | 1224c38 | 2009-07-20 21:19:07 +0000 | [diff] [blame] | 120 | } |
| 121 | |
| 122 | define i64 @sdiv_exact_ce() { |
| 123 | ; CHECK: ret i64 exact sdiv (i64 ptrtoint (i64* @addr to i64), i64 91) |
| 124 | ret i64 exact sdiv (i64 ptrtoint (i64* @addr to i64), i64 91) |
| 125 | } |