inline-asm-validate-riscv.c 1001 B

1234567891011121314151617181920212223
  1. // RUN: %clang_cc1 -triple riscv32 -fsyntax-only -verify %s
  2. // RUN: %clang_cc1 -triple riscv64 -fsyntax-only -verify %s
  3. void I(int i) {
  4. static const int BelowMin = -2049;
  5. static const int AboveMax = 2048;
  6. asm volatile ("" :: "I"(BelowMin)); // expected-error{{value '-2049' out of range for constraint 'I'}}
  7. asm volatile ("" :: "I"(AboveMax)); // expected-error{{value '2048' out of range for constraint 'I'}}
  8. }
  9. void J(int j) {
  10. static const int BelowMin = -1;
  11. static const int AboveMax = 1;
  12. asm volatile ("" :: "J"(BelowMin)); // expected-error{{value '-1' out of range for constraint 'J'}}
  13. asm volatile ("" :: "J"(AboveMax)); // expected-error{{value '1' out of range for constraint 'J'}}
  14. }
  15. void K(int k) {
  16. static const int BelowMin = -1;
  17. static const int AboveMax = 32;
  18. asm volatile ("" :: "K"(BelowMin)); // expected-error{{value '-1' out of range for constraint 'K'}}
  19. asm volatile ("" :: "K"(AboveMax)); // expected-error{{value '32' out of range for constraint 'K'}}
  20. }