[ARM] Hoist fabs/fneg above a conversion to float.
authorJames Molloy <james.molloy@arm.com>
Sat, 29 Aug 2015 10:49:11 +0000 (10:49 +0000)
committerJames Molloy <james.molloy@arm.com>
Sat, 29 Aug 2015 10:49:11 +0000 (10:49 +0000)
commit3504e2625a72f73d75040ad47c134788e6eacd9e
tree1c776a1474742cdc3d794bf18b986322e19833cd
parent820985a01bf5ea82aea152670b8bedc0436eddcd
[ARM] Hoist fabs/fneg above a conversion to float.

This is especially visible in softfp mode, for example in the implementation of libm fabs/fneg functions. If we have:

%1 = vmovdrr r0, r1
%2 = fabs %1

then move the fabs before the vmovdrr:

%1 = and r1, #0x7FFFFFFF
%2 = vmovdrr r0, r1

This is never a lose, and could be a serious win because the vmovdrr may be followed by a vmovrrd, which would enable us to remove the conversion into FPRs completely.

We already do this for f32, but not for f64. Tests are added for both.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246360 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/ARM/ARMInstrVFP.td
test/CodeGen/ARM/softfp-fabs-fneg.ll [new file with mode: 0644]