This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Add VL nodes and VP patterns for unary zvbb instructions
ClosedPublic

Authored by luke on Jul 13 2023, 12:36 PM.

Details

Summary

This follows the pattern of lowering VP nodes to equivalent
RISCVISD::*_VL nodes. The nodes are modelled after the VP ISD nodes rather
than the actual zvbb instructions, and I've included a merge operand to be
consistent with the underlying pseudos that were recently refactored.

I've defined the nodes in RISCVInstrInfoVVLpatterns.td as the nodes aren't Zvk
specific, but the patterns are in RISCVInstrInfoZvk.td.

Diff Detail

Event Timeline

luke created this revision.Jul 13 2023, 12:36 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 13 2023, 12:36 PM
luke requested review of this revision.Jul 13 2023, 12:36 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 13 2023, 12:36 PM

They

also aren't restricted to integers as presumably we can use these for
floats too later.

Wouldn't we use a bitcast for that?

luke added a comment.EditedJul 14 2023, 5:09 AM

They

also aren't restricted to integers as presumably we can use these for
floats too later.

Wouldn't we use a bitcast for that?

Ah you're right, didn't realise the langref specified that they must be integer vectors. Doesn't look like the vp intrinsics enforce this though, the verifier accepts this and crashes when trying to expand it:

declare <vscale x 2 x float> @llvm.vp.ctlz.nxv2f32(<vscale x 2 x float>, i1 immarg, <vscale x 2 x i1>, i32)

define <vscale x 2 x float> @vp_ctlz_nxv2f32(<vscale x 2 x float> %va, <vscale x 2 x i1> %m, i32 zeroext %evl) {
  %v = call <vscale x 2 x float> @llvm.vp.ctlz.nxv2f32(<vscale x 2 x float> %va, i1 false, <vscale x 2 x i1> %m, i32 %evl)
  ret <vscale x 2 x float> %v
}
luke updated this revision to Diff 540378.Jul 14 2023, 5:30 AM

Restrict VL nodes to integers

luke edited the summary of this revision. (Show Details)Jul 14 2023, 5:30 AM
luke updated this revision to Diff 540476.Jul 14 2023, 10:08 AM

Fix HasStdExtZvbb predicate from being overwritten

craig.topper added inline comments.Jul 14 2023, 10:09 AM
llvm/lib/Target/RISCV/RISCVInstrInfoZvk.td
242

This has the same predicate problem?

This revision is now accepted and ready to land.Jul 14 2023, 10:12 AM
This revision was landed with ongoing or failed builds.Jul 17 2023, 1:18 AM
This revision was automatically updated to reflect the committed changes.