asm-constraints-device.cu 901 B

123456789101112131415161718192021222324
  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. __attribute__((device)) void df() {
  6. short h;
  7. int a;
  8. // asm with PTX constraints. Some of them are PTX-specific.
  9. __asm__("output constraints"
  10. : "=h"(h), // .u16 reg, OK
  11. "=a"(a) // expected-error {{invalid output constraint '=a' in asm}}
  12. : // None
  13. );
  14. __asm__("input constraints"
  15. : // None
  16. : "f"(0.0), // .f32 reg, OK
  17. "d"(0.0), // .f64 reg, OK
  18. "h"(0), // .u16 reg, OK
  19. "r"(0), // .u32 reg, OK
  20. "l"(0), // .u64 reg, OK
  21. "a"(0) // expected-error {{invalid input constraint 'a' in asm}}
  22. );
  23. }