-
Notifications
You must be signed in to change notification settings - Fork 756
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SYCL] Enable C++11 attribute spelling for clang
loop_unroll
attrib…
…ute (#670) Signed-off-by: Viktoria Maksimova <viktoria.maksimova@intel.com>
- Loading branch information
Showing
12 changed files
with
239 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// RUN: %clang_cc1 -x c++ -triple spir64-unknown-linux-sycldevice -std=c++11 -disable-llvm-passes -fsycl-is-device -emit-llvm %s -o - | FileCheck %s | ||
|
||
// CHECK: br label %for.cond, !llvm.loop ![[COUNT:[0-9]+]] | ||
// CHECK: br label %while.cond, !llvm.loop ![[DISABLE:[0-9]+]] | ||
// CHECK: br i1 %{{.*}}, label %do.body, label %do.end, !llvm.loop ![[ENABLE:[0-9]+]] | ||
|
||
// CHECK: ![[COUNT]] = distinct !{![[COUNT]], ![[COUNT_A:[0-9]+]]} | ||
// CHECK-NEXT: ![[COUNT_A]] = !{!"llvm.loop.unroll.count", i32 8} | ||
void count() { | ||
[[clang::loop_unroll(8)]] | ||
for (int i = 0; i < 1000; ++i); | ||
} | ||
|
||
// CHECK: ![[DISABLE]] = distinct !{![[DISABLE]], ![[DISABLE_A:[0-9]+]]} | ||
// CHECK-NEXT: ![[DISABLE_A]] = !{!"llvm.loop.unroll.disable"} | ||
void disable() { | ||
int i = 1000; | ||
[[clang::loop_unroll(1)]] | ||
while (i--); | ||
} | ||
|
||
// CHECK: ![[ENABLE]] = distinct !{![[ENABLE]], ![[ENABLE_A:[0-9]+]]} | ||
// CHECK-NEXT: ![[ENABLE_A]] = !{!"llvm.loop.unroll.enable"} | ||
void enable() { | ||
int i = 1000; | ||
[[clang::loop_unroll]] | ||
do {} while (i--); | ||
} | ||
|
||
template <typename name, typename Func> | ||
__attribute__((sycl_kernel)) void kernel_single_task(Func kernelFunc) { | ||
kernelFunc(); | ||
} | ||
|
||
int main() { | ||
kernel_single_task<class kernel_function>([]() { | ||
count(); | ||
disable(); | ||
enable(); | ||
}); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// RUN: %clangxx -c -S -emit-llvm %s -o - | FileCheck %s | ||
// CHECK: br label %{{.*}}, !llvm.loop ![[COUNT:[0-9]+]] | ||
// CHECK: br label %{{.*}}, !llvm.loop ![[DISABLE:[0-9]+]] | ||
// CHECK: br i1 %{{.*}}, label %{{.*}}, label %{{.*}}, !llvm.loop ![[ENABLE:[0-9]+]] | ||
|
||
int main() { | ||
// CHECK: ![[COUNT]] = distinct !{![[COUNT]], ![[COUNT_A:[0-9]+]]} | ||
// CHECK-NEXT: ![[COUNT_A]] = !{!"llvm.loop.unroll.count", i32 4} | ||
[[clang::loop_unroll(4)]] | ||
for (int i = 0; i < 100; ++i); | ||
// CHECK: ![[DISABLE]] = distinct !{![[DISABLE]], ![[DISABLE_A:[0-9]+]]} | ||
// CHECK-NEXT: ![[DISABLE_A]] = !{!"llvm.loop.unroll.disable"} | ||
int i = 1000; | ||
[[clang::loop_unroll(1)]] | ||
while (i--); | ||
// CHECK: ![[ENABLE]] = distinct !{![[ENABLE]], ![[ENABLE_A:[0-9]+]]} | ||
// CHECK-NEXT: ![[ENABLE_A]] = !{!"llvm.loop.unroll.enable"} | ||
i = 1000; | ||
[[clang::loop_unroll]] | ||
do {} while (i--); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.