The new d-form vector load/store instructions lxv/stxv can be used in place of the x-form instructions lxvx/stxvx when the offset is an immediate. This patch adds the tlbgen patterns to exploit the new instructions. It also changes the existing instructions addressing mode from xoaddr to xaddr so a register + immediate can be selected rather than register + register only. This patch has also been functionally tested on Power9.
Diff Detail
Event Timeline
As a side node, the CHECKs may be generated and updated using llvm/util/update_llc_test_checks.py automatically.
lib/Target/PowerPC/PPCInstrVSX.td | ||
---|---|---|
2516 | Why xoaddr -> xaddr change? AFAIK LXVX doesn't accept immediates, does it? |
lib/Target/PowerPC/PPCInstrVSX.td | ||
---|---|---|
2516 | LXVX doesn't accept immediates, but the addressing mode xaddr checks if this instruction can be better represented with a register + immediate rather than register + register. Since we now have a d-form instruction, LXVX can be changed to xaddr and if the register + immediate is possible, it will be changed to used LXV. With xoaddr, only register + register is used, even if the input is an immediate. |
lib/Target/PowerPC/PPCInstrVSX.td | ||
---|---|---|
2516 | I see, thanks for the explanation! My understanding is that there are passes that generates LXVX without necessarily going through an ISD::LOAD, and we want to optimize for those as well. |
lib/Target/PowerPC/PPCInstrVSX.td | ||
---|---|---|
2348 | You should probably look into what this is used for. I remember not adding the scalar D-Forms to that map and had very hard to debug problems. But I don't remember how the problems manifested themselves. That's why I added this comment too. I imagine you should probably add yours here as well. | |
2516 | We should definitely look to see if there are other ways of generating an LXVX and address that if there are any. |
lib/Target/PowerPC/PPCInstrVSX.td | ||
---|---|---|
2348 | It is already added in the ImmToIdxMap in PPCRegisterInfo::PPCRegisterInfo. |
lib/Target/PowerPC/PPCInstrVSX.td | ||
---|---|---|
2348 | Oh, OK cool. Then this LGTM as well. |
You should probably look into what this is used for. I remember not adding the scalar D-Forms to that map and had very hard to debug problems. But I don't remember how the problems manifested themselves. That's why I added this comment too. I imagine you should probably add yours here as well.