This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Add overlapping constraints label
ClosedPublic

Authored by BeMg on Aug 10 2023, 1:02 AM.

Details

Summary

The RISCV-V-Spec[1] describes which RVV instructions are allowed to overlap between source operands and destination operands. Currently, most of these instructions are constrained with early-clobber.

This patch labels these instructions with TargetOverlapConstraintType in pseudo to indicate that these instructions can overlap.

The value of TargetOverlapConstraintType is:

1 -> default
2 -> narrow case
3 -> widen case

This information is useful for future optimization passes.

[1] https://github.com/riscv/riscv-v-spec/blob/master/v-spec.adoc#52-vector-operands

Diff Detail

Event Timeline

BeMg created this revision.Aug 10 2023, 1:02 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 10 2023, 1:02 AM
BeMg requested review of this revision.Aug 10 2023, 1:02 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 10 2023, 1:02 AM
BeMg edited the summary of this revision. (Show Details)Aug 10 2023, 1:15 AM
wangpc added inline comments.Aug 10 2023, 1:18 AM
llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td
2252

If sew=0 is the default value, then you can just use named argument TargetConstraintType=TargetConstraintType only here.

2300

ditto.

BeMg updated this revision to Diff 549247.Aug 10 2023, 10:23 PM

Make TargetConstraintType as designated argument

craig.topper added inline comments.Aug 12 2023, 10:46 AM
llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td
547

Please document the values in comments.

BeMg updated this revision to Diff 549883.Aug 14 2023, 5:08 AM

Add comment

craig.topper added inline comments.Aug 15 2023, 6:49 PM
llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td
5985–5986

Why do we need to pass TargetConstraintType here? Isn't 1 the default?

6087–6094

use TargetConstraintType=3

6099–6104

Isn't 1 the default?

craig.topper added inline comments.Aug 15 2023, 6:52 PM
llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td
2856

Is this class unused? I would expect it to need a TargetConstaintType

2862

Can we default to 3 and remove from instantiation?

2872

This class is used once. Can we default the constraint type to 3 and remove from the instantiation?

2886

Can we default all the VW classes to 3? May even just default at VPseudoBinaryW_WV?

craig.topper added inline comments.Aug 15 2023, 6:55 PM
llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td
2856

Its not unused. It used by VWSLL in a different file. And it should be widening.

BeMg updated this revision to Diff 552255.Aug 22 2023, 1:11 AM

Revmoe TargetConstraintType from argument as much as possible

craig.topper added inline comments.Aug 23 2023, 12:44 PM
llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td
1863

"Use" makes me think this variable is a boolean value, but its not.

craig.topper added inline comments.Aug 30 2023, 10:01 PM
llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td
1863

Ping

BeMg updated this revision to Diff 554995.Aug 31 2023, 5:28 AM

Rewrite the condition of ILoad's overlapping constraint.

This revision is now accepted and ready to land.Sep 19 2023, 9:02 AM
BeMg updated this revision to Diff 557160.Sep 21 2023, 12:21 AM

After rebase, update format

This revision was automatically updated to reflect the committed changes.