Details
Details
- Reviewers
RKSimon LuoYuanke craig.topper
Diff Detail
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Comment Actions
We do most TERNLOG matching inside X86DAGToDAGISel::tryVPTERNLOG (which has a 'FIXME: Handle inverted inputs?' comment) - might it be possible to handle this there?
Comment Actions
As far as I learnt it, it's hard to do so. We have 3 difficulties:
- We need a new ORNP node for pre-processing and the logic in tryVPTERNLOG, but ORNP isn't a canonical node like AND, ANDNP etc. that can be used for permutation;
- Even we have a ORNP, we have to change the logic to prioritise ORNP over other nodes and ignore the permutation math;
- Even we achieved 1 and 2, we have to change matchVPTERNLOG, because it assumes the operands are commutable while it's not true for this combine;
Comment Actions
In matchVPTERNLOG, why can’t we just check if each input is a single use xor with -1 after calculating the immediate and then change then change the mask appropriately. No new nodes needed
Comment Actions
I posted an improvement to tryVPTERNLOG here D109295. This handles the basic case but doesn't peek through bitcasts or push broadcast through a not. Are those cases important for what you're trying to do here? I don't see any tests for them.
clang-tidy: warning: invalid case style for function 'GetNot' [readability-identifier-naming]
not useful