1 #include "arm_cde.h"
2 
3 /* { dg-do assemble } */
4 /* { dg-require-effective-target arm_v8_1m_main_cde_mve_fp_ok } */
5 /* { dg-add-options arm_v8_1m_main_cde_mve_fp } */
6 
test(int8x16_t m,int8x16_t n,mve_pred16_t pred)7 uint32_t test (int8x16_t m, int8x16_t n, mve_pred16_t pred)
8 {
9   /* Bad types for polymophic arguments.  */
10   uint32_t accum = 0, n_int = 0, m_int = 0;
11   accum += __arm_vcx1qa (0, accum, 4095);
12   accum += __arm_vcx2q (0, n_int, 126);
13   accum += __arm_vcx2q_u8 (0, n_int, 127);
14   accum += __arm_vcx2qa (0, accum, n_int, 127);
15   accum += __arm_vcx3q_u8 (0, n_int, m_int, 14);
16   accum += __arm_vcx3q (0, n_int, m_int, 15);
17   accum += __arm_vcx3qa (0, accum, n_int, m_int, 15);
18 
19   /* We get a at least two errors for each function since the errors are
20      checked for validity in two different ways and both are caught.
21      The resolver manually checks that each type is 128 bits wide, and only
22      casts the value if that's true.
23      After the resolver rejects the function call then the C frontend tries to
24      fit the original call to the builtin.  This produces a second set of
25      error messages from the C frontend argument checking.  */
26 
27   /* { dg-error {argument 2 to function '__builtin_arm_vcx1qav16qi' is of type 'uint32_t' {aka '(?:long )?unsigned int'} which is not known to be 128 bits wide} "" { target *-*-* } 11 } */
28   /* { dg-error {incompatible type for argument 2 of '__builtin_arm_vcx1qav16qi'} "" { target *-*-* } 11 } */
29 
30   /* { dg-error {argument 2 to function '__builtin_arm_vcx2qv16qi' is of type 'uint32_t' {aka '(?:long )?unsigned int'} which is not known to be 128 bits wide} "" { target *-*-* } 12 } */
31   /* { dg-error {incompatible type for argument 2 of '__builtin_arm_vcx2qv16qi'} "" { target *-*-* } 12 } */
32 
33   /* { dg-error {argument 2 to function '__builtin_arm_vcx2qv16qi' is of type 'uint32_t' {aka '(?:long )?unsigned int'} which is not known to be 128 bits wide} "" { target *-*-* } 13 } */
34   /* { dg-error {incompatible type for argument 2 of '__builtin_arm_vcx2qv16qi'} "" { target *-*-* } 13 } */
35 
36   /* { dg-error {argument 2 to function '__builtin_arm_vcx2qav16qi' is of type 'uint32_t' {aka '(?:long )?unsigned int'} which is not known to be 128 bits wide} "" { target *-*-* } 14 } */
37   /* { dg-error {incompatible type for argument 2 of '__builtin_arm_vcx2qav16qi'} "" { target *-*-* } 14 } */
38   /* { dg-error {argument 3 to function '__builtin_arm_vcx2qav16qi' is of type 'uint32_t' {aka '(?:long )?unsigned int'} which is not known to be 128 bits wide} "" { target *-*-* } 14 } */
39   /* { dg-error {incompatible type for argument 3 of '__builtin_arm_vcx2qav16qi'} "" { target *-*-* } 14 } */
40 
41   /* { dg-error {argument 2 to function '__builtin_arm_vcx3qv16qi' is of type 'uint32_t' {aka '(?:long )?unsigned int'} which is not known to be 128 bits wide} "" { target *-*-* } 15 } */
42   /* { dg-error {incompatible type for argument 2 of '__builtin_arm_vcx3qv16qi'} "" { target *-*-* } 15 } */
43   /* { dg-error {argument 3 to function '__builtin_arm_vcx3qv16qi' is of type 'uint32_t' {aka '(?:long )?unsigned int'} which is not known to be 128 bits wide} "" { target *-*-* } 15 } */
44   /* { dg-error {incompatible type for argument 3 of '__builtin_arm_vcx3qv16qi'} "" { target *-*-* } 15 } */
45 
46   /* { dg-error {argument 2 to function '__builtin_arm_vcx3qv16qi' is of type 'uint32_t' {aka '(?:long )?unsigned int'} which is not known to be 128 bits wide} "" { target *-*-* } 16 } */
47   /* { dg-error {incompatible type for argument 2 of '__builtin_arm_vcx3qv16qi'} "" { target *-*-* } 16 } */
48   /* { dg-error {argument 3 to function '__builtin_arm_vcx3qv16qi' is of type 'uint32_t' {aka '(?:long )?unsigned int'} which is not known to be 128 bits wide} "" { target *-*-* } 16 } */
49   /* { dg-error {incompatible type for argument 3 of '__builtin_arm_vcx3qv16qi'} "" { target *-*-* } 16 } */
50 
51   /* { dg-error {argument 2 to function '__builtin_arm_vcx3qav16qi' is of type 'uint32_t' {aka '(?:long )?unsigned int'} which is not known to be 128 bits wide} "" { target *-*-* } 17 } */
52   /* { dg-error {incompatible type for argument 2 of '__builtin_arm_vcx3qav16qi'} "" { target *-*-* } 17 } */
53   /* { dg-error {argument 3 to function '__builtin_arm_vcx3qav16qi' is of type 'uint32_t' {aka '(?:long )?unsigned int'} which is not known to be 128 bits wide} "" { target *-*-* } 17 } */
54   /* { dg-error {incompatible type for argument 3 of '__builtin_arm_vcx3qav16qi'} "" { target *-*-* } 17 } */
55   /* { dg-error {argument 4 to function '__builtin_arm_vcx3qav16qi' is of type 'uint32_t' {aka '(?:long )?unsigned int'} which is not known to be 128 bits wide} "" { target *-*-* } 17 } */
56   /* { dg-error {incompatible type for argument 4 of '__builtin_arm_vcx3qav16qi'} "" { target *-*-* } 17 } */
57 
58   accum += __arm_vcx1qa_m (0, accum, 4095, pred);
59   accum += __arm_vcx2q_m (0, accum, n_int, 126, pred);
60   accum += __arm_vcx2qa_m (0, accum, n_int, 127, pred);
61   accum += __arm_vcx3q_m (0, accum, n_int, m_int, 15, pred);
62   accum += __arm_vcx3qa_m (0, accum, n_int, m_int, 15, pred);
63 
64   /* { dg-error {argument 2 to function '__builtin_arm_vcx1qa_p_v16qi' is of type 'uint32_t' {aka '(?:long )?unsigned int'} which is not known to be 128 bits wide} "" { target *-*-* } 58 } */
65   /* { dg-error {incompatible type for argument 2 of '__builtin_arm_vcx1qa_p_v16qi'} "" { target *-*-* } 58 } */
66 
67   /* { dg-error {argument 2 to function '__builtin_arm_vcx2q_p_v16qi' is of type 'uint32_t' {aka '(?:long )?unsigned int'} which is not known to be 128 bits wide} "" { target *-*-* } 59 } */
68   /* { dg-error {incompatible type for argument 2 of '__builtin_arm_vcx2q_p_v16qi'} "" { target *-*-* } 59 } */
69   /* { dg-error {argument 3 to function '__builtin_arm_vcx2q_p_v16qi' is of type 'uint32_t' {aka '(?:long )?unsigned int'} which is not known to be 128 bits wide} "" { target *-*-* } 59 } */
70   /* { dg-error {incompatible type for argument 3 of '__builtin_arm_vcx2q_p_v16qi'} "" { target *-*-* } 59 } */
71 
72   /* { dg-error {argument 2 to function '__builtin_arm_vcx2qa_p_v16qi' is of type 'uint32_t' {aka '(?:long )?unsigned int'} which is not known to be 128 bits wide} "" { target *-*-* } 60 } */
73   /* { dg-error {incompatible type for argument 2 of '__builtin_arm_vcx2qa_p_v16qi'} "" { target *-*-* } 60 } */
74   /* { dg-error {argument 3 to function '__builtin_arm_vcx2qa_p_v16qi' is of type 'uint32_t' {aka '(?:long )?unsigned int'} which is not known to be 128 bits wide} "" { target *-*-* } 60 } */
75   /* { dg-error {incompatible type for argument 3 of '__builtin_arm_vcx2qa_p_v16qi'} "" { target *-*-* } 60 } */
76 
77   /* { dg-error {argument 2 to function '__builtin_arm_vcx3q_p_v16qi' is of type 'uint32_t' {aka '(?:long )?unsigned int'} which is not known to be 128 bits wide} "" { target *-*-* } 61 } */
78   /* { dg-error {incompatible type for argument 2 of '__builtin_arm_vcx3q_p_v16qi'} "" { target *-*-* } 61 } */
79   /* { dg-error {argument 3 to function '__builtin_arm_vcx3q_p_v16qi' is of type 'uint32_t' {aka '(?:long )?unsigned int'} which is not known to be 128 bits wide} "" { target *-*-* } 61 } */
80   /* { dg-error {incompatible type for argument 3 of '__builtin_arm_vcx3q_p_v16qi'} "" { target *-*-* } 61 } */
81   /* { dg-error {argument 4 to function '__builtin_arm_vcx3q_p_v16qi' is of type 'uint32_t' {aka '(?:long )?unsigned int'} which is not known to be 128 bits wide} "" { target *-*-* } 61 } */
82   /* { dg-error {incompatible type for argument 4 of '__builtin_arm_vcx3q_p_v16qi'} "" { target *-*-* } 61 } */
83 
84   /* { dg-error {argument 2 to function '__builtin_arm_vcx3qa_p_v16qi' is of type 'uint32_t' {aka '(?:long )?unsigned int'} which is not known to be 128 bits wide} "" { target *-*-* } 62 } */
85   /* { dg-error {incompatible type for argument 2 of '__builtin_arm_vcx3qa_p_v16qi'} "" { target *-*-* } 62 } */
86   /* { dg-error {argument 3 to function '__builtin_arm_vcx3qa_p_v16qi' is of type 'uint32_t' {aka '(?:long )?unsigned int'} which is not known to be 128 bits wide} "" { target *-*-* } 62 } */
87   /* { dg-error {incompatible type for argument 3 of '__builtin_arm_vcx3qa_p_v16qi'} "" { target *-*-* } 62 } */
88   /* { dg-error {argument 4 to function '__builtin_arm_vcx3qa_p_v16qi' is of type 'uint32_t' {aka '(?:long )?unsigned int'} which is not known to be 128 bits wide} "" { target *-*-* } 62 } */
89   /* { dg-error {incompatible type for argument 4 of '__builtin_arm_vcx3qa_p_v16qi'} "" { target *-*-* } 62 } */
90 
91   return accum;
92 }
93 
94 /* Testing that undeclared variables work as expected.
95    (This to verify we fixed a problem hit during development).  */
test3(int8x16_t m,int8x16_t n)96 int8x16_t test3 (int8x16_t m, int8x16_t n)
97 {
98   int8x16_t accum = (int8x16_t)(uint64x2_t) { 0, 0 };
99   accum += __arm_vcx1qa (0, accum_int, 4095);
100   accum += __arm_vcx2q (0, n_int, 126);
101   accum += __arm_vcx2q_u8 (0, n_int, 127);
102   accum += __arm_vcx2qa (0, accum, n_int, 127);
103   accum += __arm_vcx3q_u8 (0, n_int, m, 14);
104   accum += __arm_vcx3q_u8 (0, n, m_int, 14);
105   accum += __arm_vcx3q (0, n_int, m, 15);
106   accum += __arm_vcx3q (0, n, m_int, 15);
107   accum += __arm_vcx3qa (0, accum, n_int, m, 15);
108   accum += __arm_vcx3qa (0, accum, n_int, m_int, 15);
109 
110   /* { dg-error {'accum_int' undeclared \(first use in this function\)} "" { target *-*-* } 99 } */
111   /* { dg-error {'n_int' undeclared \(first use in this function\)} "" { target *-*-* } 100 } */
112   /* { dg-error {'m_int' undeclared \(first use in this function\)} "" { target *-*-* } 104 } */
113   return accum;
114 }
115