25 lines · plain
1// Verify that we do check for constraints in device-side inline2// assembly. Passing an illegal input/output constraint and look 3// for corresponding error4// RUN: %clang_cc1 -triple nvptx-unknown-cuda -fsyntax-only -fcuda-is-device -verify %s5 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, OK12 "=a"(a) // expected-error {{invalid output constraint '=a' in asm}}13 : // None14 );15 __asm__("input constraints"16 : // None17 : "f"(0.0), // .f32 reg, OK18 "d"(0.0), // .f64 reg, OK19 "h"(0), // .u16 reg, OK20 "r"(0), // .u32 reg, OK21 "l"(0), // .u64 reg, OK22 "a"(0) // expected-error {{invalid input constraint 'a' in asm}}23 );24}25