This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Remove custom isel for (srl (shl val, 32), imm). Use pattern instead. NFCI
ClosedPublic

Authored by craig.topper on Oct 31 2020, 11:40 PM.

Details

Summary

We don't need custom matching, we just a need a predicate to check
the immediate is greater than 32. We can use the existing ImmSub32
to adjust the immediate.

I've also used the new predicate in the other location that used
ImmSub32. I tried to create a test case where we would break without
the greater than 32 check on that pattern, but DAG combine defeated me.
Still seemed safer to have it.

Diff Detail

Event Timeline

craig.topper created this revision.Oct 31 2020, 11:40 PM
Herald added a project: Restricted Project. · View Herald TranscriptOct 31 2020, 11:40 PM
craig.topper requested review of this revision.Oct 31 2020, 11:40 PM
frasercrmck added inline comments.Nov 4 2020, 2:43 AM
llvm/lib/Target/RISCV/RISCVInstrInfoB.td
1042

I might be wrong here, but are we getting the operands to fshr the wrong way round? I'm seeing that the intrinsic documentation says that it takes operands %a, %b with %a in the MSB of the wide value, and we're passing them through to FSR as rs1 and rs3 respectively, where rs1 is the LSB of the wide value. I'm reading spec 0.92 so maybe there's a mismatch.

I don't think this applies to FSL because the spec says rs1 is the MSB of the wide value.

frasercrmck added inline comments.Nov 4 2020, 3:17 AM
llvm/lib/Target/RISCV/RISCVInstrInfoB.td
1042

Typical; I just saw D90735. Let's move this discussion over there, then.

luismarques accepted this revision.Nov 4 2020, 3:45 AM
This revision is now accepted and ready to land.Nov 4 2020, 3:45 AM
This revision was landed with ongoing or failed builds.Nov 4 2020, 10:00 AM
This revision was automatically updated to reflect the committed changes.