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