llvm.org GIT mirror llvm / 89443ff
[NVPTX] Use ABI alignment for parameters when alignment is not specified. Affects SM 2.0+. Fixes bug 13324. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167646 91177308-0d34-0410-b5e6-96231b3b80d8 Justin Holewinski 7 years ago
2 changed file(s) with 28 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
15241524 // = PAL.getparamalignment
15251525 // size = typeallocsize of element type
15261526 unsigned align = PAL.getParamAlignment(paramIndex+1);
1527 if (align == 0)
1528 align = TD->getABITypeAlignment(ETy);
1529
15271530 unsigned sz = TD->getTypeAllocSize(ETy);
15281531 O << "\t.param .align " << align
15291532 << " .b8 ";
0 ; RUN: llc < %s -march=nvptx -mcpu=sm_20 | FileCheck %s
1
2 ;;; Need 4-byte alignment on float* passed byval
3 define ptx_device void @t1(float* byval %x) {
4 ; CHECK: .func t1
5 ; CHECK: .param .align 4 .b8 t1_param_0[4]
6 ret void
7 }
8
9
10 ;;; Need 8-byte alignment on double* passed byval
11 define ptx_device void @t2(double* byval %x) {
12 ; CHECK: .func t2
13 ; CHECK: .param .align 8 .b8 t2_param_0[8]
14 ret void
15 }
16
17
18 ;;; Need 4-byte alignment on float2* passed byval
19 %struct.float2 = type { float, float }
20 define ptx_device void @t3(%struct.float2* byval %x) {
21 ; CHECK: .func t3
22 ; CHECK: .param .align 4 .b8 t3_param_0[8]
23 ret void
24 }