1 /* { dg-options "-msve-vector-bits=256 -W -Wall" } */ 2 3 #include <arm_sve.h> 4 5 #define N __ARM_FEATURE_SVE_BITS 6 #define FIXED_ATTR __attribute__ ((arm_sve_vector_bits (N))) 7 #define GNU_ATTR __attribute__ ((vector_size (N / 8))) 8 9 typedef svint8_t fixed_int8_t FIXED_ATTR; 10 typedef svint16_t fixed_int16_t FIXED_ATTR; 11 12 typedef svuint8_t fixed_uint8_t FIXED_ATTR; 13 14 typedef svbool_t fixed_bool_t FIXED_ATTR; 15 16 typedef int8_t gnu_int8_t GNU_ATTR; 17 typedef int16_t gnu_int16_t GNU_ATTR; 18 19 typedef uint8_t gnu_uint8_t GNU_ATTR; 20 21 typedef int bad_type_1 __attribute__ ((arm_sve_vector_bits (N))); // { dg-error {'arm_sve_vector_bits' applied to non-SVE type 'int'} } 22 typedef svbool_t bad_type_2 __attribute__ ((arm_sve_vector_bits)); // { dg-error {wrong number of arguments specified for 'arm_sve_vector_bits' attribute} } 23 typedef svbool_t bad_type_3 __attribute__ ((arm_sve_vector_bits (N, N))); // { dg-error {wrong number of arguments specified for 'arm_sve_vector_bits' attribute} } 24 typedef svbool_t bad_type_4 __attribute__ ((arm_sve_vector_bits ("256"))); // { dg-error {'arm_sve_vector_bits' requires an integer constant expression} } 25 typedef svbool_t bad_type_5 __attribute__ ((arm_sve_vector_bits (100))); // { dg-warning {unsupported SVE vector size} } 26 typedef svint32x2_t bad_type_6 __attribute__ ((arm_sve_vector_bits (N))); // { dg-error {'arm_sve_vector_bits' applied to non-vector type 'svint32x2_t'} } 27 typedef svint8_t bad_type_7 __attribute__ ((arm_sve_vector_bits (N))) __attribute__ ((arm_sve_vector_bits (N))); // { dg-error {'arm_sve_vector_bits' applied to type 'svint8_t __attribute__\(\(arm_sve_vector_bits\([0-9]+\)\)\)', which already has a size} } 28 typedef fixed_bool_t bad_type_8 __attribute__ ((arm_sve_vector_bits (N))) __attribute__ ((arm_sve_vector_bits (N))); // { dg-error {'arm_sve_vector_bits' applied to type 'fixed_bool_t' {aka 'svbool_t __attribute__\(\(arm_sve_vector_bits\([0-9]+\)\)\)'}, which already has a size} } 29 typedef gnu_int8_t bad_type_9 __attribute__ ((arm_sve_vector_bits (N))) __attribute__ ((arm_sve_vector_bits (N))); // { dg-error {'arm_sve_vector_bits' applied to non-SVE type 'gnu_int8_t'} } 30 31 void f(int c)32f (int c) 33 { 34 svint8_t ss8; 35 fixed_int8_t fs8; 36 gnu_int8_t gs8; 37 38 svuint8_t su8; 39 fixed_uint8_t fu8; 40 gnu_uint8_t gu8; 41 42 svint16_t ss16; 43 fixed_int16_t fs16; 44 gnu_int16_t gs16; 45 46 svbool_t sb; 47 fixed_bool_t fb; 48 49 ss8 = ss8 + ss8; // { dg-error {invalid operands [^\n]* binary[^\n]*\+} } 50 ss8 = ss8 + fs8; // { dg-error {invalid operands [^\n]* binary[^\n]*\+} } 51 ss8 = ss8 + gs8; // { dg-error {invalid operands [^\n]* binary[^\n]*\+} } 52 ss8 += ss8; // { dg-error {invalid operands [^\n]* binary[^\n]*\+} } 53 ss8 += fs8; // { dg-error {invalid operands [^\n]* binary[^\n]*\+} } 54 ss8 += gs8; // { dg-error {invalid operands [^\n]* binary[^\n]*\+} } 55 56 fs8 = fs8 + ss8; // { dg-error {invalid operands [^\n]* binary[^\n]*\+} } 57 fs8 = fs8 + fs8; 58 fs8 = fs8 + gs8; // { dg-error {cannot combine GNU and SVE vectors in a binary operation} } 59 fs8 += ss8; // { dg-error {invalid operands [^\n]* binary[^\n]*\+} } 60 fs8 += fs8; 61 fs8 += gs8; // { dg-error {cannot combine GNU and SVE vectors in a binary operation} } 62 63 gs8 = gs8 + ss8; // { dg-error {invalid operands [^\n]* binary[^\n]*\+} } 64 gs8 = gs8 + fs8; // { dg-error {cannot combine GNU and SVE vectors in a binary operation} } 65 gs8 = gs8 + gs8; 66 gs8 += ss8; // { dg-error {invalid operands [^\n]* binary[^\n]*\+} } 67 gs8 += fs8; // { dg-error {cannot combine GNU and SVE vectors in a binary operation} } 68 gs8 += gs8; 69 70 fs8 = ss8; 71 fs8 = fs8; 72 fs8 = gs8; 73 74 fs8 = su8; // { dg-error {cannot convert|incompatible types} } 75 fs8 = fu8; // { dg-error {cannot convert|incompatible types} } 76 fs8 = gu8; // { dg-error {cannot convert|incompatible types} } 77 78 fs8 = ss16; // { dg-error {cannot convert|incompatible types} } 79 fs8 = fs16; // { dg-error {cannot convert|incompatible types} } 80 fs8 = gs16; // { dg-error {cannot convert|incompatible types} } 81 82 (void) (c ? ss8 : ss8); 83 (void) (c ? ss8 : fs8); // { dg-error {type mismatch|different types} } 84 (void) (c ? ss8 : gs8); // { dg-error {type mismatch|different types} } 85 86 (void) (c ? fs8 : ss8); // { dg-error {type mismatch|different types} } 87 (void) (c ? fs8 : fs8); 88 (void) (c ? fs8 : gs8); // { dg-error {type mismatch|different types} } 89 90 (void) (c ? gs8 : ss8); // { dg-error {type mismatch|different types} } 91 (void) (c ? gs8 : fs8); // { dg-error {type mismatch|different types} } 92 (void) (c ? gs8 : gs8); 93 94 sb = fb; 95 fb = sb; 96 97 (void) (c ? sb : sb); 98 (void) (c ? sb : fb); // { dg-error {type mismatch|different types} "" { xfail c } } 99 100 (void) (c ? fb : sb); // { dg-error {type mismatch|different types} "" { xfail c } } 101 (void) (c ? fb : fb); 102 } 103 104 void g(int c)105g (int c) 106 { 107 svint8_t *ss8; 108 fixed_int8_t *fs8; 109 gnu_int8_t *gs8; 110 111 svuint8_t *su8; 112 fixed_uint8_t *fu8; 113 gnu_uint8_t *gu8; 114 115 svint16_t *ss16; 116 fixed_int16_t *fs16; 117 gnu_int16_t *gs16; 118 119 svbool_t *sb; 120 fixed_bool_t *fb; 121 122 __PTRDIFF_TYPE__ diff __attribute__((unused)); 123 void *select __attribute__((unused)); 124 125 diff = ss8 - ss8; // { dg-error {arithmetic on pointer to SVE type 'svint8_t'} } 126 diff = ss8 - fs8; // { dg-error {invalid operands [^\n]* binary[^\n]*\-} "" } 127 diff = ss8 - gs8; // { dg-error {invalid operands [^\n]* binary[^\n]*\-} "" } 128 129 diff = fs8 - ss8; // { dg-error {invalid operands [^\n]* binary[^\n]*\-} "" } 130 diff = fs8 - fs8; 131 diff = fs8 - gs8; // { dg-error {invalid operands [^\n]* binary[^\n]*\-} "" } 132 133 diff = gs8 - ss8; // { dg-error {invalid operands [^\n]* binary[^\n]*\-} "" } 134 diff = gs8 - fs8; // { dg-error {invalid operands [^\n]* binary[^\n]*\-} "" } 135 diff = gs8 - gs8; 136 137 fs8 = ss8; // { dg-error {invalid conversion} "" { target c++ } } 138 // { dg-warning {incompatible pointer type} "c" { target c } .-1 } 139 fs8 = fs8; 140 fs8 = gs8; // { dg-error {invalid conversion} "" { target c++ } } 141 // { dg-warning {incompatible pointer type} "c" { target c } .-1 } 142 143 fs8 = su8; // { dg-error {cannot convert} "c++" { target c++ } } 144 // { dg-warning {incompatible pointer type} "c" { target c } .-1 } 145 fs8 = fu8; // { dg-error {cannot convert} "c++" { target c++ } } 146 // { dg-warning {incompatible pointer type} "c" { target c } .-1 } 147 fs8 = gu8; // { dg-error {cannot convert} "c++" { target c++ } } 148 // { dg-warning {incompatible pointer type} "c" { target c } .-1 } 149 150 fs8 = ss16; // { dg-error {cannot convert} "c++" { target c++ } } 151 // { dg-warning {incompatible pointer type} "c" { target c } .-1 } 152 fs8 = fs16; // { dg-error {cannot convert} "c++" { target c++ } } 153 // { dg-warning {incompatible pointer type} "c" { target c } .-1 } 154 fs8 = gs16; // { dg-error {cannot convert} "c++" { target c++ } } 155 // { dg-warning {incompatible pointer type} "c" { target c } .-1 } 156 157 select = c ? ss8 : ss8; 158 select = c ? ss8 : fs8; // { dg-error {distinct pointer types} "" { target c++ } } 159 // { dg-warning {pointer type mismatch} "c" { target c } .-1 } 160 select = c ? ss8 : gs8; // { dg-error {distinct pointer types} "" { target c++ } } 161 // { dg-warning {pointer type mismatch} "c" { target c } .-1 } 162 163 select = c ? fs8 : ss8; // { dg-error {distinct pointer types} "" { target c++ } } 164 // { dg-warning {pointer type mismatch} "c" { target c } .-1 } 165 select = c ? fs8 : fs8; 166 select = c ? fs8 : gs8; // { dg-error {distinct pointer types} "" { target c++ } } 167 // { dg-warning {pointer type mismatch} "c" { target c } .-1 } 168 169 select = c ? gs8 : ss8; // { dg-error {distinct pointer types} "" { target c++ } } 170 // { dg-warning {pointer type mismatch} "c" { target c } .-1 } 171 select = c ? gs8 : fs8; // { dg-error {distinct pointer types} "" { target c++ } } 172 // { dg-warning {pointer type mismatch} "c" { target c } .-1 } 173 select = c ? gs8 : gs8; 174 175 diff = sb - sb; // { dg-error {arithmetic on pointer to SVE type 'svbool_t'} } 176 diff = sb - fb; // { dg-error {invalid operands} "" { target c++ } } 177 // { dg-error {arithmetic on pointer to SVE type 'svbool_t'} "c" { target c } .-1 } 178 179 diff = fb - sb; // { dg-error {invalid operands} "" { target c++ } } 180 // { dg-error {arithmetic on pointer to SVE type 'svbool_t'} "c" { target c } .-1 } 181 diff = fb - fb; 182 183 sb = fb; // { dg-error {invalid conversion} "" { target c++ } } 184 // { dg-warning {incompatible pointer type} "c" { target c xfail c } .-1 } 185 fb = sb; // { dg-error {invalid conversion} "" { target c++ } } 186 // { dg-warning {incompatible pointer type} "c" { target c xfail c } .-1 } 187 188 select = c ? sb : sb; 189 select = c ? sb : fb; // { dg-error {distinct pointer types} "" { target c++ } } 190 // { dg-warning {pointer type mismatch} "c" { target c xfail c } .-1 } 191 192 select = c ? fb : sb; // { dg-error {distinct pointer types} "" { target c++ } } 193 // { dg-warning {pointer type mismatch} "c" { target c xfail c } .-1 } 194 select = c ? fb : fb; 195 } 196