1 // REQUIRES: mips-registered-target
2 // RUN: %clang_cc1 -triple mips-unknown-linux-gnu -target-feature +dspr2 \
3 // RUN:            -fsyntax-only -verify %s
4 
foo()5 void foo() {
6   // MIPS DSP Rev 1
7 
8   int a = 3;
9   __builtin_mips_wrdsp(2052, a);  // expected-error{{argument to '__builtin_mips_wrdsp' must be a constant integer}}
10   __builtin_mips_rddsp(a);        // expected-error{{argument to '__builtin_mips_rddsp' must be a constant integer}}
11   __builtin_mips_wrdsp(2052, -1); // expected-error-re{{argument value {{.*}} is outside the valid range}}
12   __builtin_mips_rddsp(-1);       // expected-error-re{{argument value {{.*}} is outside the valid range}}
13   __builtin_mips_wrdsp(2052, 64); // expected-error-re{{argument value {{.*}} is outside the valid range}}
14   __builtin_mips_rddsp(64);       // expected-error-re{{argument value {{.*}} is outside the valid range}}
15 
16   // MIPS DSP Rev 2
17 
18   __builtin_mips_append(1, 2, a); // expected-error{{argument to '__builtin_mips_append' must be a constant integer}}
19   __builtin_mips_balign(1, 2, a); // expected-error{{argument to '__builtin_mips_balign' must be a constant integer}}
20   __builtin_mips_precr_sra_ph_w(1, 2, a);   // expected-error{{argument to '__builtin_mips_precr_sra_ph_w' must be a constant integer}}
21   __builtin_mips_precr_sra_r_ph_w(1, 2, a); // expected-error{{argument to '__builtin_mips_precr_sra_r_ph_w' must be a constant integer}}
22   __builtin_mips_prepend(1, 2, a);          // expected-error{{argument to '__builtin_mips_prepend' must be a constant integer}}
23 
24   __builtin_mips_append(1, 2, -1);  // expected-error-re{{argument value {{.*}} is outside the valid range}}
25   __builtin_mips_append(1, 2, 32);  // expected-error-re{{argument value {{.*}} is outside the valid range}}
26 
27   __builtin_mips_balign(1, 2, -1);  // expected-error-re{{argument value {{.*}} is outside the valid range}}
28   __builtin_mips_balign(1, 2, 4);   // expected-error-re{{argument value {{.*}} is outside the valid range}}
29 
30   __builtin_mips_precr_sra_ph_w(1, 2, -1);  // expected-error-re{{argument value {{.*}} is outside the valid range}}
31   __builtin_mips_precr_sra_ph_w(1, 2, 32);  // expected-error-re{{argument value {{.*}} is outside the valid range}}
32 
33   __builtin_mips_precr_sra_r_ph_w(1, 2, -1);  // expected-error-re{{argument value {{.*}} is outside the valid range}}
34   __builtin_mips_precr_sra_r_ph_w(1, 2, 32);  // expected-error-re{{argument value {{.*}} is outside the valid range}}
35 
36   __builtin_mips_prepend(1, 2, -1); // expected-error-re{{argument value {{.*}} is outside the valid range}}
37   __builtin_mips_prepend(1, 2, -1); // expected-error-re{{argument value {{.*}} is outside the valid range}}
38 }
39