Andrea Di Biagio | bdd576d | 2016-09-07 14:50:07 +0000 | [diff] [blame] | 1 | ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py |
| 2 | ; RUN: opt < %s -instsimplify -S | FileCheck %s |
| 3 | target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-f64:32:64-v64:64:64-v128:128:128" |
| 4 | |
| 5 | define <2 x i64> @test1() { |
| 6 | ; CHECK-LABEL: @test1( |
| 7 | ; CHECK-NEXT: ret <2 x i64> <i64 4294967296, i64 12884901890> |
| 8 | ; |
| 9 | %tmp3 = bitcast <4 x i32> < i32 0, i32 1, i32 2, i32 3 > to <2 x i64> |
| 10 | ret <2 x i64> %tmp3 |
| 11 | } |
| 12 | |
| 13 | define <4 x i32> @test2() { |
| 14 | ; CHECK-LABEL: @test2( |
| 15 | ; CHECK-NEXT: ret <4 x i32> <i32 0, i32 0, i32 1, i32 0> |
| 16 | ; |
| 17 | %tmp3 = bitcast <2 x i64> < i64 0, i64 1 > to <4 x i32> |
| 18 | ret <4 x i32> %tmp3 |
| 19 | } |
| 20 | |
| 21 | define <2 x double> @test3() { |
| 22 | ; CHECK-LABEL: @test3( |
| 23 | ; CHECK-NEXT: ret <2 x double> <double 0x100000000, double 0x300000002> |
| 24 | ; |
| 25 | %tmp3 = bitcast <4 x i32> < i32 0, i32 1, i32 2, i32 3 > to <2 x double> |
| 26 | ret <2 x double> %tmp3 |
| 27 | } |
| 28 | |
| 29 | define <4 x float> @test4() { |
| 30 | ; CHECK-LABEL: @test4( |
| 31 | ; CHECK-NEXT: ret <4 x float> <float 0.000000e+00, float 0.000000e+00, float 0x36A0000000000000, float 0.000000e+00> |
| 32 | ; |
| 33 | %tmp3 = bitcast <2 x i64> < i64 0, i64 1 > to <4 x float> |
| 34 | ret <4 x float> %tmp3 |
| 35 | } |
| 36 | |
| 37 | define <2 x i64> @test5() { |
| 38 | ; CHECK-LABEL: @test5( |
| 39 | ; CHECK-NEXT: ret <2 x i64> <i64 4575657221408423936, i64 4629700418010611712> |
| 40 | ; |
| 41 | %tmp3 = bitcast <4 x float> <float 0.0, float 1.0, float 2.0, float 3.0> to <2 x i64> |
| 42 | ret <2 x i64> %tmp3 |
| 43 | } |
| 44 | |
| 45 | define <4 x i32> @test6() { |
| 46 | ; CHECK-LABEL: @test6( |
| 47 | ; CHECK-NEXT: ret <4 x i32> <i32 0, i32 1071644672, i32 0, i32 1072693248> |
| 48 | ; |
| 49 | %tmp3 = bitcast <2 x double> <double 0.5, double 1.0> to <4 x i32> |
| 50 | ret <4 x i32> %tmp3 |
| 51 | } |
| 52 | |
| 53 | define i32 @test7() { |
| 54 | ; CHECK-LABEL: @test7( |
| 55 | ; CHECK-NEXT: ret i32 1118464 |
| 56 | ; |
| 57 | %tmp3 = bitcast <2 x half> <half 0xH1100, half 0xH0011> to i32 |
| 58 | ret i32 %tmp3 |
| 59 | } |
| 60 | |
| 61 | define <4 x i32> @test8(<1 x i64> %y) { |
| 62 | ; CHECK-LABEL: @test8( |
| 63 | ; CHECK-NEXT: ret <4 x i32> zeroinitializer |
| 64 | ; |
| 65 | %c = bitcast <2 x i64> <i64 0, i64 0> to <4 x i32> |
| 66 | ret <4 x i32> %c |
| 67 | } |
| 68 | |
| 69 | define <4 x i32> @test9(<1 x i64> %y) { |
| 70 | ; CHECK-LABEL: @test9( |
| 71 | ; CHECK-NEXT: ret <4 x i32> <i32 -1, i32 -1, i32 -1, i32 -1> |
| 72 | ; |
| 73 | %c = bitcast <2 x i64> <i64 -1, i64 -1> to <4 x i32> |
| 74 | ret <4 x i32> %c |
| 75 | } |
| 76 | |
| 77 | ; from MultiSource/Benchmarks/Bullet |
| 78 | define <2 x float> @foo() { |
| 79 | ; CHECK-LABEL: @foo( |
| 80 | ; CHECK-NEXT: ret <2 x float> <float 0xFFFFFFFFE0000000, float 0xFFFFFFFFE0000000> |
| 81 | ; |
| 82 | %cast = bitcast i64 -1 to <2 x float> |
| 83 | ret <2 x float> %cast |
| 84 | } |
| 85 | |
| 86 | |
| 87 | define <2 x double> @foo2() { |
| 88 | ; CHECK-LABEL: @foo2( |
| 89 | ; CHECK-NEXT: ret <2 x double> <double 0xFFFFFFFFFFFFFFFF, double 0xFFFFFFFFFFFFFFFF> |
| 90 | ; |
| 91 | %cast = bitcast i128 -1 to <2 x double> |
| 92 | ret <2 x double> %cast |
| 93 | } |
| 94 | |
| 95 | define <1 x float> @foo3() { |
| 96 | ; CHECK-LABEL: @foo3( |
| 97 | ; CHECK-NEXT: ret <1 x float> <float 0xFFFFFFFFE0000000> |
| 98 | ; |
| 99 | %cast = bitcast i32 -1 to <1 x float> |
| 100 | ret <1 x float> %cast |
| 101 | } |
| 102 | |
| 103 | define float @foo4() { |
| 104 | ; CHECK-LABEL: @foo4( |
| 105 | ; CHECK-NEXT: ret float 0xFFFFFFFFE0000000 |
| 106 | ; |
| 107 | %cast = bitcast <1 x i32 ><i32 -1> to float |
| 108 | ret float %cast |
| 109 | } |
| 110 | |
| 111 | define double @foo5() { |
| 112 | ; CHECK-LABEL: @foo5( |
| 113 | ; CHECK-NEXT: ret double 0xFFFFFFFFFFFFFFFF |
| 114 | ; |
| 115 | %cast = bitcast <2 x i32 ><i32 -1, i32 -1> to double |
| 116 | ret double %cast |
| 117 | } |
| 118 | |
| 119 | define <2 x double> @foo6() { |
| 120 | ; CHECK-LABEL: @foo6( |
| 121 | ; CHECK-NEXT: ret <2 x double> <double 0xFFFFFFFFFFFFFFFF, double 0xFFFFFFFFFFFFFFFF> |
| 122 | ; |
| 123 | %cast = bitcast <4 x i32><i32 -1, i32 -1, i32 -1, i32 -1> to <2 x double> |
| 124 | ret <2 x double> %cast |
| 125 | } |
Andrea Di Biagio | 3647a96 | 2016-09-13 13:17:42 +0000 | [diff] [blame] | 126 | |
| 127 | define <4 x i32> @bitcast_constexpr_4i32_2i64_u2() { |
| 128 | ; CHECK-LABEL: @bitcast_constexpr_4i32_2i64_u2( |
Andrea Di Biagio | 7277afe | 2016-09-13 14:50:47 +0000 | [diff] [blame] | 129 | ; CHECK-NEXT: ret <4 x i32> <i32 undef, i32 undef, i32 2, i32 0> |
Andrea Di Biagio | 3647a96 | 2016-09-13 13:17:42 +0000 | [diff] [blame] | 130 | ; |
| 131 | %cast = bitcast <2 x i64><i64 undef, i64 2> to <4 x i32> |
| 132 | ret <4 x i32> %cast |
| 133 | } |
| 134 | |
| 135 | define <4 x i32> @bitcast_constexpr_4i32_2i64_1u() { |
| 136 | ; CHECK-LABEL: @bitcast_constexpr_4i32_2i64_1u( |
Andrea Di Biagio | 7277afe | 2016-09-13 14:50:47 +0000 | [diff] [blame] | 137 | ; CHECK-NEXT: ret <4 x i32> <i32 1, i32 0, i32 undef, i32 undef> |
Andrea Di Biagio | 3647a96 | 2016-09-13 13:17:42 +0000 | [diff] [blame] | 138 | ; |
| 139 | %cast = bitcast <2 x i64><i64 1, i64 undef> to <4 x i32> |
| 140 | ret <4 x i32> %cast |
| 141 | } |
| 142 | |
| 143 | define <4 x i32> @bitcast_constexpr_4i32_2i64() { |
| 144 | ; CHECK-LABEL: @bitcast_constexpr_4i32_2i64( |
Andrea Di Biagio | 7277afe | 2016-09-13 14:50:47 +0000 | [diff] [blame] | 145 | ; CHECK-NEXT: ret <4 x i32> <i32 undef, i32 undef, i32 2, i32 0> |
Andrea Di Biagio | 3647a96 | 2016-09-13 13:17:42 +0000 | [diff] [blame] | 146 | ; |
| 147 | %cast = bitcast <2 x i64><i64 undef, i64 2> to <4 x i32> |
| 148 | ret <4 x i32> %cast |
| 149 | } |
| 150 | |
| 151 | define <8 x i16> @bitcast_constexpr_8i16_2i64_u2() { |
| 152 | ; CHECK-LABEL: @bitcast_constexpr_8i16_2i64_u2( |
Andrea Di Biagio | 7277afe | 2016-09-13 14:50:47 +0000 | [diff] [blame] | 153 | ; CHECK-NEXT: ret <8 x i16> <i16 undef, i16 undef, i16 undef, i16 undef, i16 2, i16 0, i16 0, i16 0> |
Andrea Di Biagio | 3647a96 | 2016-09-13 13:17:42 +0000 | [diff] [blame] | 154 | ; |
| 155 | %cast = bitcast <2 x i64><i64 undef, i64 2> to <8 x i16> |
| 156 | ret <8 x i16> %cast |
| 157 | } |
| 158 | |
| 159 | define <8 x i16> @bitcast_constexpr_8i16_2i64_1u() { |
| 160 | ; CHECK-LABEL: @bitcast_constexpr_8i16_2i64_1u( |
Andrea Di Biagio | 7277afe | 2016-09-13 14:50:47 +0000 | [diff] [blame] | 161 | ; CHECK-NEXT: ret <8 x i16> <i16 1, i16 0, i16 0, i16 0, i16 undef, i16 undef, i16 undef, i16 undef> |
Andrea Di Biagio | 3647a96 | 2016-09-13 13:17:42 +0000 | [diff] [blame] | 162 | ; |
| 163 | %cast = bitcast <2 x i64><i64 1, i64 undef> to <8 x i16> |
| 164 | ret <8 x i16> %cast |
| 165 | } |
| 166 | |
| 167 | define <8 x i16> @bitcast_constexpr_8i16_2i64_u65536() { |
| 168 | ; CHECK-LABEL: @bitcast_constexpr_8i16_2i64_u65536( |
Andrea Di Biagio | 7277afe | 2016-09-13 14:50:47 +0000 | [diff] [blame] | 169 | ; CHECK-NEXT: ret <8 x i16> <i16 undef, i16 undef, i16 undef, i16 undef, i16 0, i16 1, i16 0, i16 0> |
Andrea Di Biagio | 3647a96 | 2016-09-13 13:17:42 +0000 | [diff] [blame] | 170 | ; |
| 171 | %cast = bitcast <2 x i64><i64 undef, i64 65536> to <8 x i16> |
| 172 | ret <8 x i16> %cast |
| 173 | } |
| 174 | |
| 175 | define <16 x i8> @bitcast_constexpr_16i8_2i64_u2() { |
| 176 | ; CHECK-LABEL: @bitcast_constexpr_16i8_2i64_u2( |
Andrea Di Biagio | 7277afe | 2016-09-13 14:50:47 +0000 | [diff] [blame] | 177 | ; CHECK-NEXT: ret <16 x i8> <i8 undef, i8 undef, i8 undef, i8 undef, i8 undef, i8 undef, i8 undef, i8 undef, i8 2, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0> |
Andrea Di Biagio | 3647a96 | 2016-09-13 13:17:42 +0000 | [diff] [blame] | 178 | ; |
| 179 | %cast = bitcast <2 x i64><i64 undef, i64 2> to <16 x i8> |
| 180 | ret <16 x i8> %cast |
| 181 | } |
| 182 | |
| 183 | define <16 x i8> @bitcast_constexpr_16i8_2i64_256u() { |
| 184 | ; CHECK-LABEL: @bitcast_constexpr_16i8_2i64_256u( |
Andrea Di Biagio | 7277afe | 2016-09-13 14:50:47 +0000 | [diff] [blame] | 185 | ; CHECK-NEXT: ret <16 x i8> <i8 0, i8 1, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 undef, i8 undef, i8 undef, i8 undef, i8 undef, i8 undef, i8 undef, i8 undef> |
Andrea Di Biagio | 3647a96 | 2016-09-13 13:17:42 +0000 | [diff] [blame] | 186 | ; |
| 187 | %cast = bitcast <2 x i64><i64 256, i64 undef> to <16 x i8> |
| 188 | ret <16 x i8> %cast |
| 189 | } |
| 190 | |
| 191 | define <16 x i8> @bitcast_constexpr_16i8_2i64_u256() { |
| 192 | ; CHECK-LABEL: @bitcast_constexpr_16i8_2i64_u256( |
Andrea Di Biagio | 7277afe | 2016-09-13 14:50:47 +0000 | [diff] [blame] | 193 | ; CHECK-NEXT: ret <16 x i8> <i8 undef, i8 undef, i8 undef, i8 undef, i8 undef, i8 undef, i8 undef, i8 undef, i8 0, i8 1, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0> |
Andrea Di Biagio | 3647a96 | 2016-09-13 13:17:42 +0000 | [diff] [blame] | 194 | ; |
| 195 | %cast = bitcast <2 x i64><i64 undef, i64 256> to <16 x i8> |
| 196 | ret <16 x i8> %cast |
| 197 | } |
| 198 | |
| 199 | define <8 x i16> @bitcast_constexpr_8i16_4i32_uu22() { |
| 200 | ; CHECK-LABEL: @bitcast_constexpr_8i16_4i32_uu22( |
Andrea Di Biagio | 7277afe | 2016-09-13 14:50:47 +0000 | [diff] [blame] | 201 | ; CHECK-NEXT: ret <8 x i16> <i16 undef, i16 undef, i16 undef, i16 undef, i16 2, i16 0, i16 2, i16 0> |
Andrea Di Biagio | 3647a96 | 2016-09-13 13:17:42 +0000 | [diff] [blame] | 202 | ; |
| 203 | %cast = bitcast <4 x i32><i32 undef, i32 undef, i32 2, i32 2> to <8 x i16> |
| 204 | ret <8 x i16> %cast |
| 205 | } |
| 206 | |
| 207 | define <8 x i16> @bitcast_constexpr_8i16_4i32_10uu() { |
| 208 | ; CHECK-LABEL: @bitcast_constexpr_8i16_4i32_10uu( |
Andrea Di Biagio | 7277afe | 2016-09-13 14:50:47 +0000 | [diff] [blame] | 209 | ; CHECK-NEXT: ret <8 x i16> <i16 1, i16 0, i16 0, i16 0, i16 undef, i16 undef, i16 undef, i16 undef> |
Andrea Di Biagio | 3647a96 | 2016-09-13 13:17:42 +0000 | [diff] [blame] | 210 | ; |
| 211 | %cast = bitcast <4 x i32><i32 1, i32 0, i32 undef, i32 undef> to <8 x i16> |
| 212 | ret <8 x i16> %cast |
| 213 | } |
| 214 | |
| 215 | define <8 x i16> @bitcast_constexpr_8i16_4i32_u257u256() { |
| 216 | ; CHECK-LABEL: @bitcast_constexpr_8i16_4i32_u257u256( |
Andrea Di Biagio | 7277afe | 2016-09-13 14:50:47 +0000 | [diff] [blame] | 217 | ; CHECK-NEXT: ret <8 x i16> <i16 undef, i16 undef, i16 0, i16 1, i16 undef, i16 undef, i16 0, i16 1> |
Andrea Di Biagio | 3647a96 | 2016-09-13 13:17:42 +0000 | [diff] [blame] | 218 | ; |
| 219 | %cast = bitcast <4 x i32><i32 undef, i32 65536, i32 undef, i32 65536> to <8 x i16> |
| 220 | ret <8 x i16> %cast |
| 221 | } |
| 222 | |
| 223 | define <16 x i8> @bitcast_constexpr_16i8_4i32_u2u2() { |
| 224 | ; CHECK-LABEL: @bitcast_constexpr_16i8_4i32_u2u2( |
Andrea Di Biagio | 7277afe | 2016-09-13 14:50:47 +0000 | [diff] [blame] | 225 | ; CHECK-NEXT: ret <16 x i8> <i8 undef, i8 undef, i8 undef, i8 undef, i8 2, i8 0, i8 0, i8 0, i8 undef, i8 undef, i8 undef, i8 undef, i8 2, i8 0, i8 0, i8 0> |
Andrea Di Biagio | 3647a96 | 2016-09-13 13:17:42 +0000 | [diff] [blame] | 226 | ; |
| 227 | %cast = bitcast <4 x i32><i32 undef, i32 2, i32 undef, i32 2> to <16 x i8> |
| 228 | ret <16 x i8> %cast |
| 229 | } |
| 230 | |
| 231 | define <16 x i8> @bitcast_constexpr_16i8_4i32_1u1u() { |
| 232 | ; CHECK-LABEL: @bitcast_constexpr_16i8_4i32_1u1u( |
Andrea Di Biagio | 7277afe | 2016-09-13 14:50:47 +0000 | [diff] [blame] | 233 | ; CHECK-NEXT: ret <16 x i8> <i8 1, i8 0, i8 0, i8 0, i8 undef, i8 undef, i8 undef, i8 undef, i8 1, i8 0, i8 0, i8 0, i8 undef, i8 undef, i8 undef, i8 undef> |
Andrea Di Biagio | 3647a96 | 2016-09-13 13:17:42 +0000 | [diff] [blame] | 234 | ; |
| 235 | %cast = bitcast <4 x i32><i32 1, i32 undef, i32 1, i32 undef> to <16 x i8> |
| 236 | ret <16 x i8> %cast |
| 237 | } |
| 238 | |
| 239 | define <16 x i8> @bitcast_constexpr_16i8_4i32_u256uu() { |
| 240 | ; CHECK-LABEL: @bitcast_constexpr_16i8_4i32_u256uu( |
Andrea Di Biagio | 7277afe | 2016-09-13 14:50:47 +0000 | [diff] [blame] | 241 | ; CHECK-NEXT: ret <16 x i8> <i8 undef, i8 undef, i8 undef, i8 undef, i8 0, i8 1, i8 0, i8 0, i8 undef, i8 undef, i8 undef, i8 undef, i8 undef, i8 undef, i8 undef, i8 undef> |
Andrea Di Biagio | 3647a96 | 2016-09-13 13:17:42 +0000 | [diff] [blame] | 242 | ; |
| 243 | %cast = bitcast <4 x i32><i32 undef, i32 256, i32 undef, i32 undef> to <16 x i8> |
| 244 | ret <16 x i8> %cast |
| 245 | } |
| 246 | |
| 247 | define <16 x i8> @bitcast_constexpr_16i8_8i16_u2u2u2u2() { |
| 248 | ; CHECK-LABEL: @bitcast_constexpr_16i8_8i16_u2u2u2u2( |
Andrea Di Biagio | 7277afe | 2016-09-13 14:50:47 +0000 | [diff] [blame] | 249 | ; CHECK-NEXT: ret <16 x i8> <i8 undef, i8 undef, i8 2, i8 0, i8 undef, i8 undef, i8 2, i8 0, i8 undef, i8 undef, i8 2, i8 0, i8 undef, i8 undef, i8 2, i8 0> |
Andrea Di Biagio | 3647a96 | 2016-09-13 13:17:42 +0000 | [diff] [blame] | 250 | ; |
| 251 | %cast = bitcast <8 x i16><i16 undef, i16 2, i16 undef, i16 2, i16 undef, i16 2, i16 undef, i16 2> to <16 x i8> |
| 252 | ret <16 x i8> %cast |
| 253 | } |
| 254 | |
| 255 | define <16 x i8> @bitcast_constexpr_16i8_8i16_1u1u1u1u() { |
| 256 | ; CHECK-LABEL: @bitcast_constexpr_16i8_8i16_1u1u1u1u( |
Andrea Di Biagio | 7277afe | 2016-09-13 14:50:47 +0000 | [diff] [blame] | 257 | ; CHECK-NEXT: ret <16 x i8> <i8 1, i8 0, i8 undef, i8 undef, i8 1, i8 0, i8 undef, i8 undef, i8 1, i8 0, i8 undef, i8 undef, i8 1, i8 0, i8 undef, i8 undef> |
Andrea Di Biagio | 3647a96 | 2016-09-13 13:17:42 +0000 | [diff] [blame] | 258 | ; |
| 259 | %cast = bitcast <8 x i16><i16 1, i16 undef, i16 1, i16 undef, i16 1, i16 undef, i16 1, i16 undef> to <16 x i8> |
| 260 | ret <16 x i8> %cast |
| 261 | } |
| 262 | |
| 263 | define <16 x i8> @bitcast_constexpr_16i8_8i16_u256uuu256uu() { |
| 264 | ; CHECK-LABEL: @bitcast_constexpr_16i8_8i16_u256uuu256uu( |
Andrea Di Biagio | 7277afe | 2016-09-13 14:50:47 +0000 | [diff] [blame] | 265 | ; CHECK-NEXT: ret <16 x i8> <i8 undef, i8 undef, i8 0, i8 1, i8 undef, i8 undef, i8 undef, i8 undef, i8 undef, i8 undef, i8 0, i8 1, i8 undef, i8 undef, i8 undef, i8 undef> |
Andrea Di Biagio | 3647a96 | 2016-09-13 13:17:42 +0000 | [diff] [blame] | 266 | ; |
| 267 | %cast = bitcast <8 x i16><i16 undef, i16 256, i16 undef, i16 undef, i16 undef, i16 256, i16 undef, i16 undef> to <16 x i8> |
| 268 | ret <16 x i8> %cast |
| 269 | } |