brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.6 KiB · 57c1e58 Raw
42 lines · plain
1; RUN: opt < %s -S -nvptx-lower-alloca -infer-address-spaces | FileCheck %s2; RUN: opt < %s -S -nvptx-lower-alloca | FileCheck %s --check-prefix LOWERALLOCAONLY3; RUN: llc < %s -mtriple=nvptx64 -mcpu=sm_35 | FileCheck %s --check-prefix PTX4; RUN: %if ptxas %{ llc < %s -mtriple=nvptx64 -mcpu=sm_35 | %ptxas-verify %}5 6target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v16:16:16-v32:32:32-v64:64:64-v128:128:128-n16:32:64"7target triple = "nvptx64-unknown-unknown"8 9define ptx_kernel void @kernel() {10; LABEL: @lower_alloca11; PTX-LABEL: .visible .entry kernel(12  %A = alloca i3213; CHECK: addrspacecast ptr %A to ptr addrspace(5)14; CHECK: store i32 0, ptr addrspace(5) {{%.+}}15; LOWERALLOCAONLY: [[V1:%.*]] = addrspacecast ptr %A to ptr addrspace(5)16; LOWERALLOCAONLY: [[V2:%.*]] = addrspacecast ptr addrspace(5) [[V1]] to ptr17; LOWERALLOCAONLY: store i32 0, ptr [[V2]], align 418; PTX: st.local.b32 [{{%rd[0-9]+}}], 019  store i32 0, ptr %A20  call void @callee(ptr %A)21  ret void22}23 24define void @alloca_in_explicit_local_as() {25; LABEL: @lower_alloca_addrspace526; PTX-LABEL: .visible .func alloca_in_explicit_local_as(27  %A = alloca i32, addrspace(5)28; CHECK: store i32 0, ptr addrspace(5) {{%.+}}29; PTX: st.local.b32 [%SP], 030; LOWERALLOCAONLY: [[V1:%.*]] = addrspacecast ptr addrspace(5) %A to ptr31; LOWERALLOCAONLY: store i32 0, ptr [[V1]], align 432  store i32 0, ptr addrspace(5) %A33  call void @callee(ptr addrspace(5) %A)34  ret void35}36 37declare void @callee(ptr)38declare void @callee_addrspace5(ptr addrspace(5))39 40!nvvm.annotations = !{!1}41!1 = !{ptr @alloca_in_explicit_local_as, !"alloca_in_explicit_local_as", i32 1}42