llvm.org GIT mirror llvm / a12cd23
Merging r182253: ------------------------------------------------------------------------ r182253 | jholewinski | 2013-05-20 05:13:28 -0700 (Mon, 20 May 2013) | 1 line [NVPTX] Fix i1 kernel parameters and global variables. ABI rules say we need to use .u8 for i1 parameters for kernels. ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_33@182825 91177308-0d34-0410-b5e6-96231b3b80d8 Bill Wendling 7 years ago
3 changed file(s) with 49 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
11981198
11991199 if (ETy->isPrimitiveType() || ETy->isIntegerTy() || isa(ETy)) {
12001200 O << " .";
1201 O << getPTXFundamentalTypeStr(ETy, false);
1201 // Special case: ABI requires that we use .u8 for predicates
1202 if (ETy->isIntegerTy(1))
1203 O << "u8";
1204 else
1205 O << getPTXFundamentalTypeStr(ETy, false);
12021206 O << " ";
12031207 O << *Mang->getSymbol(GVar);
12041208
15631567 }
15641568
15651569 // non-pointer scalar to kernel func
1566 O << "\t.param ." << getPTXFundamentalTypeStr(Ty) << " ";
1570 O << "\t.param .";
1571 // Special case: predicate operands become .u8 types
1572 if (Ty->isIntegerTy(1))
1573 O << "u8";
1574 else
1575 O << getPTXFundamentalTypeStr(Ty);
1576 O << " ";
15671577 printParamName(I, paramIndex, O);
15681578 continue;
15691579 }
0 ; RUN: llc < %s -march=nvptx -mcpu=sm_20 -drvcuda | FileCheck %s
1
2 target datalayout = "e-p:32:32:32-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"
3
4
5 ; CHECK: .visible .global .align 1 .u8 mypred
6 @mypred = addrspace(1) global i1 true, align 1
7
8
9 define void @foo(i1 %p, i32* %out) {
10 %ld = load i1 addrspace(1)* @mypred
11 %val = zext i1 %ld to i32
12 store i32 %val, i32* %out
13 ret void
14 }
15
16
17 !nvvm.annotations = !{!0}
18 !0 = metadata !{void (i1, i32*)* @foo, metadata !"kernel", i32 1}
0 ; RUN: llc < %s -march=nvptx -mcpu=sm_20 -drvcuda | FileCheck %s
1
2 target datalayout = "e-p:32:32:32-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"
3
4 ; Make sure predicate (i1) operands to kernels get expanded out to .u8
5
6 ; CHECK: .entry foo
7 ; CHECK: .param .u8 foo_param_0
8 ; CHECK: .param .u32 foo_param_1
9 define void @foo(i1 %p, i32* %out) {
10 %val = zext i1 %p to i32
11 store i32 %val, i32* %out
12 ret void
13 }
14
15
16 !nvvm.annotations = !{!0}
17 !0 = metadata !{void (i1, i32*)* @foo, metadata !"kernel", i32 1}