annotate clang/test/SemaCUDA/launch_bounds.cu @ 222:81f6424ef0e3 llvm-original

LLVM original branch
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Sun, 18 Jul 2021 22:10:01 +0900 (2021-07-18)
parents 1d019706d866
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
150
anatofuz
parents:
diff changeset
1 // RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
anatofuz
parents:
diff changeset
2
anatofuz
parents:
diff changeset
3 #include "Inputs/cuda.h"
anatofuz
parents:
diff changeset
4
anatofuz
parents:
diff changeset
5 __launch_bounds__(128, 7) void Test2Args(void);
anatofuz
parents:
diff changeset
6 __launch_bounds__(128) void Test1Arg(void);
anatofuz
parents:
diff changeset
7
anatofuz
parents:
diff changeset
8 __launch_bounds__(0xffffffff) void TestMaxArg(void);
anatofuz
parents:
diff changeset
9 __launch_bounds__(0x100000000) void TestTooBigArg(void); // expected-error {{integer constant expression evaluates to value 4294967296 that cannot be represented in a 32-bit unsigned integer type}}
anatofuz
parents:
diff changeset
10 __launch_bounds__(0x10000000000000000) void TestWayTooBigArg(void); // expected-error {{integer literal is too large to be represented in any integer type}}
anatofuz
parents:
diff changeset
11
anatofuz
parents:
diff changeset
12 __launch_bounds__(-128, 7) void TestNegArg1(void); // expected-warning {{'launch_bounds' attribute parameter 0 is negative and will be ignored}}
anatofuz
parents:
diff changeset
13 __launch_bounds__(128, -7) void TestNegArg2(void); // expected-warning {{'launch_bounds' attribute parameter 1 is negative and will be ignored}}
anatofuz
parents:
diff changeset
14
anatofuz
parents:
diff changeset
15 __launch_bounds__(1, 2, 3) void Test3Args(void); // expected-error {{'launch_bounds' attribute takes no more than 2 arguments}}
anatofuz
parents:
diff changeset
16 __launch_bounds__() void TestNoArgs(void); // expected-error {{'launch_bounds' attribute takes at least 1 argument}}
anatofuz
parents:
diff changeset
17
anatofuz
parents:
diff changeset
18 int TestNoFunction __launch_bounds__(128, 7); // expected-warning {{'launch_bounds' attribute only applies to Objective-C methods, functions, and function pointers}}
anatofuz
parents:
diff changeset
19
anatofuz
parents:
diff changeset
20 __launch_bounds__(true) void TestBool(void);
anatofuz
parents:
diff changeset
21 __launch_bounds__(128.0) void TestFP(void); // expected-error {{'launch_bounds' attribute requires parameter 0 to be an integer constant}}
anatofuz
parents:
diff changeset
22 __launch_bounds__((void*)0) void TestNullptr(void); // expected-error {{'launch_bounds' attribute requires parameter 0 to be an integer constant}}
anatofuz
parents:
diff changeset
23
anatofuz
parents:
diff changeset
24 int nonconstint = 256;
anatofuz
parents:
diff changeset
25 __launch_bounds__(nonconstint) void TestNonConstInt(void); // expected-error {{'launch_bounds' attribute requires parameter 0 to be an integer constant}}
anatofuz
parents:
diff changeset
26
anatofuz
parents:
diff changeset
27 const int constint = 512;
anatofuz
parents:
diff changeset
28 __launch_bounds__(constint) void TestConstInt(void);
anatofuz
parents:
diff changeset
29 __launch_bounds__(constint * 2 + 3) void TestConstIntExpr(void);
anatofuz
parents:
diff changeset
30
anatofuz
parents:
diff changeset
31 template <int a, int b> __launch_bounds__(a, b) void TestTemplate2Args(void) {}
anatofuz
parents:
diff changeset
32 template void TestTemplate2Args<128,7>(void);
anatofuz
parents:
diff changeset
33
anatofuz
parents:
diff changeset
34 template <int a> __launch_bounds__(a) void TestTemplate1Arg(void) {}
anatofuz
parents:
diff changeset
35 template void TestTemplate1Arg<128>(void);
anatofuz
parents:
diff changeset
36
anatofuz
parents:
diff changeset
37 template <class a>
anatofuz
parents:
diff changeset
38 __launch_bounds__(a) void TestTemplate1ArgClass(void) {} // expected-error {{'a' does not refer to a value}}
anatofuz
parents:
diff changeset
39 // expected-note@-2 {{declared here}}
anatofuz
parents:
diff changeset
40
anatofuz
parents:
diff changeset
41 template <int a, int b, int c>
anatofuz
parents:
diff changeset
42 __launch_bounds__(a + b, c + constint) void TestTemplateExpr(void) {}
anatofuz
parents:
diff changeset
43 template void TestTemplateExpr<128+constint, 3, 7>(void);
anatofuz
parents:
diff changeset
44
anatofuz
parents:
diff changeset
45 template <int... Args>
anatofuz
parents:
diff changeset
46 __launch_bounds__(Args) void TestTemplateVariadicArgs(void) {} // expected-error {{expression contains unexpanded parameter pack 'Args'}}
anatofuz
parents:
diff changeset
47
anatofuz
parents:
diff changeset
48 template <int... Args>
anatofuz
parents:
diff changeset
49 __launch_bounds__(1, Args) void TestTemplateVariadicArgs2(void) {} // expected-error {{expression contains unexpanded parameter pack 'Args'}}