diff options
author | Sam Elliott <quic_aelliott@quicinc.com> | 2025-02-25 11:12:08 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-02-25 11:12:08 -0800 |
commit | c8136da26c56f44ab6a217853c58f79b88ceeb97 (patch) | |
tree | 1e1b74ff09c0829aa0ddc5420cc27814280e88b2 /clang/lib/CodeGen/CodeGenModule.cpp | |
parent | 9102afcd0146e4e0be7e10ecd6a2537a6960cfcd (diff) | |
download | llvm-c8136da26c56f44ab6a217853c58f79b88ceeb97.zip llvm-c8136da26c56f44ab6a217853c58f79b88ceeb97.tar.gz llvm-c8136da26c56f44ab6a217853c58f79b88ceeb97.tar.bz2 |
[RISCV] Correctly Decode Unsigned Immediates with Ranges (#128584)
We currently have two operands upstream that are an unsigned immediate
with a range constraint - `uimm8ge32` (for `cm.jalt`) and `uimm5gt3`
(for `qc.shladd`).
Both of these were using `decodeUImmOperand<N>` for decoding. For `Zcmt`
this worked, because the generated decoder automatically checked for
`cm.jt` first because the 8 undefined bits in `cm.jalt` are `000?????`
in `cm.jt` (this is to do with the range lower-bound being a
power-of-two). For Zcmt, this patch is NFC.
We have less luck with `Xqciac` - `qc.shladd` is being decoded where the
`uimm5` field is 3 or lower. This patch fixes this by introducing a
`decodeUImmOperandGE<Width, LowerBound>` helper, which will corretly
return `MCDisassembler::Fail` when the immediate is below the lower
bound.
I have added a test to show the encoding where `uimm5` is equal to 3 is
no longer disassembled as `qc.shladd`.
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
0 files changed, 0 insertions, 0 deletions