forked from GPUOpen-Drivers/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merged master:41449c58c58 into amd-gfx:94d9f17da94
Local branch amd-gfx 94d9f17 Merged master:0f88caeef8f into amd-gfx:fea644ea3cc Remote branch master 41449c5 [RISCV] Fix evaluation of %pcrel_lo
- Loading branch information
Showing
2 changed files
with
59 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# RUN: llvm-mc -triple riscv32 -mattr=-relax -filetype obj %s \ | ||
# RUN: | llvm-objdump -M no-aliases -d -r - \ | ||
# RUN: | FileCheck --check-prefix NORELAX %s | ||
# RUN: llvm-mc -triple riscv32 -mattr=+relax -filetype obj %s \ | ||
# RUN: | llvm-objdump -M no-aliases -d -r - \ | ||
# RUN: | FileCheck --check-prefix RELAX %s | ||
# RUN: llvm-mc -triple riscv64 -mattr=-relax -filetype obj %s \ | ||
# RUN: | llvm-objdump -M no-aliases -d -r - \ | ||
# RUN: | FileCheck --check-prefix NORELAX %s | ||
# RUN: llvm-mc -triple riscv64 -mattr=+relax -filetype obj %s \ | ||
# RUN: | llvm-objdump -M no-aliases -d -r - \ | ||
# RUN: | FileCheck --check-prefix RELAX %s | ||
|
||
# Fixups for %pcrel_hi / %pcrel_lo can be evaluated within a section, | ||
# regardless of the fragment containing the target address. | ||
|
||
function: | ||
.Lpcrel_label1: | ||
auipc a0, %pcrel_hi(other_function) | ||
addi a1, a0, %pcrel_lo(.Lpcrel_label1) | ||
# NORELAX: auipc a0, 0 | ||
# NORELAX-NOT: R_RISCV | ||
# NORELAX: addi a1, a0, 16 | ||
# NORELAX-NOT: R_RISCV | ||
|
||
# RELAX: auipc a0, 0 | ||
# RELAX: R_RISCV_PCREL_HI20 other_function | ||
# RELAX: R_RISCV_RELAX *ABS* | ||
# RELAX: addi a1, a0, 0 | ||
# RELAX: R_RISCV_PCREL_LO12_I .Lpcrel_label1 | ||
# RELAX: R_RISCV_RELAX *ABS* | ||
|
||
.p2align 2 # Cause a new fragment be emitted here | ||
.Lpcrel_label2: | ||
auipc a0, %pcrel_hi(other_function) | ||
addi a1, a0, %pcrel_lo(.Lpcrel_label2) | ||
# NORELAX: auipc a0, 0 | ||
# NORELAX-NOT: R_RISCV | ||
# NORELAX: addi a1, a0, 8 | ||
# NORELAX-NOT: R_RISCV | ||
|
||
# RELAX: auipc a0, 0 | ||
# RELAX: R_RISCV_PCREL_HI20 other_function | ||
# RELAX: R_RISCV_RELAX *ABS* | ||
# RELAX: addi a1, a0, 0 | ||
# RELAX: R_RISCV_PCREL_LO12_I .Lpcrel_label2 | ||
# RELAX: R_RISCV_RELAX *ABS* | ||
|
||
.type other_function,@function | ||
other_function: | ||
ret | ||
|