xsnegdp, xsabsdp and xsnabsdp can all be used to operate on f32 operand, but we don't have patterns to generate them. This patch adds the missing patterns since we prefer VSX instructions when available.
Details
- Reviewers
nemanjai jsji steven.zhang - Group Reviewers
Restricted Project - Commits
- rG8ffe8891cd57: [PowerPC] Exploit VSX neg, abs and nabs for f32
Diff Detail
- Repository
- rG LLVM Github Monorepo
Unit Tests
Time | Test | |
---|---|---|
130 ms | lldb-unit.Host/_/HostTests::Unknown Unit Message ("") |
Event Timeline
llvm/test/CodeGen/PowerPC/fma.ll | ||
---|---|---|
130 ↗ | (On Diff #247228) | I know here looks like a regression. But I'm drafting another patch to disable nmsub instruction when no nsz flag set. So the pattern will be removed from td file and we can get xsnmsubadp naturally. |
llvm/test/CodeGen/PowerPC/fma.ll | ||
---|---|---|
130 ↗ | (On Diff #247228) | So, could you please post that patch here as the parent revision of this one, then update the patch, so that, we could have a clear picture. |
Thanks for posting this. This LGTM.
Could you also help to check if the following pairs can also be changed accordingly?
{stxsspx, stfsx}
{lxsspx, lfsx}
{stxsiwx, stfiwx}
{xssubsp, fsubs}
{xsmulsp, fmuls}
{xsdivsp, fdivs}
{xssqrtsp, fsqrts}
{xsrsqrtesq, frsqrtes}
{lxsiwzx, lfiwzx}
{lxsiwax, lfiwax}
{xsresp, fres}
{xsmsubasp, fmsubs}
{xsnmsubasp, fnmsubs}
I added description and removed unnecessary parent revision. So this patch is ready for review now.
llvm/test/CodeGen/PowerPC/fma.ll | ||
---|---|---|
130 ↗ | (On Diff #247228) | Oh, that's not related to this regression. I've updated this patch to change pattern priority. |
llvm/lib/Target/PowerPC/PPCInstrVSX.td | ||
---|---|---|
1025 | Can we use the pred that checking the pwr7 cpu type instead of harding code the complexity ? And the comment here is also unclear to me. You want to have fneg in P7 so that, it could be combined into fnmsub. We cannot combine fmsub + xsnegdp to fnmsub, is it right ? General speaking, still emit the fneg for P7 makes sense to me. |
The patch LGTM now with some comments update. But please hold for several days to see if Nemanjai(@nemanjai) has comments.
llvm/lib/Target/PowerPC/PPCInstrVSX.td | ||
---|---|---|
1590 | The comments here is confusing. We are adding pattern for fneg and it has nothing to do with XSNMSUBASP though it is combined from fneg + fmsub. We need some comments indicate that, though xsnegdp is added in P7, we still only want to select it starting from P8, as we won't break the combine pattern for fneg + fmsub because XSNMSUBASP is only available starting from P8. |
Can we use the pred that checking the pwr7 cpu type instead of harding code the complexity ? And the comment here is also unclear to me. You want to have fneg in P7 so that, it could be combined into fnmsub. We cannot combine fmsub + xsnegdp to fnmsub, is it right ? General speaking, still emit the fneg for P7 makes sense to me.