annotate llvm/test/CodeGen/AMDGPU/addrspacecast-captured.ll @ 252:1f2b6ac9f198 llvm-original

LLVM16-1
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Fri, 18 Aug 2023 09:04:13 +0900
parents 1d019706d866
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
252
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
1 ; RUN: opt -S -mtriple=amdgcn-unknown-amdhsa -mcpu=kaveri -passes=amdgpu-promote-alloca < %s | FileCheck %s
150
anatofuz
parents:
diff changeset
2 ; Nothing should be done if the addrspacecast is captured.
anatofuz
parents:
diff changeset
3
252
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
4 target datalayout = "e-p:64:64-p1:64:64-p2:32:32-p3:32:32-p4:64:64-p5:32:32-p6:32:32-p7:160:256:256:32-p8:128:128-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64-S32-A5"
150
anatofuz
parents:
diff changeset
5
anatofuz
parents:
diff changeset
6 declare void @consume_ptr2int(i32) #0
anatofuz
parents:
diff changeset
7
anatofuz
parents:
diff changeset
8 ; CHECK-LABEL: @addrspacecast_captured(
anatofuz
parents:
diff changeset
9 ; CHECK: %data = alloca i32, align 4, addrspace(5)
252
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
10 ; CHECK: %cast = addrspacecast ptr addrspace(5) %data to ptr
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
11 ; CHECK: %ptr2int = ptrtoint ptr %cast to i32
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
12 ; CHECK: store i32 %ptr2int, ptr addrspace(1) %out
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
13 define amdgpu_kernel void @addrspacecast_captured(ptr addrspace(1) %out) #0 {
150
anatofuz
parents:
diff changeset
14 entry:
anatofuz
parents:
diff changeset
15 %data = alloca i32, align 4, addrspace(5)
252
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
16 %cast = addrspacecast ptr addrspace(5) %data to ptr
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
17 %ptr2int = ptrtoint ptr %cast to i32
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
18 store i32 %ptr2int, ptr addrspace(1) %out
150
anatofuz
parents:
diff changeset
19 ret void
anatofuz
parents:
diff changeset
20 }
anatofuz
parents:
diff changeset
21
anatofuz
parents:
diff changeset
22 ; CHECK-LABEL: @addrspacecast_captured_store(
anatofuz
parents:
diff changeset
23 ; CHECK: %data = alloca i32, align 4, addrspace(5)
252
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
24 ; CHECK: %cast = addrspacecast ptr addrspace(5) %data to ptr
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
25 ; CHECK: store ptr %cast, ptr addrspace(1) %out
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
26 define amdgpu_kernel void @addrspacecast_captured_store(ptr addrspace(1) %out) #0 {
150
anatofuz
parents:
diff changeset
27 entry:
anatofuz
parents:
diff changeset
28 %data = alloca i32, align 4, addrspace(5)
252
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
29 %cast = addrspacecast ptr addrspace(5) %data to ptr
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
30 store ptr %cast, ptr addrspace(1) %out
150
anatofuz
parents:
diff changeset
31 ret void
anatofuz
parents:
diff changeset
32 }
anatofuz
parents:
diff changeset
33
anatofuz
parents:
diff changeset
34 ; CHECK-LABEL: @addrspacecast_captured_call(
anatofuz
parents:
diff changeset
35 ; CHECK: %data = alloca i32, align 4, addrspace(5)
252
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
36 ; CHECK: %cast = addrspacecast ptr addrspace(5) %data to ptr
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
37 ; CHECK: %ptr2int = ptrtoint ptr %cast to i32
150
anatofuz
parents:
diff changeset
38 ; CHECK: call void @consume_ptr2int(i32 %ptr2int)
anatofuz
parents:
diff changeset
39 define amdgpu_kernel void @addrspacecast_captured_call() #0 {
anatofuz
parents:
diff changeset
40 entry:
anatofuz
parents:
diff changeset
41 %data = alloca i32, align 4, addrspace(5)
252
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
42 %cast = addrspacecast ptr addrspace(5) %data to ptr
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
43 %ptr2int = ptrtoint ptr %cast to i32
150
anatofuz
parents:
diff changeset
44 call void @consume_ptr2int(i32 %ptr2int)
anatofuz
parents:
diff changeset
45 ret void
anatofuz
parents:
diff changeset
46 }
anatofuz
parents:
diff changeset
47
anatofuz
parents:
diff changeset
48 attributes #0 = { nounwind }