llvm.org GIT mirror llvm / 9830b45
[NVPTX] Fix bugs related to isSingleValueType Summary: With isSingleValueType starting to treat vector types as single-value types, code that uses this interface needs to be updated. Test Plan: vector-global.ll nvcl-param-align.ll Reviewers: jholewinski Reviewed By: jholewinski Subscribers: llvm-commits, meheff, eliben, jholewinski Differential Revision: http://reviews.llvm.org/D6573 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@224440 91177308-0d34-0410-b5e6-96231b3b80d8 Jingyue Wu 5 years ago
3 changed file(s) with 27 addition(s) and 13 deletion(s). Raw diff Collapse all Expand all
11271127 else
11281128 O << " .align " << GVar->getAlignment();
11291129
1130 if (ETy->isSingleValueType()) {
1130 if (ETy->isFloatingPointTy() || ETy->isIntegerTy() || ETy->isPointerTy()) {
11311131 O << " .";
11321132 // Special case: ABI requires that we use .u8 for predicates
11331133 if (ETy->isIntegerTy(1))
13091309 else
13101310 O << " .align " << GVar->getAlignment();
13111311
1312 if (ETy->isSingleValueType()) {
1312 if (ETy->isFloatingPointTy() || ETy->isIntegerTy() || ETy->isPointerTy()) {
13131313 O << " .";
13141314 O << getPTXFundamentalTypeStr(ETy);
13151315 O << " ";
13471347 const ArrayType *ATy = dyn_cast(Ty);
13481348 if (ATy)
13491349 return getOpenCLAlignment(TD, ATy->getElementType());
1350
1351 const VectorType *VTy = dyn_cast(Ty);
1352 if (VTy) {
1353 Type *ETy = VTy->getElementType();
1354 unsigned int numE = VTy->getNumElements();
1355 unsigned int alignE = TD->getPrefTypeAlignment(ETy);
1356 if (numE == 3)
1357 return 4 * alignE;
1358 else
1359 return numE * alignE;
1360 }
13611350
13621351 const StructType *STy = dyn_cast(Ty);
13631352 if (STy) {
0 ; RUN: llc < %s -march=nvptx -mcpu=sm_20 | FileCheck %s
1
2 target triple = "nvptx-unknown-nvcl"
3
4 ; CHECK-LABEL: .entry foo(
5 define void @foo(i64 %img, i64 %sampler, <5 x float>* %v) {
6 ; The parameter alignment should be the next power of 2 of 5xsizeof(float),
7 ; which is 32.
8 ; CHECK: .param .u32 .ptr .align 32 foo_param_2
9 ret void
10 }
11
12 !nvvm.annotations = !{!1, !2, !3}
13 !1 = !{void (i64, i64, <5 x float>*)* @foo, !"kernel", i32 1}
14 !2 = !{void (i64, i64, <5 x float>*)* @foo, !"rdoimage", i32 0}
15 !3 = !{void (i64, i64, <5 x float>*)* @foo, !"sampler", i32 1}
0 ; RUN: llc < %s -march=nvptx64 -mcpu=sm_20 | FileCheck %s
1
2 target datalayout = "e-i64:64-v16:16-v32:32-n16:32:64"
3 target triple = "nvptx64-nvidia-cuda"
4
5 @g1 = external global <4 x i32> ; external global variable
6 ; CHECK: .extern .global .align 16 .b8 g1[16];
7 @g2 = global <4 x i32> zeroinitializer ; module-level global variable
8 ; CHECK: .visible .global .align 16 .b8 g2[16];