Page MenuHomePhabricator

[RISCV][MC] Accept %lo and %pcrel_lo on operands to li
AbandonedPublic

Authored by asb on Sep 20 2018, 6:09 AM.

Details

Reviewers
apazos
shiva0217
Summary

This matches GNU assembler behaviour.

Diff Detail

Event Timeline

asb created this revision.Sep 20 2018, 6:09 AM

Alex, I was looking at why the fuzzer did not detect this issue (the constrained fuzzer was not generating the modifier, but the unconstrained fuzzer is and should have generated that test case).

In the process I ran into this other example that the llvm assembler fails to assemble, but GAS is able to assemble.

echo "li x0,%lo(4)" |llvm-mc -triple riscv32

.text

<stdin>:1:12: error: immediate must be an integer in the range [-2147483648, 4294967295]
li x0,%lo(4)

With your patch, this example works fine. You might want to add a test case for it.

asb updated this revision to Diff 166419.Sep 21 2018, 2:23 AM

Thanks Ana, it was indeed intentional that this patch allows li a0, %lo(1234) but the test coverage was lacking. Updated to improve tests.

LGTM. Thanks for adding the test case.

asb updated this revision to Diff 180066.Jan 3 2019, 6:44 AM

Rebasing patch so it is no longer dependent on D52298

asb added a comment.Jan 3 2019, 6:46 AM

Closed by rL350321 (sorry, forgot to mention this review in the commit message).

asb abandoned this revision.Jan 3 2019, 6:47 AM