diff options
author | Lang Hames <lhames@gmail.com> | 2012-06-21 06:10:00 +0000 |
---|---|---|
committer | Lang Hames <lhames@gmail.com> | 2012-06-21 06:10:00 +0000 |
commit | 90b2a4cbad1d89ed56793ecf375af7e4161cc6f4 (patch) | |
tree | c3adc577a628d91e0b071b18a3e41e2ccb38404a | |
parent | 5b26461e099964ef69a75170b3ee900cfea66c60 (diff) | |
download | bcm5719-llvm-90b2a4cbad1d89ed56793ecf375af7e4161cc6f4.tar.gz bcm5719-llvm-90b2a4cbad1d89ed56793ecf375af7e4161cc6f4.zip |
Add a missing llvm.fma -> VFNMS pattern to the ARM backend.
llvm-svn: 158902
-rw-r--r-- | llvm/lib/Target/ARM/ARMInstrVFP.td | 8 | ||||
-rw-r--r-- | llvm/test/CodeGen/ARM/fusedMAC.ll | 9 |
2 files changed, 17 insertions, 0 deletions
diff --git a/llvm/lib/Target/ARM/ARMInstrVFP.td b/llvm/lib/Target/ARM/ARMInstrVFP.td index dccbffa4c9f..4e2cda433ba 100644 --- a/llvm/lib/Target/ARM/ARMInstrVFP.td +++ b/llvm/lib/Target/ARM/ARMInstrVFP.td @@ -1207,6 +1207,14 @@ def : Pat<(fsub_mlx (fmul_su SPR:$a, SPR:$b), SPR:$dstin), Requires<[HasVFP4,DontUseNEONForFP,UseFusedMAC]>; // Match @llvm.fma.* intrinsics + +// (fma x, y, (fneg z)) -> (vfnms z, x, y)) +def : Pat<(f64 (fma DPR:$Dn, DPR:$Dm, (fneg DPR:$Ddin))), + (VFNMSD DPR:$Ddin, DPR:$Dn, DPR:$Dm)>, + Requires<[HasVFP4]>; +def : Pat<(f32 (fma SPR:$Sn, SPR:$Sm, (fneg SPR:$Sdin))), + (VFNMSS SPR:$Sdin, SPR:$Sn, SPR:$Sm)>, + Requires<[HasVFP4]>; // (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)>, diff --git a/llvm/test/CodeGen/ARM/fusedMAC.ll b/llvm/test/CodeGen/ARM/fusedMAC.ll index 61e7d7b1a21..0cc1cddf218 100644 --- a/llvm/test/CodeGen/ARM/fusedMAC.ll +++ b/llvm/test/CodeGen/ARM/fusedMAC.ll @@ -141,6 +141,15 @@ entry: ret double %tmp2 } +define float @test_fnms_f32(float %a, float %b, float* %c) nounwind readnone ssp { +; CHECK: test_fnms_f32 +; CHECK: vfnms.f32 + %tmp1 = load float* %c, align 4 + %tmp2 = fsub float -0.0, %tmp1 + %tmp3 = tail call float @llvm.fma.f32(float %a, float %b, float %tmp2) nounwind readnone + ret float %tmp3 +} + define double @test_fnms_f64(double %a, double %b, double %c) nounwind readnone ssp { entry: ; CHECK: test_fnms_f64 |