This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] def cm.jt as an alias inst of cm.jalt
AbandonedPublic

Authored by VincentWu on May 4 2023, 3:45 AM.

Details

Summary

This use InstAlias to fix the Decoding Conflict between cm.jt and cm.jalt.

The spec of Zc* defines cm.jt and cm.jalt has same encoding, the inst will be decode as cm.jt if $index < 32, it will be decode as cm.jalt in other cases.

In previous implemention, it defined two separate instractions with same encoding. But there is no error when compiling.

but it will report Decoding Conflict when we define cm.mva01s in https://reviews.llvm.org/D132819 .

After testing, I think it may because decoding conflict between cm.jt and cm.jalt. Although it dosen't report error promptly. (I think it might be a issue when generating RISCVGenDisassemblerTables.inc)

Diff Detail

Event Timeline

VincentWu created this revision.May 4 2023, 3:45 AM
VincentWu requested review of this revision.May 4 2023, 3:45 AM

I'm not sure this is the correct fix. The issue seems to be that we didn't isolate C_FSDSP and ZCmp/ZCmt instructions into separate DecoderNamespaces.

Doesn't this point out that the original patch was bogus in allowing you to write cm.jalt 1 despite it really being cm.jt 1, a different instruction with observably different semantics?

jrtc27 requested changes to this revision.May 4 2023, 11:48 AM
This revision now requires changes to proceed.May 4 2023, 11:48 AM

Doesn't this point out that the original patch was bogus in allowing you to write cm.jalt 1 despite it really being cm.jt 1, a different instruction with observably different semantics?

I'll fix the DecoderNamespace. I might look at fixing the other issue.

I'm somewhat surprised TableGen didn't catch that to be honest, though...

I'm somewhat surprised TableGen didn't catch that to be honest, though...

Here's the conflict

CM_JALT 101000________10
CM_JT 101000000_____10
CM_MVA01S 101011___11___10
CM_MVSA01 101011___01___10
C_FSDSP 101___________10

As far as tablegen is concerned, the _ parts could be immediates that have custom decoders that only allow values that don't conflict. I think.

D149891 adds a DecoderNamespace to Zcmt instructions.

VincentWu abandoned this revision.May 5 2023, 1:16 AM