2015-12-27 21:56:16 +08:00
|
|
|
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
|
|
|
|
; RUN: llc < %s -mtriple=x86_64-apple-darwin -mattr=+avx512f -fp-contract=fast | FileCheck %s --check-prefix=ALL --check-prefix=KNL
|
|
|
|
; RUN: llc < %s -mtriple=x86_64-apple-darwin -mcpu=skx -fp-contract=fast | FileCheck %s --check-prefix=ALL --check-prefix=SKX
|
2013-08-27 16:39:25 +08:00
|
|
|
|
|
|
|
define <16 x float> @test_x86_fmadd_ps_z(<16 x float> %a0, <16 x float> %a1, <16 x float> %a2) {
|
2015-12-27 21:56:16 +08:00
|
|
|
; ALL-LABEL: test_x86_fmadd_ps_z:
|
2017-12-05 01:18:51 +08:00
|
|
|
; ALL: ## %bb.0:
|
2018-11-10 03:05:51 +08:00
|
|
|
; ALL-NEXT: vfmadd213ps {{.*#+}} zmm0 = (zmm1 * zmm0) + zmm2
|
2015-12-27 21:56:16 +08:00
|
|
|
; ALL-NEXT: retq
|
2013-08-27 16:39:25 +08:00
|
|
|
%x = fmul <16 x float> %a0, %a1
|
|
|
|
%res = fadd <16 x float> %x, %a2
|
|
|
|
ret <16 x float> %res
|
|
|
|
}
|
|
|
|
|
|
|
|
define <16 x float> @test_x86_fmsub_ps_z(<16 x float> %a0, <16 x float> %a1, <16 x float> %a2) {
|
2015-12-27 21:56:16 +08:00
|
|
|
; ALL-LABEL: test_x86_fmsub_ps_z:
|
2017-12-05 01:18:51 +08:00
|
|
|
; ALL: ## %bb.0:
|
2018-11-10 03:05:51 +08:00
|
|
|
; ALL-NEXT: vfmsub213ps {{.*#+}} zmm0 = (zmm1 * zmm0) - zmm2
|
2015-12-27 21:56:16 +08:00
|
|
|
; ALL-NEXT: retq
|
2013-08-27 16:39:25 +08:00
|
|
|
%x = fmul <16 x float> %a0, %a1
|
|
|
|
%res = fsub <16 x float> %x, %a2
|
|
|
|
ret <16 x float> %res
|
|
|
|
}
|
|
|
|
|
|
|
|
define <16 x float> @test_x86_fnmadd_ps_z(<16 x float> %a0, <16 x float> %a1, <16 x float> %a2) {
|
2015-12-27 21:56:16 +08:00
|
|
|
; ALL-LABEL: test_x86_fnmadd_ps_z:
|
2017-12-05 01:18:51 +08:00
|
|
|
; ALL: ## %bb.0:
|
2018-11-10 03:05:51 +08:00
|
|
|
; ALL-NEXT: vfnmadd213ps {{.*#+}} zmm0 = -(zmm1 * zmm0) + zmm2
|
2015-12-27 21:56:16 +08:00
|
|
|
; ALL-NEXT: retq
|
2013-08-27 16:39:25 +08:00
|
|
|
%x = fmul <16 x float> %a0, %a1
|
|
|
|
%res = fsub <16 x float> %a2, %x
|
|
|
|
ret <16 x float> %res
|
|
|
|
}
|
|
|
|
|
|
|
|
define <16 x float> @test_x86_fnmsub_ps_z(<16 x float> %a0, <16 x float> %a1, <16 x float> %a2) {
|
2015-12-27 21:56:16 +08:00
|
|
|
; ALL-LABEL: test_x86_fnmsub_ps_z:
|
2017-12-05 01:18:51 +08:00
|
|
|
; ALL: ## %bb.0:
|
2018-11-10 03:05:51 +08:00
|
|
|
; ALL-NEXT: vfnmsub213ps {{.*#+}} zmm0 = -(zmm1 * zmm0) - zmm2
|
2015-12-27 21:56:16 +08:00
|
|
|
; ALL-NEXT: retq
|
2013-08-27 16:39:25 +08:00
|
|
|
%x = fmul <16 x float> %a0, %a1
|
2015-12-27 21:56:16 +08:00
|
|
|
%y = fsub <16 x float> <float -0.000000e+00, float -0.000000e+00, float -0.000000e+00, float -0.000000e+00, float -0.000000e+00,
|
2013-08-27 16:39:25 +08:00
|
|
|
float -0.000000e+00, float -0.000000e+00, float -0.000000e+00, float -0.000000e+00, float -0.000000e+00,
|
2015-12-27 21:56:16 +08:00
|
|
|
float -0.000000e+00, float -0.000000e+00, float -0.000000e+00, float -0.000000e+00, float -0.000000e+00,
|
|
|
|
float -0.000000e+00>, %x
|
2013-08-27 16:39:25 +08:00
|
|
|
%res = fsub <16 x float> %y, %a2
|
|
|
|
ret <16 x float> %res
|
|
|
|
}
|
|
|
|
|
|
|
|
define <8 x double> @test_x86_fmadd_pd_z(<8 x double> %a0, <8 x double> %a1, <8 x double> %a2) {
|
2015-12-27 21:56:16 +08:00
|
|
|
; ALL-LABEL: test_x86_fmadd_pd_z:
|
2017-12-05 01:18:51 +08:00
|
|
|
; ALL: ## %bb.0:
|
2018-11-10 03:05:51 +08:00
|
|
|
; ALL-NEXT: vfmadd213pd {{.*#+}} zmm0 = (zmm1 * zmm0) + zmm2
|
2015-12-27 21:56:16 +08:00
|
|
|
; ALL-NEXT: retq
|
2013-08-27 16:39:25 +08:00
|
|
|
%x = fmul <8 x double> %a0, %a1
|
|
|
|
%res = fadd <8 x double> %x, %a2
|
|
|
|
ret <8 x double> %res
|
|
|
|
}
|
|
|
|
|
|
|
|
define <8 x double> @test_x86_fmsub_pd_z(<8 x double> %a0, <8 x double> %a1, <8 x double> %a2) {
|
2015-12-27 21:56:16 +08:00
|
|
|
; ALL-LABEL: test_x86_fmsub_pd_z:
|
2017-12-05 01:18:51 +08:00
|
|
|
; ALL: ## %bb.0:
|
2018-11-10 03:05:51 +08:00
|
|
|
; ALL-NEXT: vfmsub213pd {{.*#+}} zmm0 = (zmm1 * zmm0) - zmm2
|
2015-12-27 21:56:16 +08:00
|
|
|
; ALL-NEXT: retq
|
2013-08-27 16:39:25 +08:00
|
|
|
%x = fmul <8 x double> %a0, %a1
|
|
|
|
%res = fsub <8 x double> %x, %a2
|
|
|
|
ret <8 x double> %res
|
|
|
|
}
|
|
|
|
|
2015-07-01 21:24:28 +08:00
|
|
|
define double @test_x86_fmsub_213(double %a0, double %a1, double %a2) {
|
2016-07-23 15:16:56 +08:00
|
|
|
; ALL-LABEL: test_x86_fmsub_213:
|
2017-12-05 01:18:51 +08:00
|
|
|
; ALL: ## %bb.0:
|
2018-11-10 03:05:51 +08:00
|
|
|
; ALL-NEXT: vfmsub213sd {{.*#+}} xmm0 = (xmm1 * xmm0) - xmm2
|
2016-07-23 15:16:56 +08:00
|
|
|
; ALL-NEXT: retq
|
2013-08-27 16:39:25 +08:00
|
|
|
%x = fmul double %a0, %a1
|
|
|
|
%res = fsub double %x, %a2
|
|
|
|
ret double %res
|
|
|
|
}
|
|
|
|
|
2015-07-01 21:24:28 +08:00
|
|
|
define double @test_x86_fmsub_213_m(double %a0, double %a1, double * %a2_ptr) {
|
2016-07-23 15:16:56 +08:00
|
|
|
; ALL-LABEL: test_x86_fmsub_213_m:
|
2017-12-05 01:18:51 +08:00
|
|
|
; ALL: ## %bb.0:
|
2018-11-10 03:05:51 +08:00
|
|
|
; ALL-NEXT: vfmsub213sd {{.*#+}} xmm0 = (xmm1 * xmm0) - mem
|
2016-07-23 15:16:56 +08:00
|
|
|
; ALL-NEXT: retq
|
2015-07-01 21:24:28 +08:00
|
|
|
%a2 = load double , double *%a2_ptr
|
|
|
|
%x = fmul double %a0, %a1
|
|
|
|
%res = fsub double %x, %a2
|
|
|
|
ret double %res
|
|
|
|
}
|
|
|
|
|
|
|
|
define double @test_x86_fmsub_231_m(double %a0, double %a1, double * %a2_ptr) {
|
2016-07-23 15:16:56 +08:00
|
|
|
; ALL-LABEL: test_x86_fmsub_231_m:
|
2017-12-05 01:18:51 +08:00
|
|
|
; ALL: ## %bb.0:
|
2018-11-10 03:05:51 +08:00
|
|
|
; ALL-NEXT: vfmsub132sd {{.*#+}} xmm0 = (xmm0 * mem) - xmm1
|
2016-07-23 15:16:56 +08:00
|
|
|
; ALL-NEXT: retq
|
2015-07-01 21:24:28 +08:00
|
|
|
%a2 = load double , double *%a2_ptr
|
|
|
|
%x = fmul double %a0, %a2
|
|
|
|
%res = fsub double %x, %a1
|
|
|
|
ret double %res
|
|
|
|
}
|
|
|
|
|
2015-06-29 17:10:00 +08:00
|
|
|
define <16 x float> @test231_br(<16 x float> %a1, <16 x float> %a2) nounwind {
|
2015-12-27 21:56:16 +08:00
|
|
|
; ALL-LABEL: test231_br:
|
2017-12-05 01:18:51 +08:00
|
|
|
; ALL: ## %bb.0:
|
2018-11-10 03:05:51 +08:00
|
|
|
; ALL-NEXT: vfmadd132ps {{.*#+}} zmm0 = (zmm0 * mem) + zmm1
|
2015-12-27 21:56:16 +08:00
|
|
|
; ALL-NEXT: retq
|
2013-08-27 16:39:25 +08:00
|
|
|
%b1 = fmul <16 x float> %a1, <float 0x3FB99999A0000000, float 0x3FB99999A0000000, float 0x3FB99999A0000000, float 0x3FB99999A0000000, float 0x3FB99999A0000000, float 0x3FB99999A0000000, float 0x3FB99999A0000000, float 0x3FB99999A0000000, float 0x3FB99999A0000000, float 0x3FB99999A0000000, float 0x3FB99999A0000000, float 0x3FB99999A0000000, float 0x3FB99999A0000000, float 0x3FB99999A0000000, float 0x3FB99999A0000000, float 0x3FB99999A0000000>
|
|
|
|
%b2 = fadd <16 x float> %b1, %a2
|
|
|
|
ret <16 x float> %b2
|
|
|
|
}
|
|
|
|
|
|
|
|
define <16 x float> @test213_br(<16 x float> %a1, <16 x float> %a2) nounwind {
|
2015-12-27 21:56:16 +08:00
|
|
|
; ALL-LABEL: test213_br:
|
2017-12-05 01:18:51 +08:00
|
|
|
; ALL: ## %bb.0:
|
2018-11-10 03:05:51 +08:00
|
|
|
; ALL-NEXT: vfmadd213ps {{.*#+}} zmm0 = (zmm1 * zmm0) + mem
|
2015-12-27 21:56:16 +08:00
|
|
|
; ALL-NEXT: retq
|
2013-08-27 16:39:25 +08:00
|
|
|
%b1 = fmul <16 x float> %a1, %a2
|
|
|
|
%b2 = fadd <16 x float> %b1, <float 0x3FB99999A0000000, float 0x3FB99999A0000000, float 0x3FB99999A0000000, float 0x3FB99999A0000000, float 0x3FB99999A0000000, float 0x3FB99999A0000000, float 0x3FB99999A0000000, float 0x3FB99999A0000000, float 0x3FB99999A0000000, float 0x3FB99999A0000000, float 0x3FB99999A0000000, float 0x3FB99999A0000000, float 0x3FB99999A0000000, float 0x3FB99999A0000000, float 0x3FB99999A0000000, float 0x3FB99999A0000000>
|
|
|
|
ret <16 x float> %b2
|
|
|
|
}
|
2015-06-29 17:10:00 +08:00
|
|
|
|
|
|
|
;mask (a*c+b , a)
|
|
|
|
define <16 x float> @test_x86_fmadd132_ps(<16 x float> %a0, <16 x float> %a1, <16 x float> *%a2_ptrt, <16 x i1> %mask) {
|
2015-12-27 21:56:16 +08:00
|
|
|
; KNL-LABEL: test_x86_fmadd132_ps:
|
2017-12-05 01:18:51 +08:00
|
|
|
; KNL: ## %bb.0:
|
2018-11-10 03:05:51 +08:00
|
|
|
; KNL-NEXT: vpmovzxbd {{.*#+}} zmm2 = xmm2[0],zero,zero,zero,xmm2[1],zero,zero,zero,xmm2[2],zero,zero,zero,xmm2[3],zero,zero,zero,xmm2[4],zero,zero,zero,xmm2[5],zero,zero,zero,xmm2[6],zero,zero,zero,xmm2[7],zero,zero,zero,xmm2[8],zero,zero,zero,xmm2[9],zero,zero,zero,xmm2[10],zero,zero,zero,xmm2[11],zero,zero,zero,xmm2[12],zero,zero,zero,xmm2[13],zero,zero,zero,xmm2[14],zero,zero,zero,xmm2[15],zero,zero,zero
|
2015-12-27 21:56:16 +08:00
|
|
|
; KNL-NEXT: vpslld $31, %zmm2, %zmm2
|
|
|
|
; KNL-NEXT: vptestmd %zmm2, %zmm2, %k1
|
2018-11-10 03:05:51 +08:00
|
|
|
; KNL-NEXT: vfmadd132ps {{.*#+}} zmm0 = (zmm0 * mem) + zmm1
|
2015-12-27 21:56:16 +08:00
|
|
|
; KNL-NEXT: retq
|
2015-06-29 17:10:00 +08:00
|
|
|
;
|
|
|
|
; SKX-LABEL: test_x86_fmadd132_ps:
|
2017-12-05 01:18:51 +08:00
|
|
|
; SKX: ## %bb.0:
|
2015-12-27 21:56:16 +08:00
|
|
|
; SKX-NEXT: vpsllw $7, %xmm2, %xmm2
|
2015-06-29 17:10:00 +08:00
|
|
|
; SKX-NEXT: vpmovb2m %xmm2, %k1
|
2018-11-10 03:05:51 +08:00
|
|
|
; SKX-NEXT: vfmadd132ps {{.*#+}} zmm0 = (zmm0 * mem) + zmm1
|
2015-06-29 17:10:00 +08:00
|
|
|
; SKX-NEXT: retq
|
|
|
|
%a2 = load <16 x float>,<16 x float> *%a2_ptrt,align 1
|
|
|
|
%x = fmul <16 x float> %a0, %a2
|
|
|
|
%y = fadd <16 x float> %x, %a1
|
|
|
|
%res = select <16 x i1> %mask, <16 x float> %y, <16 x float> %a0
|
|
|
|
ret <16 x float> %res
|
|
|
|
}
|
|
|
|
|
|
|
|
;mask (a*c+b , b)
|
|
|
|
define <16 x float> @test_x86_fmadd231_ps(<16 x float> %a0, <16 x float> %a1, <16 x float> *%a2_ptrt, <16 x i1> %mask) {
|
2015-12-27 21:56:16 +08:00
|
|
|
; KNL-LABEL: test_x86_fmadd231_ps:
|
2017-12-05 01:18:51 +08:00
|
|
|
; KNL: ## %bb.0:
|
2018-11-10 03:05:51 +08:00
|
|
|
; KNL-NEXT: vpmovzxbd {{.*#+}} zmm2 = xmm2[0],zero,zero,zero,xmm2[1],zero,zero,zero,xmm2[2],zero,zero,zero,xmm2[3],zero,zero,zero,xmm2[4],zero,zero,zero,xmm2[5],zero,zero,zero,xmm2[6],zero,zero,zero,xmm2[7],zero,zero,zero,xmm2[8],zero,zero,zero,xmm2[9],zero,zero,zero,xmm2[10],zero,zero,zero,xmm2[11],zero,zero,zero,xmm2[12],zero,zero,zero,xmm2[13],zero,zero,zero,xmm2[14],zero,zero,zero,xmm2[15],zero,zero,zero
|
2015-12-27 21:56:16 +08:00
|
|
|
; KNL-NEXT: vpslld $31, %zmm2, %zmm2
|
|
|
|
; KNL-NEXT: vptestmd %zmm2, %zmm2, %k1
|
2018-11-10 03:05:51 +08:00
|
|
|
; KNL-NEXT: vfmadd231ps {{.*#+}} zmm1 = (zmm0 * mem) + zmm1
|
2015-12-27 21:56:16 +08:00
|
|
|
; KNL-NEXT: vmovaps %zmm1, %zmm0
|
|
|
|
; KNL-NEXT: retq
|
2015-06-29 17:10:00 +08:00
|
|
|
;
|
|
|
|
; SKX-LABEL: test_x86_fmadd231_ps:
|
2017-12-05 01:18:51 +08:00
|
|
|
; SKX: ## %bb.0:
|
2015-12-27 21:56:16 +08:00
|
|
|
; SKX-NEXT: vpsllw $7, %xmm2, %xmm2
|
2015-06-29 17:10:00 +08:00
|
|
|
; SKX-NEXT: vpmovb2m %xmm2, %k1
|
2018-11-10 03:05:51 +08:00
|
|
|
; SKX-NEXT: vfmadd231ps {{.*#+}} zmm1 = (zmm0 * mem) + zmm1
|
2015-06-29 17:10:00 +08:00
|
|
|
; SKX-NEXT: vmovaps %zmm1, %zmm0
|
|
|
|
; SKX-NEXT: retq
|
|
|
|
%a2 = load <16 x float>,<16 x float> *%a2_ptrt,align 1
|
|
|
|
%x = fmul <16 x float> %a0, %a2
|
|
|
|
%y = fadd <16 x float> %x, %a1
|
|
|
|
%res = select <16 x i1> %mask, <16 x float> %y, <16 x float> %a1
|
|
|
|
ret <16 x float> %res
|
|
|
|
}
|
|
|
|
|
|
|
|
;mask (b*a+c , b)
|
|
|
|
define <16 x float> @test_x86_fmadd213_ps(<16 x float> %a0, <16 x float> %a1, <16 x float> *%a2_ptrt, <16 x i1> %mask) {
|
2015-12-27 21:56:16 +08:00
|
|
|
; KNL-LABEL: test_x86_fmadd213_ps:
|
2017-12-05 01:18:51 +08:00
|
|
|
; KNL: ## %bb.0:
|
2018-11-10 03:05:51 +08:00
|
|
|
; KNL-NEXT: vpmovzxbd {{.*#+}} zmm2 = xmm2[0],zero,zero,zero,xmm2[1],zero,zero,zero,xmm2[2],zero,zero,zero,xmm2[3],zero,zero,zero,xmm2[4],zero,zero,zero,xmm2[5],zero,zero,zero,xmm2[6],zero,zero,zero,xmm2[7],zero,zero,zero,xmm2[8],zero,zero,zero,xmm2[9],zero,zero,zero,xmm2[10],zero,zero,zero,xmm2[11],zero,zero,zero,xmm2[12],zero,zero,zero,xmm2[13],zero,zero,zero,xmm2[14],zero,zero,zero,xmm2[15],zero,zero,zero
|
2015-12-27 21:56:16 +08:00
|
|
|
; KNL-NEXT: vpslld $31, %zmm2, %zmm2
|
|
|
|
; KNL-NEXT: vptestmd %zmm2, %zmm2, %k1
|
2018-11-10 03:05:51 +08:00
|
|
|
; KNL-NEXT: vfmadd213ps {{.*#+}} zmm1 = (zmm0 * zmm1) + mem
|
2015-12-27 21:56:16 +08:00
|
|
|
; KNL-NEXT: vmovaps %zmm1, %zmm0
|
|
|
|
; KNL-NEXT: retq
|
2015-06-29 17:10:00 +08:00
|
|
|
;
|
|
|
|
; SKX-LABEL: test_x86_fmadd213_ps:
|
2017-12-05 01:18:51 +08:00
|
|
|
; SKX: ## %bb.0:
|
2015-12-27 21:56:16 +08:00
|
|
|
; SKX-NEXT: vpsllw $7, %xmm2, %xmm2
|
2015-06-29 17:10:00 +08:00
|
|
|
; SKX-NEXT: vpmovb2m %xmm2, %k1
|
2018-11-10 03:05:51 +08:00
|
|
|
; SKX-NEXT: vfmadd213ps {{.*#+}} zmm1 = (zmm0 * zmm1) + mem
|
2015-06-29 17:10:00 +08:00
|
|
|
; SKX-NEXT: vmovaps %zmm1, %zmm0
|
|
|
|
; SKX-NEXT: retq
|
|
|
|
%a2 = load <16 x float>,<16 x float> *%a2_ptrt,align 1
|
|
|
|
%x = fmul <16 x float> %a1, %a0
|
|
|
|
%y = fadd <16 x float> %x, %a2
|
|
|
|
%res = select <16 x i1> %mask, <16 x float> %y, <16 x float> %a1
|
|
|
|
ret <16 x float> %res
|
|
|
|
}
|
|
|
|
|