xref: /minix3/external/bsd/llvm/dist/clang/test/CodeGen/nvptx-abi.c (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1f4a2713aSLionel Sambuc // RUN: %clang_cc1 -triple nvptx-unknown-unknown -S -o - %s -emit-llvm | FileCheck %s
2f4a2713aSLionel Sambuc // RUN: %clang_cc1 -triple nvptx64-unknown-unknown -S -o - %s -emit-llvm | FileCheck %s
3f4a2713aSLionel Sambuc 
4f4a2713aSLionel Sambuc typedef struct float4_s {
5f4a2713aSLionel Sambuc   float x, y, z, w;
6f4a2713aSLionel Sambuc } float4_t;
7f4a2713aSLionel Sambuc 
my_function(void)8*0a6a1f1dSLionel Sambuc float4_t my_function(void) {
9*0a6a1f1dSLionel Sambuc // CHECK-LABEL: define %struct.float4_s @my_function
10*0a6a1f1dSLionel Sambuc   float4_t t;
11*0a6a1f1dSLionel Sambuc   return t;
12*0a6a1f1dSLionel Sambuc };
13f4a2713aSLionel Sambuc 
bar(void)14f4a2713aSLionel Sambuc float bar(void) {
15f4a2713aSLionel Sambuc   float4_t ret;
16*0a6a1f1dSLionel Sambuc // CHECK-LABEL: @bar
17*0a6a1f1dSLionel Sambuc // CHECK: call %struct.float4_s @my_function
18f4a2713aSLionel Sambuc   ret = my_function();
19f4a2713aSLionel Sambuc   return ret.x;
20f4a2713aSLionel Sambuc }
21*0a6a1f1dSLionel Sambuc 
foo(float4_t x)22*0a6a1f1dSLionel Sambuc void foo(float4_t x) {
23*0a6a1f1dSLionel Sambuc // CHECK-LABEL: @foo
24*0a6a1f1dSLionel Sambuc // CHECK: %struct.float4_s* byval %x
25*0a6a1f1dSLionel Sambuc }
26*0a6a1f1dSLionel Sambuc 
fooN(float4_t x,float4_t y,float4_t z)27*0a6a1f1dSLionel Sambuc void fooN(float4_t x, float4_t y, float4_t z) {
28*0a6a1f1dSLionel Sambuc // CHECK-LABEL: @fooN
29*0a6a1f1dSLionel Sambuc // CHECK: %struct.float4_s* byval %x
30*0a6a1f1dSLionel Sambuc // CHECK: %struct.float4_s* byval %y
31*0a6a1f1dSLionel Sambuc // CHECK: %struct.float4_s* byval %z
32*0a6a1f1dSLionel Sambuc }
33*0a6a1f1dSLionel Sambuc 
34*0a6a1f1dSLionel Sambuc typedef struct nested_s {
35*0a6a1f1dSLionel Sambuc   unsigned long long x;
36*0a6a1f1dSLionel Sambuc   float z[64];
37*0a6a1f1dSLionel Sambuc   float4_t t;
38*0a6a1f1dSLionel Sambuc } nested_t;
39*0a6a1f1dSLionel Sambuc 
baz(nested_t x)40*0a6a1f1dSLionel Sambuc void baz(nested_t x) {
41*0a6a1f1dSLionel Sambuc // CHECK-LABEL: @baz
42*0a6a1f1dSLionel Sambuc // CHECK: %struct.nested_s* byval %x)
43*0a6a1f1dSLionel Sambuc }
44