File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change 1+ // RUN: %clang_cc1 -fsycl-is-device -triple spir64-unknown-unknown -disable-llvm-passes -emit-llvm %s -o - | FileCheck %s --check-prefix=CHECKD
2+ // RUN: %clang_cc1 -fsycl-is-host -triple spir64-unknown-unknown -disable-llvm-passes -emit-llvm %s -o - | FileCheck %s --check-prefix=CHECKH
3+ // Test code generation for sycl_device_only attribute.
4+
5+ // CHECK-LABEL: _Z3fooi
6+ // CHECKH: %add = add nsw i32 %0, 10
7+ // CHECKD: %add = add nsw i32 %0, 20
8+ int foo (int a) { return a + 10 ; }
9+
10+ #ifdef __SYCL_DEVICE_ONLY__
11+ __attribute__ ((sycl_device_only)) int foo(int a) { return a + 20 ; }
12+ #endif
13+
14+ __attribute__ ((sycl_device)) int bar(int b) {
15+ return foo (b);
16+ }
17+
18+ extern " C" {
19+ // CHECK-LABEL: _Z3fooci
20+ // CHECKH: %add = add nsw i32 %0, 10
21+ // CHECKD: %add = add nsw i32 %0, 20
22+ int fooc (int a) { return a + 10 ; }
23+ #ifdef __SYCL_DEVICE_ONLY__
24+ __attribute__ ((sycl_device_only)) int fooc(int a) { return a + 20 ; }
25+ #endif
26+
27+ __attribute__ ((sycl_device)) int barc(int b) {
28+ return fooc (b);
29+ }
30+ }
You can’t perform that action at this time.
0 commit comments