| ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py |
| ; RUN: opt < %s -passes=instsimplify -S -data-layout="e-p:32:32:32-i1:8:8-i8:8:8-f64:32:64-v64:64:64-v128:128:128" | FileCheck %s --check-prefixes=CHECK,LE |
| ; RUN: opt < %s -passes=instsimplify -use-constant-fp-for-fixed-length-splat -use-constant-int-for-fixed-length-splat -S -data-layout="e-p:32:32:32-i1:8:8-i8:8:8-f64:32:64-v64:64:64-v128:128:128" | FileCheck %s --check-prefixes=CHECK,LE |
| ; RUN: opt < %s -passes=instsimplify -S -data-layout="E-p:32:32:32-i1:8:8-i8:8:8-f64:32:64-v64:64:64-v128:128:128" | FileCheck %s --check-prefixes=CHECK,BE |
| |
| define <2 x i64> @test1() { |
| ; LE-LABEL: @test1( |
| ; LE-NEXT: ret <2 x i64> <i64 4294967296, i64 12884901890> |
| ; |
| ; BE-LABEL: @test1( |
| ; BE-NEXT: ret <2 x i64> <i64 1, i64 8589934595> |
| ; |
| %tmp3 = bitcast <4 x i32> < i32 0, i32 1, i32 2, i32 3 > to <2 x i64> |
| ret <2 x i64> %tmp3 |
| } |
| |
| define <4 x i32> @test2() { |
| ; LE-LABEL: @test2( |
| ; LE-NEXT: ret <4 x i32> <i32 0, i32 0, i32 1, i32 0> |
| ; |
| ; BE-LABEL: @test2( |
| ; BE-NEXT: ret <4 x i32> <i32 0, i32 0, i32 0, i32 1> |
| ; |
| %tmp3 = bitcast <2 x i64> < i64 0, i64 1 > to <4 x i32> |
| ret <4 x i32> %tmp3 |
| } |
| |
| define <2 x double> @test3() { |
| ; LE-LABEL: @test3( |
| ; LE-NEXT: ret <2 x double> <double 0x100000000, double 0x300000002> |
| ; |
| ; BE-LABEL: @test3( |
| ; BE-NEXT: ret <2 x double> <double 4.940660e-324, double 0x200000003> |
| ; |
| %tmp3 = bitcast <4 x i32> < i32 0, i32 1, i32 2, i32 3 > to <2 x double> |
| ret <2 x double> %tmp3 |
| } |
| |
| define <4 x float> @test4() { |
| ; LE-LABEL: @test4( |
| ; LE-NEXT: ret <4 x float> <float 0.000000e+00, float 0.000000e+00, float 0x36A0000000000000, float 0.000000e+00> |
| ; |
| ; BE-LABEL: @test4( |
| ; BE-NEXT: ret <4 x float> <float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0x36A0000000000000> |
| ; |
| %tmp3 = bitcast <2 x i64> < i64 0, i64 1 > to <4 x float> |
| ret <4 x float> %tmp3 |
| } |
| |
| define <2 x i64> @test5() { |
| ; LE-LABEL: @test5( |
| ; LE-NEXT: ret <2 x i64> <i64 4575657221408423936, i64 4629700418010611712> |
| ; |
| ; BE-LABEL: @test5( |
| ; BE-NEXT: ret <2 x i64> <i64 1065353216, i64 4611686019505324032> |
| ; |
| %tmp3 = bitcast <4 x float> <float 0.0, float 1.0, float 2.0, float 3.0> to <2 x i64> |
| ret <2 x i64> %tmp3 |
| } |
| |
| define <4 x i32> @test6() { |
| ; LE-LABEL: @test6( |
| ; LE-NEXT: ret <4 x i32> <i32 0, i32 1071644672, i32 0, i32 1072693248> |
| ; |
| ; BE-LABEL: @test6( |
| ; BE-NEXT: ret <4 x i32> <i32 1071644672, i32 0, i32 1072693248, i32 0> |
| ; |
| %tmp3 = bitcast <2 x double> <double 0.5, double 1.0> to <4 x i32> |
| ret <4 x i32> %tmp3 |
| } |
| |
| define i32 @test7() { |
| ; LE-LABEL: @test7( |
| ; LE-NEXT: ret i32 1118464 |
| ; |
| ; BE-LABEL: @test7( |
| ; BE-NEXT: ret i32 285212689 |
| ; |
| %tmp3 = bitcast <2 x half> <half 0xH1100, half 0xH0011> to i32 |
| ret i32 %tmp3 |
| } |
| |
| define <4 x i32> @test8(<1 x i64> %y) { |
| ; CHECK-LABEL: @test8( |
| ; CHECK-NEXT: ret <4 x i32> zeroinitializer |
| ; |
| %c = bitcast <2 x i64> <i64 0, i64 0> to <4 x i32> |
| ret <4 x i32> %c |
| } |
| |
| define <4 x i32> @test9(<1 x i64> %y) { |
| ; CHECK-LABEL: @test9( |
| ; CHECK-NEXT: ret <4 x i32> splat (i32 -1) |
| ; |
| %c = bitcast <2 x i64> <i64 -1, i64 -1> to <4 x i32> |
| ret <4 x i32> %c |
| } |
| |
| define <1 x i1> @test10() { |
| ; CHECK-LABEL: @test10( |
| ; CHECK-NEXT: ret <1 x i1> zeroinitializer |
| ; |
| %ret = icmp eq <1 x i64> <i64 bitcast (<1 x double> <double 0xFFFFFFFFFFFFFFFF> to i64)>, zeroinitializer |
| ret <1 x i1> %ret |
| } |
| |
| define <4 x i24> @test11() { |
| ; LE-LABEL: @test11( |
| ; LE-NEXT: ret <4 x i24> <i24 1, i24 256, i24 65536, i24 0> |
| ; |
| ; BE-LABEL: @test11( |
| ; BE-NEXT: ret <4 x i24> <i24 0, i24 65536, i24 256, i24 1> |
| ; |
| %c = bitcast <3 x i32> <i32 1, i32 1, i32 1> to <4 x i24> |
| ret <4 x i24> %c |
| } |
| |
| define <8 x i24> @test12() { |
| ; LE-LABEL: @test12( |
| ; LE-NEXT: ret <8 x i24> splat (i24 1) |
| ; |
| ; BE-LABEL: @test12( |
| ; BE-NEXT: ret <8 x i24> <i24 256, i24 256, i24 257, i24 1, i24 1, i24 0, i24 65536, i24 65536> |
| ; |
| %c = bitcast <3 x i64> <i64 281474993487873, i64 72057598332895488, i64 1099511693312> to <8 x i24> |
| ret <8 x i24> %c |
| } |
| |
| define <3 x i32> @test13() { |
| ; LE-LABEL: @test13( |
| ; LE-NEXT: ret <3 x i32> splat (i32 1) |
| ; |
| ; BE-LABEL: @test13( |
| ; BE-NEXT: ret <3 x i32> <i32 256, i32 16777472, i32 0> |
| ; |
| %c = bitcast <4 x i24> <i24 1, i24 256, i24 65536, i24 0> to <3 x i32> |
| ret <3 x i32> %c |
| } |
| |
| define <3 x i64> @test14() { |
| ; LE-LABEL: @test14( |
| ; LE-NEXT: ret <3 x i64> <i64 281474993487873, i64 72057598332895488, i64 1099511693312> |
| ; |
| ; BE-LABEL: @test14( |
| ; BE-NEXT: ret <3 x i64> <i64 1099511693312, i64 72057598332895488, i64 281474993487873> |
| ; |
| %c = bitcast <8 x i24> splat (i24 1) to <3 x i64> |
| ret <3 x i64> %c |
| } |
| |
| ; from MultiSource/Benchmarks/Bullet |
| define <2 x float> @foo() { |
| ; CHECK-LABEL: @foo( |
| ; CHECK-NEXT: ret <2 x float> splat (float 0xFFFFFFFFE0000000) |
| ; |
| %cast = bitcast i64 -1 to <2 x float> |
| ret <2 x float> %cast |
| } |
| |
| |
| define <2 x double> @foo2() { |
| ; CHECK-LABEL: @foo2( |
| ; CHECK-NEXT: ret <2 x double> splat (double 0xFFFFFFFFFFFFFFFF) |
| ; |
| %cast = bitcast i128 -1 to <2 x double> |
| ret <2 x double> %cast |
| } |
| |
| define <1 x float> @foo3() { |
| ; CHECK-LABEL: @foo3( |
| ; CHECK-NEXT: ret <1 x float> splat (float 0xFFFFFFFFE0000000) |
| ; |
| %cast = bitcast i32 -1 to <1 x float> |
| ret <1 x float> %cast |
| } |
| |
| define float @foo4() { |
| ; CHECK-LABEL: @foo4( |
| ; CHECK-NEXT: ret float 0xFFFFFFFFE0000000 |
| ; |
| %cast = bitcast <1 x i32 ><i32 -1> to float |
| ret float %cast |
| } |
| |
| define double @foo5() { |
| ; CHECK-LABEL: @foo5( |
| ; CHECK-NEXT: ret double 0xFFFFFFFFFFFFFFFF |
| ; |
| %cast = bitcast <2 x i32 ><i32 -1, i32 -1> to double |
| ret double %cast |
| } |
| |
| define <2 x double> @foo6() { |
| ; CHECK-LABEL: @foo6( |
| ; CHECK-NEXT: ret <2 x double> splat (double 0xFFFFFFFFFFFFFFFF) |
| ; |
| %cast = bitcast <4 x i32><i32 -1, i32 -1, i32 -1, i32 -1> to <2 x double> |
| ret <2 x double> %cast |
| } |
| |
| define <4 x i32> @bitcast_constexpr_4i32_2i64_u2() { |
| ; LE-LABEL: @bitcast_constexpr_4i32_2i64_u2( |
| ; LE-NEXT: ret <4 x i32> <i32 undef, i32 undef, i32 2, i32 0> |
| ; |
| ; BE-LABEL: @bitcast_constexpr_4i32_2i64_u2( |
| ; BE-NEXT: ret <4 x i32> <i32 undef, i32 undef, i32 0, i32 2> |
| ; |
| %cast = bitcast <2 x i64><i64 undef, i64 2> to <4 x i32> |
| ret <4 x i32> %cast |
| } |
| |
| define <4 x i32> @bitcast_constexpr_4i32_2i64_1u() { |
| ; LE-LABEL: @bitcast_constexpr_4i32_2i64_1u( |
| ; LE-NEXT: ret <4 x i32> <i32 1, i32 0, i32 undef, i32 undef> |
| ; |
| ; BE-LABEL: @bitcast_constexpr_4i32_2i64_1u( |
| ; BE-NEXT: ret <4 x i32> <i32 0, i32 1, i32 undef, i32 undef> |
| ; |
| %cast = bitcast <2 x i64><i64 1, i64 undef> to <4 x i32> |
| ret <4 x i32> %cast |
| } |
| |
| define <4 x i32> @bitcast_constexpr_4i32_2i64() { |
| ; LE-LABEL: @bitcast_constexpr_4i32_2i64( |
| ; LE-NEXT: ret <4 x i32> <i32 undef, i32 undef, i32 2, i32 0> |
| ; |
| ; BE-LABEL: @bitcast_constexpr_4i32_2i64( |
| ; BE-NEXT: ret <4 x i32> <i32 undef, i32 undef, i32 0, i32 2> |
| ; |
| %cast = bitcast <2 x i64><i64 undef, i64 2> to <4 x i32> |
| ret <4 x i32> %cast |
| } |
| |
| define <8 x i16> @bitcast_constexpr_8i16_2i64_u2() { |
| ; LE-LABEL: @bitcast_constexpr_8i16_2i64_u2( |
| ; LE-NEXT: ret <8 x i16> <i16 undef, i16 undef, i16 undef, i16 undef, i16 2, i16 0, i16 0, i16 0> |
| ; |
| ; BE-LABEL: @bitcast_constexpr_8i16_2i64_u2( |
| ; BE-NEXT: ret <8 x i16> <i16 undef, i16 undef, i16 undef, i16 undef, i16 0, i16 0, i16 0, i16 2> |
| ; |
| %cast = bitcast <2 x i64><i64 undef, i64 2> to <8 x i16> |
| ret <8 x i16> %cast |
| } |
| |
| define <8 x i16> @bitcast_constexpr_8i16_2i64_1u() { |
| ; LE-LABEL: @bitcast_constexpr_8i16_2i64_1u( |
| ; LE-NEXT: ret <8 x i16> <i16 1, i16 0, i16 0, i16 0, i16 undef, i16 undef, i16 undef, i16 undef> |
| ; |
| ; BE-LABEL: @bitcast_constexpr_8i16_2i64_1u( |
| ; BE-NEXT: ret <8 x i16> <i16 0, i16 0, i16 0, i16 1, i16 undef, i16 undef, i16 undef, i16 undef> |
| ; |
| %cast = bitcast <2 x i64><i64 1, i64 undef> to <8 x i16> |
| ret <8 x i16> %cast |
| } |
| |
| define <8 x i16> @bitcast_constexpr_8i16_2i64_u65536() { |
| ; LE-LABEL: @bitcast_constexpr_8i16_2i64_u65536( |
| ; LE-NEXT: ret <8 x i16> <i16 undef, i16 undef, i16 undef, i16 undef, i16 0, i16 1, i16 0, i16 0> |
| ; |
| ; BE-LABEL: @bitcast_constexpr_8i16_2i64_u65536( |
| ; BE-NEXT: ret <8 x i16> <i16 undef, i16 undef, i16 undef, i16 undef, i16 0, i16 0, i16 1, i16 0> |
| ; |
| %cast = bitcast <2 x i64><i64 undef, i64 65536> to <8 x i16> |
| ret <8 x i16> %cast |
| } |
| |
| define <16 x i8> @bitcast_constexpr_16i8_2i64_u2() { |
| ; LE-LABEL: @bitcast_constexpr_16i8_2i64_u2( |
| ; LE-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> |
| ; |
| ; BE-LABEL: @bitcast_constexpr_16i8_2i64_u2( |
| ; BE-NEXT: ret <16 x i8> <i8 undef, i8 undef, i8 undef, i8 undef, i8 undef, i8 undef, i8 undef, i8 undef, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 2> |
| ; |
| %cast = bitcast <2 x i64><i64 undef, i64 2> to <16 x i8> |
| ret <16 x i8> %cast |
| } |
| |
| define <16 x i8> @bitcast_constexpr_16i8_2i64_256u() { |
| ; LE-LABEL: @bitcast_constexpr_16i8_2i64_256u( |
| ; LE-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> |
| ; |
| ; BE-LABEL: @bitcast_constexpr_16i8_2i64_256u( |
| ; BE-NEXT: ret <16 x i8> <i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 1, i8 0, i8 undef, i8 undef, i8 undef, i8 undef, i8 undef, i8 undef, i8 undef, i8 undef> |
| ; |
| %cast = bitcast <2 x i64><i64 256, i64 undef> to <16 x i8> |
| ret <16 x i8> %cast |
| } |
| |
| define <16 x i8> @bitcast_constexpr_16i8_2i64_u256() { |
| ; LE-LABEL: @bitcast_constexpr_16i8_2i64_u256( |
| ; LE-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> |
| ; |
| ; BE-LABEL: @bitcast_constexpr_16i8_2i64_u256( |
| ; BE-NEXT: ret <16 x i8> <i8 undef, i8 undef, i8 undef, i8 undef, i8 undef, i8 undef, i8 undef, i8 undef, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 1, i8 0> |
| ; |
| %cast = bitcast <2 x i64><i64 undef, i64 256> to <16 x i8> |
| ret <16 x i8> %cast |
| } |
| |
| define <8 x i16> @bitcast_constexpr_8i16_4i32_uu22() { |
| ; LE-LABEL: @bitcast_constexpr_8i16_4i32_uu22( |
| ; LE-NEXT: ret <8 x i16> <i16 undef, i16 undef, i16 undef, i16 undef, i16 2, i16 0, i16 2, i16 0> |
| ; |
| ; BE-LABEL: @bitcast_constexpr_8i16_4i32_uu22( |
| ; BE-NEXT: ret <8 x i16> <i16 undef, i16 undef, i16 undef, i16 undef, i16 0, i16 2, i16 0, i16 2> |
| ; |
| %cast = bitcast <4 x i32><i32 undef, i32 undef, i32 2, i32 2> to <8 x i16> |
| ret <8 x i16> %cast |
| } |
| |
| define <8 x i16> @bitcast_constexpr_8i16_4i32_10uu() { |
| ; LE-LABEL: @bitcast_constexpr_8i16_4i32_10uu( |
| ; LE-NEXT: ret <8 x i16> <i16 1, i16 0, i16 0, i16 0, i16 undef, i16 undef, i16 undef, i16 undef> |
| ; |
| ; BE-LABEL: @bitcast_constexpr_8i16_4i32_10uu( |
| ; BE-NEXT: ret <8 x i16> <i16 0, i16 1, i16 0, i16 0, i16 undef, i16 undef, i16 undef, i16 undef> |
| ; |
| %cast = bitcast <4 x i32><i32 1, i32 0, i32 undef, i32 undef> to <8 x i16> |
| ret <8 x i16> %cast |
| } |
| |
| define <8 x i16> @bitcast_constexpr_8i16_4i32_u257u256() { |
| ; LE-LABEL: @bitcast_constexpr_8i16_4i32_u257u256( |
| ; LE-NEXT: ret <8 x i16> <i16 undef, i16 undef, i16 0, i16 1, i16 undef, i16 undef, i16 0, i16 1> |
| ; |
| ; BE-LABEL: @bitcast_constexpr_8i16_4i32_u257u256( |
| ; BE-NEXT: ret <8 x i16> <i16 undef, i16 undef, i16 1, i16 0, i16 undef, i16 undef, i16 1, i16 0> |
| ; |
| %cast = bitcast <4 x i32><i32 undef, i32 65536, i32 undef, i32 65536> to <8 x i16> |
| ret <8 x i16> %cast |
| } |
| |
| define <16 x i8> @bitcast_constexpr_16i8_4i32_u2u2() { |
| ; LE-LABEL: @bitcast_constexpr_16i8_4i32_u2u2( |
| ; LE-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> |
| ; |
| ; BE-LABEL: @bitcast_constexpr_16i8_4i32_u2u2( |
| ; BE-NEXT: ret <16 x i8> <i8 undef, i8 undef, i8 undef, i8 undef, i8 0, i8 0, i8 0, i8 2, i8 undef, i8 undef, i8 undef, i8 undef, i8 0, i8 0, i8 0, i8 2> |
| ; |
| %cast = bitcast <4 x i32><i32 undef, i32 2, i32 undef, i32 2> to <16 x i8> |
| ret <16 x i8> %cast |
| } |
| |
| define <16 x i8> @bitcast_constexpr_16i8_4i32_1u1u() { |
| ; LE-LABEL: @bitcast_constexpr_16i8_4i32_1u1u( |
| ; LE-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> |
| ; |
| ; BE-LABEL: @bitcast_constexpr_16i8_4i32_1u1u( |
| ; BE-NEXT: ret <16 x i8> <i8 0, i8 0, i8 0, i8 1, i8 undef, i8 undef, i8 undef, i8 undef, i8 0, i8 0, i8 0, i8 1, i8 undef, i8 undef, i8 undef, i8 undef> |
| ; |
| %cast = bitcast <4 x i32><i32 1, i32 undef, i32 1, i32 undef> to <16 x i8> |
| ret <16 x i8> %cast |
| } |
| |
| define <16 x i8> @bitcast_constexpr_16i8_4i32_u256uu() { |
| ; LE-LABEL: @bitcast_constexpr_16i8_4i32_u256uu( |
| ; LE-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> |
| ; |
| ; BE-LABEL: @bitcast_constexpr_16i8_4i32_u256uu( |
| ; BE-NEXT: ret <16 x i8> <i8 undef, i8 undef, i8 undef, i8 undef, i8 0, i8 0, i8 1, i8 0, i8 undef, i8 undef, i8 undef, i8 undef, i8 undef, i8 undef, i8 undef, i8 undef> |
| ; |
| %cast = bitcast <4 x i32><i32 undef, i32 256, i32 undef, i32 undef> to <16 x i8> |
| ret <16 x i8> %cast |
| } |
| |
| define <16 x i8> @bitcast_constexpr_16i8_8i16_u2u2u2u2() { |
| ; LE-LABEL: @bitcast_constexpr_16i8_8i16_u2u2u2u2( |
| ; LE-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> |
| ; |
| ; BE-LABEL: @bitcast_constexpr_16i8_8i16_u2u2u2u2( |
| ; BE-NEXT: ret <16 x i8> <i8 undef, i8 undef, i8 0, i8 2, i8 undef, i8 undef, i8 0, i8 2, i8 undef, i8 undef, i8 0, i8 2, i8 undef, i8 undef, i8 0, i8 2> |
| ; |
| %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> |
| ret <16 x i8> %cast |
| } |
| |
| define <16 x i8> @bitcast_constexpr_16i8_8i16_1u1u1u1u() { |
| ; LE-LABEL: @bitcast_constexpr_16i8_8i16_1u1u1u1u( |
| ; LE-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> |
| ; |
| ; BE-LABEL: @bitcast_constexpr_16i8_8i16_1u1u1u1u( |
| ; BE-NEXT: ret <16 x i8> <i8 0, i8 1, i8 undef, i8 undef, i8 0, i8 1, i8 undef, i8 undef, i8 0, i8 1, i8 undef, i8 undef, i8 0, i8 1, i8 undef, i8 undef> |
| ; |
| %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> |
| ret <16 x i8> %cast |
| } |
| |
| define <16 x i8> @bitcast_constexpr_16i8_8i16_u256uuu256uu() { |
| ; LE-LABEL: @bitcast_constexpr_16i8_8i16_u256uuu256uu( |
| ; LE-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> |
| ; |
| ; BE-LABEL: @bitcast_constexpr_16i8_8i16_u256uuu256uu( |
| ; BE-NEXT: ret <16 x i8> <i8 undef, i8 undef, i8 1, i8 0, i8 undef, i8 undef, i8 undef, i8 undef, i8 undef, i8 undef, i8 1, i8 0, i8 undef, i8 undef, i8 undef, i8 undef> |
| ; |
| %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> |
| ret <16 x i8> %cast |
| } |
| |
| define <4 x i24> @bitcast_constexpr_4i24_3i32_u1u() { |
| ; LE-LABEL: @bitcast_constexpr_4i24_3i32_u1u( |
| ; LE-NEXT: ret <4 x i24> <i24 undef, i24 256, i24 0, i24 undef> |
| ; |
| ; BE-LABEL: @bitcast_constexpr_4i24_3i32_u1u( |
| ; BE-NEXT: ret <4 x i24> <i24 undef, i24 0, i24 256, i24 undef> |
| ; |
| %cast = bitcast <3 x i32><i32 undef, i32 1, i32 undef> to <4 x i24> |
| ret <4 x i24> %cast |
| } |
| |
| define <3 x i32> @bitcast_constexpr_3i32_4i24_n1255uu() { |
| ; LE-LABEL: @bitcast_constexpr_3i32_4i24_n1255uu( |
| ; LE-NEXT: ret <3 x i32> <i32 -1, i32 0, i32 undef> |
| ; |
| ; BE-LABEL: @bitcast_constexpr_3i32_4i24_n1255uu( |
| ; BE-NEXT: ret <3 x i32> <i32 -256, i32 0, i32 undef> |
| ; |
| %cast = bitcast <4 x i24><i24 -1, i24 255, i24 undef, i24 undef> to <3 x i32> |
| ret <3 x i32> %cast |
| } |
| |
| define <1 x i32> @bitcast_constexpr_scalar_fp_to_vector_int() { |
| ; CHECK-LABEL: @bitcast_constexpr_scalar_fp_to_vector_int( |
| ; CHECK-NEXT: ret <1 x i32> splat (i32 1065353216) |
| ; |
| %res = bitcast float 1.0 to <1 x i32> |
| ret <1 x i32> %res |
| } |
| |
| define <2 x i64> @bitcast_constexpr_4f32_2i64_1111() { |
| ; CHECK-LABEL: @bitcast_constexpr_4f32_2i64_1111( |
| ; CHECK-NEXT: ret <2 x i64> splat (i64 4575657222473777152) |
| ; |
| %res = bitcast <4 x float> splat (float 1.0) to <2 x i64> |
| ret <2 x i64> %res |
| } |
| |
| define <2 x b64> @bitcast_constexpr_16i8_2b64() { |
| ; CHECK-LABEL: @bitcast_constexpr_16i8_2b64( |
| ; CHECK-NEXT: ret <2 x b64> splat (b64 144680345676153346) |
| ; |
| %res = bitcast <16 x i8> splat (i8 2) to <2 x b64> |
| ret <2 x b64> %res |
| } |
| |
| define <2 x b64> @bitcast_constexpr_16b8_2b64() { |
| ; CHECK-LABEL: @bitcast_constexpr_16b8_2b64( |
| ; CHECK-NEXT: ret <2 x b64> splat (b64 144680345676153346) |
| ; |
| %res = bitcast <16 x b8> splat (b8 2) to <2 x b64> |
| ret <2 x b64> %res |
| } |
| |
| define <2 x i64> @bitcast_constexpr_4b32_2i64() { |
| ; LE-LABEL: @bitcast_constexpr_4b32_2i64( |
| ; LE-NEXT: ret <2 x i64> <i64 4294967296, i64 12884901890> |
| ; |
| ; BE-LABEL: @bitcast_constexpr_4b32_2i64( |
| ; BE-NEXT: ret <2 x i64> <i64 1, i64 8589934595> |
| ; |
| %res = bitcast <4 x b32> <b32 0, b32 1, b32 2, b32 3> to <2 x i64> |
| ret <2 x i64> %res |
| } |
| |
| define <4 x i32> @bitcast_constexpr_2b64_4i32() { |
| ; LE-LABEL: @bitcast_constexpr_2b64_4i32( |
| ; LE-NEXT: ret <4 x i32> <i32 0, i32 0, i32 1, i32 0> |
| ; |
| ; BE-LABEL: @bitcast_constexpr_2b64_4i32( |
| ; BE-NEXT: ret <4 x i32> <i32 0, i32 0, i32 0, i32 1> |
| ; |
| %res = bitcast <2 x b64> <b64 0, b64 1> to <4 x i32> |
| ret <4 x i32> %res |
| } |
| |
| define <2 x b64> @bitcast_constexpr_4i32_2b64() { |
| ; LE-LABEL: @bitcast_constexpr_4i32_2b64( |
| ; LE-NEXT: ret <2 x b64> <b64 4294967296, b64 12884901890> |
| ; |
| ; BE-LABEL: @bitcast_constexpr_4i32_2b64( |
| ; BE-NEXT: ret <2 x b64> <b64 1, b64 8589934595> |
| ; |
| %res = bitcast <4 x i32> <i32 0, i32 1, i32 2, i32 3> to <2 x b64> |
| ret <2 x b64> %res |
| } |
| |
| define <4 x b32> @bitcast_constexpr_2i64_4b32() { |
| ; LE-LABEL: @bitcast_constexpr_2i64_4b32( |
| ; LE-NEXT: ret <4 x b32> <b32 0, b32 0, b32 1, b32 0> |
| ; |
| ; BE-LABEL: @bitcast_constexpr_2i64_4b32( |
| ; BE-NEXT: ret <4 x b32> <b32 0, b32 0, b32 0, b32 1> |
| ; |
| %res = bitcast <2 x i64> <i64 0, i64 1> to <4 x b32> |
| ret <4 x b32> %res |
| } |
| |
| define <2 x b64> @bitcast_constexpr_4b32_2b64() { |
| ; LE-LABEL: @bitcast_constexpr_4b32_2b64( |
| ; LE-NEXT: ret <2 x b64> <b64 4294967296, b64 12884901890> |
| ; |
| ; BE-LABEL: @bitcast_constexpr_4b32_2b64( |
| ; BE-NEXT: ret <2 x b64> <b64 1, b64 8589934595> |
| ; |
| %res = bitcast <4 x b32> <b32 0, b32 1, b32 2, b32 3> to <2 x b64> |
| ret <2 x b64> %res |
| } |
| |
| define <16 x b8> @bitcast_constexpr_2b64_16b8() { |
| ; LE-LABEL: @bitcast_constexpr_2b64_16b8( |
| ; LE-NEXT: ret <16 x b8> <b8 0, b8 0, b8 0, b8 0, b8 0, b8 0, b8 0, b8 0, b8 1, b8 0, b8 0, b8 0, b8 0, b8 0, b8 0, b8 0> |
| ; |
| ; BE-LABEL: @bitcast_constexpr_2b64_16b8( |
| ; BE-NEXT: ret <16 x b8> <b8 0, b8 0, b8 0, b8 0, b8 0, b8 0, b8 0, b8 0, b8 0, b8 0, b8 0, b8 0, b8 0, b8 0, b8 0, b8 1> |
| ; |
| %res = bitcast <2 x b64> <b64 0, b64 1> to <16 x b8> |
| ret <16 x b8> %res |
| } |
| |
| define <2 x i32> @bitcast_constexpr_scalar_b64_to_vector_2i32() { |
| ; LE-LABEL: @bitcast_constexpr_scalar_b64_to_vector_2i32( |
| ; LE-NEXT: ret <2 x i32> <i32 1, i32 0> |
| ; |
| ; BE-LABEL: @bitcast_constexpr_scalar_b64_to_vector_2i32( |
| ; BE-NEXT: ret <2 x i32> <i32 0, i32 1> |
| ; |
| %res = bitcast b64 1 to <2 x i32> |
| ret <2 x i32> %res |
| } |
| |
| define <2 x b32> @bitcast_constexpr_scalar_i64_to_vector_2b32() { |
| ; LE-LABEL: @bitcast_constexpr_scalar_i64_to_vector_2b32( |
| ; LE-NEXT: ret <2 x b32> <b32 1, b32 0> |
| ; |
| ; BE-LABEL: @bitcast_constexpr_scalar_i64_to_vector_2b32( |
| ; BE-NEXT: ret <2 x b32> <b32 0, b32 1> |
| ; |
| %res = bitcast i64 1 to <2 x b32> |
| ret <2 x b32> %res |
| } |
| |
| define <2 x b64> @bitcast_constexpr_4f32_2b64() { |
| ; CHECK-LABEL: @bitcast_constexpr_4f32_2b64( |
| ; CHECK-NEXT: ret <2 x b64> splat (b64 4575657222473777152) |
| ; |
| %res = bitcast <4 x float> splat (float 1.0) to <2 x b64> |
| ret <2 x b64> %res |
| } |
| |
| define <4 x float> @bitcast_constexpr_2b64_4f32() { |
| ; LE-LABEL: @bitcast_constexpr_2b64_4f32( |
| ; LE-NEXT: ret <4 x float> <float 0.000000e+00, float 0.000000e+00, float 0x36A0000000000000, float 0.000000e+00> |
| ; |
| ; BE-LABEL: @bitcast_constexpr_2b64_4f32( |
| ; BE-NEXT: ret <4 x float> <float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0x36A0000000000000> |
| ; |
| %res = bitcast <2 x b64> <b64 0, b64 1> to <4 x float> |
| ret <4 x float> %res |
| } |
| |
| define <2 x i64> @bitcast_constexpr_allones_4b32_2i64() { |
| ; CHECK-LABEL: @bitcast_constexpr_allones_4b32_2i64( |
| ; CHECK-NEXT: ret <2 x i64> splat (i64 -1) |
| ; |
| %res = bitcast <4 x b32> splat (b32 -1) to <2 x i64> |
| ret <2 x i64> %res |
| } |
| |
| define <4 x i32> @bitcast_constexpr_allones_4b32_4i32() { |
| ; CHECK-LABEL: @bitcast_constexpr_allones_4b32_4i32( |
| ; CHECK-NEXT: ret <4 x i32> splat (i32 -1) |
| ; |
| %res = bitcast <4 x b32> splat (b32 -1) to <4 x i32> |
| ret <4 x i32> %res |
| } |
| |
| define <4 x b32> @bitcast_constexpr_allones_2i64_4b32() { |
| ; CHECK-LABEL: @bitcast_constexpr_allones_2i64_4b32( |
| ; CHECK-NEXT: ret <4 x b32> splat (b32 -1) |
| ; |
| %res = bitcast <2 x i64> splat (i64 -1) to <4 x b32> |
| ret <4 x b32> %res |
| } |
| |
| define <4 x b32> @bitcast_constexpr_allones_4i32_4b32() { |
| ; CHECK-LABEL: @bitcast_constexpr_allones_4i32_4b32( |
| ; CHECK-NEXT: ret <4 x b32> splat (b32 -1) |
| ; |
| %res = bitcast <4 x i32> splat (i32 -1) to <4 x b32> |
| ret <4 x b32> %res |
| } |
| |
| define <2 x b64> @bitcast_constexpr_4b32_2b64_poison() { |
| ; CHECK-LABEL: @bitcast_constexpr_4b32_2b64_poison( |
| ; CHECK-NEXT: ret <2 x b64> bitcast (<4 x b32> <b32 poison, b32 1, b32 2, b32 3> to <2 x b64>) |
| ; |
| %res = bitcast <4 x b32> <b32 poison, b32 1, b32 2, b32 3> to <2 x b64> |
| ret <2 x b64> %res |
| } |
| |
| define <2 x b64> @bitcast_constexpr_4i32_2b64_poison() { |
| ; CHECK-LABEL: @bitcast_constexpr_4i32_2b64_poison( |
| ; CHECK-NEXT: ret <2 x b64> bitcast (<4 x i32> <i32 0, i32 1, i32 poison, i32 3> to <2 x b64>) |
| ; |
| %res = bitcast <4 x i32> <i32 0, i32 1, i32 poison, i32 3> to <2 x b64> |
| ret <2 x b64> %res |
| } |
| |
| define <2 x b64> @bitcast_constexpr_4f32_2b64_poison() { |
| ; CHECK-LABEL: @bitcast_constexpr_4f32_2b64_poison( |
| ; CHECK-NEXT: ret <2 x b64> bitcast (<4 x float> <float 1.000000e+00, float poison, float 2.000000e+00, float 3.000000e+00> to <2 x b64>) |
| ; |
| %res = bitcast <4 x float> <float 1.0, float poison, float 2.0, float 3.0> to <2 x b64> |
| ret <2 x b64> %res |
| } |
| |
| define <2 x b64> @bitcast_constexpr_8b16_2b64_poison() { |
| ; CHECK-LABEL: @bitcast_constexpr_8b16_2b64_poison( |
| ; CHECK-NEXT: ret <2 x b64> bitcast (<8 x b16> <b16 0, b16 1, b16 2, b16 poison, b16 4, b16 5, b16 6, b16 7> to <2 x b64>) |
| ; |
| %res = bitcast <8 x b16> <b16 0, b16 1, b16 2, b16 poison, b16 4, b16 5, b16 6, b16 7> to <2 x b64> |
| ret <2 x b64> %res |
| } |
| |
| define <2 x b64> @bitcast_constexpr_4b32_2b64_all_poison_group() { |
| ; LE-LABEL: @bitcast_constexpr_4b32_2b64_all_poison_group( |
| ; LE-NEXT: ret <2 x b64> <b64 poison, b64 12884901890> |
| ; |
| ; BE-LABEL: @bitcast_constexpr_4b32_2b64_all_poison_group( |
| ; BE-NEXT: ret <2 x b64> <b64 poison, b64 8589934595> |
| ; |
| %res = bitcast <4 x b32> <b32 poison, b32 poison, b32 2, b32 3> to <2 x b64> |
| ret <2 x b64> %res |
| } |
| |
| define <2 x b64> @bitcast_constexpr_4i32_2b64_all_poison_group() { |
| ; LE-LABEL: @bitcast_constexpr_4i32_2b64_all_poison_group( |
| ; LE-NEXT: ret <2 x b64> <b64 poison, b64 12884901890> |
| ; |
| ; BE-LABEL: @bitcast_constexpr_4i32_2b64_all_poison_group( |
| ; BE-NEXT: ret <2 x b64> <b64 poison, b64 8589934595> |
| ; |
| %res = bitcast <4 x i32> <i32 poison, i32 poison, i32 2, i32 3> to <2 x b64> |
| ret <2 x b64> %res |
| } |
| |
| define <2 x i64> @bitcast_constexpr_4b32_2i64_poison() { |
| ; LE-LABEL: @bitcast_constexpr_4b32_2i64_poison( |
| ; LE-NEXT: ret <2 x i64> <i64 poison, i64 12884901890> |
| ; |
| ; BE-LABEL: @bitcast_constexpr_4b32_2i64_poison( |
| ; BE-NEXT: ret <2 x i64> <i64 poison, i64 8589934595> |
| ; |
| %res = bitcast <4 x b32> <b32 poison, b32 1, b32 2, b32 3> to <2 x i64> |
| ret <2 x i64> %res |
| } |
| |
| define <4 x b32> @bitcast_constexpr_2b64_4b32_poison() { |
| ; LE-LABEL: @bitcast_constexpr_2b64_4b32_poison( |
| ; LE-NEXT: ret <4 x b32> <b32 poison, b32 poison, b32 1, b32 0> |
| ; |
| ; BE-LABEL: @bitcast_constexpr_2b64_4b32_poison( |
| ; BE-NEXT: ret <4 x b32> <b32 poison, b32 poison, b32 0, b32 1> |
| ; |
| %res = bitcast <2 x b64> <b64 poison, b64 1> to <4 x b32> |
| ret <4 x b32> %res |
| } |
| |
| define <2 x b64> @bitcast_constexpr_4b32_2b64_all_poison() { |
| ; CHECK-LABEL: @bitcast_constexpr_4b32_2b64_all_poison( |
| ; CHECK-NEXT: ret <2 x b64> poison |
| ; |
| %res = bitcast <4 x b32> splat (b32 poison) to <2 x b64> |
| ret <2 x b64> %res |
| } |
| |
| define <4 x i32> @bitcast_constexpr_2b64_4i32_poison() { |
| ; LE-LABEL: @bitcast_constexpr_2b64_4i32_poison( |
| ; LE-NEXT: ret <4 x i32> <i32 poison, i32 poison, i32 1, i32 0> |
| ; |
| ; BE-LABEL: @bitcast_constexpr_2b64_4i32_poison( |
| ; BE-NEXT: ret <4 x i32> <i32 poison, i32 poison, i32 0, i32 1> |
| ; |
| %res = bitcast <2 x b64> <b64 poison, b64 1> to <4 x i32> |
| ret <4 x i32> %res |
| } |
| |
| define <2 x double> @bitcast_constexpr_4b32_2f64_poison() { |
| ; LE-LABEL: @bitcast_constexpr_4b32_2f64_poison( |
| ; LE-NEXT: ret <2 x double> <double poison, double 0x300000002> |
| ; |
| ; BE-LABEL: @bitcast_constexpr_4b32_2f64_poison( |
| ; BE-NEXT: ret <2 x double> <double poison, double 0x200000003> |
| ; |
| %res = bitcast <4 x b32> <b32 poison, b32 1, b32 2, b32 3> to <2 x double> |
| ret <2 x double> %res |
| } |
| |
| define <4 x float> @bitcast_constexpr_2b64_4f32_poison() { |
| ; LE-LABEL: @bitcast_constexpr_2b64_4f32_poison( |
| ; LE-NEXT: ret <4 x float> <float poison, float poison, float 0x36A0000000000000, float 0.000000e+00> |
| ; |
| ; BE-LABEL: @bitcast_constexpr_2b64_4f32_poison( |
| ; BE-NEXT: ret <4 x float> <float poison, float poison, float 0.000000e+00, float 0x36A0000000000000> |
| ; |
| %res = bitcast <2 x b64> <b64 poison, b64 1> to <4 x float> |
| ret <4 x float> %res |
| } |
| |
| define i128 @bitcast_constexpr_2b64_i128() { |
| ; LE-LABEL: @bitcast_constexpr_2b64_i128( |
| ; LE-NEXT: ret i128 18446744073709551618 |
| ; |
| ; BE-LABEL: @bitcast_constexpr_2b64_i128( |
| ; BE-NEXT: ret i128 36893488147419103233 |
| ; |
| %res = bitcast <2 x b64> <b64 2, b64 1> to i128 |
| ret i128 %res |
| } |
| |
| define i128 @bitcast_constexpr_2b64_i128_poison() { |
| ; CHECK-LABEL: @bitcast_constexpr_2b64_i128_poison( |
| ; CHECK-NEXT: ret i128 poison |
| ; |
| %res = bitcast <2 x b64> <b64 poison, b64 1> to i128 |
| ret i128 %res |
| } |
| |
| define double @bitcast_constexpr_2b32_f64() { |
| ; LE-LABEL: @bitcast_constexpr_2b32_f64( |
| ; LE-NEXT: ret double 0x100000002 |
| ; |
| ; BE-LABEL: @bitcast_constexpr_2b32_f64( |
| ; BE-NEXT: ret double 0x200000001 |
| ; |
| %res = bitcast <2 x b32> <b32 2, b32 1> to double |
| ret double %res |
| } |
| |
| define double @bitcast_constexpr_2b32_f64_poison() { |
| ; CHECK-LABEL: @bitcast_constexpr_2b32_f64_poison( |
| ; CHECK-NEXT: ret double poison |
| ; |
| %res = bitcast <2 x b32> <b32 poison, b32 1> to double |
| ret double %res |
| } |
| |
| define <3 x b8> @bitcast_constexpr_8b3_3b8() { |
| ; LE-LABEL: @bitcast_constexpr_8b3_3b8( |
| ; LE-NEXT: ret <3 x b8> <b8 -120, b8 -58, b8 -6> |
| ; |
| ; BE-LABEL: @bitcast_constexpr_8b3_3b8( |
| ; BE-NEXT: ret <3 x b8> <b8 5, b8 57, b8 119> |
| ; |
| %res = bitcast <8 x b3> <b3 0, b3 1, b3 2, b3 3, b3 4, b3 5, b3 6, b3 7> to <3 x b8> |
| ret <3 x b8> %res |
| } |
| |
| define <3 x b8> @bitcast_constexpr_8b3_3b8_poison() { |
| ; CHECK-LABEL: @bitcast_constexpr_8b3_3b8_poison( |
| ; CHECK-NEXT: ret <3 x b8> bitcast (<8 x b3> <b3 poison, b3 poison, b3 1, b3 2, b3 3, b3 -4, b3 -3, b3 -2> to <3 x b8>) |
| ; |
| %res = bitcast <8 x b3> <b3 poison, b3 poison, b3 1, b3 2, b3 3, b3 4, b3 5, b3 6> to <3 x b8> |
| ret <3 x b8> %res |
| } |
| |
| ; TODO: this can be folded. |
| define <3 x i8> @bitcast_constexpr_8b3_3i8_poison() { |
| ; CHECK-LABEL: @bitcast_constexpr_8b3_3i8_poison( |
| ; CHECK-NEXT: ret <3 x i8> bitcast (<8 x b3> <b3 poison, b3 poison, b3 1, b3 2, b3 3, b3 -4, b3 -3, b3 -2> to <3 x i8>) |
| ; |
| %res = bitcast <8 x b3> <b3 poison, b3 poison, b3 1, b3 2, b3 3, b3 4, b3 5, b3 6> to <3 x i8> |
| ret <3 x i8> %res |
| } |
| |
| ; TODO: this can be folded. |
| define <3 x i8> @bitcast_constexpr_8b3_3i8_crossing_poison() { |
| ; CHECK-LABEL: @bitcast_constexpr_8b3_3i8_crossing_poison( |
| ; CHECK-NEXT: ret <3 x i8> bitcast (<8 x b3> <b3 1, b3 2, b3 poison, b3 3, b3 -4, b3 -3, b3 -2, b3 -1> to <3 x i8>) |
| ; |
| %res = bitcast <8 x b3> <b3 1, b3 2, b3 poison, b3 3, b3 4, b3 5, b3 6, b3 7> to <3 x i8> |
| ret <3 x i8> %res |
| } |