[PATCH] D60657: [RISCV] Fix evaluation of %pcrel_lo

James Clarke via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 31 06:09:13 PDT 2019


jrtc27 added a comment.

In D60657#1475609 <https://reviews.llvm.org/D60657#1475609>, @lewis-revill wrote:

> Thanks for this. I realize D58843 <https://reviews.llvm.org/D58843> is a very heavy-handed approach so I'd be happy if we could avoid it cleanly with target-specific changes, however I'm not certain we would be able to cover all the combinations we would need to with patches like this?
>
> For example would we be able to cover pairs that occur out of order?


Yes, this seems to work just fine with them:

  % cat pcrel-lohi.s
  foo:
      j 1f
  0:  addi a0, a0, %pcrel_lo(1f)
      ret
  1: auipc a0, %pcrel_hi(bar)
      j 0b
  
  .align 2
  bar:
  % llvm-mc -filetype=obj -triple riscv32 pcrel-lohi.s | llvm-objdump -d -r -
  
  <stdin>:        file format ELF32-riscv
  
  Disassembly of section .text:
  0000000000000000 foo:
         0:       6f 00 c0 00     j       12
         4:       13 05 85 00     addi    a0, a0, 8
         8:       67 80 00 00     ret
         c:       17 05 00 00     auipc   a0, 0
        10:       6f f0 5f ff     j       -12


Repository:
  rL LLVM

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

https://reviews.llvm.org/D60657





More information about the llvm-commits mailing list