summaryrefslogtreecommitdiffstats
path: root/llvm/test/CodeGen/X86/avx512-shuffles/broadcast-scalar-fp.ll
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/test/CodeGen/X86/avx512-shuffles/broadcast-scalar-fp.ll')
-rw-r--r--llvm/test/CodeGen/X86/avx512-shuffles/broadcast-scalar-fp.ll1158
1 files changed, 1158 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/X86/avx512-shuffles/broadcast-scalar-fp.ll b/llvm/test/CodeGen/X86/avx512-shuffles/broadcast-scalar-fp.ll
new file mode 100644
index 00000000000..46349931bf1
--- /dev/null
+++ b/llvm/test/CodeGen/X86/avx512-shuffles/broadcast-scalar-fp.ll
@@ -0,0 +1,1158 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
+; RUN: llc -mcpu=skx %s -o - | FileCheck %s
+
+define <4 x double> @test_double_to_4(double %s) {
+; CHECK-LABEL: test_double_to_4:
+; CHECK: # BB#0:
+; CHECK-NEXT: vbroadcastsd %xmm0, %ymm0
+; CHECK-NEXT: retq
+ %vec = insertelement <2 x double> undef, double %s, i32 0
+ %res = shufflevector <2 x double> %vec, <2 x double> undef, <4 x i32> <i32 0, i32 0, i32 0, i32 0>
+ ret <4 x double> %res
+}
+define <4 x double> @test_masked_double_to_4_mask0(double %s, <4 x double> %default) {
+; CHECK-LABEL: test_masked_double_to_4_mask0:
+; CHECK: # BB#0:
+; CHECK-NEXT: movb $12, %al
+; CHECK-NEXT: kmovd %eax, %k1
+; CHECK-NEXT: vbroadcastsd %xmm0, %ymm1 {%k1}
+; CHECK-NEXT: vmovapd %ymm1, %ymm0
+; CHECK-NEXT: retq
+ %vec = insertelement <2 x double> undef, double %s, i32 0
+ %shuf = shufflevector <2 x double> %vec, <2 x double> undef, <4 x i32> <i32 0, i32 0, i32 0, i32 0>
+ %res = select <4 x i1> <i1 0, i1 0, i1 1, i1 1>, <4 x double> %shuf, <4 x double> %default
+ ret <4 x double> %res
+}
+
+define <4 x double> @test_masked_z_double_to_4_mask0(double %s) {
+; CHECK-LABEL: test_masked_z_double_to_4_mask0:
+; CHECK: # BB#0:
+; CHECK-NEXT: movb $12, %al
+; CHECK-NEXT: kmovd %eax, %k1
+; CHECK-NEXT: vbroadcastsd %xmm0, %ymm0 {%k1} {z}
+; CHECK-NEXT: retq
+ %vec = insertelement <2 x double> undef, double %s, i32 0
+ %shuf = shufflevector <2 x double> %vec, <2 x double> undef, <4 x i32> <i32 0, i32 0, i32 0, i32 0>
+ %res = select <4 x i1> <i1 0, i1 0, i1 1, i1 1>, <4 x double> %shuf, <4 x double> zeroinitializer
+ ret <4 x double> %res
+}
+define <4 x double> @test_masked_double_to_4_mask1(double %s, <4 x double> %default) {
+; CHECK-LABEL: test_masked_double_to_4_mask1:
+; CHECK: # BB#0:
+; CHECK-NEXT: movb $10, %al
+; CHECK-NEXT: kmovd %eax, %k1
+; CHECK-NEXT: vbroadcastsd %xmm0, %ymm1 {%k1}
+; CHECK-NEXT: vmovapd %ymm1, %ymm0
+; CHECK-NEXT: retq
+ %vec = insertelement <2 x double> undef, double %s, i32 0
+ %shuf = shufflevector <2 x double> %vec, <2 x double> undef, <4 x i32> <i32 0, i32 0, i32 0, i32 0>
+ %res = select <4 x i1> <i1 0, i1 1, i1 0, i1 1>, <4 x double> %shuf, <4 x double> %default
+ ret <4 x double> %res
+}
+
+define <4 x double> @test_masked_z_double_to_4_mask1(double %s) {
+; CHECK-LABEL: test_masked_z_double_to_4_mask1:
+; CHECK: # BB#0:
+; CHECK-NEXT: movb $10, %al
+; CHECK-NEXT: kmovd %eax, %k1
+; CHECK-NEXT: vbroadcastsd %xmm0, %ymm0 {%k1} {z}
+; CHECK-NEXT: retq
+ %vec = insertelement <2 x double> undef, double %s, i32 0
+ %shuf = shufflevector <2 x double> %vec, <2 x double> undef, <4 x i32> <i32 0, i32 0, i32 0, i32 0>
+ %res = select <4 x i1> <i1 0, i1 1, i1 0, i1 1>, <4 x double> %shuf, <4 x double> zeroinitializer
+ ret <4 x double> %res
+}
+define <4 x double> @test_masked_double_to_4_mask2(double %s, <4 x double> %default) {
+; CHECK-LABEL: test_masked_double_to_4_mask2:
+; CHECK: # BB#0:
+; CHECK-NEXT: movb $6, %al
+; CHECK-NEXT: kmovd %eax, %k1
+; CHECK-NEXT: vbroadcastsd %xmm0, %ymm1 {%k1}
+; CHECK-NEXT: vmovapd %ymm1, %ymm0
+; CHECK-NEXT: retq
+ %vec = insertelement <2 x double> undef, double %s, i32 0
+ %shuf = shufflevector <2 x double> %vec, <2 x double> undef, <4 x i32> <i32 0, i32 0, i32 0, i32 0>
+ %res = select <4 x i1> <i1 0, i1 1, i1 1, i1 0>, <4 x double> %shuf, <4 x double> %default
+ ret <4 x double> %res
+}
+
+define <4 x double> @test_masked_z_double_to_4_mask2(double %s) {
+; CHECK-LABEL: test_masked_z_double_to_4_mask2:
+; CHECK: # BB#0:
+; CHECK-NEXT: movb $6, %al
+; CHECK-NEXT: kmovd %eax, %k1
+; CHECK-NEXT: vbroadcastsd %xmm0, %ymm0 {%k1} {z}
+; CHECK-NEXT: retq
+ %vec = insertelement <2 x double> undef, double %s, i32 0
+ %shuf = shufflevector <2 x double> %vec, <2 x double> undef, <4 x i32> <i32 0, i32 0, i32 0, i32 0>
+ %res = select <4 x i1> <i1 0, i1 1, i1 1, i1 0>, <4 x double> %shuf, <4 x double> zeroinitializer
+ ret <4 x double> %res
+}
+define <4 x double> @test_masked_double_to_4_mask3(double %s, <4 x double> %default) {
+; CHECK-LABEL: test_masked_double_to_4_mask3:
+; CHECK: # BB#0:
+; CHECK-NEXT: movb $3, %al
+; CHECK-NEXT: kmovd %eax, %k1
+; CHECK-NEXT: vbroadcastsd %xmm0, %ymm1 {%k1}
+; CHECK-NEXT: vmovapd %ymm1, %ymm0
+; CHECK-NEXT: retq
+ %vec = insertelement <2 x double> undef, double %s, i32 0
+ %shuf = shufflevector <2 x double> %vec, <2 x double> undef, <4 x i32> <i32 0, i32 0, i32 0, i32 0>
+ %res = select <4 x i1> <i1 1, i1 1, i1 0, i1 0>, <4 x double> %shuf, <4 x double> %default
+ ret <4 x double> %res
+}
+
+define <4 x double> @test_masked_z_double_to_4_mask3(double %s) {
+; CHECK-LABEL: test_masked_z_double_to_4_mask3:
+; CHECK: # BB#0:
+; CHECK-NEXT: movb $3, %al
+; CHECK-NEXT: kmovd %eax, %k1
+; CHECK-NEXT: vbroadcastsd %xmm0, %ymm0 {%k1} {z}
+; CHECK-NEXT: retq
+ %vec = insertelement <2 x double> undef, double %s, i32 0
+ %shuf = shufflevector <2 x double> %vec, <2 x double> undef, <4 x i32> <i32 0, i32 0, i32 0, i32 0>
+ %res = select <4 x i1> <i1 1, i1 1, i1 0, i1 0>, <4 x double> %shuf, <4 x double> zeroinitializer
+ ret <4 x double> %res
+}
+define <8 x double> @test_double_to_8(double %s) {
+; CHECK-LABEL: test_double_to_8:
+; CHECK: # BB#0:
+; CHECK-NEXT: vbroadcastsd %xmm0, %zmm0
+; CHECK-NEXT: retq
+ %vec = insertelement <2 x double> undef, double %s, i32 0
+ %res = shufflevector <2 x double> %vec, <2 x double> undef, <8 x i32> <i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0>
+ ret <8 x double> %res
+}
+define <8 x double> @test_masked_double_to_8_mask0(double %s, <8 x double> %default) {
+; CHECK-LABEL: test_masked_double_to_8_mask0:
+; CHECK: # BB#0:
+; CHECK-NEXT: movb $-126, %al
+; CHECK-NEXT: kmovd %eax, %k1
+; CHECK-NEXT: vbroadcastsd %xmm0, %zmm1 {%k1}
+; CHECK-NEXT: vmovapd %zmm1, %zmm0
+; CHECK-NEXT: retq
+ %vec = insertelement <2 x double> undef, double %s, i32 0
+ %shuf = shufflevector <2 x double> %vec, <2 x double> undef, <8 x i32> <i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0>
+ %res = select <8 x i1> <i1 0, i1 1, i1 0, i1 0, i1 0, i1 0, i1 0, i1 1>, <8 x double> %shuf, <8 x double> %default
+ ret <8 x double> %res
+}
+
+define <8 x double> @test_masked_z_double_to_8_mask0(double %s) {
+; CHECK-LABEL: test_masked_z_double_to_8_mask0:
+; CHECK: # BB#0:
+; CHECK-NEXT: movb $-126, %al
+; CHECK-NEXT: kmovd %eax, %k1
+; CHECK-NEXT: vbroadcastsd %xmm0, %zmm0 {%k1} {z}
+; CHECK-NEXT: retq
+ %vec = insertelement <2 x double> undef, double %s, i32 0
+ %shuf = shufflevector <2 x double> %vec, <2 x double> undef, <8 x i32> <i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0>
+ %res = select <8 x i1> <i1 0, i1 1, i1 0, i1 0, i1 0, i1 0, i1 0, i1 1>, <8 x double> %shuf, <8 x double> zeroinitializer
+ ret <8 x double> %res
+}
+define <8 x double> @test_masked_double_to_8_mask1(double %s, <8 x double> %default) {
+; CHECK-LABEL: test_masked_double_to_8_mask1:
+; CHECK: # BB#0:
+; CHECK-NEXT: movb $103, %al
+; CHECK-NEXT: kmovd %eax, %k1
+; CHECK-NEXT: vbroadcastsd %xmm0, %zmm1 {%k1}
+; CHECK-NEXT: vmovapd %zmm1, %zmm0
+; CHECK-NEXT: retq
+ %vec = insertelement <2 x double> undef, double %s, i32 0
+ %shuf = shufflevector <2 x double> %vec, <2 x double> undef, <8 x i32> <i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0>
+ %res = select <8 x i1> <i1 1, i1 1, i1 1, i1 0, i1 0, i1 1, i1 1, i1 0>, <8 x double> %shuf, <8 x double> %default
+ ret <8 x double> %res
+}
+
+define <8 x double> @test_masked_z_double_to_8_mask1(double %s) {
+; CHECK-LABEL: test_masked_z_double_to_8_mask1:
+; CHECK: # BB#0:
+; CHECK-NEXT: movb $103, %al
+; CHECK-NEXT: kmovd %eax, %k1
+; CHECK-NEXT: vbroadcastsd %xmm0, %zmm0 {%k1} {z}
+; CHECK-NEXT: retq
+ %vec = insertelement <2 x double> undef, double %s, i32 0
+ %shuf = shufflevector <2 x double> %vec, <2 x double> undef, <8 x i32> <i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0>
+ %res = select <8 x i1> <i1 1, i1 1, i1 1, i1 0, i1 0, i1 1, i1 1, i1 0>, <8 x double> %shuf, <8 x double> zeroinitializer
+ ret <8 x double> %res
+}
+define <8 x double> @test_masked_double_to_8_mask2(double %s, <8 x double> %default) {
+; CHECK-LABEL: test_masked_double_to_8_mask2:
+; CHECK: # BB#0:
+; CHECK-NEXT: movb $-56, %al
+; CHECK-NEXT: kmovd %eax, %k1
+; CHECK-NEXT: vbroadcastsd %xmm0, %zmm1 {%k1}
+; CHECK-NEXT: vmovapd %zmm1, %zmm0
+; CHECK-NEXT: retq
+ %vec = insertelement <2 x double> undef, double %s, i32 0
+ %shuf = shufflevector <2 x double> %vec, <2 x double> undef, <8 x i32> <i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0>
+ %res = select <8 x i1> <i1 0, i1 0, i1 0, i1 1, i1 0, i1 0, i1 1, i1 1>, <8 x double> %shuf, <8 x double> %default
+ ret <8 x double> %res
+}
+
+define <8 x double> @test_masked_z_double_to_8_mask2(double %s) {
+; CHECK-LABEL: test_masked_z_double_to_8_mask2:
+; CHECK: # BB#0:
+; CHECK-NEXT: movb $-56, %al
+; CHECK-NEXT: kmovd %eax, %k1
+; CHECK-NEXT: vbroadcastsd %xmm0, %zmm0 {%k1} {z}
+; CHECK-NEXT: retq
+ %vec = insertelement <2 x double> undef, double %s, i32 0
+ %shuf = shufflevector <2 x double> %vec, <2 x double> undef, <8 x i32> <i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0>
+ %res = select <8 x i1> <i1 0, i1 0, i1 0, i1 1, i1 0, i1 0, i1 1, i1 1>, <8 x double> %shuf, <8 x double> zeroinitializer
+ ret <8 x double> %res
+}
+define <8 x double> @test_masked_double_to_8_mask3(double %s, <8 x double> %default) {
+; CHECK-LABEL: test_masked_double_to_8_mask3:
+; CHECK: # BB#0:
+; CHECK-NEXT: movb $78, %al
+; CHECK-NEXT: kmovd %eax, %k1
+; CHECK-NEXT: vbroadcastsd %xmm0, %zmm1 {%k1}
+; CHECK-NEXT: vmovapd %zmm1, %zmm0
+; CHECK-NEXT: retq
+ %vec = insertelement <2 x double> undef, double %s, i32 0
+ %shuf = shufflevector <2 x double> %vec, <2 x double> undef, <8 x i32> <i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0>
+ %res = select <8 x i1> <i1 0, i1 1, i1 1, i1 1, i1 0, i1 0, i1 1, i1 0>, <8 x double> %shuf, <8 x double> %default
+ ret <8 x double> %res
+}
+
+define <8 x double> @test_masked_z_double_to_8_mask3(double %s) {
+; CHECK-LABEL: test_masked_z_double_to_8_mask3:
+; CHECK: # BB#0:
+; CHECK-NEXT: movb $78, %al
+; CHECK-NEXT: kmovd %eax, %k1
+; CHECK-NEXT: vbroadcastsd %xmm0, %zmm0 {%k1} {z}
+; CHECK-NEXT: retq
+ %vec = insertelement <2 x double> undef, double %s, i32 0
+ %shuf = shufflevector <2 x double> %vec, <2 x double> undef, <8 x i32> <i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0>
+ %res = select <8 x i1> <i1 0, i1 1, i1 1, i1 1, i1 0, i1 0, i1 1, i1 0>, <8 x double> %shuf, <8 x double> zeroinitializer
+ ret <8 x double> %res
+}
+define <4 x float> @test_float_to_4(float %s) {
+; CHECK-LABEL: test_float_to_4:
+; CHECK: # BB#0:
+; CHECK-NEXT: vbroadcastss %xmm0, %xmm0
+; CHECK-NEXT: retq
+ %vec = insertelement <2 x float> undef, float %s, i32 0
+ %res = shufflevector <2 x float> %vec, <2 x float> undef, <4 x i32> <i32 0, i32 0, i32 0, i32 0>
+ ret <4 x float> %res
+}
+define <4 x float> @test_masked_float_to_4_mask0(float %s, <4 x float> %default) {
+; CHECK-LABEL: test_masked_float_to_4_mask0:
+; CHECK: # BB#0:
+; CHECK-NEXT: movb $7, %al
+; CHECK-NEXT: kmovd %eax, %k1
+; CHECK-NEXT: vbroadcastss %xmm0, %xmm1 {%k1}
+; CHECK-NEXT: vmovaps %xmm1, %xmm0
+; CHECK-NEXT: retq
+ %vec = insertelement <2 x float> undef, float %s, i32 0
+ %shuf = shufflevector <2 x float> %vec, <2 x float> undef, <4 x i32> <i32 0, i32 0, i32 0, i32 0>
+ %res = select <4 x i1> <i1 1, i1 1, i1 1, i1 0>, <4 x float> %shuf, <4 x float> %default
+ ret <4 x float> %res
+}
+
+define <4 x float> @test_masked_z_float_to_4_mask0(float %s) {
+; CHECK-LABEL: test_masked_z_float_to_4_mask0:
+; CHECK: # BB#0:
+; CHECK-NEXT: movb $7, %al
+; CHECK-NEXT: kmovd %eax, %k1
+; CHECK-NEXT: vbroadcastss %xmm0, %xmm0 {%k1} {z}
+; CHECK-NEXT: retq
+ %vec = insertelement <2 x float> undef, float %s, i32 0
+ %shuf = shufflevector <2 x float> %vec, <2 x float> undef, <4 x i32> <i32 0, i32 0, i32 0, i32 0>
+ %res = select <4 x i1> <i1 1, i1 1, i1 1, i1 0>, <4 x float> %shuf, <4 x float> zeroinitializer
+ ret <4 x float> %res
+}
+define <4 x float> @test_masked_float_to_4_mask1(float %s, <4 x float> %default) {
+; CHECK-LABEL: test_masked_float_to_4_mask1:
+; CHECK: # BB#0:
+; CHECK-NEXT: movb $8, %al
+; CHECK-NEXT: kmovd %eax, %k1
+; CHECK-NEXT: vbroadcastss %xmm0, %xmm1 {%k1}
+; CHECK-NEXT: vmovaps %xmm1, %xmm0
+; CHECK-NEXT: retq
+ %vec = insertelement <2 x float> undef, float %s, i32 0
+ %shuf = shufflevector <2 x float> %vec, <2 x float> undef, <4 x i32> <i32 0, i32 0, i32 0, i32 0>
+ %res = select <4 x i1> <i1 0, i1 0, i1 0, i1 1>, <4 x float> %shuf, <4 x float> %default
+ ret <4 x float> %res
+}
+
+define <4 x float> @test_masked_z_float_to_4_mask1(float %s) {
+; CHECK-LABEL: test_masked_z_float_to_4_mask1:
+; CHECK: # BB#0:
+; CHECK-NEXT: movb $8, %al
+; CHECK-NEXT: kmovd %eax, %k1
+; CHECK-NEXT: vbroadcastss %xmm0, %xmm0 {%k1} {z}
+; CHECK-NEXT: retq
+ %vec = insertelement <2 x float> undef, float %s, i32 0
+ %shuf = shufflevector <2 x float> %vec, <2 x float> undef, <4 x i32> <i32 0, i32 0, i32 0, i32 0>
+ %res = select <4 x i1> <i1 0, i1 0, i1 0, i1 1>, <4 x float> %shuf, <4 x float> zeroinitializer
+ ret <4 x float> %res
+}
+define <4 x float> @test_masked_float_to_4_mask2(float %s, <4 x float> %default) {
+; CHECK-LABEL: test_masked_float_to_4_mask2:
+; CHECK: # BB#0:
+; CHECK-NEXT: movb $11, %al
+; CHECK-NEXT: kmovd %eax, %k1
+; CHECK-NEXT: vbroadcastss %xmm0, %xmm1 {%k1}
+; CHECK-NEXT: vmovaps %xmm1, %xmm0
+; CHECK-NEXT: retq
+ %vec = insertelement <2 x float> undef, float %s, i32 0
+ %shuf = shufflevector <2 x float> %vec, <2 x float> undef, <4 x i32> <i32 0, i32 0, i32 0, i32 0>
+ %res = select <4 x i1> <i1 1, i1 1, i1 0, i1 1>, <4 x float> %shuf, <4 x float> %default
+ ret <4 x float> %res
+}
+
+define <4 x float> @test_masked_z_float_to_4_mask2(float %s) {
+; CHECK-LABEL: test_masked_z_float_to_4_mask2:
+; CHECK: # BB#0:
+; CHECK-NEXT: movb $11, %al
+; CHECK-NEXT: kmovd %eax, %k1
+; CHECK-NEXT: vbroadcastss %xmm0, %xmm0 {%k1} {z}
+; CHECK-NEXT: retq
+ %vec = insertelement <2 x float> undef, float %s, i32 0
+ %shuf = shufflevector <2 x float> %vec, <2 x float> undef, <4 x i32> <i32 0, i32 0, i32 0, i32 0>
+ %res = select <4 x i1> <i1 1, i1 1, i1 0, i1 1>, <4 x float> %shuf, <4 x float> zeroinitializer
+ ret <4 x float> %res
+}
+define <4 x float> @test_masked_float_to_4_mask3(float %s, <4 x float> %default) {
+; CHECK-LABEL: test_masked_float_to_4_mask3:
+; CHECK: # BB#0:
+; CHECK-NEXT: movb $6, %al
+; CHECK-NEXT: kmovd %eax, %k1
+; CHECK-NEXT: vbroadcastss %xmm0, %xmm1 {%k1}
+; CHECK-NEXT: vmovaps %xmm1, %xmm0
+; CHECK-NEXT: retq
+ %vec = insertelement <2 x float> undef, float %s, i32 0
+ %shuf = shufflevector <2 x float> %vec, <2 x float> undef, <4 x i32> <i32 0, i32 0, i32 0, i32 0>
+ %res = select <4 x i1> <i1 0, i1 1, i1 1, i1 0>, <4 x float> %shuf, <4 x float> %default
+ ret <4 x float> %res
+}
+
+define <4 x float> @test_masked_z_float_to_4_mask3(float %s) {
+; CHECK-LABEL: test_masked_z_float_to_4_mask3:
+; CHECK: # BB#0:
+; CHECK-NEXT: movb $6, %al
+; CHECK-NEXT: kmovd %eax, %k1
+; CHECK-NEXT: vbroadcastss %xmm0, %xmm0 {%k1} {z}
+; CHECK-NEXT: retq
+ %vec = insertelement <2 x float> undef, float %s, i32 0
+ %shuf = shufflevector <2 x float> %vec, <2 x float> undef, <4 x i32> <i32 0, i32 0, i32 0, i32 0>
+ %res = select <4 x i1> <i1 0, i1 1, i1 1, i1 0>, <4 x float> %shuf, <4 x float> zeroinitializer
+ ret <4 x float> %res
+}
+define <8 x float> @test_float_to_8(float %s) {
+; CHECK-LABEL: test_float_to_8:
+; CHECK: # BB#0:
+; CHECK-NEXT: vbroadcastss %xmm0, %ymm0
+; CHECK-NEXT: retq
+ %vec = insertelement <2 x float> undef, float %s, i32 0
+ %res = shufflevector <2 x float> %vec, <2 x float> undef, <8 x i32> <i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0>
+ ret <8 x float> %res
+}
+define <8 x float> @test_masked_float_to_8_mask0(float %s, <8 x float> %default) {
+; CHECK-LABEL: test_masked_float_to_8_mask0:
+; CHECK: # BB#0:
+; CHECK-NEXT: movb $72, %al
+; CHECK-NEXT: kmovd %eax, %k1
+; CHECK-NEXT: vbroadcastss %xmm0, %ymm1 {%k1}
+; CHECK-NEXT: vmovaps %ymm1, %ymm0
+; CHECK-NEXT: retq
+ %vec = insertelement <2 x float> undef, float %s, i32 0
+ %shuf = shufflevector <2 x float> %vec, <2 x float> undef, <8 x i32> <i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0>
+ %res = select <8 x i1> <i1 0, i1 0, i1 0, i1 1, i1 0, i1 0, i1 1, i1 0>, <8 x float> %shuf, <8 x float> %default
+ ret <8 x float> %res
+}
+
+define <8 x float> @test_masked_z_float_to_8_mask0(float %s) {
+; CHECK-LABEL: test_masked_z_float_to_8_mask0:
+; CHECK: # BB#0:
+; CHECK-NEXT: movb $72, %al
+; CHECK-NEXT: kmovd %eax, %k1
+; CHECK-NEXT: vbroadcastss %xmm0, %ymm0 {%k1} {z}
+; CHECK-NEXT: retq
+ %vec = insertelement <2 x float> undef, float %s, i32 0
+ %shuf = shufflevector <2 x float> %vec, <2 x float> undef, <8 x i32> <i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0>
+ %res = select <8 x i1> <i1 0, i1 0, i1 0, i1 1, i1 0, i1 0, i1 1, i1 0>, <8 x float> %shuf, <8 x float> zeroinitializer
+ ret <8 x float> %res
+}
+define <8 x float> @test_masked_float_to_8_mask1(float %s, <8 x float> %default) {
+; CHECK-LABEL: test_masked_float_to_8_mask1:
+; CHECK: # BB#0:
+; CHECK-NEXT: movb $-64, %al
+; CHECK-NEXT: kmovd %eax, %k1
+; CHECK-NEXT: vbroadcastss %xmm0, %ymm1 {%k1}
+; CHECK-NEXT: vmovaps %ymm1, %ymm0
+; CHECK-NEXT: retq
+ %vec = insertelement <2 x float> undef, float %s, i32 0
+ %shuf = shufflevector <2 x float> %vec, <2 x float> undef, <8 x i32> <i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0>
+ %res = select <8 x i1> <i1 0, i1 0, i1 0, i1 0, i1 0, i1 0, i1 1, i1 1>, <8 x float> %shuf, <8 x float> %default
+ ret <8 x float> %res
+}
+
+define <8 x float> @test_masked_z_float_to_8_mask1(float %s) {
+; CHECK-LABEL: test_masked_z_float_to_8_mask1:
+; CHECK: # BB#0:
+; CHECK-NEXT: movb $-64, %al
+; CHECK-NEXT: kmovd %eax, %k1
+; CHECK-NEXT: vbroadcastss %xmm0, %ymm0 {%k1} {z}
+; CHECK-NEXT: retq
+ %vec = insertelement <2 x float> undef, float %s, i32 0
+ %shuf = shufflevector <2 x float> %vec, <2 x float> undef, <8 x i32> <i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0>
+ %res = select <8 x i1> <i1 0, i1 0, i1 0, i1 0, i1 0, i1 0, i1 1, i1 1>, <8 x float> %shuf, <8 x float> zeroinitializer
+ ret <8 x float> %res
+}
+define <8 x float> @test_masked_float_to_8_mask2(float %s, <8 x float> %default) {
+; CHECK-LABEL: test_masked_float_to_8_mask2:
+; CHECK: # BB#0:
+; CHECK-NEXT: movb $-98, %al
+; CHECK-NEXT: kmovd %eax, %k1
+; CHECK-NEXT: vbroadcastss %xmm0, %ymm1 {%k1}
+; CHECK-NEXT: vmovaps %ymm1, %ymm0
+; CHECK-NEXT: retq
+ %vec = insertelement <2 x float> undef, float %s, i32 0
+ %shuf = shufflevector <2 x float> %vec, <2 x float> undef, <8 x i32> <i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0>
+ %res = select <8 x i1> <i1 0, i1 1, i1 1, i1 1, i1 1, i1 0, i1 0, i1 1>, <8 x float> %shuf, <8 x float> %default
+ ret <8 x float> %res
+}
+
+define <8 x float> @test_masked_z_float_to_8_mask2(float %s) {
+; CHECK-LABEL: test_masked_z_float_to_8_mask2:
+; CHECK: # BB#0:
+; CHECK-NEXT: movb $-98, %al
+; CHECK-NEXT: kmovd %eax, %k1
+; CHECK-NEXT: vbroadcastss %xmm0, %ymm0 {%k1} {z}
+; CHECK-NEXT: retq
+ %vec = insertelement <2 x float> undef, float %s, i32 0
+ %shuf = shufflevector <2 x float> %vec, <2 x float> undef, <8 x i32> <i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0>
+ %res = select <8 x i1> <i1 0, i1 1, i1 1, i1 1, i1 1, i1 0, i1 0, i1 1>, <8 x float> %shuf, <8 x float> zeroinitializer
+ ret <8 x float> %res
+}
+define <8 x float> @test_masked_float_to_8_mask3(float %s, <8 x float> %default) {
+; CHECK-LABEL: test_masked_float_to_8_mask3:
+; CHECK: # BB#0:
+; CHECK-NEXT: movb $64, %al
+; CHECK-NEXT: kmovd %eax, %k1
+; CHECK-NEXT: vbroadcastss %xmm0, %ymm1 {%k1}
+; CHECK-NEXT: vmovaps %ymm1, %ymm0
+; CHECK-NEXT: retq
+ %vec = insertelement <2 x float> undef, float %s, i32 0
+ %shuf = shufflevector <2 x float> %vec, <2 x float> undef, <8 x i32> <i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0>
+ %res = select <8 x i1> <i1 0, i1 0, i1 0, i1 0, i1 0, i1 0, i1 1, i1 0>, <8 x float> %shuf, <8 x float> %default
+ ret <8 x float> %res
+}
+
+define <8 x float> @test_masked_z_float_to_8_mask3(float %s) {
+; CHECK-LABEL: test_masked_z_float_to_8_mask3:
+; CHECK: # BB#0:
+; CHECK-NEXT: movb $64, %al
+; CHECK-NEXT: kmovd %eax, %k1
+; CHECK-NEXT: vbroadcastss %xmm0, %ymm0 {%k1} {z}
+; CHECK-NEXT: retq
+ %vec = insertelement <2 x float> undef, float %s, i32 0
+ %shuf = shufflevector <2 x float> %vec, <2 x float> undef, <8 x i32> <i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0>
+ %res = select <8 x i1> <i1 0, i1 0, i1 0, i1 0, i1 0, i1 0, i1 1, i1 0>, <8 x float> %shuf, <8 x float> zeroinitializer
+ ret <8 x float> %res
+}
+define <16 x float> @test_float_to_16(float %s) {
+; CHECK-LABEL: test_float_to_16:
+; CHECK: # BB#0:
+; CHECK-NEXT: vbroadcastss %xmm0, %zmm0
+; CHECK-NEXT: retq
+ %vec = insertelement <2 x float> undef, float %s, i32 0
+ %res = shufflevector <2 x float> %vec, <2 x float> undef, <16 x i32> <i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0>
+ ret <16 x float> %res
+}
+define <16 x float> @test_masked_float_to_16_mask0(float %s, <16 x float> %default) {
+; CHECK-LABEL: test_masked_float_to_16_mask0:
+; CHECK: # BB#0:
+; CHECK-NEXT: movw $-5916, %ax # imm = 0xE8E4
+; CHECK-NEXT: kmovd %eax, %k1
+; CHECK-NEXT: vbroadcastss %xmm0, %zmm1 {%k1}
+; CHECK-NEXT: vmovaps %zmm1, %zmm0
+; CHECK-NEXT: retq
+ %vec = insertelement <2 x float> undef, float %s, i32 0
+ %shuf = shufflevector <2 x float> %vec, <2 x float> undef, <16 x i32> <i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0>
+ %res = select <16 x i1> <i1 0, i1 0, i1 1, i1 0, i1 0, i1 1, i1 1, i1 1, i1 0, i1 0, i1 0, i1 1, i1 0, i1 1, i1 1, i1 1>, <16 x float> %shuf, <16 x float> %default
+ ret <16 x float> %res
+}
+
+define <16 x float> @test_masked_z_float_to_16_mask0(float %s) {
+; CHECK-LABEL: test_masked_z_float_to_16_mask0:
+; CHECK: # BB#0:
+; CHECK-NEXT: movw $-5916, %ax # imm = 0xE8E4
+; CHECK-NEXT: kmovd %eax, %k1
+; CHECK-NEXT: vbroadcastss %xmm0, %zmm0 {%k1} {z}
+; CHECK-NEXT: retq
+ %vec = insertelement <2 x float> undef, float %s, i32 0
+ %shuf = shufflevector <2 x float> %vec, <2 x float> undef, <16 x i32> <i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0>
+ %res = select <16 x i1> <i1 0, i1 0, i1 1, i1 0, i1 0, i1 1, i1 1, i1 1, i1 0, i1 0, i1 0, i1 1, i1 0, i1 1, i1 1, i1 1>, <16 x float> %shuf, <16 x float> zeroinitializer
+ ret <16 x float> %res
+}
+define <16 x float> @test_masked_float_to_16_mask1(float %s, <16 x float> %default) {
+; CHECK-LABEL: test_masked_float_to_16_mask1:
+; CHECK: # BB#0:
+; CHECK-NEXT: movw $-1130, %ax # imm = 0xFB96
+; CHECK-NEXT: kmovd %eax, %k1
+; CHECK-NEXT: vbroadcastss %xmm0, %zmm1 {%k1}
+; CHECK-NEXT: vmovaps %zmm1, %zmm0
+; CHECK-NEXT: retq
+ %vec = insertelement <2 x float> undef, float %s, i32 0
+ %shuf = shufflevector <2 x float> %vec, <2 x float> undef, <16 x i32> <i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0>
+ %res = select <16 x i1> <i1 0, i1 1, i1 1, i1 0, i1 1, i1 0, i1 0, i1 1, i1 1, i1 1, i1 0, i1 1, i1 1, i1 1, i1 1, i1 1>, <16 x float> %shuf, <16 x float> %default
+ ret <16 x float> %res
+}
+
+define <16 x float> @test_masked_z_float_to_16_mask1(float %s) {
+; CHECK-LABEL: test_masked_z_float_to_16_mask1:
+; CHECK: # BB#0:
+; CHECK-NEXT: movw $-1130, %ax # imm = 0xFB96
+; CHECK-NEXT: kmovd %eax, %k1
+; CHECK-NEXT: vbroadcastss %xmm0, %zmm0 {%k1} {z}
+; CHECK-NEXT: retq
+ %vec = insertelement <2 x float> undef, float %s, i32 0
+ %shuf = shufflevector <2 x float> %vec, <2 x float> undef, <16 x i32> <i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0>
+ %res = select <16 x i1> <i1 0, i1 1, i1 1, i1 0, i1 1, i1 0, i1 0, i1 1, i1 1, i1 1, i1 0, i1 1, i1 1, i1 1, i1 1, i1 1>, <16 x float> %shuf, <16 x float> zeroinitializer
+ ret <16 x float> %res
+}
+define <16 x float> @test_masked_float_to_16_mask2(float %s, <16 x float> %default) {
+; CHECK-LABEL: test_masked_float_to_16_mask2:
+; CHECK: # BB#0:
+; CHECK-NEXT: movw $-12439, %ax # imm = 0xCF69
+; CHECK-NEXT: kmovd %eax, %k1
+; CHECK-NEXT: vbroadcastss %xmm0, %zmm1 {%k1}
+; CHECK-NEXT: vmovaps %zmm1, %zmm0
+; CHECK-NEXT: retq
+ %vec = insertelement <2 x float> undef, float %s, i32 0
+ %shuf = shufflevector <2 x float> %vec, <2 x float> undef, <16 x i32> <i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0>
+ %res = select <16 x i1> <i1 1, i1 0, i1 0, i1 1, i1 0, i1 1, i1 1, i1 0, i1 1, i1 1, i1 1, i1 1, i1 0, i1 0, i1 1, i1 1>, <16 x float> %shuf, <16 x float> %default
+ ret <16 x float> %res
+}
+
+define <16 x float> @test_masked_z_float_to_16_mask2(float %s) {
+; CHECK-LABEL: test_masked_z_float_to_16_mask2:
+; CHECK: # BB#0:
+; CHECK-NEXT: movw $-12439, %ax # imm = 0xCF69
+; CHECK-NEXT: kmovd %eax, %k1
+; CHECK-NEXT: vbroadcastss %xmm0, %zmm0 {%k1} {z}
+; CHECK-NEXT: retq
+ %vec = insertelement <2 x float> undef, float %s, i32 0
+ %shuf = shufflevector <2 x float> %vec, <2 x float> undef, <16 x i32> <i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0>
+ %res = select <16 x i1> <i1 1, i1 0, i1 0, i1 1, i1 0, i1 1, i1 1, i1 0, i1 1, i1 1, i1 1, i1 1, i1 0, i1 0, i1 1, i1 1>, <16 x float> %shuf, <16 x float> zeroinitializer
+ ret <16 x float> %res
+}
+define <16 x float> @test_masked_float_to_16_mask3(float %s, <16 x float> %default) {
+; CHECK-LABEL: test_masked_float_to_16_mask3:
+; CHECK: # BB#0:
+; CHECK-NEXT: movw $-6413, %ax # imm = 0xE6F3
+; CHECK-NEXT: kmovd %eax, %k1
+; CHECK-NEXT: vbroadcastss %xmm0, %zmm1 {%k1}
+; CHECK-NEXT: vmovaps %zmm1, %zmm0
+; CHECK-NEXT: retq
+ %vec = insertelement <2 x float> undef, float %s, i32 0
+ %shuf = shufflevector <2 x float> %vec, <2 x float> undef, <16 x i32> <i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0>
+ %res = select <16 x i1> <i1 1, i1 1, i1 0, i1 0, i1 1, i1 1, i1 1, i1 1, i1 0, i1 1, i1 1, i1 0, i1 0, i1 1, i1 1, i1 1>, <16 x float> %shuf, <16 x float> %default
+ ret <16 x float> %res
+}
+
+define <16 x float> @test_masked_z_float_to_16_mask3(float %s) {
+; CHECK-LABEL: test_masked_z_float_to_16_mask3:
+; CHECK: # BB#0:
+; CHECK-NEXT: movw $-6413, %ax # imm = 0xE6F3
+; CHECK-NEXT: kmovd %eax, %k1
+; CHECK-NEXT: vbroadcastss %xmm0, %zmm0 {%k1} {z}
+; CHECK-NEXT: retq
+ %vec = insertelement <2 x float> undef, float %s, i32 0
+ %shuf = shufflevector <2 x float> %vec, <2 x float> undef, <16 x i32> <i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0>
+ %res = select <16 x i1> <i1 1, i1 1, i1 0, i1 0, i1 1, i1 1, i1 1, i1 1, i1 0, i1 1, i1 1, i1 0, i1 0, i1 1, i1 1, i1 1>, <16 x float> %shuf, <16 x float> zeroinitializer
+ ret <16 x float> %res
+}
+define <4 x double> @test_double_to_4_mem(double* %p) {
+; CHECK-LABEL: test_double_to_4_mem:
+; CHECK: # BB#0:
+; CHECK-NEXT: vbroadcastsd (%rdi), %ymm0
+; CHECK-NEXT: retq
+ %s = load double, double* %p
+ %vec = insertelement <2 x double> undef, double %s, i32 0
+ %res = shufflevector <2 x double> %vec, <2 x double> undef, <4 x i32> <i32 0, i32 0, i32 0, i32 0>
+ ret <4 x double> %res
+}
+define <4 x double> @test_masked_double_to_4_mem_mask0(double* %p, <4 x double> %default) {
+; CHECK-LABEL: test_masked_double_to_4_mem_mask0:
+; CHECK: # BB#0:
+; CHECK-NEXT: movb $5, %al
+; CHECK-NEXT: kmovd %eax, %k1
+; CHECK-NEXT: vbroadcastsd (%rdi), %ymm0 {%k1}
+; CHECK-NEXT: retq
+ %s = load double, double* %p
+ %vec = insertelement <2 x double> undef, double %s, i32 0
+ %shuf = shufflevector <2 x double> %vec, <2 x double> undef, <4 x i32> <i32 0, i32 0, i32 0, i32 0>
+ %res = select <4 x i1> <i1 1, i1 0, i1 1, i1 0>, <4 x double> %shuf, <4 x double> %default
+ ret <4 x double> %res
+}
+
+define <4 x double> @test_masked_z_double_to_4_mem_mask0(double* %p) {
+; CHECK-LABEL: test_masked_z_double_to_4_mem_mask0:
+; CHECK: # BB#0:
+; CHECK-NEXT: movb $5, %al
+; CHECK-NEXT: kmovd %eax, %k1
+; CHECK-NEXT: vbroadcastsd (%rdi), %ymm0 {%k1} {z}
+; CHECK-NEXT: retq
+ %s = load double, double* %p
+ %vec = insertelement <2 x double> undef, double %s, i32 0
+ %shuf = shufflevector <2 x double> %vec, <2 x double> undef, <4 x i32> <i32 0, i32 0, i32 0, i32 0>
+ %res = select <4 x i1> <i1 1, i1 0, i1 1, i1 0>, <4 x double> %shuf, <4 x double> zeroinitializer
+ ret <4 x double> %res
+}
+define <4 x double> @test_masked_double_to_4_mem_mask1(double* %p, <4 x double> %default) {
+; CHECK-LABEL: test_masked_double_to_4_mem_mask1:
+; CHECK: # BB#0:
+; CHECK-NEXT: movb $10, %al
+; CHECK-NEXT: kmovd %eax, %k1
+; CHECK-NEXT: vbroadcastsd (%rdi), %ymm0 {%k1}
+; CHECK-NEXT: retq
+ %s = load double, double* %p
+ %vec = insertelement <2 x double> undef, double %s, i32 0
+ %shuf = shufflevector <2 x double> %vec, <2 x double> undef, <4 x i32> <i32 0, i32 0, i32 0, i32 0>
+ %res = select <4 x i1> <i1 0, i1 1, i1 0, i1 1>, <4 x double> %shuf, <4 x double> %default
+ ret <4 x double> %res
+}
+
+define <4 x double> @test_masked_z_double_to_4_mem_mask1(double* %p) {
+; CHECK-LABEL: test_masked_z_double_to_4_mem_mask1:
+; CHECK: # BB#0:
+; CHECK-NEXT: movb $10, %al
+; CHECK-NEXT: kmovd %eax, %k1
+; CHECK-NEXT: vbroadcastsd (%rdi), %ymm0 {%k1} {z}
+; CHECK-NEXT: retq
+ %s = load double, double* %p
+ %vec = insertelement <2 x double> undef, double %s, i32 0
+ %shuf = shufflevector <2 x double> %vec, <2 x double> undef, <4 x i32> <i32 0, i32 0, i32 0, i32 0>
+ %res = select <4 x i1> <i1 0, i1 1, i1 0, i1 1>, <4 x double> %shuf, <4 x double> zeroinitializer
+ ret <4 x double> %res
+}
+define <4 x double> @test_masked_double_to_4_mem_mask2(double* %p, <4 x double> %default) {
+; CHECK-LABEL: test_masked_double_to_4_mem_mask2:
+; CHECK: # BB#0:
+; CHECK-NEXT: movb $11, %al
+; CHECK-NEXT: kmovd %eax, %k1
+; CHECK-NEXT: vbroadcastsd (%rdi), %ymm0 {%k1}
+; CHECK-NEXT: retq
+ %s = load double, double* %p
+ %vec = insertelement <2 x double> undef, double %s, i32 0
+ %shuf = shufflevector <2 x double> %vec, <2 x double> undef, <4 x i32> <i32 0, i32 0, i32 0, i32 0>
+ %res = select <4 x i1> <i1 1, i1 1, i1 0, i1 1>, <4 x double> %shuf, <4 x double> %default
+ ret <4 x double> %res
+}
+
+define <4 x double> @test_masked_z_double_to_4_mem_mask2(double* %p) {
+; CHECK-LABEL: test_masked_z_double_to_4_mem_mask2:
+; CHECK: # BB#0:
+; CHECK-NEXT: movb $11, %al
+; CHECK-NEXT: kmovd %eax, %k1
+; CHECK-NEXT: vbroadcastsd (%rdi), %ymm0 {%k1} {z}
+; CHECK-NEXT: retq
+ %s = load double, double* %p
+ %vec = insertelement <2 x double> undef, double %s, i32 0
+ %shuf = shufflevector <2 x double> %vec, <2 x double> undef, <4 x i32> <i32 0, i32 0, i32 0, i32 0>
+ %res = select <4 x i1> <i1 1, i1 1, i1 0, i1 1>, <4 x double> %shuf, <4 x double> zeroinitializer
+ ret <4 x double> %res
+}
+define <4 x double> @test_masked_double_to_4_mem_mask3(double* %p, <4 x double> %default) {
+; CHECK-LABEL: test_masked_double_to_4_mem_mask3:
+; CHECK: # BB#0:
+; CHECK-NEXT: movb $8, %al
+; CHECK-NEXT: kmovd %eax, %k1
+; CHECK-NEXT: vbroadcastsd (%rdi), %ymm0 {%k1}
+; CHECK-NEXT: retq
+ %s = load double, double* %p
+ %vec = insertelement <2 x double> undef, double %s, i32 0
+ %shuf = shufflevector <2 x double> %vec, <2 x double> undef, <4 x i32> <i32 0, i32 0, i32 0, i32 0>
+ %res = select <4 x i1> <i1 0, i1 0, i1 0, i1 1>, <4 x double> %shuf, <4 x double> %default
+ ret <4 x double> %res
+}
+
+define <4 x double> @test_masked_z_double_to_4_mem_mask3(double* %p) {
+; CHECK-LABEL: test_masked_z_double_to_4_mem_mask3:
+; CHECK: # BB#0:
+; CHECK-NEXT: movb $8, %al
+; CHECK-NEXT: kmovd %eax, %k1
+; CHECK-NEXT: vbroadcastsd (%rdi), %ymm0 {%k1} {z}
+; CHECK-NEXT: retq
+ %s = load double, double* %p
+ %vec = insertelement <2 x double> undef, double %s, i32 0
+ %shuf = shufflevector <2 x double> %vec, <2 x double> undef, <4 x i32> <i32 0, i32 0, i32 0, i32 0>
+ %res = select <4 x i1> <i1 0, i1 0, i1 0, i1 1>, <4 x double> %shuf, <4 x double> zeroinitializer
+ ret <4 x double> %res
+}
+define <8 x double> @test_double_to_8_mem(double* %p) {
+; CHECK-LABEL: test_double_to_8_mem:
+; CHECK: # BB#0:
+; CHECK-NEXT: vbroadcastsd (%rdi), %zmm0
+; CHECK-NEXT: retq
+ %s = load double, double* %p
+ %vec = insertelement <2 x double> undef, double %s, i32 0
+ %res = shufflevector <2 x double> %vec, <2 x double> undef, <8 x i32> <i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0>
+ ret <8 x double> %res
+}
+define <8 x double> @test_masked_double_to_8_mem_mask0(double* %p, <8 x double> %default) {
+; CHECK-LABEL: test_masked_double_to_8_mem_mask0:
+; CHECK: # BB#0:
+; CHECK-NEXT: movb $120, %al
+; CHECK-NEXT: kmovd %eax, %k1
+; CHECK-NEXT: vbroadcastsd (%rdi), %zmm0 {%k1}
+; CHECK-NEXT: retq
+ %s = load double, double* %p
+ %vec = insertelement <2 x double> undef, double %s, i32 0
+ %shuf = shufflevector <2 x double> %vec, <2 x double> undef, <8 x i32> <i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0>
+ %res = select <8 x i1> <i1 0, i1 0, i1 0, i1 1, i1 1, i1 1, i1 1, i1 0>, <8 x double> %shuf, <8 x double> %default
+ ret <8 x double> %res
+}
+
+define <8 x double> @test_masked_z_double_to_8_mem_mask0(double* %p) {
+; CHECK-LABEL: test_masked_z_double_to_8_mem_mask0:
+; CHECK: # BB#0:
+; CHECK-NEXT: movb $120, %al
+; CHECK-NEXT: kmovd %eax, %k1
+; CHECK-NEXT: vbroadcastsd (%rdi), %zmm0 {%k1} {z}
+; CHECK-NEXT: retq
+ %s = load double, double* %p
+ %vec = insertelement <2 x double> undef, double %s, i32 0
+ %shuf = shufflevector <2 x double> %vec, <2 x double> undef, <8 x i32> <i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0>
+ %res = select <8 x i1> <i1 0, i1 0, i1 0, i1 1, i1 1, i1 1, i1 1, i1 0>, <8 x double> %shuf, <8 x double> zeroinitializer
+ ret <8 x double> %res
+}
+define <8 x double> @test_masked_double_to_8_mem_mask1(double* %p, <8 x double> %default) {
+; CHECK-LABEL: test_masked_double_to_8_mem_mask1:
+; CHECK: # BB#0:
+; CHECK-NEXT: movb $26, %al
+; CHECK-NEXT: kmovd %eax, %k1
+; CHECK-NEXT: vbroadcastsd (%rdi), %zmm0 {%k1}
+; CHECK-NEXT: retq
+ %s = load double, double* %p
+ %vec = insertelement <2 x double> undef, double %s, i32 0
+ %shuf = shufflevector <2 x double> %vec, <2 x double> undef, <8 x i32> <i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0>
+ %res = select <8 x i1> <i1 0, i1 1, i1 0, i1 1, i1 1, i1 0, i1 0, i1 0>, <8 x double> %shuf, <8 x double> %default
+ ret <8 x double> %res
+}
+
+define <8 x double> @test_masked_z_double_to_8_mem_mask1(double* %p) {
+; CHECK-LABEL: test_masked_z_double_to_8_mem_mask1:
+; CHECK: # BB#0:
+; CHECK-NEXT: movb $26, %al
+; CHECK-NEXT: kmovd %eax, %k1
+; CHECK-NEXT: vbroadcastsd (%rdi), %zmm0 {%k1} {z}
+; CHECK-NEXT: retq
+ %s = load double, double* %p
+ %vec = insertelement <2 x double> undef, double %s, i32 0
+ %shuf = shufflevector <2 x double> %vec, <2 x double> undef, <8 x i32> <i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0>
+ %res = select <8 x i1> <i1 0, i1 1, i1 0, i1 1, i1 1, i1 0, i1 0, i1 0>, <8 x double> %shuf, <8 x double> zeroinitializer
+ ret <8 x double> %res
+}
+define <8 x double> @test_masked_double_to_8_mem_mask2(double* %p, <8 x double> %default) {
+; CHECK-LABEL: test_masked_double_to_8_mem_mask2:
+; CHECK: # BB#0:
+; CHECK-NEXT: movb $111, %al
+; CHECK-NEXT: kmovd %eax, %k1
+; CHECK-NEXT: vbroadcastsd (%rdi), %zmm0 {%k1}
+; CHECK-NEXT: retq
+ %s = load double, double* %p
+ %vec = insertelement <2 x double> undef, double %s, i32 0
+ %shuf = shufflevector <2 x double> %vec, <2 x double> undef, <8 x i32> <i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0>
+ %res = select <8 x i1> <i1 1, i1 1, i1 1, i1 1, i1 0, i1 1, i1 1, i1 0>, <8 x double> %shuf, <8 x double> %default
+ ret <8 x double> %res
+}
+
+define <8 x double> @test_masked_z_double_to_8_mem_mask2(double* %p) {
+; CHECK-LABEL: test_masked_z_double_to_8_mem_mask2:
+; CHECK: # BB#0:
+; CHECK-NEXT: movb $111, %al
+; CHECK-NEXT: kmovd %eax, %k1
+; CHECK-NEXT: vbroadcastsd (%rdi), %zmm0 {%k1} {z}
+; CHECK-NEXT: retq
+ %s = load double, double* %p
+ %vec = insertelement <2 x double> undef, double %s, i32 0
+ %shuf = shufflevector <2 x double> %vec, <2 x double> undef, <8 x i32> <i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0>
+ %res = select <8 x i1> <i1 1, i1 1, i1 1, i1 1, i1 0, i1 1, i1 1, i1 0>, <8 x double> %shuf, <8 x double> zeroinitializer
+ ret <8 x double> %res
+}
+define <8 x double> @test_masked_double_to_8_mem_mask3(double* %p, <8 x double> %default) {
+; CHECK-LABEL: test_masked_double_to_8_mem_mask3:
+; CHECK: # BB#0:
+; CHECK-NEXT: movb $-100, %al
+; CHECK-NEXT: kmovd %eax, %k1
+; CHECK-NEXT: vbroadcastsd (%rdi), %zmm0 {%k1}
+; CHECK-NEXT: retq
+ %s = load double, double* %p
+ %vec = insertelement <2 x double> undef, double %s, i32 0
+ %shuf = shufflevector <2 x double> %vec, <2 x double> undef, <8 x i32> <i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0>
+ %res = select <8 x i1> <i1 0, i1 0, i1 1, i1 1, i1 1, i1 0, i1 0, i1 1>, <8 x double> %shuf, <8 x double> %default
+ ret <8 x double> %res
+}
+
+define <8 x double> @test_masked_z_double_to_8_mem_mask3(double* %p) {
+; CHECK-LABEL: test_masked_z_double_to_8_mem_mask3:
+; CHECK: # BB#0:
+; CHECK-NEXT: movb $-100, %al
+; CHECK-NEXT: kmovd %eax, %k1
+; CHECK-NEXT: vbroadcastsd (%rdi), %zmm0 {%k1} {z}
+; CHECK-NEXT: retq
+ %s = load double, double* %p
+ %vec = insertelement <2 x double> undef, double %s, i32 0
+ %shuf = shufflevector <2 x double> %vec, <2 x double> undef, <8 x i32> <i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0>
+ %res = select <8 x i1> <i1 0, i1 0, i1 1, i1 1, i1 1, i1 0, i1 0, i1 1>, <8 x double> %shuf, <8 x double> zeroinitializer
+ ret <8 x double> %res
+}
+define <4 x float> @test_float_to_4_mem(float* %p) {
+; CHECK-LABEL: test_float_to_4_mem:
+; CHECK: # BB#0:
+; CHECK-NEXT: vbroadcastss (%rdi), %xmm0
+; CHECK-NEXT: retq
+ %s = load float, float* %p
+ %vec = insertelement <2 x float> undef, float %s, i32 0
+ %res = shufflevector <2 x float> %vec, <2 x float> undef, <4 x i32> <i32 0, i32 0, i32 0, i32 0>
+ ret <4 x float> %res
+}
+define <4 x float> @test_masked_float_to_4_mem_mask0(float* %p, <4 x float> %default) {
+; CHECK-LABEL: test_masked_float_to_4_mem_mask0:
+; CHECK: # BB#0:
+; CHECK-NEXT: movb $13, %al
+; CHECK-NEXT: kmovd %eax, %k1
+; CHECK-NEXT: vbroadcastss (%rdi), %xmm0 {%k1}
+; CHECK-NEXT: retq
+ %s = load float, float* %p
+ %vec = insertelement <2 x float> undef, float %s, i32 0
+ %shuf = shufflevector <2 x float> %vec, <2 x float> undef, <4 x i32> <i32 0, i32 0, i32 0, i32 0>
+ %res = select <4 x i1> <i1 1, i1 0, i1 1, i1 1>, <4 x float> %shuf, <4 x float> %default
+ ret <4 x float> %res
+}
+
+define <4 x float> @test_masked_z_float_to_4_mem_mask0(float* %p) {
+; CHECK-LABEL: test_masked_z_float_to_4_mem_mask0:
+; CHECK: # BB#0:
+; CHECK-NEXT: movb $13, %al
+; CHECK-NEXT: kmovd %eax, %k1
+; CHECK-NEXT: vbroadcastss (%rdi), %xmm0 {%k1} {z}
+; CHECK-NEXT: retq
+ %s = load float, float* %p
+ %vec = insertelement <2 x float> undef, float %s, i32 0
+ %shuf = shufflevector <2 x float> %vec, <2 x float> undef, <4 x i32> <i32 0, i32 0, i32 0, i32 0>
+ %res = select <4 x i1> <i1 1, i1 0, i1 1, i1 1>, <4 x float> %shuf, <4 x float> zeroinitializer
+ ret <4 x float> %res
+}
+define <4 x float> @test_masked_float_to_4_mem_mask1(float* %p, <4 x float> %default) {
+; CHECK-LABEL: test_masked_float_to_4_mem_mask1:
+; CHECK: # BB#0:
+; CHECK-NEXT: movb $14, %al
+; CHECK-NEXT: kmovd %eax, %k1
+; CHECK-NEXT: vbroadcastss (%rdi), %xmm0 {%k1}
+; CHECK-NEXT: retq
+ %s = load float, float* %p
+ %vec = insertelement <2 x float> undef, float %s, i32 0
+ %shuf = shufflevector <2 x float> %vec, <2 x float> undef, <4 x i32> <i32 0, i32 0, i32 0, i32 0>
+ %res = select <4 x i1> <i1 0, i1 1, i1 1, i1 1>, <4 x float> %shuf, <4 x float> %default
+ ret <4 x float> %res
+}
+
+define <4 x float> @test_masked_z_float_to_4_mem_mask1(float* %p) {
+; CHECK-LABEL: test_masked_z_float_to_4_mem_mask1:
+; CHECK: # BB#0:
+; CHECK-NEXT: movb $14, %al
+; CHECK-NEXT: kmovd %eax, %k1
+; CHECK-NEXT: vbroadcastss (%rdi), %xmm0 {%k1} {z}
+; CHECK-NEXT: retq
+ %s = load float, float* %p
+ %vec = insertelement <2 x float> undef, float %s, i32 0
+ %shuf = shufflevector <2 x float> %vec, <2 x float> undef, <4 x i32> <i32 0, i32 0, i32 0, i32 0>
+ %res = select <4 x i1> <i1 0, i1 1, i1 1, i1 1>, <4 x float> %shuf, <4 x float> zeroinitializer
+ ret <4 x float> %res
+}
+define <4 x float> @test_masked_float_to_4_mem_mask2(float* %p, <4 x float> %default) {
+; CHECK-LABEL: test_masked_float_to_4_mem_mask2:
+; CHECK: # BB#0:
+; CHECK-NEXT: movb $6, %al
+; CHECK-NEXT: kmovd %eax, %k1
+; CHECK-NEXT: vbroadcastss (%rdi), %xmm0 {%k1}
+; CHECK-NEXT: retq
+ %s = load float, float* %p
+ %vec = insertelement <2 x float> undef, float %s, i32 0
+ %shuf = shufflevector <2 x float> %vec, <2 x float> undef, <4 x i32> <i32 0, i32 0, i32 0, i32 0>
+ %res = select <4 x i1> <i1 0, i1 1, i1 1, i1 0>, <4 x float> %shuf, <4 x float> %default
+ ret <4 x float> %res
+}
+
+define <4 x float> @test_masked_z_float_to_4_mem_mask2(float* %p) {
+; CHECK-LABEL: test_masked_z_float_to_4_mem_mask2:
+; CHECK: # BB#0:
+; CHECK-NEXT: movb $6, %al
+; CHECK-NEXT: kmovd %eax, %k1
+; CHECK-NEXT: vbroadcastss (%rdi), %xmm0 {%k1} {z}
+; CHECK-NEXT: retq
+ %s = load float, float* %p
+ %vec = insertelement <2 x float> undef, float %s, i32 0
+ %shuf = shufflevector <2 x float> %vec, <2 x float> undef, <4 x i32> <i32 0, i32 0, i32 0, i32 0>
+ %res = select <4 x i1> <i1 0, i1 1, i1 1, i1 0>, <4 x float> %shuf, <4 x float> zeroinitializer
+ ret <4 x float> %res
+}
+define <4 x float> @test_masked_float_to_4_mem_mask3(float* %p, <4 x float> %default) {
+; CHECK-LABEL: test_masked_float_to_4_mem_mask3:
+; CHECK: # BB#0:
+; CHECK-NEXT: movb $10, %al
+; CHECK-NEXT: kmovd %eax, %k1
+; CHECK-NEXT: vbroadcastss (%rdi), %xmm0 {%k1}
+; CHECK-NEXT: retq
+ %s = load float, float* %p
+ %vec = insertelement <2 x float> undef, float %s, i32 0
+ %shuf = shufflevector <2 x float> %vec, <2 x float> undef, <4 x i32> <i32 0, i32 0, i32 0, i32 0>
+ %res = select <4 x i1> <i1 0, i1 1, i1 0, i1 1>, <4 x float> %shuf, <4 x float> %default
+ ret <4 x float> %res
+}
+
+define <4 x float> @test_masked_z_float_to_4_mem_mask3(float* %p) {
+; CHECK-LABEL: test_masked_z_float_to_4_mem_mask3:
+; CHECK: # BB#0:
+; CHECK-NEXT: movb $10, %al
+; CHECK-NEXT: kmovd %eax, %k1
+; CHECK-NEXT: vbroadcastss (%rdi), %xmm0 {%k1} {z}
+; CHECK-NEXT: retq
+ %s = load float, float* %p
+ %vec = insertelement <2 x float> undef, float %s, i32 0
+ %shuf = shufflevector <2 x float> %vec, <2 x float> undef, <4 x i32> <i32 0, i32 0, i32 0, i32 0>
+ %res = select <4 x i1> <i1 0, i1 1, i1 0, i1 1>, <4 x float> %shuf, <4 x float> zeroinitializer
+ ret <4 x float> %res
+}
+define <8 x float> @test_float_to_8_mem(float* %p) {
+; CHECK-LABEL: test_float_to_8_mem:
+; CHECK: # BB#0:
+; CHECK-NEXT: vbroadcastss (%rdi), %ymm0
+; CHECK-NEXT: retq
+ %s = load float, float* %p
+ %vec = insertelement <2 x float> undef, float %s, i32 0
+ %res = shufflevector <2 x float> %vec, <2 x float> undef, <8 x i32> <i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0>
+ ret <8 x float> %res
+}
+define <8 x float> @test_masked_float_to_8_mem_mask0(float* %p, <8 x float> %default) {
+; CHECK-LABEL: test_masked_float_to_8_mem_mask0:
+; CHECK: # BB#0:
+; CHECK-NEXT: movb $67, %al
+; CHECK-NEXT: kmovd %eax, %k1
+; CHECK-NEXT: vbroadcastss (%rdi), %ymm0 {%k1}
+; CHECK-NEXT: retq
+ %s = load float, float* %p
+ %vec = insertelement <2 x float> undef, float %s, i32 0
+ %shuf = shufflevector <2 x float> %vec, <2 x float> undef, <8 x i32> <i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0>
+ %res = select <8 x i1> <i1 1, i1 1, i1 0, i1 0, i1 0, i1 0, i1 1, i1 0>, <8 x float> %shuf, <8 x float> %default
+ ret <8 x float> %res
+}
+
+define <8 x float> @test_masked_z_float_to_8_mem_mask0(float* %p) {
+; CHECK-LABEL: test_masked_z_float_to_8_mem_mask0:
+; CHECK: # BB#0:
+; CHECK-NEXT: movb $67, %al
+; CHECK-NEXT: kmovd %eax, %k1
+; CHECK-NEXT: vbroadcastss (%rdi), %ymm0 {%k1} {z}
+; CHECK-NEXT: retq
+ %s = load float, float* %p
+ %vec = insertelement <2 x float> undef, float %s, i32 0
+ %shuf = shufflevector <2 x float> %vec, <2 x float> undef, <8 x i32> <i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0>
+ %res = select <8 x i1> <i1 1, i1 1, i1 0, i1 0, i1 0, i1 0, i1 1, i1 0>, <8 x float> %shuf, <8 x float> zeroinitializer
+ ret <8 x float> %res
+}
+define <8 x float> @test_masked_float_to_8_mem_mask1(float* %p, <8 x float> %default) {
+; CHECK-LABEL: test_masked_float_to_8_mem_mask1:
+; CHECK: # BB#0:
+; CHECK-NEXT: movb $-51, %al
+; CHECK-NEXT: kmovd %eax, %k1
+; CHECK-NEXT: vbroadcastss (%rdi), %ymm0 {%k1}
+; CHECK-NEXT: retq
+ %s = load float, float* %p
+ %vec = insertelement <2 x float> undef, float %s, i32 0
+ %shuf = shufflevector <2 x float> %vec, <2 x float> undef, <8 x i32> <i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0>
+ %res = select <8 x i1> <i1 1, i1 0, i1 1, i1 1, i1 0, i1 0, i1 1, i1 1>, <8 x float> %shuf, <8 x float> %default
+ ret <8 x float> %res
+}
+
+define <8 x float> @test_masked_z_float_to_8_mem_mask1(float* %p) {
+; CHECK-LABEL: test_masked_z_float_to_8_mem_mask1:
+; CHECK: # BB#0:
+; CHECK-NEXT: movb $-51, %al
+; CHECK-NEXT: kmovd %eax, %k1
+; CHECK-NEXT: vbroadcastss (%rdi), %ymm0 {%k1} {z}
+; CHECK-NEXT: retq
+ %s = load float, float* %p
+ %vec = insertelement <2 x float> undef, float %s, i32 0
+ %shuf = shufflevector <2 x float> %vec, <2 x float> undef, <8 x i32> <i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0>
+ %res = select <8 x i1> <i1 1, i1 0, i1 1, i1 1, i1 0, i1 0, i1 1, i1 1>, <8 x float> %shuf, <8 x float> zeroinitializer
+ ret <8 x float> %res
+}
+define <8 x float> @test_masked_float_to_8_mem_mask2(float* %p, <8 x float> %default) {
+; CHECK-LABEL: test_masked_float_to_8_mem_mask2:
+; CHECK: # BB#0:
+; CHECK-NEXT: movb $-116, %al
+; CHECK-NEXT: kmovd %eax, %k1
+; CHECK-NEXT: vbroadcastss (%rdi), %ymm0 {%k1}
+; CHECK-NEXT: retq
+ %s = load float, float* %p
+ %vec = insertelement <2 x float> undef, float %s, i32 0
+ %shuf = shufflevector <2 x float> %vec, <2 x float> undef, <8 x i32> <i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0>
+ %res = select <8 x i1> <i1 0, i1 0, i1 1, i1 1, i1 0, i1 0, i1 0, i1 1>, <8 x float> %shuf, <8 x float> %default
+ ret <8 x float> %res
+}
+
+define <8 x float> @test_masked_z_float_to_8_mem_mask2(float* %p) {
+; CHECK-LABEL: test_masked_z_float_to_8_mem_mask2:
+; CHECK: # BB#0:
+; CHECK-NEXT: movb $-116, %al
+; CHECK-NEXT: kmovd %eax, %k1
+; CHECK-NEXT: vbroadcastss (%rdi), %ymm0 {%k1} {z}
+; CHECK-NEXT: retq
+ %s = load float, float* %p
+ %vec = insertelement <2 x float> undef, float %s, i32 0
+ %shuf = shufflevector <2 x float> %vec, <2 x float> undef, <8 x i32> <i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0>
+ %res = select <8 x i1> <i1 0, i1 0, i1 1, i1 1, i1 0, i1 0, i1 0, i1 1>, <8 x float> %shuf, <8 x float> zeroinitializer
+ ret <8 x float> %res
+}
+define <8 x float> @test_masked_float_to_8_mem_mask3(float* %p, <8 x float> %default) {
+; CHECK-LABEL: test_masked_float_to_8_mem_mask3:
+; CHECK: # BB#0:
+; CHECK-NEXT: movb $4, %al
+; CHECK-NEXT: kmovd %eax, %k1
+; CHECK-NEXT: vbroadcastss (%rdi), %ymm0 {%k1}
+; CHECK-NEXT: retq
+ %s = load float, float* %p
+ %vec = insertelement <2 x float> undef, float %s, i32 0
+ %shuf = shufflevector <2 x float> %vec, <2 x float> undef, <8 x i32> <i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0>
+ %res = select <8 x i1> <i1 0, i1 0, i1 1, i1 0, i1 0, i1 0, i1 0, i1 0>, <8 x float> %shuf, <8 x float> %default
+ ret <8 x float> %res
+}
+
+define <8 x float> @test_masked_z_float_to_8_mem_mask3(float* %p) {
+; CHECK-LABEL: test_masked_z_float_to_8_mem_mask3:
+; CHECK: # BB#0:
+; CHECK-NEXT: movb $4, %al
+; CHECK-NEXT: kmovd %eax, %k1
+; CHECK-NEXT: vbroadcastss (%rdi), %ymm0 {%k1} {z}
+; CHECK-NEXT: retq
+ %s = load float, float* %p
+ %vec = insertelement <2 x float> undef, float %s, i32 0
+ %shuf = shufflevector <2 x float> %vec, <2 x float> undef, <8 x i32> <i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0>
+ %res = select <8 x i1> <i1 0, i1 0, i1 1, i1 0, i1 0, i1 0, i1 0, i1 0>, <8 x float> %shuf, <8 x float> zeroinitializer
+ ret <8 x float> %res
+}
+define <16 x float> @test_float_to_16_mem(float* %p) {
+; CHECK-LABEL: test_float_to_16_mem:
+; CHECK: # BB#0:
+; CHECK-NEXT: vbroadcastss (%rdi), %zmm0
+; CHECK-NEXT: retq
+ %s = load float, float* %p
+ %vec = insertelement <2 x float> undef, float %s, i32 0
+ %res = shufflevector <2 x float> %vec, <2 x float> undef, <16 x i32> <i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0>
+ ret <16 x float> %res
+}
+define <16 x float> @test_masked_float_to_16_mem_mask0(float* %p, <16 x float> %default) {
+; CHECK-LABEL: test_masked_float_to_16_mem_mask0:
+; CHECK: # BB#0:
+; CHECK-NEXT: movw $-18370, %ax # imm = 0xB83E
+; CHECK-NEXT: kmovd %eax, %k1
+; CHECK-NEXT: vbroadcastss (%rdi), %zmm0 {%k1}
+; CHECK-NEXT: retq
+ %s = load float, float* %p
+ %vec = insertelement <2 x float> undef, float %s, i32 0
+ %shuf = shufflevector <2 x float> %vec, <2 x float> undef, <16 x i32> <i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0>
+ %res = select <16 x i1> <i1 0, i1 1, i1 1, i1 1, i1 1, i1 1, i1 0, i1 0, i1 0, i1 0, i1 0, i1 1, i1 1, i1 1, i1 0, i1 1>, <16 x float> %shuf, <16 x float> %default
+ ret <16 x float> %res
+}
+
+define <16 x float> @test_masked_z_float_to_16_mem_mask0(float* %p) {
+; CHECK-LABEL: test_masked_z_float_to_16_mem_mask0:
+; CHECK: # BB#0:
+; CHECK-NEXT: movw $-18370, %ax # imm = 0xB83E
+; CHECK-NEXT: kmovd %eax, %k1
+; CHECK-NEXT: vbroadcastss (%rdi), %zmm0 {%k1} {z}
+; CHECK-NEXT: retq
+ %s = load float, float* %p
+ %vec = insertelement <2 x float> undef, float %s, i32 0
+ %shuf = shufflevector <2 x float> %vec, <2 x float> undef, <16 x i32> <i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0>
+ %res = select <16 x i1> <i1 0, i1 1, i1 1, i1 1, i1 1, i1 1, i1 0, i1 0, i1 0, i1 0, i1 0, i1 1, i1 1, i1 1, i1 0, i1 1>, <16 x float> %shuf, <16 x float> zeroinitializer
+ ret <16 x float> %res
+}
+define <16 x float> @test_masked_float_to_16_mem_mask1(float* %p, <16 x float> %default) {
+; CHECK-LABEL: test_masked_float_to_16_mem_mask1:
+; CHECK: # BB#0:
+; CHECK-NEXT: movw $26137, %ax # imm = 0x6619
+; CHECK-NEXT: kmovd %eax, %k1
+; CHECK-NEXT: vbroadcastss (%rdi), %zmm0 {%k1}
+; CHECK-NEXT: retq
+ %s = load float, float* %p
+ %vec = insertelement <2 x float> undef, float %s, i32 0
+ %shuf = shufflevector <2 x float> %vec, <2 x float> undef, <16 x i32> <i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0>
+ %res = select <16 x i1> <i1 1, i1 0, i1 0, i1 1, i1 1, i1 0, i1 0, i1 0, i1 0, i1 1, i1 1, i1 0, i1 0, i1 1, i1 1, i1 0>, <16 x float> %shuf, <16 x float> %default
+ ret <16 x float> %res
+}
+
+define <16 x float> @test_masked_z_float_to_16_mem_mask1(float* %p) {
+; CHECK-LABEL: test_masked_z_float_to_16_mem_mask1:
+; CHECK: # BB#0:
+; CHECK-NEXT: movw $26137, %ax # imm = 0x6619
+; CHECK-NEXT: kmovd %eax, %k1
+; CHECK-NEXT: vbroadcastss (%rdi), %zmm0 {%k1} {z}
+; CHECK-NEXT: retq
+ %s = load float, float* %p
+ %vec = insertelement <2 x float> undef, float %s, i32 0
+ %shuf = shufflevector <2 x float> %vec, <2 x float> undef, <16 x i32> <i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0>
+ %res = select <16 x i1> <i1 1, i1 0, i1 0, i1 1, i1 1, i1 0, i1 0, i1 0, i1 0, i1 1, i1 1, i1 0, i1 0, i1 1, i1 1, i1 0>, <16 x float> %shuf, <16 x float> zeroinitializer
+ ret <16 x float> %res
+}
+define <16 x float> @test_masked_float_to_16_mem_mask2(float* %p, <16 x float> %default) {
+; CHECK-LABEL: test_masked_float_to_16_mem_mask2:
+; CHECK: # BB#0:
+; CHECK-NEXT: movw $-11480, %ax # imm = 0xD328
+; CHECK-NEXT: kmovd %eax, %k1
+; CHECK-NEXT: vbroadcastss (%rdi), %zmm0 {%k1}
+; CHECK-NEXT: retq
+ %s = load float, float* %p
+ %vec = insertelement <2 x float> undef, float %s, i32 0
+ %shuf = shufflevector <2 x float> %vec, <2 x float> undef, <16 x i32> <i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0>
+ %res = select <16 x i1> <i1 0, i1 0, i1 0, i1 1, i1 0, i1 1, i1 0, i1 0, i1 1, i1 1, i1 0, i1 0, i1 1, i1 0, i1 1, i1 1>, <16 x float> %shuf, <16 x float> %default
+ ret <16 x float> %res
+}
+
+define <16 x float> @test_masked_z_float_to_16_mem_mask2(float* %p) {
+; CHECK-LABEL: test_masked_z_float_to_16_mem_mask2:
+; CHECK: # BB#0:
+; CHECK-NEXT: movw $-11480, %ax # imm = 0xD328
+; CHECK-NEXT: kmovd %eax, %k1
+; CHECK-NEXT: vbroadcastss (%rdi), %zmm0 {%k1} {z}
+; CHECK-NEXT: retq
+ %s = load float, float* %p
+ %vec = insertelement <2 x float> undef, float %s, i32 0
+ %shuf = shufflevector <2 x float> %vec, <2 x float> undef, <16 x i32> <i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0>
+ %res = select <16 x i1> <i1 0, i1 0, i1 0, i1 1, i1 0, i1 1, i1 0, i1 0, i1 1, i1 1, i1 0, i1 0, i1 1, i1 0, i1 1, i1 1>, <16 x float> %shuf, <16 x float> zeroinitializer
+ ret <16 x float> %res
+}
+define <16 x float> @test_masked_float_to_16_mem_mask3(float* %p, <16 x float> %default) {
+; CHECK-LABEL: test_masked_float_to_16_mem_mask3:
+; CHECK: # BB#0:
+; CHECK-NEXT: movw $-21749, %ax # imm = 0xAB0B
+; CHECK-NEXT: kmovd %eax, %k1
+; CHECK-NEXT: vbroadcastss (%rdi), %zmm0 {%k1}
+; CHECK-NEXT: retq
+ %s = load float, float* %p
+ %vec = insertelement <2 x float> undef, float %s, i32 0
+ %shuf = shufflevector <2 x float> %vec, <2 x float> undef, <16 x i32> <i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0>
+ %res = select <16 x i1> <i1 1, i1 1, i1 0, i1 1, i1 0, i1 0, i1 0, i1 0, i1 1, i1 1, i1 0, i1 1, i1 0, i1 1, i1 0, i1 1>, <16 x float> %shuf, <16 x float> %default
+ ret <16 x float> %res
+}
+
+define <16 x float> @test_masked_z_float_to_16_mem_mask3(float* %p) {
+; CHECK-LABEL: test_masked_z_float_to_16_mem_mask3:
+; CHECK: # BB#0:
+; CHECK-NEXT: movw $-21749, %ax # imm = 0xAB0B
+; CHECK-NEXT: kmovd %eax, %k1
+; CHECK-NEXT: vbroadcastss (%rdi), %zmm0 {%k1} {z}
+; CHECK-NEXT: retq
+ %s = load float, float* %p
+ %vec = insertelement <2 x float> undef, float %s, i32 0
+ %shuf = shufflevector <2 x float> %vec, <2 x float> undef, <16 x i32> <i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0>
+ %res = select <16 x i1> <i1 1, i1 1, i1 0, i1 1, i1 0, i1 0, i1 0, i1 0, i1 1, i1 1, i1 0, i1 1, i1 0, i1 1, i1 0, i1 1>, <16 x float> %shuf, <16 x float> zeroinitializer
+ ret <16 x float> %res
+}
OpenPOWER on IntegriCloud