mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-01-12 10:52:38 +00:00
[x86][AArch64] add tests for fmul-fma combine; NFC
As discussed in D80801, there's a possible overstep in what is allowed by the 'contract' fast-math-flag.
This commit is contained in:
parent
56b530d92c
commit
26fd3ffa78
@ -207,6 +207,19 @@ define double @fadd_fma_fmul_1(double %a, double %b, double %c, double %d, doubl
|
||||
ret double %a2
|
||||
}
|
||||
|
||||
define float @fadd_fma_fmul_fmf(float %a, float %b, float %c, float %d, float %n0) nounwind {
|
||||
; CHECK-LABEL: fadd_fma_fmul_fmf:
|
||||
; CHECK: // %bb.0:
|
||||
; CHECK-NEXT: fmadd s2, s2, s3, s4
|
||||
; CHECK-NEXT: fmadd s0, s0, s1, s2
|
||||
; CHECK-NEXT: ret
|
||||
%m1 = fmul float %a, %b
|
||||
%m2 = fmul float %c, %d
|
||||
%a1 = fadd contract float %m1, %m2
|
||||
%a2 = fadd reassoc float %n0, %a1
|
||||
ret float %a2
|
||||
}
|
||||
|
||||
; Minimum FMF, commute final add operands, change type.
|
||||
|
||||
define float @fadd_fma_fmul_2(float %a, float %b, float %c, float %d, float %n0) nounwind {
|
||||
|
@ -1821,6 +1821,31 @@ define double @fadd_fma_fmul_1(double %a, double %b, double %c, double %d, doubl
|
||||
ret double %a2
|
||||
}
|
||||
|
||||
define float @fadd_fma_fmul_fmf(float %a, float %b, float %c, float %d, float %n0) nounwind {
|
||||
; FMA-LABEL: fadd_fma_fmul_fmf:
|
||||
; FMA: # %bb.0:
|
||||
; FMA-NEXT: vfmadd213ss {{.*#+}} xmm2 = (xmm3 * xmm2) + xmm4
|
||||
; FMA-NEXT: vfmadd213ss {{.*#+}} xmm0 = (xmm1 * xmm0) + xmm2
|
||||
; FMA-NEXT: retq
|
||||
;
|
||||
; FMA4-LABEL: fadd_fma_fmul_fmf:
|
||||
; FMA4: # %bb.0:
|
||||
; FMA4-NEXT: vfmaddss {{.*#+}} xmm2 = (xmm2 * xmm3) + xmm4
|
||||
; FMA4-NEXT: vfmaddss {{.*#+}} xmm0 = (xmm0 * xmm1) + xmm2
|
||||
; FMA4-NEXT: retq
|
||||
;
|
||||
; AVX512-LABEL: fadd_fma_fmul_fmf:
|
||||
; AVX512: # %bb.0:
|
||||
; AVX512-NEXT: vfmadd213ss {{.*#+}} xmm2 = (xmm3 * xmm2) + xmm4
|
||||
; AVX512-NEXT: vfmadd213ss {{.*#+}} xmm0 = (xmm1 * xmm0) + xmm2
|
||||
; AVX512-NEXT: retq
|
||||
%m1 = fmul float %a, %b
|
||||
%m2 = fmul float %c, %d
|
||||
%a1 = fadd contract float %m1, %m2
|
||||
%a2 = fadd reassoc float %n0, %a1
|
||||
ret float %a2
|
||||
}
|
||||
|
||||
; Minimum FMF, commute final add operands, change type.
|
||||
|
||||
define float @fadd_fma_fmul_2(float %a, float %b, float %c, float %d, float %n0) nounwind {
|
||||
|
Loading…
x
Reference in New Issue
Block a user