1 // Verify that we do check for constraints in device-side inline
2 // assembly. Passing an illegal input/output constraint and look
3 // for corresponding error
4 // RUN: %clang_cc1 -triple nvptx-unknown-cuda -fsyntax-only -fcuda-is-device -verify %s
5
df()6 __attribute__((device)) void df() {
7 short h;
8 int a;
9 // asm with PTX constraints. Some of them are PTX-specific.
10 __asm__("output constraints"
11 : "=h"(h), // .u16 reg, OK
12 "=a"(a) // expected-error {{invalid output constraint '=a' in asm}}
13 : // None
14 );
15 __asm__("input constraints"
16 : // None
17 : "f"(0.0), // .f32 reg, OK
18 "d"(0.0), // .f64 reg, OK
19 "h"(0), // .u16 reg, OK
20 "r"(0), // .u32 reg, OK
21 "l"(0), // .u64 reg, OK
22 "a"(0) // expected-error {{invalid input constraint 'a' in asm}}
23 );
24 }
25