| Dan Gohman | ca8d9e1 | 2011-07-01 00:42:17 +0000 | [diff] [blame] | 1 | ; RUN: opt -instsimplify -S < %s | FileCheck %s |
| 2 | |
| 3 | ; @test0 |
| 4 | ; CHECK: ret i64 undef |
| 5 | define i64 @test0() { |
| 6 | %r = mul i64 undef, undef |
| 7 | ret i64 %r |
| 8 | } |
| 9 | |
| 10 | ; @test1 |
| 11 | ; CHECK: ret i64 undef |
| 12 | define i64 @test1() { |
| 13 | %r = mul i64 3, undef |
| 14 | ret i64 %r |
| 15 | } |
| 16 | |
| 17 | ; @test2 |
| 18 | ; CHECK: ret i64 undef |
| 19 | define i64 @test2() { |
| 20 | %r = mul i64 undef, 3 |
| 21 | ret i64 %r |
| 22 | } |
| 23 | |
| 24 | ; @test3 |
| 25 | ; CHECK: ret i64 0 |
| 26 | define i64 @test3() { |
| 27 | %r = mul i64 undef, 6 |
| 28 | ret i64 %r |
| 29 | } |
| 30 | |
| 31 | ; @test4 |
| 32 | ; CHECK: ret i64 0 |
| 33 | define i64 @test4() { |
| 34 | %r = mul i64 6, undef |
| 35 | ret i64 %r |
| 36 | } |
| 37 | |
| 38 | ; @test5 |
| 39 | ; CHECK: ret i64 undef |
| 40 | define i64 @test5() { |
| 41 | %r = and i64 undef, undef |
| 42 | ret i64 %r |
| 43 | } |
| 44 | |
| 45 | ; @test6 |
| 46 | ; CHECK: ret i64 undef |
| 47 | define i64 @test6() { |
| 48 | %r = or i64 undef, undef |
| 49 | ret i64 %r |
| 50 | } |
| 51 | |
| 52 | ; @test7 |
| 53 | ; CHECK: ret i64 undef |
| 54 | define i64 @test7() { |
| 55 | %r = udiv i64 undef, 1 |
| 56 | ret i64 %r |
| 57 | } |
| 58 | |
| 59 | ; @test8 |
| 60 | ; CHECK: ret i64 undef |
| 61 | define i64 @test8() { |
| 62 | %r = sdiv i64 undef, 1 |
| 63 | ret i64 %r |
| 64 | } |
| 65 | |
| 66 | ; @test9 |
| 67 | ; CHECK: ret i64 0 |
| 68 | define i64 @test9() { |
| 69 | %r = urem i64 undef, 1 |
| 70 | ret i64 %r |
| 71 | } |
| 72 | |
| 73 | ; @test10 |
| 74 | ; CHECK: ret i64 0 |
| 75 | define i64 @test10() { |
| 76 | %r = srem i64 undef, 1 |
| 77 | ret i64 %r |
| 78 | } |
| 79 | |
| 80 | ; @test11 |
| 81 | ; CHECK: ret i64 undef |
| 82 | define i64 @test11() { |
| 83 | %r = shl i64 undef, undef |
| 84 | ret i64 %r |
| 85 | } |
| 86 | |
| Dan Gohman | ce3d624 | 2011-11-04 18:39:16 +0000 | [diff] [blame] | 87 | ; @test11b |
| 88 | ; CHECK: ret i64 undef |
| 89 | define i64 @test11b(i64 %a) { |
| 90 | %r = shl i64 %a, undef |
| 91 | ret i64 %r |
| 92 | } |
| 93 | |
| Dan Gohman | ca8d9e1 | 2011-07-01 00:42:17 +0000 | [diff] [blame] | 94 | ; @test12 |
| 95 | ; CHECK: ret i64 undef |
| 96 | define i64 @test12() { |
| 97 | %r = ashr i64 undef, undef |
| 98 | ret i64 %r |
| 99 | } |
| 100 | |
| Dan Gohman | ce3d624 | 2011-11-04 18:39:16 +0000 | [diff] [blame] | 101 | ; @test12b |
| 102 | ; CHECK: ret i64 undef |
| 103 | define i64 @test12b(i64 %a) { |
| 104 | %r = ashr i64 %a, undef |
| 105 | ret i64 %r |
| 106 | } |
| 107 | |
| Dan Gohman | ca8d9e1 | 2011-07-01 00:42:17 +0000 | [diff] [blame] | 108 | ; @test13 |
| 109 | ; CHECK: ret i64 undef |
| 110 | define i64 @test13() { |
| 111 | %r = lshr i64 undef, undef |
| 112 | ret i64 %r |
| 113 | } |
| Dan Gohman | 54664ed | 2011-07-01 01:03:43 +0000 | [diff] [blame] | 114 | |
| Dan Gohman | ce3d624 | 2011-11-04 18:39:16 +0000 | [diff] [blame] | 115 | ; @test13b |
| 116 | ; CHECK: ret i64 undef |
| 117 | define i64 @test13b(i64 %a) { |
| 118 | %r = lshr i64 %a, undef |
| 119 | ret i64 %r |
| 120 | } |
| 121 | |
| Dan Gohman | 54664ed | 2011-07-01 01:03:43 +0000 | [diff] [blame] | 122 | ; @test14 |
| 123 | ; CHECK: ret i1 undef |
| 124 | define i1 @test14() { |
| 125 | %r = icmp slt i64 undef, undef |
| 126 | ret i1 %r |
| 127 | } |
| 128 | |
| 129 | ; @test15 |
| 130 | ; CHECK: ret i1 undef |
| 131 | define i1 @test15() { |
| 132 | %r = icmp ult i64 undef, undef |
| 133 | ret i1 %r |
| 134 | } |
| 135 | |
| 136 | ; @test16 |
| 137 | ; CHECK: ret i64 undef |
| 138 | define i64 @test16(i64 %a) { |
| 139 | %r = select i1 undef, i64 %a, i64 undef |
| 140 | ret i64 %r |
| 141 | } |
| 142 | |
| 143 | ; @test17 |
| 144 | ; CHECK: ret i64 undef |
| 145 | define i64 @test17(i64 %a) { |
| 146 | %r = select i1 undef, i64 undef, i64 %a |
| 147 | ret i64 %r |
| 148 | } |
| Dan Gohman | 85977e6 | 2011-11-04 18:32:42 +0000 | [diff] [blame] | 149 | |
| 150 | ; @test18 |
| 151 | ; CHECK: ret i64 undef |
| 152 | define i64 @test18(i64 %a) { |
| 153 | %r = call i64 (i64)* undef(i64 %a) |
| 154 | ret i64 %r |
| 155 | } |
| Benjamin Kramer | 5e1794e | 2014-01-24 17:09:53 +0000 | [diff] [blame] | 156 | |
| 157 | ; CHECK-LABEL: @test19 |
| 158 | ; CHECK: ret <4 x i8> undef |
| 159 | define <4 x i8> @test19(<4 x i8> %a) { |
| 160 | %b = shl <4 x i8> %a, <i8 8, i8 9, i8 undef, i8 -1> |
| 161 | ret <4 x i8> %b |
| 162 | } |
| David Majnemer | 71dc8fb | 2014-12-10 07:52:18 +0000 | [diff] [blame] | 163 | |
| 164 | ; CHECK-LABEL: @test20 |
| 165 | ; CHECK: ret i32 undef |
| 166 | define i32 @test20(i32 %a) { |
| 167 | %b = udiv i32 %a, 0 |
| 168 | ret i32 %b |
| 169 | } |
| 170 | |
| 171 | ; CHECK-LABEL: @test21 |
| 172 | ; CHECK: ret i32 undef |
| 173 | define i32 @test21(i32 %a) { |
| 174 | %b = sdiv i32 %a, 0 |
| 175 | ret i32 %b |
| 176 | } |
| David Majnemer | ae70758 | 2014-12-10 09:14:52 +0000 | [diff] [blame] | 177 | |
| 178 | ; CHECK-LABEL: @test22 |
| 179 | ; CHECK: ret i32 undef |
| 180 | define i32 @test22(i32 %a) { |
| 181 | %b = ashr exact i32 undef, %a |
| 182 | ret i32 %b |
| 183 | } |
| 184 | |
| 185 | ; CHECK-LABEL: @test23 |
| 186 | ; CHECK: ret i32 undef |
| 187 | define i32 @test23(i32 %a) { |
| 188 | %b = lshr exact i32 undef, %a |
| 189 | ret i32 %b |
| 190 | } |
| David Majnemer | 7b86b77 | 2014-12-10 09:14:55 +0000 | [diff] [blame] | 191 | |
| 192 | ; CHECK-LABEL: @test24 |
| 193 | ; CHECK: ret i32 undef |
| David Majnemer | f532fcb | 2014-12-11 12:56:17 +0000 | [diff] [blame^] | 194 | define i32 @test24() { |
| David Majnemer | 7b86b77 | 2014-12-10 09:14:55 +0000 | [diff] [blame] | 195 | %b = udiv i32 undef, 0 |
| 196 | ret i32 %b |
| 197 | } |
| David Majnemer | 89cf6d7 | 2014-12-10 21:38:05 +0000 | [diff] [blame] | 198 | |
| 199 | ; CHECK-LABEL: @test25 |
| 200 | ; CHECK: ret i32 undef |
| David Majnemer | f532fcb | 2014-12-11 12:56:17 +0000 | [diff] [blame^] | 201 | define i32 @test25() { |
| David Majnemer | 89cf6d7 | 2014-12-10 21:38:05 +0000 | [diff] [blame] | 202 | %b = lshr i32 0, undef |
| 203 | ret i32 %b |
| 204 | } |
| 205 | |
| 206 | ; CHECK-LABEL: @test26 |
| 207 | ; CHECK: ret i32 undef |
| David Majnemer | f532fcb | 2014-12-11 12:56:17 +0000 | [diff] [blame^] | 208 | define i32 @test26() { |
| David Majnemer | 89cf6d7 | 2014-12-10 21:38:05 +0000 | [diff] [blame] | 209 | %b = ashr i32 0, undef |
| 210 | ret i32 %b |
| 211 | } |
| 212 | |
| 213 | ; CHECK-LABEL: @test27 |
| 214 | ; CHECK: ret i32 undef |
| David Majnemer | f532fcb | 2014-12-11 12:56:17 +0000 | [diff] [blame^] | 215 | define i32 @test27() { |
| David Majnemer | 89cf6d7 | 2014-12-10 21:38:05 +0000 | [diff] [blame] | 216 | %b = shl i32 0, undef |
| 217 | ret i32 %b |
| 218 | } |