[PATCH] D150133: [RISCV] Support constant immediate for la pseudo instruction

Jessica Clarke via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 11 07:48:36 PDT 2023


jrtc27 added a comment.

In D150133#4334953 <https://reviews.llvm.org/D150133#4334953>, @garvitgupta08 wrote:

> In D150133#4334850 <https://reviews.llvm.org/D150133#4334850>, @jrtc27 wrote:
>
>> Using AUIPC to generate an absolute address (which is how GNU people seem to justify this ugly ability) sounds wrong
>
> To be on the same page - GCC expands this instruction as what it does with li i.e. GCC expands it into lui + addi pair. But since spec mentions auipc + addi, therefore I have used that.

GCC doesn't do anything with assembly, it's binutils's assembler that expands pseudos. And the spec says auipc+addi or auipc+l[wd], because it's in the context of getting a symbol's address, it doesn't document being able to pass an immediate argument at all, which does not make sense to generate with auipc + addi. So don't; it's completely broken. At which point, just reuse the expansion for li.

You'll also need to see which of la, lla and lga support an immediate in order to determine where this needs to be handled.

And please upload your diffs with full context per https://llvm.org/docs/DeveloperPolicy.html#making-and-submitting-a-patch.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D150133/new/

https://reviews.llvm.org/D150133



More information about the llvm-commits mailing list