xref: /minix3/external/bsd/llvm/dist/clang/test/CodeGenOpenCL/addr-space-struct-arg.cl (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1*f4a2713aSLionel Sambuc// RUN: %clang_cc1 %s -emit-llvm -o - -O0 -ffake-address-space-map -triple i686-pc-darwin | FileCheck %s
2*f4a2713aSLionel Sambuc
3*f4a2713aSLionel Sambuctypedef struct {
4*f4a2713aSLionel Sambuc  int cells[9];
5*f4a2713aSLionel Sambuc} Mat3X3;
6*f4a2713aSLionel Sambuc
7*f4a2713aSLionel Sambuctypedef struct {
8*f4a2713aSLionel Sambuc  int cells[16];
9*f4a2713aSLionel Sambuc} Mat4X4;
10*f4a2713aSLionel Sambuc
11*f4a2713aSLionel SambucMat4X4 __attribute__((noinline)) foo(Mat3X3 in) {
12*f4a2713aSLionel Sambuc  Mat4X4 out;
13*f4a2713aSLionel Sambuc  return out;
14*f4a2713aSLionel Sambuc}
15*f4a2713aSLionel Sambuc
16*f4a2713aSLionel Sambuckernel void ker(global Mat3X3 *in, global Mat4X4 *out) {
17*f4a2713aSLionel Sambuc  out[0] = foo(in[1]);
18*f4a2713aSLionel Sambuc}
19*f4a2713aSLionel Sambuc
20*f4a2713aSLionel Sambuc// Expect two mem copies: one for the argument "in", and one for
21*f4a2713aSLionel Sambuc// the return value.
22*f4a2713aSLionel Sambuc// CHECK: call void @llvm.memcpy.p0i8.p1i8.i32(i8*
23*f4a2713aSLionel Sambuc// CHECK: call void @llvm.memcpy.p1i8.p0i8.i32(i8 addrspace(1)*
24