2020-06-09 20:18:37 +08:00
|
|
|
// RUN: llvm-mc -triple aarch64-none-linux-gnu %s -filetype=obj -o %t
|
|
|
|
// RUN: llvm-objdump --triple aarch64-none-linux-gnu -Dr %t | FileCheck %s
|
[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
2020-06-09 08:56:46 +08:00
|
|
|
|
|
|
|
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
|