xref: /llvm-project/clang/test/CodeGen/PowerPC/builtins-ppc-xlcompat-pwr9-error.c (revision 62f20f51ce39560e439f522536e0bf1e2f1f9fa9)
1 // REQUIRES: powerpc-registered-target
2 // RUN: %clang_cc1 -triple powerpc64-unknown-linux-gnu -target-cpu pwr9 \
3 // RUN:   -fsyntax-only -Wall -Werror -verify %s
4 // RUN: %clang_cc1 -triple powerpc64le-unknown-linux-gnu -target-cpu pwr9 \
5 // RUN:   -fsyntax-only -Wall -Werror -verify %s
6 // RUN: %clang_cc1 -triple powerpc64-unknown-aix -target-cpu pwr9 \
7 // RUN:   -fsyntax-only -Wall -Werror -verify %s
8 // RUN: %clang_cc1 -triple powerpc-unknown-aix -target-cpu pwr9 \
9 // RUN:   -fsyntax-only -Wall -Werror -verify %s
10 
11 extern unsigned int ui;
12 extern unsigned long long ull;
13 extern long long ll;
14 extern float f;
15 extern double d;
16 
test_builtin_ppc_cmprb()17 void test_builtin_ppc_cmprb() {
18   int res = __builtin_ppc_cmprb(3, ui, ui); // expected-error {{argument value 3 is outside the valid range [0, 1]}}
19 }
20 
21 #ifdef __PPC64__
22 
test_builtin_ppc_addex()23 void test_builtin_ppc_addex() {
24   long long res = __builtin_ppc_addex(ll, ll, 4); // expected-error {{argument value 4 is outside the valid range [0, 3]}}
25   unsigned long long res2 = __builtin_ppc_addex(ull, ull, -1); // expected-error {{argument value -1 is outside the valid range [0, 3]}}
26 }
27 
28 #endif
29 
test_builtin_ppc_test_data_class_d()30 int test_builtin_ppc_test_data_class_d() {
31   return __builtin_ppc_test_data_class(d, -1); // expected-error {{argument value -1 is outside the valid range [0, 127]}}
32 }
33 
test_builtin_ppc_test_data_class_f()34 int test_builtin_ppc_test_data_class_f() {
35   return __builtin_ppc_test_data_class(f, -1); // expected-error {{argument value -1 is outside the valid range [0, 127]}}
36 }
37 
test_test_data_class_d()38 int test_test_data_class_d() {
39   return __test_data_class(d, 128); // expected-error {{argument value 128 is outside the valid range [0, 127]}}
40 }
41 
test_test_data_class_f()42 int test_test_data_class_f() {
43   return __test_data_class(f, 128); // expected-error {{argument value 128 is outside the valid range [0, 127]}}
44 }
45 
test_test_data_class_type()46 int test_test_data_class_type() {
47   return __test_data_class(ui, 0); // expected-error {{expected a 'float', 'double' or '__float128' for the first argument}}
48 }
49