35 lines · plain
1// RUN: %clang_cc1 -fsyntax-only -fcuda-is-device -verify %s2 3#include "Inputs/cuda.h"4 5__device__ float f0(float) __attribute__((noconvergent));6__device__ __attribute__((noconvergent)) float f1(float);7[[clang::noconvergent]] __device__ float f2(float);8 9__device__ [[clang::noconvergent(1)]] float f3(float);10// expected-error@-1 {{'clang::noconvergent' attribute takes no arguments}}11 12__device__ [[clang::noconvergent]] float g0;13// expected-warning@-1 {{'clang::noconvergent' attribute only applies to functions and statements}}14 15__device__ __attribute__((convergent)) __attribute__((noconvergent)) float f4(float);16// expected-error@-1 {{'noconvergent' and 'convergent' attributes are not compatible}}17// expected-note@-2 {{conflicting attribute is here}}18 19__device__ [[clang::noconvergent]] float f5(float);20__device__ [[clang::convergent]] float f5(float);21// expected-error@-1 {{'clang::convergent' and 'clang::noconvergent' attributes are not compatible}}22// expected-note@-3 {{conflicting attribute is here}}23 24__device__ float f5(float x) {25 [[clang::noconvergent]] float y;26// expected-warning@-1 {{'clang::noconvergent' attribute only applies to functions and statements}}27 28 float z;29 30 [[clang::noconvergent]] z = 1;31// expected-warning@-1 {{'clang::noconvergent' attribute is ignored because there exists no call expression inside the statement}}32 33 [[clang::noconvergent]] z = f0(x);34}35