196 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py2; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu -mattr=+avx512f -mattr=+avx512vl| FileCheck %s3 4declare void @func_f32(float)5define <8 x float> @_256_broadcast_ss_spill(float %x) {6; CHECK-LABEL: _256_broadcast_ss_spill:7; CHECK: # %bb.0:8; CHECK-NEXT: subq $24, %rsp9; CHECK-NEXT: .cfi_def_cfa_offset 3210; CHECK-NEXT: vaddss %xmm0, %xmm0, %xmm011; CHECK-NEXT: vmovaps %xmm0, (%rsp) # 16-byte Spill12; CHECK-NEXT: callq func_f32@PLT13; CHECK-NEXT: vbroadcastss (%rsp), %ymm0 # 16-byte Folded Reload14; CHECK-NEXT: addq $24, %rsp15; CHECK-NEXT: .cfi_def_cfa_offset 816; CHECK-NEXT: retq17 %a = fadd float %x, %x18 call void @func_f32(float %a)19 %b = insertelement <8 x float> undef, float %a, i32 020 %c = shufflevector <8 x float> %b, <8 x float> undef, <8 x i32> zeroinitializer21 ret <8 x float> %c22}23 24define <4 x float> @_128_broadcast_ss_spill(float %x) {25; CHECK-LABEL: _128_broadcast_ss_spill:26; CHECK: # %bb.0:27; CHECK-NEXT: subq $24, %rsp28; CHECK-NEXT: .cfi_def_cfa_offset 3229; CHECK-NEXT: vaddss %xmm0, %xmm0, %xmm030; CHECK-NEXT: vmovaps %xmm0, (%rsp) # 16-byte Spill31; CHECK-NEXT: callq func_f32@PLT32; CHECK-NEXT: vbroadcastss (%rsp), %xmm0 # 16-byte Folded Reload33; CHECK-NEXT: addq $24, %rsp34; CHECK-NEXT: .cfi_def_cfa_offset 835; CHECK-NEXT: retq36 %a = fadd float %x, %x37 call void @func_f32(float %a)38 %b = insertelement <4 x float> undef, float %a, i32 039 %c = shufflevector <4 x float> %b, <4 x float> undef, <4 x i32> zeroinitializer40 ret <4 x float> %c41}42 43declare void @func_f64(double)44define <4 x double> @_256_broadcast_sd_spill(double %x) {45; CHECK-LABEL: _256_broadcast_sd_spill:46; CHECK: # %bb.0:47; CHECK-NEXT: subq $24, %rsp48; CHECK-NEXT: .cfi_def_cfa_offset 3249; CHECK-NEXT: vaddsd %xmm0, %xmm0, %xmm050; CHECK-NEXT: vmovapd %xmm0, (%rsp) # 16-byte Spill51; CHECK-NEXT: callq func_f64@PLT52; CHECK-NEXT: vbroadcastsd (%rsp), %ymm0 # 16-byte Folded Reload53; CHECK-NEXT: addq $24, %rsp54; CHECK-NEXT: .cfi_def_cfa_offset 855; CHECK-NEXT: retq56 %a = fadd double %x, %x57 call void @func_f64(double %a)58 %b = insertelement <4 x double> undef, double %a, i32 059 %c = shufflevector <4 x double> %b, <4 x double> undef, <4 x i32> zeroinitializer60 ret <4 x double> %c61}62 63define <8 x float> @_inreg8xfloat(float %a) {64; CHECK-LABEL: _inreg8xfloat:65; CHECK: # %bb.0:66; CHECK-NEXT: vbroadcastss %xmm0, %ymm067; CHECK-NEXT: retq68 %b = insertelement <8 x float> undef, float %a, i32 069 %c = shufflevector <8 x float> %b, <8 x float> undef, <8 x i32> zeroinitializer70 ret <8 x float> %c71}72 73define <8 x float> @_ss8xfloat_mask(<8 x float> %i, float %a, <8 x i32> %mask1) {74; CHECK-LABEL: _ss8xfloat_mask:75; CHECK: # %bb.0:76; CHECK-NEXT: vptestmd %ymm2, %ymm2, %k177; CHECK-NEXT: vbroadcastss %xmm1, %ymm0 {%k1}78; CHECK-NEXT: retq79 %mask = icmp ne <8 x i32> %mask1, zeroinitializer80 %b = insertelement <8 x float> undef, float %a, i32 081 %c = shufflevector <8 x float> %b, <8 x float> undef, <8 x i32> zeroinitializer82 %r = select <8 x i1> %mask, <8 x float> %c, <8 x float> %i83 ret <8 x float> %r84}85 86define <8 x float> @_ss8xfloat_maskz(float %a, <8 x i32> %mask1) {87; CHECK-LABEL: _ss8xfloat_maskz:88; CHECK: # %bb.0:89; CHECK-NEXT: vptestmd %ymm1, %ymm1, %k190; CHECK-NEXT: vbroadcastss %xmm0, %ymm0 {%k1} {z}91; CHECK-NEXT: retq92 %mask = icmp ne <8 x i32> %mask1, zeroinitializer93 %b = insertelement <8 x float> undef, float %a, i32 094 %c = shufflevector <8 x float> %b, <8 x float> undef, <8 x i32> zeroinitializer95 %r = select <8 x i1> %mask, <8 x float> %c, <8 x float> zeroinitializer96 ret <8 x float> %r97}98 99define <4 x float> @_inreg4xfloat(float %a) {100; CHECK-LABEL: _inreg4xfloat:101; CHECK: # %bb.0:102; CHECK-NEXT: vbroadcastss %xmm0, %xmm0103; CHECK-NEXT: retq104 %b = insertelement <4 x float> undef, float %a, i32 0105 %c = shufflevector <4 x float> %b, <4 x float> undef, <4 x i32> zeroinitializer106 ret <4 x float> %c107}108 109define <4 x float> @_ss4xfloat_mask(<4 x float> %i, float %a, <4 x i32> %mask1) {110; CHECK-LABEL: _ss4xfloat_mask:111; CHECK: # %bb.0:112; CHECK-NEXT: vptestmd %xmm2, %xmm2, %k1113; CHECK-NEXT: vbroadcastss %xmm1, %xmm0 {%k1}114; CHECK-NEXT: retq115 %mask = icmp ne <4 x i32> %mask1, zeroinitializer116 %b = insertelement <4 x float> undef, float %a, i32 0117 %c = shufflevector <4 x float> %b, <4 x float> undef, <4 x i32> zeroinitializer118 %r = select <4 x i1> %mask, <4 x float> %c, <4 x float> %i119 ret <4 x float> %r120}121 122define <4 x float> @_ss4xfloat_maskz(float %a, <4 x i32> %mask1) {123; CHECK-LABEL: _ss4xfloat_maskz:124; CHECK: # %bb.0:125; CHECK-NEXT: vptestmd %xmm1, %xmm1, %k1126; CHECK-NEXT: vbroadcastss %xmm0, %xmm0 {%k1} {z}127; CHECK-NEXT: retq128 %mask = icmp ne <4 x i32> %mask1, zeroinitializer129 %b = insertelement <4 x float> undef, float %a, i32 0130 %c = shufflevector <4 x float> %b, <4 x float> undef, <4 x i32> zeroinitializer131 %r = select <4 x i1> %mask, <4 x float> %c, <4 x float> zeroinitializer132 ret <4 x float> %r133}134 135define <4 x double> @_inreg4xdouble(double %a) {136; CHECK-LABEL: _inreg4xdouble:137; CHECK: # %bb.0:138; CHECK-NEXT: vbroadcastsd %xmm0, %ymm0139; CHECK-NEXT: retq140 %b = insertelement <4 x double> undef, double %a, i32 0141 %c = shufflevector <4 x double> %b, <4 x double> undef, <4 x i32> zeroinitializer142 ret <4 x double> %c143}144 145define <4 x double> @_ss4xdouble_mask(<4 x double> %i, double %a, <4 x i32> %mask1) {146; CHECK-LABEL: _ss4xdouble_mask:147; CHECK: # %bb.0:148; CHECK-NEXT: vptestmd %xmm2, %xmm2, %k1149; CHECK-NEXT: vbroadcastsd %xmm1, %ymm0 {%k1}150; CHECK-NEXT: retq151 %mask = icmp ne <4 x i32> %mask1, zeroinitializer152 %b = insertelement <4 x double> undef, double %a, i32 0153 %c = shufflevector <4 x double> %b, <4 x double> undef, <4 x i32> zeroinitializer154 %r = select <4 x i1> %mask, <4 x double> %c, <4 x double> %i155 ret <4 x double> %r156}157 158define <4 x double> @_ss4xdouble_maskz(double %a, <4 x i32> %mask1) {159; CHECK-LABEL: _ss4xdouble_maskz:160; CHECK: # %bb.0:161; CHECK-NEXT: vptestmd %xmm1, %xmm1, %k1162; CHECK-NEXT: vbroadcastsd %xmm0, %ymm0 {%k1} {z}163; CHECK-NEXT: retq164 %mask = icmp ne <4 x i32> %mask1, zeroinitializer165 %b = insertelement <4 x double> undef, double %a, i32 0166 %c = shufflevector <4 x double> %b, <4 x double> undef, <4 x i32> zeroinitializer167 %r = select <4 x i1> %mask, <4 x double> %c, <4 x double> zeroinitializer168 ret <4 x double> %r169}170 171define <2 x double> @test_v2f64_broadcast_fold(ptr%a0, <2 x double> %a1) {172; CHECK-LABEL: test_v2f64_broadcast_fold:173; CHECK: # %bb.0:174; CHECK-NEXT: vaddpd (%rdi){1to2}, %xmm0, %xmm0175; CHECK-NEXT: retq176 %1 = load <2 x double>, ptr%a0, align 16177 %2 = shufflevector <2 x double> %1, <2 x double> undef, <2 x i32> zeroinitializer178 %3 = fadd <2 x double> %2, %a1179 ret <2 x double> %3180}181 182define <2 x double> @test_v2f64_broadcast_fold_mask(ptr%a0, <2 x double> %a1, <2 x i64> %mask1, <2 x double> %a2) {183; CHECK-LABEL: test_v2f64_broadcast_fold_mask:184; CHECK: # %bb.0:185; CHECK-NEXT: vptestmq %xmm1, %xmm1, %k1186; CHECK-NEXT: vaddpd (%rdi){1to2}, %xmm0, %xmm2 {%k1}187; CHECK-NEXT: vmovapd %xmm2, %xmm0188; CHECK-NEXT: retq189 %mask = icmp ne <2 x i64> %mask1, zeroinitializer190 %1 = load <2 x double>, ptr%a0, align 16191 %2 = shufflevector <2 x double> %1, <2 x double> undef, <2 x i32> zeroinitializer192 %3 = fadd <2 x double> %2, %a1193 %4 = select <2 x i1> %mask, <2 x double> %3, <2 x double> %a2194 ret <2 x double> %4195}196