Skip to content

Commit ae53a73

Browse files
committed
Add compiler test.
1 parent 6897ba4 commit ae53a73

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
// RUN: %clang_cc1 -triple native_cpu -aux-triple x86_64-unknown-linux-gnu -fsycl-is-device -emit-llvm -o - %s | FileCheck %s
2+
3+
struct S {
4+
char c;
5+
short s;
6+
};
7+
using short16 = short __attribute__((ext_vector_type(16)));
8+
9+
__attribute__((sycl_device))
10+
S foo(short16, S);
11+
12+
__attribute__((sycl_device, libclc_call))
13+
S bar(short16, S);
14+
15+
// CHECK: define noundef <16 x i16> @_Z3bazRDv16_sR1S(ptr noundef nonnull align 32 dereferenceable(32) %x, ptr noundef nonnull align 2 dereferenceable(4) %y)
16+
__attribute__((sycl_device))
17+
short16 baz(short16 &x, S &y) {
18+
// Host ABI:
19+
// short16 argument is passed by reference.
20+
// S is passed by value.
21+
// S is returned by value.
22+
// CHECK: call i32 @_Z3fooDv16_s1S(ptr noundef byval(<16 x i16>) align 32 {{%.*}}, i32 {{%.*}})
23+
y = foo(x, y);
24+
// Libclc ABI:
25+
// short16 is passed by value.
26+
// S is passed by reference.
27+
// S is returned by reference.
28+
// CHECK: call void @_Z3barDv16_s1S(ptr dead_on_unwind writable sret(%struct.S) align 2 {{%.*}}, <16 x i16> noundef {{%.*}}, ptr noundef byval(%struct.S) align 2 {{%.*}})
29+
y = bar(x, y);
30+
return x;
31+
}

0 commit comments

Comments
 (0)