1 // RUN: %clang_cc1 --std=c++11 -triple x86_64-unknown-linux-gnu -emit-llvm -o - %s | \
2 // RUN: FileCheck -check-prefix HOST -check-prefix CHECK %s
4 // RUN: %clang_cc1 --std=c++11 -fcuda-is-device -triple nvptx64-nvidia-cuda \
5 // RUN: -emit-llvm -o - %s | FileCheck -check-prefix DEVICE -check-prefix CHECK %s
7 #include "Inputs/cuda.h"
11 } __attribute__((packed));
19 // Clang should generate a packed LLVM struct for S (denoted by the <>s),
20 // otherwise this test isn't interesting.
21 // CHECK: %struct.S = type <{ i32*, i8, %struct.U, [5 x i8] }>
23 static_assert(alignof(S) == 8, "Unexpected alignment.");
25 // HOST-LABEL: @_Z6kernelc1SPi
26 // Marshalled kernel args should be:
27 // 1. offset 0, width 1
28 // 2. offset 8 (because alignof(S) == 8), width 16
29 // 3. offset 24, width 8
30 // HOST: call i32 @cudaSetupArgument({{[^,]*}}, i64 1, i64 0)
31 // HOST: call i32 @cudaSetupArgument({{[^,]*}}, i64 16, i64 8)
32 // HOST: call i32 @cudaSetupArgument({{[^,]*}}, i64 8, i64 24)
34 // DEVICE-LABEL: @_Z6kernelc1SPi
35 // DEVICE-SAME: i8{{[^,]*}}, %struct.S* byval align 8{{[^,]*}}, i32*
36 __global__ void kernel(char a, S s, int *b) {}