mirror of
https://github.com/RPCS3/llvm.git
synced 2024-11-29 06:30:30 +00:00
Fix the order of the operands in the llvm.fma intrinsic patterns for ARM,
<rdar://problem/11325085>. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@155724 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
5dde20bfac
commit
7787800481
@ -4136,16 +4136,16 @@ def VFMSfq : N3VQMulOp<0, 0, 0b10, 0b1100, 1, IIC_VFMACQ, "vfms", "f32",
|
||||
Requires<[HasVFP4,UseFusedMAC]>;
|
||||
|
||||
// Match @llvm.fma.* intrinsics
|
||||
def : Pat<(v2f32 (fma DPR:$src1, DPR:$Vn, DPR:$Vm)),
|
||||
def : Pat<(v2f32 (fma DPR:$Vn, DPR:$Vm, DPR:$src1)),
|
||||
(VFMAfd DPR:$src1, DPR:$Vn, DPR:$Vm)>,
|
||||
Requires<[HasVFP4]>;
|
||||
def : Pat<(v4f32 (fma QPR:$src1, QPR:$Vn, QPR:$Vm)),
|
||||
def : Pat<(v4f32 (fma QPR:$Vn, QPR:$Vm, QPR:$src1)),
|
||||
(VFMAfq QPR:$src1, QPR:$Vn, QPR:$Vm)>,
|
||||
Requires<[HasVFP4]>;
|
||||
def : Pat<(v2f32 (fma (fneg DPR:$src1), DPR:$Vn, DPR:$Vm)),
|
||||
def : Pat<(v2f32 (fma (fneg DPR:$Vn), DPR:$Vm, DPR:$src1)),
|
||||
(VFMSfd DPR:$src1, DPR:$Vn, DPR:$Vm)>,
|
||||
Requires<[HasVFP4]>;
|
||||
def : Pat<(v4f32 (fma (fneg QPR:$src1), QPR:$Vn, QPR:$Vm)),
|
||||
def : Pat<(v4f32 (fma (fneg QPR:$Vn), QPR:$Vm, QPR:$src1)),
|
||||
(VFMSfq QPR:$src1, QPR:$Vn, QPR:$Vm)>,
|
||||
Requires<[HasVFP4]>;
|
||||
|
||||
|
@ -1089,10 +1089,11 @@ def : Pat<(fadd_mlx SPR:$dstin, (fmul_su SPR:$a, SPR:$b)),
|
||||
Requires<[HasVFP4,DontUseNEONForFP,UseFusedMAC]>;
|
||||
|
||||
// Match @llvm.fma.* intrinsics
|
||||
def : Pat<(f64 (fma DPR:$Ddin, DPR:$Dn, DPR:$Dm)),
|
||||
// (fma x, y, z) -> (vfms z, x, y)
|
||||
def : Pat<(f64 (fma DPR:$Dn, DPR:$Dm, DPR:$Ddin)),
|
||||
(VFMAD DPR:$Ddin, DPR:$Dn, DPR:$Dm)>,
|
||||
Requires<[HasVFP4]>;
|
||||
def : Pat<(f32 (fma SPR:$Sdin, SPR:$Sn, SPR:$Sm)),
|
||||
def : Pat<(f32 (fma SPR:$Sn, SPR:$Sm, SPR:$Sdin)),
|
||||
(VFMAS SPR:$Sdin, SPR:$Sn, SPR:$Sm)>,
|
||||
Requires<[HasVFP4]>;
|
||||
|
||||
@ -1123,18 +1124,18 @@ def : Pat<(fsub_mlx SPR:$dstin, (fmul_su SPR:$a, SPR:$b)),
|
||||
Requires<[HasVFP4,DontUseNEONForFP,UseFusedMAC]>;
|
||||
|
||||
// Match @llvm.fma.* intrinsics
|
||||
// (fma (fneg x), y, z) -> (vfms x, y, z)
|
||||
def : Pat<(f64 (fma (fneg DPR:$Ddin), DPR:$Dn, DPR:$Dm)),
|
||||
// (fma (fneg x), y, z) -> (vfms z, x, y)
|
||||
def : Pat<(f64 (fma (fneg DPR:$Dn), DPR:$Dm, DPR:$Ddin)),
|
||||
(VFMSD DPR:$Ddin, DPR:$Dn, DPR:$Dm)>,
|
||||
Requires<[HasVFP4]>;
|
||||
def : Pat<(f32 (fma (fneg SPR:$Sdin), SPR:$Sn, SPR:$Sm)),
|
||||
def : Pat<(f32 (fma (fneg SPR:$Sn), SPR:$Sm, SPR:$Sdin)),
|
||||
(VFMSS SPR:$Sdin, SPR:$Sn, SPR:$Sm)>,
|
||||
Requires<[HasVFP4]>;
|
||||
// (fneg (fma x, (fneg y), z) -> (vfms x, y, z)
|
||||
def : Pat<(fneg (f64 (fma DPR:$Ddin, (fneg DPR:$Dn), DPR:$Dm))),
|
||||
// (fma x, (fneg y), z) -> (vfms z, x, y)
|
||||
def : Pat<(f64 (fma DPR:$Dn, (fneg DPR:$Dm), DPR:$Ddin)),
|
||||
(VFMSD DPR:$Ddin, DPR:$Dn, DPR:$Dm)>,
|
||||
Requires<[HasVFP4]>;
|
||||
def : Pat<(fneg (f32 (fma SPR:$Sdin, (fneg SPR:$Sn), SPR:$Sm))),
|
||||
def : Pat<(f32 (fma SPR:$Sn, (fneg SPR:$Sm), SPR:$Sdin)),
|
||||
(VFMSS SPR:$Sdin, SPR:$Sn, SPR:$Sm)>,
|
||||
Requires<[HasVFP4]>;
|
||||
|
||||
@ -1165,18 +1166,18 @@ def : Pat<(fsub_mlx (fneg (fmul_su SPR:$a, SPR:$b)), SPR:$dstin),
|
||||
Requires<[HasVFP4,DontUseNEONForFP,UseFusedMAC]>;
|
||||
|
||||
// Match @llvm.fma.* intrinsics
|
||||
// (fneg (fma x, y, z)) -> (vfnma x, y, z)
|
||||
def : Pat<(fneg (fma (f64 DPR:$Ddin), (f64 DPR:$Dn), (f64 DPR:$Dm))),
|
||||
// (fneg (fma x, y, z)) -> (vfnma z, x, y)
|
||||
def : Pat<(fneg (fma (f64 DPR:$Dn), (f64 DPR:$Dm), (f64 DPR:$Ddin))),
|
||||
(VFNMAD DPR:$Ddin, DPR:$Dn, DPR:$Dm)>,
|
||||
Requires<[HasVFP4]>;
|
||||
def : Pat<(fneg (fma (f32 SPR:$Sdin), (f32 SPR:$Sn), (f32 SPR:$Sm))),
|
||||
def : Pat<(fneg (fma (f32 SPR:$Sn), (f32 SPR:$Sm), (f32 SPR:$Sdin))),
|
||||
(VFNMAS SPR:$Sdin, SPR:$Sn, SPR:$Sm)>,
|
||||
Requires<[HasVFP4]>;
|
||||
// (fma (fneg x), y, (fneg z)) -> (vfnma x, y, z)
|
||||
def : Pat<(f64 (fma (fneg DPR:$Ddin), DPR:$Dn, (fneg DPR:$Dm))),
|
||||
// (fma (fneg x), y, (fneg z)) -> (vfnma z, x, y)
|
||||
def : Pat<(f64 (fma (fneg DPR:$Dn), DPR:$Dm, (fneg DPR:$Ddin))),
|
||||
(VFNMAD DPR:$Ddin, DPR:$Dn, DPR:$Dm)>,
|
||||
Requires<[HasVFP4]>;
|
||||
def : Pat<(f32 (fma (fneg SPR:$Sdin), SPR:$Sn, (fneg SPR:$Sm))),
|
||||
def : Pat<(f32 (fma (fneg SPR:$Sn), SPR:$Sm, (fneg SPR:$Sdin))),
|
||||
(VFNMAS SPR:$Sdin, SPR:$Sn, SPR:$Sm)>,
|
||||
Requires<[HasVFP4]>;
|
||||
|
||||
@ -1206,18 +1207,18 @@ def : Pat<(fsub_mlx (fmul_su SPR:$a, SPR:$b), SPR:$dstin),
|
||||
Requires<[HasVFP4,DontUseNEONForFP,UseFusedMAC]>;
|
||||
|
||||
// Match @llvm.fma.* intrinsics
|
||||
// (fneg (fma (fneg x), y, z)) -> (vnfms x, y, z)
|
||||
def : Pat<(fneg (f64 (fma (fneg DPR:$Ddin), DPR:$Dn, DPR:$Dm))),
|
||||
// (fneg (fma (fneg x), y, z)) -> (vfnms z, x, y)
|
||||
def : Pat<(fneg (f64 (fma (fneg DPR:$Dn), DPR:$Dm, DPR:$Ddin))),
|
||||
(VFNMSD DPR:$Ddin, DPR:$Dn, DPR:$Dm)>,
|
||||
Requires<[HasVFP4]>;
|
||||
def : Pat<(fneg (f32 (fma (fneg SPR:$Sdin), SPR:$Sn, SPR:$Sm))),
|
||||
def : Pat<(fneg (f32 (fma (fneg SPR:$Sn), SPR:$Sm, SPR:$Sdin))),
|
||||
(VFNMSS SPR:$Sdin, SPR:$Sn, SPR:$Sm)>,
|
||||
Requires<[HasVFP4]>;
|
||||
// (fma x, (fneg y), z) -> (vnfms x, y, z)
|
||||
def : Pat<(f64 (fma DPR:$Ddin, (fneg DPR:$Dn), DPR:$Dm)),
|
||||
// (fneg (fma x, (fneg y), z) -> (vfnms z, x, y)
|
||||
def : Pat<(fneg (f64 (fma DPR:$Dn, (fneg DPR:$Dm), DPR:$Ddin))),
|
||||
(VFNMSD DPR:$Ddin, DPR:$Dn, DPR:$Dm)>,
|
||||
Requires<[HasVFP4]>;
|
||||
def : Pat<(f32 (fma SPR:$Sdin, (fneg SPR:$Sn), SPR:$Sm)),
|
||||
def : Pat<(fneg (f32 (fma SPR:$Sn, (fneg SPR:$Sm), SPR:$Sdin))),
|
||||
(VFNMSS SPR:$Sdin, SPR:$Sn, SPR:$Sm)>,
|
||||
Requires<[HasVFP4]>;
|
||||
|
||||
|
@ -138,8 +138,7 @@ entry:
|
||||
; CHECK: vfms.f64
|
||||
%tmp1 = fsub double -0.0, %b
|
||||
%tmp2 = tail call double @llvm.fma.f64(double %a, double %tmp1, double %c) nounwind readnone
|
||||
%tmp3 = fsub double -0.0, %tmp2
|
||||
ret double %tmp3
|
||||
ret double %tmp2
|
||||
}
|
||||
|
||||
define double @test_fnms_f64(double %a, double %b, double %c) nounwind readnone ssp {
|
||||
@ -158,7 +157,8 @@ entry:
|
||||
; CHECK: vfnms.f64
|
||||
%tmp1 = fsub double -0.0, %b
|
||||
%tmp2 = tail call double @llvm.fma.f64(double %a, double %tmp1, double %c) nounwind readnone
|
||||
ret double %tmp2
|
||||
%tmp3 = fsub double -0.0, %tmp2
|
||||
ret double %tmp3
|
||||
}
|
||||
|
||||
define double @test_fnma_f64(double %a, double %b, double %c) nounwind readnone ssp {
|
||||
|
Loading…
Reference in New Issue
Block a user