brintos

brintos / llvm-project-archived public Read only

0
0
Text · 4.0 KiB · d5d9028 Raw
58 lines · plain
1// RUN: %clang_cc1 -std=c++11 -fsyntax-only -triple nvptx-unknown-unknown -target-cpu sm_90 -verify %s2 3#include "Inputs/cuda.h"4 5__launch_bounds__(128, 7) void Test2Args(void);6__launch_bounds__(128) void Test1Arg(void);7 8__launch_bounds__(0xffffffff) void TestMaxArg(void);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}}10__launch_bounds__(0x10000000000000000) void TestWayTooBigArg(void); // expected-error {{integer literal is too large to be represented in any integer type}}11__launch_bounds__(1, 1, 0x10000000000000000) void TestWayTooBigArg(void); // expected-error {{integer literal is too large to be represented in any integer type}}12 13__launch_bounds__(-128, 7) void TestNegArg1(void); // expected-warning {{'launch_bounds' attribute parameter 0 is negative and will be ignored}}14__launch_bounds__(128, -7) void TestNegArg2(void); // expected-warning {{'launch_bounds' attribute parameter 1 is negative and will be ignored}}15__launch_bounds__(-128, 1, 7) void TestNegArg2(void); // expected-warning {{'launch_bounds' attribute parameter 0 is negative and will be ignored}}16__launch_bounds__(128, -1, 7) void TestNegArg2(void); // expected-warning {{'launch_bounds' attribute parameter 1 is negative and will be ignored}}17__launch_bounds__(128, 1, -7) void TestNegArg2(void); // expected-warning {{'launch_bounds' attribute parameter 2 is negative and will be ignored}}18// expected-warning@20 {{'launch_bounds' attribute parameter 0 is negative and will be ignored}}19// expected-warning@20 {{'launch_bounds' attribute parameter 1 is negative and will be ignored}}20__launch_bounds__(-128, -1, 7) void TestNegArg2(void);21// expected-warning@23 {{'launch_bounds' attribute parameter 0 is negative and will be ignored}}22// expected-warning@23 {{'launch_bounds' attribute parameter 2 is negative and will be ignored}}23__launch_bounds__(-128, 1, -7) void TestNegArg2(void);24// expected-warning@27 {{'launch_bounds' attribute parameter 0 is negative and will be ignored}}25// expected-warning@27 {{'launch_bounds' attribute parameter 1 is negative and will be ignored}}26// expected-warning@27 {{'launch_bounds' attribute parameter 2 is negative and will be ignored}}27__launch_bounds__(-128, -1, -7) void TestNegArg2(void);28 29 30__launch_bounds__(1, 2, 3, 4) void Test4Args(void); // expected-error {{'launch_bounds' attribute takes no more than 3 arguments}}31__launch_bounds__() void TestNoArgs(void); // expected-error {{'launch_bounds' attribute takes at least 1 argument}}32 33int TestNoFunction __launch_bounds__(128, 7, 13); // expected-warning {{'launch_bounds' attribute only applies to Objective-C methods, functions, and function pointers}}34 35__launch_bounds__(true) void TestBool(void);36__launch_bounds__(128, 1, 128.0) void TestFP(void); // expected-error {{'launch_bounds' attribute requires parameter 2 to be an integer constant}}37__launch_bounds__(128, 1, (void*)0) void TestNullptr(void); // expected-error {{'launch_bounds' attribute requires parameter 2 to be an integer constant}}38 39int nonconstint = 256;40__launch_bounds__(125, 1, nonconstint) void TestNonConstInt(void); // expected-error {{'launch_bounds' attribute requires parameter 2 to be an integer constant}}41 42const int constint = 512;43__launch_bounds__(128, 1, constint) void TestConstInt(void);44__launch_bounds__(128, 1, constint * 2 + 3) void TestConstIntExpr(void);45 46template <int a, int b, int c> __launch_bounds__(a, b, c) void TestTemplate2Args(void) {}47template void TestTemplate2Args<128,7, 13>(void);48 49template <int a, int b, int c>50__launch_bounds__(a + b, c + constint, a + b + c + constint) void TestTemplateExpr(void) {}51template void TestTemplateExpr<128+constint, 3, 7>(void);52 53template <int... Args>54__launch_bounds__(Args) void TestTemplateVariadicArgs(void) {} // expected-error {{expression contains unexpanded parameter pack 'Args'}}55 56template <int... Args>57__launch_bounds__(1, 22, Args) void TestTemplateVariadicArgs2(void) {} // expected-error {{expression contains unexpanded parameter pack 'Args'}}58