diff --git a/test/CodeGen/X86/avx512vl-intrinsics-fast-isel.ll b/test/CodeGen/X86/avx512vl-intrinsics-fast-isel.ll index 4f1affb94e61..af0529fe41ba 100644 --- a/test/CodeGen/X86/avx512vl-intrinsics-fast-isel.ll +++ b/test/CodeGen/X86/avx512vl-intrinsics-fast-isel.ll @@ -4282,6 +4282,28 @@ entry: ret <2 x double> %2 } +define <2 x double> @test_mm_mask_fmsub_pd_unary_fneg(<2 x double> %__A, i8 zeroext %__U, <2 x double> %__B, <2 x double> %__C) { +; X86-LABEL: test_mm_mask_fmsub_pd_unary_fneg: +; X86: # %bb.0: # %entry +; X86-NEXT: movb {{[0-9]+}}(%esp), %al +; X86-NEXT: kmovw %eax, %k1 +; X86-NEXT: vfmsub132pd {{.*#+}} xmm0 = (xmm0 * xmm1) - xmm2 +; X86-NEXT: retl +; +; X64-LABEL: test_mm_mask_fmsub_pd_unary_fneg: +; X64: # %bb.0: # %entry +; X64-NEXT: kmovw %edi, %k1 +; X64-NEXT: vfmsub132pd {{.*#+}} xmm0 = (xmm0 * xmm1) - xmm2 +; X64-NEXT: retq +entry: + %neg.i = fneg <2 x double> %__C + %0 = tail call <2 x double> @llvm.fma.v2f64(<2 x double> %__A, <2 x double> %__B, <2 x double> %neg.i) #9 + %1 = bitcast i8 %__U to <8 x i1> + %extract.i = shufflevector <8 x i1> %1, <8 x i1> undef, <2 x i32> + %2 = select <2 x i1> %extract.i, <2 x double> %0, <2 x double> %__A + ret <2 x double> %2 +} + define <2 x double> @test_mm_mask3_fmadd_pd(<2 x double> %__A, <2 x double> %__B, <2 x double> %__C, i8 zeroext %__U) { ; X86-LABEL: test_mm_mask3_fmadd_pd: ; X86: # %bb.0: # %entry @@ -4329,6 +4351,30 @@ entry: ret <2 x double> %2 } +define <2 x double> @test_mm_mask3_fnmadd_pd_unary_fneg(<2 x double> %__A, <2 x double> %__B, <2 x double> %__C, i8 zeroext %__U) { +; X86-LABEL: test_mm_mask3_fnmadd_pd_unary_fneg: +; X86: # %bb.0: # %entry +; X86-NEXT: movb {{[0-9]+}}(%esp), %al +; X86-NEXT: kmovw %eax, %k1 +; X86-NEXT: vfnmadd231pd {{.*#+}} xmm2 = -(xmm0 * xmm1) + xmm2 +; X86-NEXT: vmovapd %xmm2, %xmm0 +; X86-NEXT: retl +; +; X64-LABEL: test_mm_mask3_fnmadd_pd_unary_fneg: +; X64: # %bb.0: # %entry +; X64-NEXT: kmovw %edi, %k1 +; X64-NEXT: vfnmadd231pd {{.*#+}} xmm2 = -(xmm0 * xmm1) + xmm2 +; X64-NEXT: vmovapd %xmm2, %xmm0 +; X64-NEXT: retq +entry: + %neg.i = fneg <2 x double> %__A + %0 = tail call <2 x double> @llvm.fma.v2f64(<2 x double> %neg.i, <2 x double> %__B, <2 x double> %__C) #9 + %1 = bitcast i8 %__U to <8 x i1> + %extract.i = shufflevector <8 x i1> %1, <8 x i1> undef, <2 x i32> + %2 = select <2 x i1> %extract.i, <2 x double> %0, <2 x double> %__C + ret <2 x double> %2 +} + define <2 x double> @test_mm_maskz_fmadd_pd(i8 zeroext %__U, <2 x double> %__A, <2 x double> %__B, <2 x double> %__C) { ; X86-LABEL: test_mm_maskz_fmadd_pd: ; X86: # %bb.0: # %entry @@ -4372,6 +4418,28 @@ entry: ret <2 x double> %2 } +define <2 x double> @test_mm_maskz_fmsub_pd_unary_fneg(i8 zeroext %__U, <2 x double> %__A, <2 x double> %__B, <2 x double> %__C) { +; X86-LABEL: test_mm_maskz_fmsub_pd_unary_fneg: +; X86: # %bb.0: # %entry +; X86-NEXT: movb {{[0-9]+}}(%esp), %al +; X86-NEXT: kmovw %eax, %k1 +; X86-NEXT: vfmsub213pd {{.*#+}} xmm0 = (xmm1 * xmm0) - xmm2 +; X86-NEXT: retl +; +; X64-LABEL: test_mm_maskz_fmsub_pd_unary_fneg: +; X64: # %bb.0: # %entry +; X64-NEXT: kmovw %edi, %k1 +; X64-NEXT: vfmsub213pd {{.*#+}} xmm0 = (xmm1 * xmm0) - xmm2 +; X64-NEXT: retq +entry: + %neg.i = fneg <2 x double> %__C + %0 = tail call <2 x double> @llvm.fma.v2f64(<2 x double> %__A, <2 x double> %__B, <2 x double> %neg.i) #9 + %1 = bitcast i8 %__U to <8 x i1> + %extract.i = shufflevector <8 x i1> %1, <8 x i1> undef, <2 x i32> + %2 = select <2 x i1> %extract.i, <2 x double> %0, <2 x double> zeroinitializer + ret <2 x double> %2 +} + define <2 x double> @test_mm_maskz_fnmadd_pd(i8 zeroext %__U, <2 x double> %__A, <2 x double> %__B, <2 x double> %__C) { ; X86-LABEL: test_mm_maskz_fnmadd_pd: ; X86: # %bb.0: # %entry @@ -4394,6 +4462,28 @@ entry: ret <2 x double> %2 } +define <2 x double> @test_mm_maskz_fnmadd_pd_unary_fneg(i8 zeroext %__U, <2 x double> %__A, <2 x double> %__B, <2 x double> %__C) { +; X86-LABEL: test_mm_maskz_fnmadd_pd_unary_fneg: +; X86: # %bb.0: # %entry +; X86-NEXT: movb {{[0-9]+}}(%esp), %al +; X86-NEXT: kmovw %eax, %k1 +; X86-NEXT: vfnmadd213pd {{.*#+}} xmm0 = -(xmm1 * xmm0) + xmm2 +; X86-NEXT: retl +; +; X64-LABEL: test_mm_maskz_fnmadd_pd_unary_fneg: +; X64: # %bb.0: # %entry +; X64-NEXT: kmovw %edi, %k1 +; X64-NEXT: vfnmadd213pd {{.*#+}} xmm0 = -(xmm1 * xmm0) + xmm2 +; X64-NEXT: retq +entry: + %neg.i = fneg <2 x double> %__A + %0 = tail call <2 x double> @llvm.fma.v2f64(<2 x double> %neg.i, <2 x double> %__B, <2 x double> %__C) #9 + %1 = bitcast i8 %__U to <8 x i1> + %extract.i = shufflevector <8 x i1> %1, <8 x i1> undef, <2 x i32> + %2 = select <2 x i1> %extract.i, <2 x double> %0, <2 x double> zeroinitializer + ret <2 x double> %2 +} + define <2 x double> @test_mm_maskz_fnmsub_pd(i8 zeroext %__U, <2 x double> %__A, <2 x double> %__B, <2 x double> %__C) { ; X86-LABEL: test_mm_maskz_fnmsub_pd: ; X86: # %bb.0: # %entry @@ -4417,6 +4507,29 @@ entry: ret <2 x double> %2 } +define <2 x double> @test_mm_maskz_fnmsub_pd_unary_fneg(i8 zeroext %__U, <2 x double> %__A, <2 x double> %__B, <2 x double> %__C) { +; X86-LABEL: test_mm_maskz_fnmsub_pd_unary_fneg: +; X86: # %bb.0: # %entry +; X86-NEXT: movb {{[0-9]+}}(%esp), %al +; X86-NEXT: kmovw %eax, %k1 +; X86-NEXT: vfnmsub213pd {{.*#+}} xmm0 = -(xmm1 * xmm0) - xmm2 +; X86-NEXT: retl +; +; X64-LABEL: test_mm_maskz_fnmsub_pd_unary_fneg: +; X64: # %bb.0: # %entry +; X64-NEXT: kmovw %edi, %k1 +; X64-NEXT: vfnmsub213pd {{.*#+}} xmm0 = -(xmm1 * xmm0) - xmm2 +; X64-NEXT: retq +entry: + %neg.i = fneg <2 x double> %__A + %neg1.i = fneg <2 x double> %__C + %0 = tail call <2 x double> @llvm.fma.v2f64(<2 x double> %neg.i, <2 x double> %__B, <2 x double> %neg1.i) #9 + %1 = bitcast i8 %__U to <8 x i1> + %extract.i = shufflevector <8 x i1> %1, <8 x i1> undef, <2 x i32> + %2 = select <2 x i1> %extract.i, <2 x double> %0, <2 x double> zeroinitializer + ret <2 x double> %2 +} + define <4 x double> @test_mm256_mask_fmadd_pd(<4 x double> %__A, i8 zeroext %__U, <4 x double> %__B, <4 x double> %__C) { ; X86-LABEL: test_mm256_mask_fmadd_pd: ; X86: # %bb.0: # %entry @@ -4460,6 +4573,28 @@ entry: ret <4 x double> %2 } +define <4 x double> @test_mm256_mask_fmsub_pd_unary_fneg(<4 x double> %__A, i8 zeroext %__U, <4 x double> %__B, <4 x double> %__C) { +; X86-LABEL: test_mm256_mask_fmsub_pd_unary_fneg: +; X86: # %bb.0: # %entry +; X86-NEXT: movb {{[0-9]+}}(%esp), %al +; X86-NEXT: kmovw %eax, %k1 +; X86-NEXT: vfmsub132pd {{.*#+}} ymm0 = (ymm0 * ymm1) - ymm2 +; X86-NEXT: retl +; +; X64-LABEL: test_mm256_mask_fmsub_pd_unary_fneg: +; X64: # %bb.0: # %entry +; X64-NEXT: kmovw %edi, %k1 +; X64-NEXT: vfmsub132pd {{.*#+}} ymm0 = (ymm0 * ymm1) - ymm2 +; X64-NEXT: retq +entry: + %neg.i = fneg <4 x double> %__C + %0 = tail call <4 x double> @llvm.fma.v4f64(<4 x double> %__A, <4 x double> %__B, <4 x double> %neg.i) #9 + %1 = bitcast i8 %__U to <8 x i1> + %extract.i = shufflevector <8 x i1> %1, <8 x i1> undef, <4 x i32> + %2 = select <4 x i1> %extract.i, <4 x double> %0, <4 x double> %__A + ret <4 x double> %2 +} + define <4 x double> @test_mm256_mask3_fmadd_pd(<4 x double> %__A, <4 x double> %__B, <4 x double> %__C, i8 zeroext %__U) { ; X86-LABEL: test_mm256_mask3_fmadd_pd: ; X86: # %bb.0: # %entry @@ -4507,6 +4642,30 @@ entry: ret <4 x double> %2 } +define <4 x double> @test_mm256_mask3_fnmadd_pd_unary_fneg(<4 x double> %__A, <4 x double> %__B, <4 x double> %__C, i8 zeroext %__U) { +; X86-LABEL: test_mm256_mask3_fnmadd_pd_unary_fneg: +; X86: # %bb.0: # %entry +; X86-NEXT: movb {{[0-9]+}}(%esp), %al +; X86-NEXT: kmovw %eax, %k1 +; X86-NEXT: vfnmadd231pd {{.*#+}} ymm2 = -(ymm0 * ymm1) + ymm2 +; X86-NEXT: vmovapd %ymm2, %ymm0 +; X86-NEXT: retl +; +; X64-LABEL: test_mm256_mask3_fnmadd_pd_unary_fneg: +; X64: # %bb.0: # %entry +; X64-NEXT: kmovw %edi, %k1 +; X64-NEXT: vfnmadd231pd {{.*#+}} ymm2 = -(ymm0 * ymm1) + ymm2 +; X64-NEXT: vmovapd %ymm2, %ymm0 +; X64-NEXT: retq +entry: + %neg.i = fneg <4 x double> %__A + %0 = tail call <4 x double> @llvm.fma.v4f64(<4 x double> %neg.i, <4 x double> %__B, <4 x double> %__C) #9 + %1 = bitcast i8 %__U to <8 x i1> + %extract.i = shufflevector <8 x i1> %1, <8 x i1> undef, <4 x i32> + %2 = select <4 x i1> %extract.i, <4 x double> %0, <4 x double> %__C + ret <4 x double> %2 +} + define <4 x double> @test_mm256_maskz_fmadd_pd(i8 zeroext %__U, <4 x double> %__A, <4 x double> %__B, <4 x double> %__C) { ; X86-LABEL: test_mm256_maskz_fmadd_pd: ; X86: # %bb.0: # %entry @@ -4550,6 +4709,28 @@ entry: ret <4 x double> %2 } +define <4 x double> @test_mm256_maskz_fmsub_pd_unary_fneg(i8 zeroext %__U, <4 x double> %__A, <4 x double> %__B, <4 x double> %__C) { +; X86-LABEL: test_mm256_maskz_fmsub_pd_unary_fneg: +; X86: # %bb.0: # %entry +; X86-NEXT: movb {{[0-9]+}}(%esp), %al +; X86-NEXT: kmovw %eax, %k1 +; X86-NEXT: vfmsub213pd {{.*#+}} ymm0 = (ymm1 * ymm0) - ymm2 +; X86-NEXT: retl +; +; X64-LABEL: test_mm256_maskz_fmsub_pd_unary_fneg: +; X64: # %bb.0: # %entry +; X64-NEXT: kmovw %edi, %k1 +; X64-NEXT: vfmsub213pd {{.*#+}} ymm0 = (ymm1 * ymm0) - ymm2 +; X64-NEXT: retq +entry: + %neg.i = fneg <4 x double> %__C + %0 = tail call <4 x double> @llvm.fma.v4f64(<4 x double> %__A, <4 x double> %__B, <4 x double> %neg.i) #9 + %1 = bitcast i8 %__U to <8 x i1> + %extract.i = shufflevector <8 x i1> %1, <8 x i1> undef, <4 x i32> + %2 = select <4 x i1> %extract.i, <4 x double> %0, <4 x double> zeroinitializer + ret <4 x double> %2 +} + define <4 x double> @test_mm256_maskz_fnmadd_pd(i8 zeroext %__U, <4 x double> %__A, <4 x double> %__B, <4 x double> %__C) { ; X86-LABEL: test_mm256_maskz_fnmadd_pd: ; X86: # %bb.0: # %entry @@ -4572,6 +4753,28 @@ entry: ret <4 x double> %2 } +define <4 x double> @test_mm256_maskz_fnmadd_pd_unary_fneg(i8 zeroext %__U, <4 x double> %__A, <4 x double> %__B, <4 x double> %__C) { +; X86-LABEL: test_mm256_maskz_fnmadd_pd_unary_fneg: +; X86: # %bb.0: # %entry +; X86-NEXT: movb {{[0-9]+}}(%esp), %al +; X86-NEXT: kmovw %eax, %k1 +; X86-NEXT: vfnmadd213pd {{.*#+}} ymm0 = -(ymm1 * ymm0) + ymm2 +; X86-NEXT: retl +; +; X64-LABEL: test_mm256_maskz_fnmadd_pd_unary_fneg: +; X64: # %bb.0: # %entry +; X64-NEXT: kmovw %edi, %k1 +; X64-NEXT: vfnmadd213pd {{.*#+}} ymm0 = -(ymm1 * ymm0) + ymm2 +; X64-NEXT: retq +entry: + %neg.i = fneg <4 x double> %__A + %0 = tail call <4 x double> @llvm.fma.v4f64(<4 x double> %neg.i, <4 x double> %__B, <4 x double> %__C) #9 + %1 = bitcast i8 %__U to <8 x i1> + %extract.i = shufflevector <8 x i1> %1, <8 x i1> undef, <4 x i32> + %2 = select <4 x i1> %extract.i, <4 x double> %0, <4 x double> zeroinitializer + ret <4 x double> %2 +} + define <4 x double> @test_mm256_maskz_fnmsub_pd(i8 zeroext %__U, <4 x double> %__A, <4 x double> %__B, <4 x double> %__C) { ; X86-LABEL: test_mm256_maskz_fnmsub_pd: ; X86: # %bb.0: # %entry @@ -4595,6 +4798,29 @@ entry: ret <4 x double> %2 } +define <4 x double> @test_mm256_maskz_fnmsub_pd_unary_fneg(i8 zeroext %__U, <4 x double> %__A, <4 x double> %__B, <4 x double> %__C) { +; X86-LABEL: test_mm256_maskz_fnmsub_pd_unary_fneg: +; X86: # %bb.0: # %entry +; X86-NEXT: movb {{[0-9]+}}(%esp), %al +; X86-NEXT: kmovw %eax, %k1 +; X86-NEXT: vfnmsub213pd {{.*#+}} ymm0 = -(ymm1 * ymm0) - ymm2 +; X86-NEXT: retl +; +; X64-LABEL: test_mm256_maskz_fnmsub_pd_unary_fneg: +; X64: # %bb.0: # %entry +; X64-NEXT: kmovw %edi, %k1 +; X64-NEXT: vfnmsub213pd {{.*#+}} ymm0 = -(ymm1 * ymm0) - ymm2 +; X64-NEXT: retq +entry: + %neg.i = fneg <4 x double> %__A + %neg1.i = fneg <4 x double> %__C + %0 = tail call <4 x double> @llvm.fma.v4f64(<4 x double> %neg.i, <4 x double> %__B, <4 x double> %neg1.i) #9 + %1 = bitcast i8 %__U to <8 x i1> + %extract.i = shufflevector <8 x i1> %1, <8 x i1> undef, <4 x i32> + %2 = select <4 x i1> %extract.i, <4 x double> %0, <4 x double> zeroinitializer + ret <4 x double> %2 +} + define <4 x float> @test_mm_mask_fmadd_ps(<4 x float> %__A, i8 zeroext %__U, <4 x float> %__B, <4 x float> %__C) { ; X86-LABEL: test_mm_mask_fmadd_ps: ; X86: # %bb.0: # %entry @@ -4638,6 +4864,28 @@ entry: ret <4 x float> %2 } +define <4 x float> @test_mm_mask_fmsub_ps_unary_fneg(<4 x float> %__A, i8 zeroext %__U, <4 x float> %__B, <4 x float> %__C) { +; X86-LABEL: test_mm_mask_fmsub_ps_unary_fneg: +; X86: # %bb.0: # %entry +; X86-NEXT: movb {{[0-9]+}}(%esp), %al +; X86-NEXT: kmovw %eax, %k1 +; X86-NEXT: vfmsub132ps {{.*#+}} xmm0 = (xmm0 * xmm1) - xmm2 +; X86-NEXT: retl +; +; X64-LABEL: test_mm_mask_fmsub_ps_unary_fneg: +; X64: # %bb.0: # %entry +; X64-NEXT: kmovw %edi, %k1 +; X64-NEXT: vfmsub132ps {{.*#+}} xmm0 = (xmm0 * xmm1) - xmm2 +; X64-NEXT: retq +entry: + %neg.i = fneg <4 x float> %__C + %0 = tail call <4 x float> @llvm.fma.v4f32(<4 x float> %__A, <4 x float> %__B, <4 x float> %neg.i) #9 + %1 = bitcast i8 %__U to <8 x i1> + %extract.i = shufflevector <8 x i1> %1, <8 x i1> undef, <4 x i32> + %2 = select <4 x i1> %extract.i, <4 x float> %0, <4 x float> %__A + ret <4 x float> %2 +} + define <4 x float> @test_mm_mask3_fmadd_ps(<4 x float> %__A, <4 x float> %__B, <4 x float> %__C, i8 zeroext %__U) { ; X86-LABEL: test_mm_mask3_fmadd_ps: ; X86: # %bb.0: # %entry @@ -4685,6 +4933,30 @@ entry: ret <4 x float> %2 } +define <4 x float> @test_mm_mask3_fnmadd_ps_unary_fneg(<4 x float> %__A, <4 x float> %__B, <4 x float> %__C, i8 zeroext %__U) { +; X86-LABEL: test_mm_mask3_fnmadd_ps_unary_fneg: +; X86: # %bb.0: # %entry +; X86-NEXT: movb {{[0-9]+}}(%esp), %al +; X86-NEXT: kmovw %eax, %k1 +; X86-NEXT: vfnmadd231ps {{.*#+}} xmm2 = -(xmm0 * xmm1) + xmm2 +; X86-NEXT: vmovaps %xmm2, %xmm0 +; X86-NEXT: retl +; +; X64-LABEL: test_mm_mask3_fnmadd_ps_unary_fneg: +; X64: # %bb.0: # %entry +; X64-NEXT: kmovw %edi, %k1 +; X64-NEXT: vfnmadd231ps {{.*#+}} xmm2 = -(xmm0 * xmm1) + xmm2 +; X64-NEXT: vmovaps %xmm2, %xmm0 +; X64-NEXT: retq +entry: + %neg.i = fneg <4 x float> %__A + %0 = tail call <4 x float> @llvm.fma.v4f32(<4 x float> %neg.i, <4 x float> %__B, <4 x float> %__C) #9 + %1 = bitcast i8 %__U to <8 x i1> + %extract.i = shufflevector <8 x i1> %1, <8 x i1> undef, <4 x i32> + %2 = select <4 x i1> %extract.i, <4 x float> %0, <4 x float> %__C + ret <4 x float> %2 +} + define <4 x float> @test_mm_maskz_fmadd_ps(i8 zeroext %__U, <4 x float> %__A, <4 x float> %__B, <4 x float> %__C) { ; X86-LABEL: test_mm_maskz_fmadd_ps: ; X86: # %bb.0: # %entry @@ -4728,6 +5000,28 @@ entry: ret <4 x float> %2 } +define <4 x float> @test_mm_maskz_fmsub_ps_unary_fneg(i8 zeroext %__U, <4 x float> %__A, <4 x float> %__B, <4 x float> %__C) { +; X86-LABEL: test_mm_maskz_fmsub_ps_unary_fneg: +; X86: # %bb.0: # %entry +; X86-NEXT: movb {{[0-9]+}}(%esp), %al +; X86-NEXT: kmovw %eax, %k1 +; X86-NEXT: vfmsub213ps {{.*#+}} xmm0 = (xmm1 * xmm0) - xmm2 +; X86-NEXT: retl +; +; X64-LABEL: test_mm_maskz_fmsub_ps_unary_fneg: +; X64: # %bb.0: # %entry +; X64-NEXT: kmovw %edi, %k1 +; X64-NEXT: vfmsub213ps {{.*#+}} xmm0 = (xmm1 * xmm0) - xmm2 +; X64-NEXT: retq +entry: + %neg.i = fneg <4 x float> %__C + %0 = tail call <4 x float> @llvm.fma.v4f32(<4 x float> %__A, <4 x float> %__B, <4 x float> %neg.i) #9 + %1 = bitcast i8 %__U to <8 x i1> + %extract.i = shufflevector <8 x i1> %1, <8 x i1> undef, <4 x i32> + %2 = select <4 x i1> %extract.i, <4 x float> %0, <4 x float> zeroinitializer + ret <4 x float> %2 +} + define <4 x float> @test_mm_maskz_fnmadd_ps(i8 zeroext %__U, <4 x float> %__A, <4 x float> %__B, <4 x float> %__C) { ; X86-LABEL: test_mm_maskz_fnmadd_ps: ; X86: # %bb.0: # %entry @@ -4750,6 +5044,28 @@ entry: ret <4 x float> %2 } +define <4 x float> @test_mm_maskz_fnmadd_ps_unary_fneg(i8 zeroext %__U, <4 x float> %__A, <4 x float> %__B, <4 x float> %__C) { +; X86-LABEL: test_mm_maskz_fnmadd_ps_unary_fneg: +; X86: # %bb.0: # %entry +; X86-NEXT: movb {{[0-9]+}}(%esp), %al +; X86-NEXT: kmovw %eax, %k1 +; X86-NEXT: vfnmadd213ps {{.*#+}} xmm0 = -(xmm1 * xmm0) + xmm2 +; X86-NEXT: retl +; +; X64-LABEL: test_mm_maskz_fnmadd_ps_unary_fneg: +; X64: # %bb.0: # %entry +; X64-NEXT: kmovw %edi, %k1 +; X64-NEXT: vfnmadd213ps {{.*#+}} xmm0 = -(xmm1 * xmm0) + xmm2 +; X64-NEXT: retq +entry: + %neg.i = fneg <4 x float> %__A + %0 = tail call <4 x float> @llvm.fma.v4f32(<4 x float> %neg.i, <4 x float> %__B, <4 x float> %__C) #9 + %1 = bitcast i8 %__U to <8 x i1> + %extract.i = shufflevector <8 x i1> %1, <8 x i1> undef, <4 x i32> + %2 = select <4 x i1> %extract.i, <4 x float> %0, <4 x float> zeroinitializer + ret <4 x float> %2 +} + define <4 x float> @test_mm_maskz_fnmsub_ps(i8 zeroext %__U, <4 x float> %__A, <4 x float> %__B, <4 x float> %__C) { ; X86-LABEL: test_mm_maskz_fnmsub_ps: ; X86: # %bb.0: # %entry @@ -4773,6 +5089,29 @@ entry: ret <4 x float> %2 } +define <4 x float> @test_mm_maskz_fnmsub_ps_unary_fneg(i8 zeroext %__U, <4 x float> %__A, <4 x float> %__B, <4 x float> %__C) { +; X86-LABEL: test_mm_maskz_fnmsub_ps_unary_fneg: +; X86: # %bb.0: # %entry +; X86-NEXT: movb {{[0-9]+}}(%esp), %al +; X86-NEXT: kmovw %eax, %k1 +; X86-NEXT: vfnmsub213ps {{.*#+}} xmm0 = -(xmm1 * xmm0) - xmm2 +; X86-NEXT: retl +; +; X64-LABEL: test_mm_maskz_fnmsub_ps_unary_fneg: +; X64: # %bb.0: # %entry +; X64-NEXT: kmovw %edi, %k1 +; X64-NEXT: vfnmsub213ps {{.*#+}} xmm0 = -(xmm1 * xmm0) - xmm2 +; X64-NEXT: retq +entry: + %neg.i = fneg <4 x float> %__A + %neg1.i = fneg <4 x float> %__C + %0 = tail call <4 x float> @llvm.fma.v4f32(<4 x float> %neg.i, <4 x float> %__B, <4 x float> %neg1.i) #9 + %1 = bitcast i8 %__U to <8 x i1> + %extract.i = shufflevector <8 x i1> %1, <8 x i1> undef, <4 x i32> + %2 = select <4 x i1> %extract.i, <4 x float> %0, <4 x float> zeroinitializer + ret <4 x float> %2 +} + define <8 x float> @test_mm256_mask_fmadd_ps(<8 x float> %__A, i8 zeroext %__U, <8 x float> %__B, <8 x float> %__C) { ; X86-LABEL: test_mm256_mask_fmadd_ps: ; X86: # %bb.0: # %entry @@ -4814,6 +5153,27 @@ entry: ret <8 x float> %2 } +define <8 x float> @test_mm256_mask_fmsub_ps_unary_fneg(<8 x float> %__A, i8 zeroext %__U, <8 x float> %__B, <8 x float> %__C) { +; X86-LABEL: test_mm256_mask_fmsub_ps_unary_fneg: +; X86: # %bb.0: # %entry +; X86-NEXT: movb {{[0-9]+}}(%esp), %al +; X86-NEXT: kmovw %eax, %k1 +; X86-NEXT: vfmsub132ps {{.*#+}} ymm0 = (ymm0 * ymm1) - ymm2 +; X86-NEXT: retl +; +; X64-LABEL: test_mm256_mask_fmsub_ps_unary_fneg: +; X64: # %bb.0: # %entry +; X64-NEXT: kmovw %edi, %k1 +; X64-NEXT: vfmsub132ps {{.*#+}} ymm0 = (ymm0 * ymm1) - ymm2 +; X64-NEXT: retq +entry: + %neg.i = fneg <8 x float> %__C + %0 = tail call <8 x float> @llvm.fma.v8f32(<8 x float> %__A, <8 x float> %__B, <8 x float> %neg.i) #9 + %1 = bitcast i8 %__U to <8 x i1> + %2 = select <8 x i1> %1, <8 x float> %0, <8 x float> %__A + ret <8 x float> %2 +} + define <8 x float> @test_mm256_mask3_fmadd_ps(<8 x float> %__A, <8 x float> %__B, <8 x float> %__C, i8 zeroext %__U) { ; X86-LABEL: test_mm256_mask3_fmadd_ps: ; X86: # %bb.0: # %entry @@ -5547,6 +5907,32 @@ entry: ret <2 x double> %4 } +define <2 x double> @test_mm_mask3_fmsubadd_pd_unary_fneg(<2 x double> %__A, <2 x double> %__B, <2 x double> %__C, i8 zeroext %__U) { +; X86-LABEL: test_mm_mask3_fmsubadd_pd_unary_fneg: +; X86: # %bb.0: # %entry +; X86-NEXT: movb {{[0-9]+}}(%esp), %al +; X86-NEXT: kmovw %eax, %k1 +; X86-NEXT: vfmsubadd231pd {{.*#+}} xmm2 = (xmm0 * xmm1) -/+ xmm2 +; X86-NEXT: vmovapd %xmm2, %xmm0 +; X86-NEXT: retl +; +; X64-LABEL: test_mm_mask3_fmsubadd_pd_unary_fneg: +; X64: # %bb.0: # %entry +; X64-NEXT: kmovw %edi, %k1 +; X64-NEXT: vfmsubadd231pd {{.*#+}} xmm2 = (xmm0 * xmm1) -/+ xmm2 +; X64-NEXT: vmovapd %xmm2, %xmm0 +; X64-NEXT: retq +entry: + %neg.i = fneg <2 x double> %__C + %0 = tail call <2 x double> @llvm.fma.v2f64(<2 x double> %__A, <2 x double> %__B, <2 x double> %neg.i) #9 + %1 = tail call <2 x double> @llvm.fma.v2f64(<2 x double> %__A, <2 x double> %__B, <2 x double> %__C) #9 + %2 = shufflevector <2 x double> %1, <2 x double> %0, <2 x i32> + %3 = bitcast i8 %__U to <8 x i1> + %extract.i = shufflevector <8 x i1> %3, <8 x i1> undef, <2 x i32> + %4 = select <2 x i1> %extract.i, <2 x double> %2, <2 x double> %__C + ret <2 x double> %4 +} + define <4 x double> @test_mm256_mask3_fmsubadd_pd(<4 x double> %__A, <4 x double> %__B, <4 x double> %__C, i8 zeroext %__U) { ; X86-LABEL: test_mm256_mask3_fmsubadd_pd: ; X86: # %bb.0: # %entry @@ -5573,6 +5959,32 @@ entry: ret <4 x double> %4 } +define <4 x double> @test_mm256_mask3_fmsubadd_pd_unary_fneg(<4 x double> %__A, <4 x double> %__B, <4 x double> %__C, i8 zeroext %__U) { +; X86-LABEL: test_mm256_mask3_fmsubadd_pd_unary_fneg: +; X86: # %bb.0: # %entry +; X86-NEXT: movb {{[0-9]+}}(%esp), %al +; X86-NEXT: kmovw %eax, %k1 +; X86-NEXT: vfmsubadd231pd {{.*#+}} ymm2 = (ymm0 * ymm1) -/+ ymm2 +; X86-NEXT: vmovapd %ymm2, %ymm0 +; X86-NEXT: retl +; +; X64-LABEL: test_mm256_mask3_fmsubadd_pd_unary_fneg: +; X64: # %bb.0: # %entry +; X64-NEXT: kmovw %edi, %k1 +; X64-NEXT: vfmsubadd231pd {{.*#+}} ymm2 = (ymm0 * ymm1) -/+ ymm2 +; X64-NEXT: vmovapd %ymm2, %ymm0 +; X64-NEXT: retq +entry: + %neg.i = fneg <4 x double> %__C + %0 = tail call <4 x double> @llvm.fma.v4f64(<4 x double> %__A, <4 x double> %__B, <4 x double> %neg.i) #9 + %1 = tail call <4 x double> @llvm.fma.v4f64(<4 x double> %__A, <4 x double> %__B, <4 x double> %__C) #9 + %2 = shufflevector <4 x double> %1, <4 x double> %0, <4 x i32> + %3 = bitcast i8 %__U to <8 x i1> + %extract.i = shufflevector <8 x i1> %3, <8 x i1> undef, <4 x i32> + %4 = select <4 x i1> %extract.i, <4 x double> %2, <4 x double> %__C + ret <4 x double> %4 +} + define <4 x float> @test_mm_mask3_fmsubadd_ps(<4 x float> %__A, <4 x float> %__B, <4 x float> %__C, i8 zeroext %__U) { ; X86-LABEL: test_mm_mask3_fmsubadd_ps: ; X86: # %bb.0: # %entry @@ -5599,6 +6011,32 @@ entry: ret <4 x float> %4 } +define <4 x float> @test_mm_mask3_fmsubadd_ps_unary_fneg(<4 x float> %__A, <4 x float> %__B, <4 x float> %__C, i8 zeroext %__U) { +; X86-LABEL: test_mm_mask3_fmsubadd_ps_unary_fneg: +; X86: # %bb.0: # %entry +; X86-NEXT: movb {{[0-9]+}}(%esp), %al +; X86-NEXT: kmovw %eax, %k1 +; X86-NEXT: vfmsubadd231ps {{.*#+}} xmm2 = (xmm0 * xmm1) -/+ xmm2 +; X86-NEXT: vmovaps %xmm2, %xmm0 +; X86-NEXT: retl +; +; X64-LABEL: test_mm_mask3_fmsubadd_ps_unary_fneg: +; X64: # %bb.0: # %entry +; X64-NEXT: kmovw %edi, %k1 +; X64-NEXT: vfmsubadd231ps {{.*#+}} xmm2 = (xmm0 * xmm1) -/+ xmm2 +; X64-NEXT: vmovaps %xmm2, %xmm0 +; X64-NEXT: retq +entry: + %neg.i = fneg <4 x float> %__C + %0 = tail call <4 x float> @llvm.fma.v4f32(<4 x float> %__A, <4 x float> %__B, <4 x float> %neg.i) #9 + %1 = tail call <4 x float> @llvm.fma.v4f32(<4 x float> %__A, <4 x float> %__B, <4 x float> %__C) #9 + %2 = shufflevector <4 x float> %1, <4 x float> %0, <4 x i32> + %3 = bitcast i8 %__U to <8 x i1> + %extract.i = shufflevector <8 x i1> %3, <8 x i1> undef, <4 x i32> + %4 = select <4 x i1> %extract.i, <4 x float> %2, <4 x float> %__C + ret <4 x float> %4 +} + define <8 x float> @test_mm256_mask3_fmsubadd_ps(<8 x float> %__A, <8 x float> %__B, <8 x float> %__C, i8 zeroext %__U) { ; X86-LABEL: test_mm256_mask3_fmsubadd_ps: ; X86: # %bb.0: # %entry @@ -5624,6 +6062,31 @@ entry: ret <8 x float> %4 } +define <8 x float> @test_mm256_mask3_fmsubadd_ps_unary_fneg(<8 x float> %__A, <8 x float> %__B, <8 x float> %__C, i8 zeroext %__U) { +; X86-LABEL: test_mm256_mask3_fmsubadd_ps_unary_fneg: +; X86: # %bb.0: # %entry +; X86-NEXT: movb {{[0-9]+}}(%esp), %al +; X86-NEXT: kmovw %eax, %k1 +; X86-NEXT: vfmsubadd231ps {{.*#+}} ymm2 = (ymm0 * ymm1) -/+ ymm2 +; X86-NEXT: vmovaps %ymm2, %ymm0 +; X86-NEXT: retl +; +; X64-LABEL: test_mm256_mask3_fmsubadd_ps_unary_fneg: +; X64: # %bb.0: # %entry +; X64-NEXT: kmovw %edi, %k1 +; X64-NEXT: vfmsubadd231ps {{.*#+}} ymm2 = (ymm0 * ymm1) -/+ ymm2 +; X64-NEXT: vmovaps %ymm2, %ymm0 +; X64-NEXT: retq +entry: + %neg.i = fneg <8 x float> %__C + %0 = tail call <8 x float> @llvm.fma.v8f32(<8 x float> %__A, <8 x float> %__B, <8 x float> %neg.i) #9 + %1 = tail call <8 x float> @llvm.fma.v8f32(<8 x float> %__A, <8 x float> %__B, <8 x float> %__C) #9 + %2 = shufflevector <8 x float> %1, <8 x float> %0, <8 x i32> + %3 = bitcast i8 %__U to <8 x i1> + %4 = select <8 x i1> %3, <8 x float> %2, <8 x float> %__C + ret <8 x float> %4 +} + define <2 x double> @test_mm_mask_fnmadd_pd(<2 x double> %__A, i8 zeroext %__U, <2 x double> %__B, <2 x double> %__C) { ; X86-LABEL: test_mm_mask_fnmadd_pd: ; X86: # %bb.0: # %entry @@ -5646,6 +6109,28 @@ entry: ret <2 x double> %2 } +define <2 x double> @test_mm_mask_fnmadd_pd_unary_fneg(<2 x double> %__A, i8 zeroext %__U, <2 x double> %__B, <2 x double> %__C) { +; X86-LABEL: test_mm_mask_fnmadd_pd_unary_fneg: +; X86: # %bb.0: # %entry +; X86-NEXT: movb {{[0-9]+}}(%esp), %al +; X86-NEXT: kmovw %eax, %k1 +; X86-NEXT: vfnmadd132pd {{.*#+}} xmm0 = -(xmm0 * xmm1) + xmm2 +; X86-NEXT: retl +; +; X64-LABEL: test_mm_mask_fnmadd_pd_unary_fneg: +; X64: # %bb.0: # %entry +; X64-NEXT: kmovw %edi, %k1 +; X64-NEXT: vfnmadd132pd {{.*#+}} xmm0 = -(xmm0 * xmm1) + xmm2 +; X64-NEXT: retq +entry: + %neg.i = fneg <2 x double> %__B + %0 = tail call <2 x double> @llvm.fma.v2f64(<2 x double> %__A, <2 x double> %neg.i, <2 x double> %__C) #9 + %1 = bitcast i8 %__U to <8 x i1> + %extract.i = shufflevector <8 x i1> %1, <8 x i1> undef, <2 x i32> + %2 = select <2 x i1> %extract.i, <2 x double> %0, <2 x double> %__A + ret <2 x double> %2 +} + define <4 x double> @test_mm256_mask_fnmadd_pd(<4 x double> %__A, i8 zeroext %__U, <4 x double> %__B, <4 x double> %__C) { ; X86-LABEL: test_mm256_mask_fnmadd_pd: ; X86: # %bb.0: # %entry @@ -5668,6 +6153,28 @@ entry: ret <4 x double> %2 } +define <4 x double> @test_mm256_mask_fnmadd_pd_unary_fneg(<4 x double> %__A, i8 zeroext %__U, <4 x double> %__B, <4 x double> %__C) { +; X86-LABEL: test_mm256_mask_fnmadd_pd_unary_fneg: +; X86: # %bb.0: # %entry +; X86-NEXT: movb {{[0-9]+}}(%esp), %al +; X86-NEXT: kmovw %eax, %k1 +; X86-NEXT: vfnmadd132pd {{.*#+}} ymm0 = -(ymm0 * ymm1) + ymm2 +; X86-NEXT: retl +; +; X64-LABEL: test_mm256_mask_fnmadd_pd_unary_fneg: +; X64: # %bb.0: # %entry +; X64-NEXT: kmovw %edi, %k1 +; X64-NEXT: vfnmadd132pd {{.*#+}} ymm0 = -(ymm0 * ymm1) + ymm2 +; X64-NEXT: retq +entry: + %neg.i = fneg <4 x double> %__B + %0 = tail call <4 x double> @llvm.fma.v4f64(<4 x double> %__A, <4 x double> %neg.i, <4 x double> %__C) #9 + %1 = bitcast i8 %__U to <8 x i1> + %extract.i = shufflevector <8 x i1> %1, <8 x i1> undef, <4 x i32> + %2 = select <4 x i1> %extract.i, <4 x double> %0, <4 x double> %__A + ret <4 x double> %2 +} + define <4 x float> @test_mm_mask_fnmadd_ps(<4 x float> %__A, i8 zeroext %__U, <4 x float> %__B, <4 x float> %__C) { ; X86-LABEL: test_mm_mask_fnmadd_ps: ; X86: # %bb.0: # %entry @@ -5690,6 +6197,28 @@ entry: ret <4 x float> %2 } +define <4 x float> @test_mm_mask_fnmadd_ps_unary_fneg(<4 x float> %__A, i8 zeroext %__U, <4 x float> %__B, <4 x float> %__C) { +; X86-LABEL: test_mm_mask_fnmadd_ps_unary_fneg: +; X86: # %bb.0: # %entry +; X86-NEXT: movb {{[0-9]+}}(%esp), %al +; X86-NEXT: kmovw %eax, %k1 +; X86-NEXT: vfnmadd132ps {{.*#+}} xmm0 = -(xmm0 * xmm1) + xmm2 +; X86-NEXT: retl +; +; X64-LABEL: test_mm_mask_fnmadd_ps_unary_fneg: +; X64: # %bb.0: # %entry +; X64-NEXT: kmovw %edi, %k1 +; X64-NEXT: vfnmadd132ps {{.*#+}} xmm0 = -(xmm0 * xmm1) + xmm2 +; X64-NEXT: retq +entry: + %neg.i = fneg <4 x float> %__B + %0 = tail call <4 x float> @llvm.fma.v4f32(<4 x float> %__A, <4 x float> %neg.i, <4 x float> %__C) #9 + %1 = bitcast i8 %__U to <8 x i1> + %extract.i = shufflevector <8 x i1> %1, <8 x i1> undef, <4 x i32> + %2 = select <4 x i1> %extract.i, <4 x float> %0, <4 x float> %__A + ret <4 x float> %2 +} + define <8 x float> @test_mm256_mask_fnmadd_ps(<8 x float> %__A, i8 zeroext %__U, <8 x float> %__B, <8 x float> %__C) { ; X86-LABEL: test_mm256_mask_fnmadd_ps: ; X86: # %bb.0: # %entry @@ -5711,6 +6240,27 @@ entry: ret <8 x float> %2 } +define <8 x float> @test_mm256_mask_fnmadd_ps_unary_fneg(<8 x float> %__A, i8 zeroext %__U, <8 x float> %__B, <8 x float> %__C) { +; X86-LABEL: test_mm256_mask_fnmadd_ps_unary_fneg: +; X86: # %bb.0: # %entry +; X86-NEXT: movb {{[0-9]+}}(%esp), %al +; X86-NEXT: kmovw %eax, %k1 +; X86-NEXT: vfnmadd132ps {{.*#+}} ymm0 = -(ymm0 * ymm1) + ymm2 +; X86-NEXT: retl +; +; X64-LABEL: test_mm256_mask_fnmadd_ps_unary_fneg: +; X64: # %bb.0: # %entry +; X64-NEXT: kmovw %edi, %k1 +; X64-NEXT: vfnmadd132ps {{.*#+}} ymm0 = -(ymm0 * ymm1) + ymm2 +; X64-NEXT: retq +entry: + %neg.i = fneg <8 x float> %__B + %0 = tail call <8 x float> @llvm.fma.v8f32(<8 x float> %__A, <8 x float> %neg.i, <8 x float> %__C) #9 + %1 = bitcast i8 %__U to <8 x i1> + %2 = select <8 x i1> %1, <8 x float> %0, <8 x float> %__A + ret <8 x float> %2 +} + define <2 x double> @test_mm_mask_fnmsub_pd(<2 x double> %__A, i8 zeroext %__U, <2 x double> %__B, <2 x double> %__C) { ; X86-LABEL: test_mm_mask_fnmsub_pd: ; X86: # %bb.0: # %entry @@ -5734,6 +6284,29 @@ entry: ret <2 x double> %2 } +define <2 x double> @test_mm_mask_fnmsub_pd_unary_fneg(<2 x double> %__A, i8 zeroext %__U, <2 x double> %__B, <2 x double> %__C) { +; X86-LABEL: test_mm_mask_fnmsub_pd_unary_fneg: +; X86: # %bb.0: # %entry +; X86-NEXT: movb {{[0-9]+}}(%esp), %al +; X86-NEXT: kmovw %eax, %k1 +; X86-NEXT: vfnmsub132pd {{.*#+}} xmm0 = -(xmm0 * xmm1) - xmm2 +; X86-NEXT: retl +; +; X64-LABEL: test_mm_mask_fnmsub_pd_unary_fneg: +; X64: # %bb.0: # %entry +; X64-NEXT: kmovw %edi, %k1 +; X64-NEXT: vfnmsub132pd {{.*#+}} xmm0 = -(xmm0 * xmm1) - xmm2 +; X64-NEXT: retq +entry: + %neg.i = fneg <2 x double> %__B + %neg1.i = fneg <2 x double> %__C + %0 = tail call <2 x double> @llvm.fma.v2f64(<2 x double> %__A, <2 x double> %neg.i, <2 x double> %neg1.i) #9 + %1 = bitcast i8 %__U to <8 x i1> + %extract.i = shufflevector <8 x i1> %1, <8 x i1> undef, <2 x i32> + %2 = select <2 x i1> %extract.i, <2 x double> %0, <2 x double> %__A + ret <2 x double> %2 +} + define <2 x double> @test_mm_mask3_fnmsub_pd(<2 x double> %__A, <2 x double> %__B, <2 x double> %__C, i8 zeroext %__U) { ; X86-LABEL: test_mm_mask3_fnmsub_pd: ; X86: # %bb.0: # %entry @@ -5759,6 +6332,31 @@ entry: ret <2 x double> %2 } +define <2 x double> @test_mm_mask3_fnmsub_pd_unary_fneg(<2 x double> %__A, <2 x double> %__B, <2 x double> %__C, i8 zeroext %__U) { +; X86-LABEL: test_mm_mask3_fnmsub_pd_unary_fneg: +; X86: # %bb.0: # %entry +; X86-NEXT: movb {{[0-9]+}}(%esp), %al +; X86-NEXT: kmovw %eax, %k1 +; X86-NEXT: vfnmsub231pd {{.*#+}} xmm2 = -(xmm0 * xmm1) - xmm2 +; X86-NEXT: vmovapd %xmm2, %xmm0 +; X86-NEXT: retl +; +; X64-LABEL: test_mm_mask3_fnmsub_pd_unary_fneg: +; X64: # %bb.0: # %entry +; X64-NEXT: kmovw %edi, %k1 +; X64-NEXT: vfnmsub231pd {{.*#+}} xmm2 = -(xmm0 * xmm1) - xmm2 +; X64-NEXT: vmovapd %xmm2, %xmm0 +; X64-NEXT: retq +entry: + %neg.i = fneg <2 x double> %__B + %neg1.i = fneg <2 x double> %__C + %0 = tail call <2 x double> @llvm.fma.v2f64(<2 x double> %__A, <2 x double> %neg.i, <2 x double> %neg1.i) #9 + %1 = bitcast i8 %__U to <8 x i1> + %extract.i = shufflevector <8 x i1> %1, <8 x i1> undef, <2 x i32> + %2 = select <2 x i1> %extract.i, <2 x double> %0, <2 x double> %__C + ret <2 x double> %2 +} + define <4 x double> @test_mm256_mask_fnmsub_pd(<4 x double> %__A, i8 zeroext %__U, <4 x double> %__B, <4 x double> %__C) { ; X86-LABEL: test_mm256_mask_fnmsub_pd: ; X86: # %bb.0: # %entry @@ -5782,6 +6380,29 @@ entry: ret <4 x double> %2 } +define <4 x double> @test_mm256_mask_fnmsub_pd_unary_fneg(<4 x double> %__A, i8 zeroext %__U, <4 x double> %__B, <4 x double> %__C) { +; X86-LABEL: test_mm256_mask_fnmsub_pd_unary_fneg: +; X86: # %bb.0: # %entry +; X86-NEXT: movb {{[0-9]+}}(%esp), %al +; X86-NEXT: kmovw %eax, %k1 +; X86-NEXT: vfnmsub132pd {{.*#+}} ymm0 = -(ymm0 * ymm1) - ymm2 +; X86-NEXT: retl +; +; X64-LABEL: test_mm256_mask_fnmsub_pd_unary_fneg: +; X64: # %bb.0: # %entry +; X64-NEXT: kmovw %edi, %k1 +; X64-NEXT: vfnmsub132pd {{.*#+}} ymm0 = -(ymm0 * ymm1) - ymm2 +; X64-NEXT: retq +entry: + %neg.i = fneg <4 x double> %__B + %neg1.i = fneg <4 x double> %__C + %0 = tail call <4 x double> @llvm.fma.v4f64(<4 x double> %__A, <4 x double> %neg.i, <4 x double> %neg1.i) #9 + %1 = bitcast i8 %__U to <8 x i1> + %extract.i = shufflevector <8 x i1> %1, <8 x i1> undef, <4 x i32> + %2 = select <4 x i1> %extract.i, <4 x double> %0, <4 x double> %__A + ret <4 x double> %2 +} + define <4 x double> @test_mm256_mask3_fnmsub_pd(<4 x double> %__A, <4 x double> %__B, <4 x double> %__C, i8 zeroext %__U) { ; X86-LABEL: test_mm256_mask3_fnmsub_pd: ; X86: # %bb.0: # %entry @@ -5807,6 +6428,31 @@ entry: ret <4 x double> %2 } +define <4 x double> @test_mm256_mask3_fnmsub_pd_unary_fneg(<4 x double> %__A, <4 x double> %__B, <4 x double> %__C, i8 zeroext %__U) { +; X86-LABEL: test_mm256_mask3_fnmsub_pd_unary_fneg: +; X86: # %bb.0: # %entry +; X86-NEXT: movb {{[0-9]+}}(%esp), %al +; X86-NEXT: kmovw %eax, %k1 +; X86-NEXT: vfnmsub231pd {{.*#+}} ymm2 = -(ymm0 * ymm1) - ymm2 +; X86-NEXT: vmovapd %ymm2, %ymm0 +; X86-NEXT: retl +; +; X64-LABEL: test_mm256_mask3_fnmsub_pd_unary_fneg: +; X64: # %bb.0: # %entry +; X64-NEXT: kmovw %edi, %k1 +; X64-NEXT: vfnmsub231pd {{.*#+}} ymm2 = -(ymm0 * ymm1) - ymm2 +; X64-NEXT: vmovapd %ymm2, %ymm0 +; X64-NEXT: retq +entry: + %neg.i = fneg <4 x double> %__B + %neg1.i = fneg <4 x double> %__C + %0 = tail call <4 x double> @llvm.fma.v4f64(<4 x double> %__A, <4 x double> %neg.i, <4 x double> %neg1.i) #9 + %1 = bitcast i8 %__U to <8 x i1> + %extract.i = shufflevector <8 x i1> %1, <8 x i1> undef, <4 x i32> + %2 = select <4 x i1> %extract.i, <4 x double> %0, <4 x double> %__C + ret <4 x double> %2 +} + define <4 x float> @test_mm_mask_fnmsub_ps(<4 x float> %__A, i8 zeroext %__U, <4 x float> %__B, <4 x float> %__C) { ; X86-LABEL: test_mm_mask_fnmsub_ps: ; X86: # %bb.0: # %entry @@ -5830,6 +6476,29 @@ entry: ret <4 x float> %2 } +define <4 x float> @test_mm_mask_fnmsub_ps_unary_fneg(<4 x float> %__A, i8 zeroext %__U, <4 x float> %__B, <4 x float> %__C) { +; X86-LABEL: test_mm_mask_fnmsub_ps_unary_fneg: +; X86: # %bb.0: # %entry +; X86-NEXT: movb {{[0-9]+}}(%esp), %al +; X86-NEXT: kmovw %eax, %k1 +; X86-NEXT: vfnmsub132ps {{.*#+}} xmm0 = -(xmm0 * xmm1) - xmm2 +; X86-NEXT: retl +; +; X64-LABEL: test_mm_mask_fnmsub_ps_unary_fneg: +; X64: # %bb.0: # %entry +; X64-NEXT: kmovw %edi, %k1 +; X64-NEXT: vfnmsub132ps {{.*#+}} xmm0 = -(xmm0 * xmm1) - xmm2 +; X64-NEXT: retq +entry: + %neg.i = fneg <4 x float> %__B + %neg1.i = fneg <4 x float> %__C + %0 = tail call <4 x float> @llvm.fma.v4f32(<4 x float> %__A, <4 x float> %neg.i, <4 x float> %neg1.i) #9 + %1 = bitcast i8 %__U to <8 x i1> + %extract.i = shufflevector <8 x i1> %1, <8 x i1> undef, <4 x i32> + %2 = select <4 x i1> %extract.i, <4 x float> %0, <4 x float> %__A + ret <4 x float> %2 +} + define <4 x float> @test_mm_mask3_fnmsub_ps(<4 x float> %__A, <4 x float> %__B, <4 x float> %__C, i8 zeroext %__U) { ; X86-LABEL: test_mm_mask3_fnmsub_ps: ; X86: # %bb.0: # %entry diff --git a/test/CodeGen/X86/combine-fabs.ll b/test/CodeGen/X86/combine-fabs.ll index b779c589cf9d..67b695ebd018 100644 --- a/test/CodeGen/X86/combine-fabs.ll +++ b/test/CodeGen/X86/combine-fabs.ll @@ -85,6 +85,22 @@ define float @combine_fabs_fneg(float %a) { ret float %2 } +define float @combine_fabs_unary_fneg(float %a) { +; SSE-LABEL: combine_fabs_unary_fneg: +; SSE: # %bb.0: +; SSE-NEXT: andps {{.*}}(%rip), %xmm0 +; SSE-NEXT: retq +; +; AVX-LABEL: combine_fabs_unary_fneg: +; AVX: # %bb.0: +; AVX-NEXT: vbroadcastss {{.*}}(%rip), %xmm1 +; AVX-NEXT: vandps %xmm1, %xmm0, %xmm0 +; AVX-NEXT: retq + %1 = fneg float %a + %2 = call float @llvm.fabs.f32(float %1) + ret float %2 +} + define <4 x float> @combine_vec_fabs_fneg(<4 x float> %a) { ; SSE-LABEL: combine_vec_fabs_fneg: ; SSE: # %bb.0: @@ -101,6 +117,22 @@ define <4 x float> @combine_vec_fabs_fneg(<4 x float> %a) { ret <4 x float> %2 } +define <4 x float> @combine_vec_fabs_unary_fneg(<4 x float> %a) { +; SSE-LABEL: combine_vec_fabs_unary_fneg: +; SSE: # %bb.0: +; SSE-NEXT: andps {{.*}}(%rip), %xmm0 +; SSE-NEXT: retq +; +; AVX-LABEL: combine_vec_fabs_unary_fneg: +; AVX: # %bb.0: +; AVX-NEXT: vbroadcastss {{.*}}(%rip), %xmm1 +; AVX-NEXT: vandps %xmm1, %xmm0, %xmm0 +; AVX-NEXT: retq + %1 = fneg <4 x float> %a + %2 = call <4 x float> @llvm.fabs.v4f32(<4 x float> %1) + ret <4 x float> %2 +} + ; fabs(fcopysign(x, y)) -> fabs(x) define float @combine_fabs_fcopysign(float %a, float %b) { ; SSE-LABEL: combine_fabs_fcopysign: