xref: /llvm-project/clang/test/CodeGen/hexagon-check-builtins.c (revision 16e6bc23a12ecaee8b2eeb6a4246843ce24e751c)
1 // REQUIRES: hexagon-registered-target
2 // RUN: %clang_cc1 -fsyntax-only -triple hexagon-unknown-elf -verify %s
3 
foo(int x)4 int foo(int x) {
5   // expected-error-re@+2 {{argument value {{.*}} is outside the valid range}}
6   // expected-error-re@+1 {{argument value {{.*}} is outside the valid range}}
7   return __builtin_HEXAGON_S4_extract(x, 33, -1) +
8   // expected-error-re@+1 {{argument value {{.*}} is outside the valid range}}
9          __builtin_HEXAGON_S4_extract(x, 3, 91) +
10   // expected-error-re@+2 {{argument value {{.*}} is outside the valid range}}
11   // expected-error-re@+1 {{argument value {{.*}} is outside the valid range}}
12          __builtin_HEXAGON_S4_extract(x, -1, 35) +
13          __builtin_HEXAGON_S4_extract(x, 0, 31) +
14          __builtin_HEXAGON_S4_extract(x, 31, 0);
15 }
16 
bar(void * p,void * q,int x)17 int bar(void *p, void *q, int x) {
18   // expected-error@+1 {{argument should be a multiple of 4}}
19   return __builtin_HEXAGON_L2_loadri_pci(p, -1, x, q) +
20   // expected-error-re@+2 {{argument value {{.*}} is outside the valid range}}
21   // expected-error@+1 {{argument should be a multiple of 4}}
22          __builtin_HEXAGON_L2_loadri_pci(p, -99, x, q) +
23   // expected-error-re@+1 {{argument value {{.*}} is outside the valid range}}
24          __builtin_HEXAGON_L2_loadri_pci(p, -132, x, q) +
25          __builtin_HEXAGON_L2_loadri_pci(p, 28, x, q) +
26   // expected-error-re@+2 {{argument value {{.*}} is outside the valid range}}
27   // expected-error@+1 {{argument should be a multiple of 4}}
28          __builtin_HEXAGON_L2_loadri_pci(p, 29, x, q);
29 }
30 
31