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
60 lines
2.1 KiB
C
60 lines
2.1 KiB
C
// RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm %s -o - | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-X86-64
|
|
// RUN: %clang_cc1 -triple arm64-linux-gnu -emit-llvm %s -o - | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-ARM
|
|
// RUN: %clang_cc1 -triple armv7-linux-gnu -target-abi apcs-gnu -emit-llvm %s -o - | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-ARM
|
|
|
|
// CHECK-NOT: @sp = common global
|
|
|
|
#if defined(__x86_64__)
|
|
register unsigned long current_stack_pointer asm("rsp");
|
|
#else
|
|
register unsigned long current_stack_pointer asm("sp");
|
|
#endif
|
|
|
|
struct p4_Thread {
|
|
struct {
|
|
int len;
|
|
} word;
|
|
};
|
|
// Testing pointer types as well
|
|
#if defined(__x86_64__)
|
|
register struct p4_Thread *p4TH asm("rsp");
|
|
#else
|
|
register struct p4_Thread *p4TH asm("sp");
|
|
#endif
|
|
|
|
// CHECK: define{{.*}} i[[bits:[0-9]+]] @get_stack_pointer_addr()
|
|
// CHECK: [[ret:%[0-9]+]] = call i[[bits]] @llvm.read_register.i[[bits]](metadata !0)
|
|
// CHECK: ret i[[bits]] [[ret]]
|
|
unsigned long get_stack_pointer_addr(void) {
|
|
return current_stack_pointer;
|
|
}
|
|
// CHECK: declare{{.*}} i[[bits]] @llvm.read_register.i[[bits]](metadata)
|
|
|
|
// CHECK: define{{.*}} void @set_stack_pointer_addr(i[[bits]] noundef %addr) #0 {
|
|
// CHECK: [[sto:%[0-9]+]] = load i[[bits]], ptr %
|
|
// CHECK: call void @llvm.write_register.i[[bits]](metadata !0, i[[bits]] [[sto]])
|
|
// CHECK: ret void
|
|
void set_stack_pointer_addr(unsigned long addr) {
|
|
current_stack_pointer = addr;
|
|
}
|
|
// CHECK: declare{{.*}} void @llvm.write_register.i[[bits]](metadata, i[[bits]])
|
|
|
|
// CHECK: define {{.*}}@fn1
|
|
int fn1(void) {
|
|
return (*p4TH).word.len;
|
|
}
|
|
// CHECK: %[[regr:[0-9]+]] = call i[[bits]] @llvm.read_register.i[[bits]](metadata !0)
|
|
// CHECK: inttoptr i[[bits]] %[[regr]] to ptr
|
|
|
|
// CHECK: define {{.*}}@fn2
|
|
void fn2(struct p4_Thread *val) {
|
|
p4TH = val;
|
|
}
|
|
// CHECK: %[[regw:[0-9]+]] = ptrtoint ptr %{{.*}} to i[[bits]]
|
|
// CHECK: call void @llvm.write_register.i[[bits]](metadata !0, i[[bits]] %[[regw]])
|
|
|
|
// CHECK-X86-64: !llvm.named.register.rsp = !{!0}
|
|
// CHECK-X86-64: !0 = !{!"rsp"}
|
|
// CHECK-ARM: !llvm.named.register.sp = !{!0}
|
|
// CHECK-ARM: !0 = !{!"sp"}
|