Files
TheRock/compiler/amd-llvm/llvm/test/CodeGen/RISCV/large-codemodel-sections.ll
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

110 lines
3.2 KiB
LLVM

; RUN: llc -mtriple=riscv64 -mattr=+f,+zfh -target-abi=lp64f -code-model=large -verify-machineinstrs < %s \
; RUN: -riscv-lower-fpimm-cost=0 -filetype=obj -o - | llvm-readobj -r - \
; RUN: | FileCheck %s
; RUN: llc -mtriple=riscv64 -mattr=+zfinx,+zhinx -target-abi=lp64 -code-model=large -verify-machineinstrs < %s \
; RUN: -riscv-lower-fpimm-cost=0 -filetype=obj -o - | llvm-readobj -r - \
; RUN: | FileCheck %s
; RUN: llc -mtriple=riscv64 -mattr=+f,+zfh -target-abi=lp64f -code-model=large -verify-machineinstrs --function-sections < %s \
; RUN: -riscv-lower-fpimm-cost=0 -filetype=obj -o - | llvm-readobj -r - \
; RUN: | FileCheck %s --check-prefix=FUNCSEC
;; This tests that we are lowering large code model constants into `.text`
;; constant pools, so that accessing them is close to `.text`, rather than
;; far away in `.data`. The other choices are `.rodata` and `.data.rel.ro`,
;; both of which may not be close enough to `.text` to be referenced.
;;
;; The test uses `readobj` to check that there are relocations against the
;; `.text` section for these addresses. This is not compatible with PIC,
;; just like the rest of the large code model.
; CHECK: Section (3) .rela.text {
; CHECK-NEXT: R_RISCV_64 G 0x0
; CHECK-NEXT: R_RISCV_64 addr 0x0
; CHECK-NEXT: R_RISCV_64 W 0x0
; CHECK-NEXT: R_RISCV_64 X 0x0
; CHECK-NEXT: }
; FUNCSEC: Section (4) .rela.text.lower_global {
; FUNCSEC-NEXT: 0x0 R_RISCV_64 G 0x0
; FUNCSEC-NEXT: }
; FUNCSEC: Section (6) .rela.text.lower_blockaddress {
; FUNCSEC-NEXT: 0x0 R_RISCV_64 addr 0x0
; FUNCSEC-NEXT: }
; FUNCSEC: Section (10) .rela.text.lower_extern_weak {
; FUNCSEC-NEXT: 0x0 R_RISCV_64 W 0x0
; FUNCSEC-NEXT: }
; FUNCSEC: Section (12) .rela.text.lower_global_half {
; FUNCSEC-NEXT: 0x0 R_RISCV_64 X 0x0
; FUNCSEC-NEXT: }
; Check lowering of globals
@G = global i32 0
define i32 @lower_global(i32 %a) nounwind {
%1 = load volatile i32, ptr @G
ret i32 %1
}
; Check lowering of blockaddresses
@addr = global ptr null
define void @lower_blockaddress() nounwind {
store volatile ptr blockaddress(@lower_blockaddress, %block), ptr @addr
ret void
block:
unreachable
}
; Check lowering of blockaddress that forces a displacement to be added
define signext i32 @lower_blockaddress_displ(i32 signext %w) nounwind {
entry:
%x = alloca ptr, align 8
store ptr blockaddress(@lower_blockaddress_displ, %test_block), ptr %x, align 8
%cmp = icmp sgt i32 %w, 100
br i1 %cmp, label %if.then, label %if.end
if.then:
%addr = load ptr, ptr %x, align 8
br label %indirectgoto
if.end:
br label %return
test_block:
br label %return
return:
%retval = phi i32 [ 3, %if.end ], [ 4, %test_block ]
ret i32 %retval
indirectgoto:
indirectbr ptr %addr, [ label %test_block ]
}
; Check lowering of constantpools
define float @lower_constantpool(float %a) nounwind {
%1 = fadd float %a, 1.000244140625
ret float %1
}
; Check lowering of extern_weaks
@W = extern_weak global i32
define i32 @lower_extern_weak(i32 %a) nounwind {
%1 = load volatile i32, ptr @W
ret i32 %1
}
@X = global half 1.5
define half @lower_global_half(half %a) nounwind {
%b = load half, ptr @X
%1 = fadd half %a, %b
ret half %1
}
define half @lower_cp_half(half %a) nounwind {
%b = fadd half %a, 0xH3D17
ret half %b
}