GAS support immediate operand for those instructions without i suffix.
Details
Diff Detail
Event Timeline
test/MC/RISCV/rvi-aliases-valid.s | ||
---|---|---|
179 | This test should print the canonical version of the instruction, you are printing the Alias. |
test/MC/RISCV/rvi-aliases-valid.s | ||
---|---|---|
179 | Those alias instructions always disassemble to i version in GAS even -M no-aliases is given, my thought is keep the behavior with GAS. |
Thanks Kito, I've added a couple of comments. I think the main issue is the pattern for the shift amount immediate, which means invalid assembly is accepted.
lib/Target/RISCV/RISCVInstrInfo.td | ||
---|---|---|
562–567 | These should use uimmlog2xlen for the shift amount. When fixing this, could you please also add tests that demonstrate the range checks are correct (adding to rv32i-aliases-invalid.s and rv64i-aliases-invalid.s)? | |
test/MC/RISCV/rvi-aliases-valid.s | ||
179 | Yes, we should match gas here. Perhaps add a comment to this test like "The following aliases are accepted as input but the canonical form of the instruction will always be printed." |
Thanks Kito. This patch breaks rv32i-invalid.s as the error message for add a1, a2, (a3) changes. Could you adjust that test too please?
It probably makes most sense to use 32 as the shamt in the relevant tests in rv32i-aliases-invalid.s and rv64i-aliases-invalid.s
Changes:
- Update testcase for rv32i-aliases-invalid.s and rv64i-aliases-invalid.s
- Fix rv32i-invalid.s
These should use uimmlog2xlen for the shift amount. When fixing this, could you please also add tests that demonstrate the range checks are correct (adding to rv32i-aliases-invalid.s and rv64i-aliases-invalid.s)?