Page MenuHomePhabricator

[RISCV] : Add support for immediate operands.
ClosedPublic

Authored by MarkGoncharovAl on Aug 12 2022, 6:10 AM.

Details

Summary

Launching on RISCV machine llvm-exegesis to measure latency, I faced with troubles like: 'Operand is not set: ... <MCOperand INVALID>>; ... OpInfo.OperandType: 0'
(explanation: OperandType 0 means Unknown type).

Find out that this problem occurs with instructions:
C_ADDI
C_ADDIW
C_ADDI_HINT_IMM_ZERO
C_ANDI
C_FLD
C_FLW
C_LD
C_LW
C_SLLI
C_SRAI
C_SRLI
SHFLI
UNSHFLI
VADC_VIM
VADD_VI
VAND_VI
VMADC_VI
VMADC_VIM
VMERGE_VIM
VMSEQ_VI
VMSGTU_VI
VMSGT_VI
VMSLEU_VI
VMSLE_VI
VMSNE_VI
VOR_VI
VRSUB_VI
VSADDU_VI
VSADD_VI
VSETVLI
VXOR_VI

llvm-exegesis uses operand type information provided in tablegen files to initialize immediate arguments of the instruction. Some of them (listed above) simply don't have such information. Thus we should set into relevant immediate operands their specific type. Also create verification methods for them.

Diff Detail

Event Timeline

Herald added a project: Restricted Project. · View Herald TranscriptAug 12 2022, 6:10 AM
MarkGoncharovAl requested review of this revision.Aug 12 2022, 6:10 AM
craig.topper added inline comments.
llvm/lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.h
219

Stray blank line?

llvm/lib/Target/RISCV/RISCVInstrInfoV.td
31

VI -> VTYPEI

42

This is never used in a pattern, why does it need ImmLeaf?

102

I don't think there are any instruction that uses this as an operand. Why do we need this change?

Unuseful stray blank line was removed.

Operand VI was renamed to VTYPEI.

Operand type for SIMM5_NONZERO and unuseful ImmLeaf were removed.

Run testsuite - success.

Diff to check new update relative to main branch.

MarkGoncharovAl edited reviewers, added: craig.topper; removed: 255, 13rac1.Aug 18 2022, 6:01 AM

Please, take a look to review changes.

This revision is now accepted and ready to land.Aug 18 2022, 7:46 AM

I do not have commit access.
Someone who has it, please, push this commit to upstream.

This revision was automatically updated to reflect the committed changes.

I do not have commit access.
Someone who has it, please, push this commit to upstream.

I will commit it for you.

I do not have commit access.
Someone who has it, please, push this commit to upstream.

I will commit it for you.

Thank you