forked from llvm/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 333
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[AArch64] Support expression results as immediate values in mov
Summary: This patch adds support of using the result of an expression as an immediate value. For example, 0: .skip 4 1: mov x0, 1b - 0b is assembled to mov x0, #4 Currently it does not support expressions requiring relocation unless explicitly specified. This fixes PR#45781. Reviewers: peter.smith, ostannard, efriedma Reviewed By: efriedma Subscribers: nickdesaulniers, llozano, manojgupta, efriedma, ostannard, kristof.beyls, hiraditya, danielkiss, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D80028
- Loading branch information
Showing
7 changed files
with
94 additions
and
31 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
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
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,16 @@ | ||
// RUN: llvm-mc -triple aarch64-none-linux-gnu %s -filetype=obj -o %t | llvm-objdump --triple aarch64-none-linux-gnu -Dr %t | FileCheck %s | ||
|
||
0: | ||
.skip 4 | ||
1: | ||
mov x0, 1b - 0b | ||
// CHECK: mov x0, #4 | ||
mov x0, 0b - 1b | ||
// CHECK: mov x0, #-4 | ||
mov x0, 0b - 0b | ||
// CHECK: mov x0, #0 | ||
mov x0, 1b - 2 - 0b + 6 | ||
// CHECK: mov x0, #8 | ||
mov x0, #:abs_g0_s:1b | ||
// CHECK: mov x0, #0 | ||
// CHECK-NEXT: R_AARCH64_MOVW_SABS_G0 .text+0x4 |
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,9 @@ | ||
// RUN: llvm-mc -triple aarch64-none-linux-gnu %s -filetype=obj -o %t | llvm-objdump -d %t | FileCheck %s | ||
|
||
0: | ||
.skip 4 | ||
1: | ||
mov x0, 1b - 0b | ||
// CHECK: mov x0, #4 | ||
mov x0, 0b - 1b | ||
// CHECK: mov x0, #-4 |
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,17 @@ | ||
// RUN: not llvm-mc -triple aarch64-none-linux-gnu %s -filetype=obj -o /dev/null 2>&1 | FileCheck %s | ||
|
||
0: | ||
.skip 0x10000 | ||
1: | ||
mov x0, 1b - 0b | ||
// CHECK: error: fixup value out of range | ||
// CHECK: mov x0, 1b - 0b | ||
// CHECK: ^ | ||
mov x0, 0b - 1b | ||
// CHECK: error: fixup value out of range | ||
// CHECK: mov x0, 0b - 1b | ||
// CHECK: ^ | ||
mov x0, 1b | ||
// CHECK: error: invalid fixup for movz/movk instruction | ||
// CHECK: mov x0, 1b | ||
// CHECK: ^ |