Files
TheRock/compiler/amd-llvm/bolt/test/AArch64/ldr-relaxation.s
T
derek.holloway 7502bf64a4
CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

146 lines
3.3 KiB
ArmAsm

## Check that LDR relaxation will fail since LDR is inside a non-simple
## function and there is no NOP next to it.
# RUN: llvm-mc -filetype=obj -triple aarch64-unknown-unknown \
# RUN: --defsym FAIL=1 %s -o %t.o
# RUN: %clang %cflags %t.o -o %t.so -Wl,-q
# RUN: not llvm-bolt %t.so -o %t.bolt 2>&1 | FileCheck %s --check-prefix=FAIL
# FAIL: BOLT-ERROR: cannot relax LDR in non-simple function _start
.ifdef FAIL
.text
.global _start
.type _start, %function
_start:
.cfi_startproc
br x2
ldr x0, _foo
ret
.cfi_endproc
.size _start, .-_start
.endif
## Check that LDR relaxation is not needed since the reference is not far away.
# RUN: llvm-mc -filetype=obj -triple aarch64-unknown-unknown \
# RUN: --defsym NOT_NEEDED=1 %s -o %t.o
# RUN: %clang %cflags %t.o -o %t.so -Wl,-q
# RUN: llvm-bolt %t.so -o %t.bolt
# RUN: llvm-objdump -d %t.bolt | FileCheck %s --check-prefix=NOT_NEEDED
# NOT_NEEDED: <_start>
# NOT_NEEDED-NEXT: ldr
.ifdef NOT_NEEDED
.text
.global _start
.type _start, %function
_start:
.cfi_startproc
ldr x0, _start
ret
.cfi_endproc
.size _start, .-_start
.endif
## Check that LDR relaxation is done in a simple function, where NOP will
## be inserted as needed.
# RUN: llvm-mc -filetype=obj -triple aarch64-unknown-unknown \
# RUN: --defsym RELAX_SIMPLE=1 %s -o %t.o
# RUN: %clang %cflags %t.o -o %t.so -Wl,-q
# RUN: llvm-bolt %t.so -o %t.bolt
# RUN: llvm-objdump -d %t.bolt | FileCheck %s --check-prefix=RELAX
# RELAX: adrp
# RELAX-NEXT: ldr
.ifdef RELAX_SIMPLE
.text
.global _start
.type _start, %function
_start:
.cfi_startproc
ldr x0, _foo
ret
.cfi_endproc
.size _start, .-_start
.endif
## Check that LDR relaxation is done in a non-simple function, where NOP
## exists next to LDR.
# RUN: llvm-mc -filetype=obj -triple aarch64-unknown-unknown \
# RUN: --defsym RELAX_NON_SIMPLE=1 %s -o %t.o
# RUN: %clang %cflags %t.o -o %t.so -Wl,-q
# RUN: llvm-bolt %t.so -o %t.bolt
# RUN: llvm-objdump -d %t.bolt | FileCheck %s --check-prefix=RELAX
.ifdef RELAX_NON_SIMPLE
.text
.global _start
.type _start, %function
_start:
.cfi_startproc
br x2
ldr x0, _foo
nop
ret
.cfi_endproc
.size _start, .-_start
.endif
## Check LDR relaxation works on loading W (low 32-bit of X) registers.
# RUN: llvm-mc -filetype=obj -triple aarch64-unknown-unknown \
# RUN: --defsym RELAX_SIMPLE_WREG=1 %s -o %t.o
# RUN: %clang %cflags %t.o -o %t.so -Wl,-q
# RUN: llvm-bolt %t.so -o %t.bolt
# RUN: llvm-objdump -d %t.bolt | FileCheck %s --check-prefix=RELAXW
# RELAXW: adrp x0
# RELAXW-NEXT: ldr w0
.ifdef RELAX_SIMPLE_WREG
.text
.global _start
.type _start, %function
_start:
.cfi_startproc
ldr w0, _foo
ret
.cfi_endproc
.size _start, .-_start
.endif
## Check LDR relaxation works on LDRSW (literal)
# RUN: llvm-mc -filetype=obj -triple aarch64-unknown-unknown \
# RUN: --defsym RELAX_SIMPLE_LDRSW=1 %s -o %t.o
# RUN: %clang %cflags %t.o -o %t.so -Wl,-q
# RUN: llvm-bolt %t.so -o %t.bolt
# RUN: llvm-objdump -d %t.bolt | FileCheck %s --check-prefix=RELAX_LDRSW
# RELAX_LDRSW: adrp
# RELAX_LDRSW-NEXT: ldrsw
.ifdef RELAX_SIMPLE_LDRSW
.text
.global _start
.type _start, %function
_start:
.cfi_startproc
ldrsw x0, _foo
ret
.cfi_endproc
.size _start, .-_start
.endif
.section .text_cold
.global _foo
.align 3
_foo:
.long 0x12345678
.size _foo, .-_foo