This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Define vwadd/vwaddu/vwsub/vwsubu intrinsics.
ClosedPublic

Authored by HsiangKai on Dec 11 2020, 5:14 AM.

Details

Summary

Define vwadd/vwaddu/vwsub/vwsubu intrinsics and lower to V instructions.

In this patch, it demonstrates how to model widening vector instructions.

We work with @rogfer01 from BSC to come out this patch.

Authored-by: Roger Ferrer Ibanez <rofirrim@gmail.com>
Co-Authored-by: Hsiangkai Wang <kai.wang@sifive.com>

Diff Detail

Event Timeline

HsiangKai created this revision.Dec 11 2020, 5:14 AM
HsiangKai requested review of this revision.Dec 11 2020, 5:14 AM
Herald added a project: Restricted Project. · View Herald TranscriptDec 11 2020, 5:14 AM
Herald added a subscriber: MaskRay. · View Herald Transcript
craig.topper added inline comments.Dec 11 2020, 1:47 PM
llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td
311

Since we're already passing "m" down to VPseudoBinary, can we just assign VLMul in VPseudoBinary?

HsiangKai updated this revision to Diff 311352.Dec 11 2020, 6:23 PM

Address @craig.topper's comments.

HsiangKai marked an inline comment as done.Dec 12 2020, 3:44 AM

I think this looks good other than that naming comment.

llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td
140

Widenable is probably better than Wideable.

Also LGTM once Craig's comments are addressed. Thanks a lot Kai!

HsiangKai edited the summary of this revision. (Show Details)
This revision is now accepted and ready to land.Dec 15 2020, 1:30 AM
This revision was landed with ongoing or failed builds.Dec 15 2020, 4:27 AM
This revision was automatically updated to reflect the committed changes.
fhahn added a subscriber: fhahn.EditedDec 17 2020, 1:28 AM

Cross-post from db48a6de7702

this appears to cause the following warnings when building LLVM with assertions

[1148/2221] Building RISCVGenAsmMatcher.inc...
warning: Compiler has made implicit assumption that TypeSize is not scalable. This may or may not lead to broken code.
[1793/2221] Building RISCVGenAsmWriter.inc...
warning: Compiler has made implicit assumption that TypeSize is not scalable. This may or may not lead to broken code.
[1795/2221] Building RISCVGenCompressInstEmitter.inc...
warning: Compiler has made implicit assumption that TypeSize is not scalable. This may or may not lead to broken code.
[1802/2221] Building RISCVGenRegisterBank.inc...
warning: Compiler has made implicit assumption that TypeSize is not scalable. This may or may not lead to broken code.
[1803/2221] Building RISCVGenRegisterInfo.inc...
warning: Compiler has made implicit assumption that TypeSize is not scalable. This may or may not lead to broken code.
[1805/2221] Building RISCVGenDAGISel.inc...
warning: Compiler has made implicit assumption that TypeSize is not scalable. This may or may not lead to broken code.
[1810/2221] Building RISCVGenGlobalISel.inc...
warning: Compiler has made implicit assumption that TypeSize is not scalable. This may or may not lead to broken code.
[1813/2221] Building RISCVGenInstrInfo.inc...
warning: Compiler has made implicit assumption that TypeSize is not scalable. This may or may not lead to broken code.

@HsiangKai it would be great if you could take a look and fix or revert, so we avoid more people having to spend time on tracking this down themselves.

Cross-post from db48a6de7702

this appears to cause the following warnings when building LLVM with assertions

[1148/2221] Building RISCVGenAsmMatcher.inc...
warning: Compiler has made implicit assumption that TypeSize is not scalable. This may or may not lead to broken code.
[1793/2221] Building RISCVGenAsmWriter.inc...
warning: Compiler has made implicit assumption that TypeSize is not scalable. This may or may not lead to broken code.
[1795/2221] Building RISCVGenCompressInstEmitter.inc...
warning: Compiler has made implicit assumption that TypeSize is not scalable. This may or may not lead to broken code.
[1802/2221] Building RISCVGenRegisterBank.inc...
warning: Compiler has made implicit assumption that TypeSize is not scalable. This may or may not lead to broken code.
[1803/2221] Building RISCVGenRegisterInfo.inc...
warning: Compiler has made implicit assumption that TypeSize is not scalable. This may or may not lead to broken code.
[1805/2221] Building RISCVGenDAGISel.inc...
warning: Compiler has made implicit assumption that TypeSize is not scalable. This may or may not lead to broken code.
[1810/2221] Building RISCVGenGlobalISel.inc...
warning: Compiler has made implicit assumption that TypeSize is not scalable. This may or may not lead to broken code.
[1813/2221] Building RISCVGenInstrInfo.inc...
warning: Compiler has made implicit assumption that TypeSize is not scalable. This may or may not lead to broken code.

@HsiangKai it would be great if you could take a look and fix or revert, so we avoid more people having to spend time on tracking this down themselves.

I'm guessing this is coming from the NoVReg class computing a Size of 0?

Cross-post from db48a6de7702

this appears to cause the following warnings when building LLVM with assertions

[1148/2221] Building RISCVGenAsmMatcher.inc...
warning: Compiler has made implicit assumption that TypeSize is not scalable. This may or may not lead to broken code.
[1793/2221] Building RISCVGenAsmWriter.inc...
warning: Compiler has made implicit assumption that TypeSize is not scalable. This may or may not lead to broken code.
[1795/2221] Building RISCVGenCompressInstEmitter.inc...
warning: Compiler has made implicit assumption that TypeSize is not scalable. This may or may not lead to broken code.
[1802/2221] Building RISCVGenRegisterBank.inc...
warning: Compiler has made implicit assumption that TypeSize is not scalable. This may or may not lead to broken code.
[1803/2221] Building RISCVGenRegisterInfo.inc...
warning: Compiler has made implicit assumption that TypeSize is not scalable. This may or may not lead to broken code.
[1805/2221] Building RISCVGenDAGISel.inc...
warning: Compiler has made implicit assumption that TypeSize is not scalable. This may or may not lead to broken code.
[1810/2221] Building RISCVGenGlobalISel.inc...
warning: Compiler has made implicit assumption that TypeSize is not scalable. This may or may not lead to broken code.
[1813/2221] Building RISCVGenInstrInfo.inc...
warning: Compiler has made implicit assumption that TypeSize is not scalable. This may or may not lead to broken code.

@HsiangKai it would be great if you could take a look and fix or revert, so we avoid more people having to spend time on tracking this down themselves.

I'm guessing this is coming from the NoVReg class computing a Size of 0?

Indeed, it is caused by NoVReg. I revert it first. I am sorry for the annoying messages caused by my patch.