| 1 |
/* { dg-do run { target aarch64_sve_hw } } */ |
| 2 |
/* { dg-options "-O2" } */ |
| 3 |
|
| 4 |
#include <arm_sve.h> |
| 5 |
#include <stdio.h> |
| 6 |
|
| 7 |
#define DECL_FUNC_UNARY(type, name, op, intr, su, sz, id) \ |
| 8 |
__attribute__ ((noipa)) \ |
| 9 |
type func_ ## name ## type ## _unary (type a) { \ |
| 10 |
return op (a); \ |
| 11 |
} \ |
| 12 |
void checkfunc_ ## name ## type ## _unary () { \ |
| 13 |
type data = svindex_ ## su ## sz (0, 1); \ |
| 14 |
type zr = svindex_ ## su ## sz (0, 0); \ |
| 15 |
type one = svindex_ ## su ## sz (1, 0); \ |
| 16 |
type mone = svindex_ ## su ## sz (-1, 0); \ |
| 17 |
svbool_t pg = svptrue_b ## sz (); \ |
| 18 |
type exp = intr ## su ## sz ## _z (pg, id, data); \ |
| 19 |
type actual = func_ ## name ## type ## _unary (data); \ |
| 20 |
svbool_t res = svcmpeq_ ## su ## sz (pg, exp, actual); \ |
| 21 |
if (svptest_any (pg, svnot_b_z (pg, res))) \ |
| 22 |
__builtin_abort (); \ |
| 23 |
} |
| 24 |
|
| 25 |
#define DECL_FUNC_UNARY_FLOAT(type, name, op, intr, su, sz, id) \ |
| 26 |
__attribute__ ((noipa)) \ |
| 27 |
type func_ ## name ## type ## _unary (type a) { \ |
| 28 |
return op (a); \ |
| 29 |
} \ |
| 30 |
void checkfunc_ ## name ## type ## _unary () { \ |
| 31 |
type data = svdup_n_ ## su ## sz (2.0); \ |
| 32 |
type zr = svdup_n_ ## su ## sz (0.0); \ |
| 33 |
type one = svdup_n_ ## su ## sz (1.0); \ |
| 34 |
type mone = svdup_n_ ## su ## sz (-1.0); \ |
| 35 |
svbool_t pg = svptrue_b ## sz (); \ |
| 36 |
type exp = intr ## su ## sz ## _z (pg, id, data); \ |
| 37 |
type actual = func_ ## name ## type ## _unary (data); \ |
| 38 |
svbool_t res = svcmpeq_ ## su ## sz (pg, exp, actual); \ |
| 39 |
if (svptest_any (pg, svnot_b_z (pg, res))) \ |
| 40 |
__builtin_abort (); \ |
| 41 |
} |
| 42 |
|
| 43 |
#define DECL_FUNC_INDEX(rtype, type, intr, su, sz) \ |
| 44 |
__attribute__ ((noipa)) \ |
| 45 |
rtype func_ ## rtype ## type ## _vindex (type a, int n) { \ |
| 46 |
return (a[n]); \ |
| 47 |
} \ |
| 48 |
__attribute__ ((noipa)) \ |
| 49 |
rtype func_ ## rtype ## type ## _cindex (type a) { \ |
| 50 |
return (a[0]); \ |
| 51 |
} \ |
| 52 |
void checkfunc_ ## rtype ## type ## _vindex () { \ |
| 53 |
type a = svindex_ ## su ## sz (0, 1); \ |
| 54 |
int n = 2; \ |
| 55 |
if (2 != func_ ## rtype ## type ## _vindex (a, n)) \ |
| 56 |
__builtin_abort (); \ |
| 57 |
} \ |
| 58 |
void checkfunc_ ## rtype ## type ## _cindex () { \ |
| 59 |
type a = svindex_ ## su ## sz (1, 0); \ |
| 60 |
if (1 != func_ ## rtype ## type ## _cindex (a)) \ |
| 61 |
__builtin_abort (); \ |
| 62 |
} |
| 63 |
|
| 64 |
#define DECL_FUNC_INDEX_FLOAT(rtype, type, intr, su, sz) \ |
| 65 |
__attribute__ ((noipa)) \ |
| 66 |
rtype func_ ## rtype ## type ## _vindex (type a, int n) { \ |
| 67 |
return (a[n]); \ |
| 68 |
} \ |
| 69 |
__attribute__ ((noipa)) \ |
| 70 |
rtype func_ ## rtype ## type ## _cindex (type a) { \ |
| 71 |
return (a[0]); \ |
| 72 |
} \ |
| 73 |
void checkfunc_ ## rtype ## type ## _vindex () { \ |
| 74 |
type a = svdup_n_ ## su ## sz (2.0); \ |
| 75 |
int n = 2; \ |
| 76 |
if (2.0 != func_ ## rtype ## type ## _vindex (a, n)) \ |
| 77 |
__builtin_abort (); \ |
| 78 |
} \ |
| 79 |
void checkfunc_ ## rtype ## type ## _cindex () { \ |
| 80 |
type a = svdup_n_ ## su ## sz (4.0); \ |
| 81 |
if (4.0 != func_ ## rtype ## type ## _cindex (a)) \ |
| 82 |
__builtin_abort (); \ |
| 83 |
} |
| 84 |
|
| 85 |
#define DECL_FUNC_BINARY(type, name, op, intr, su, sz) \ |
| 86 |
__attribute__ ((noipa)) \ |
| 87 |
type func_ ## name ## type ## _binary(type a, type b) { \ |
| 88 |
return (a) op (b); \ |
| 89 |
} \ |
| 90 |
void checkfunc_ ## name ## type ## _binary () { \ |
| 91 |
type a = svindex_ ## su ## sz (0, 1); \ |
| 92 |
type b = svindex_ ## su ## sz (0, 2); \ |
| 93 |
svbool_t all_true = svptrue_b ## sz (); \ |
| 94 |
type exp = intr ## su ## sz ## _z (all_true, a, b); \ |
| 95 |
type actual = func_ ## name ## type ## _binary (a, b); \ |
| 96 |
svbool_t res = svcmpeq_ ## su ## sz (all_true, exp, actual); \ |
| 97 |
if (svptest_any (all_true, svnot_b_z (all_true, res))) \ |
| 98 |
__builtin_abort (); \ |
| 99 |
} |
| 100 |
|
| 101 |
#define DECL_FUNC_BINARY_SHIFT(type, name, op, intr, su, sz) \ |
| 102 |
__attribute__ ((noipa)) \ |
| 103 |
type func_ ## name ## type ## _binary(type a, type b) { \ |
| 104 |
return (a) op (b); \ |
| 105 |
} \ |
| 106 |
void checkfunc_ ## name ## type ## _binary () { \ |
| 107 |
type a = svindex_ ## su ## sz (0, 1); \ |
| 108 |
svuint ## sz ## _t b = svindex_u ## sz (0, 2); \ |
| 109 |
type c = svindex_ ## su ## sz (0, 2); \ |
| 110 |
svbool_t all_true = svptrue_b ## sz (); \ |
| 111 |
type exp = intr ## su ## sz ## _z (all_true, a, b); \ |
| 112 |
type actual = func_ ## name ## type ## _binary (a, c); \ |
| 113 |
svbool_t res = svcmpeq_ ## su ## sz (all_true, exp, actual); \ |
| 114 |
if (svptest_any (all_true, svnot_b_z (all_true, res))) \ |
| 115 |
__builtin_abort (); \ |
| 116 |
} |
| 117 |
|
| 118 |
#define DECL_FUNC_BINARY_FLOAT(type, name, op, intr, su, sz) \ |
| 119 |
__attribute__ ((noipa)) \ |
| 120 |
type func_ ## name ## type ## _binary(type a, type b) { \ |
| 121 |
return (a) op (b); \ |
| 122 |
} \ |
| 123 |
void checkfunc_ ## name ## type ## _binary () { \ |
| 124 |
type a = svdup_n_ ## su ## sz (1.0); \ |
| 125 |
type b = svdup_n_ ## su ## sz (2.0); \ |
| 126 |
svbool_t all_true = svptrue_b ## sz (); \ |
| 127 |
type exp = intr ## su ## sz ## _z (all_true, a, b); \ |
| 128 |
type actual = func_ ## name ## type ## _binary (a, b); \ |
| 129 |
svbool_t res = svcmpeq_ ## su ## sz (all_true, exp, actual); \ |
| 130 |
if (svptest_any (all_true, svnot_b_z (all_true, res))) \ |
| 131 |
__builtin_abort (); \ |
| 132 |
} |
| 133 |
|
| 134 |
#define DECL_FUNC_BINARY_CMP(type, name, op, intr, su, sz) \ |
| 135 |
__attribute__ ((noipa)) \ |
| 136 |
type func_ ## name ## type ## _binary_cmp(type a, type b) { \ |
| 137 |
return (a) op (b); \ |
| 138 |
} \ |
| 139 |
void checkfunc_ ## name ## type ## _binary_cmp () { \ |
| 140 |
type a = svindex_ ## su ## sz (0, 1); \ |
| 141 |
type b = svindex_ ## su ## sz (0, 2); \ |
| 142 |
type c = func_ ## name ## type ## _binary_cmp (a, b); \ |
| 143 |
svbool_t all_true = svptrue_b ## sz (); \ |
| 144 |
svbool_t pgc = svcmpne_n_ ## su ## sz (all_true, c, 0); \ |
| 145 |
svbool_t pg = intr ## su ## sz (all_true, a, b); \ |
| 146 |
svbool_t res = sveor_b_z (all_true, pgc, pg); \ |
| 147 |
if (svptest_any (all_true, res)) \ |
| 148 |
__builtin_abort (); \ |
| 149 |
} |
| 150 |
|
| 151 |
#define DECL_FUNC_TERNARY(type, su, sz) \ |
| 152 |
__attribute__ ((noipa)) \ |
| 153 |
type func_ ## type ## _ternary(type p, type q, type a, type b) { \ |
| 154 |
return (p >= q) ? a : b; \ |
| 155 |
} \ |
| 156 |
void checkfunc_ ## type ## _ternary() { \ |
| 157 |
type p = svindex_ ## su ## sz (0, 1); \ |
| 158 |
type q = svindex_ ## su ## sz (1, 1); \ |
| 159 |
type a = svindex_ ## su ## sz (2, 1); \ |
| 160 |
type b = svindex_ ## su ## sz (3, 1); \ |
| 161 |
svbool_t all_true = svptrue_b ## sz (); \ |
| 162 |
svbool_t cmp = svcmpge_ ## su ## sz (all_true, p, q); \ |
| 163 |
type res = svsel_ ## su ## sz (cmp, a, b); \ |
| 164 |
type actual = func_ ## type ## _ternary(p, q, a, b); \ |
| 165 |
svbool_t pgc = svcmpeq_ ## su ## sz (all_true, res, actual); \ |
| 166 |
if (svptest_any (all_true, svnot_b_z (all_true, pgc))) \ |
| 167 |
__builtin_abort (); \ |
| 168 |
} |
| 169 |
|
| 170 |
#define VECT_CST_s8 { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 } |
| 171 |
#define VECT_CST_s16 { 0, 1, 2, 3, 4, 5, 6, 7 } |
| 172 |
#define VECT_CST_s32 { 0, 1, 2, 3 } |
| 173 |
#define VECT_CST_s64 { 0, 1 } |
| 174 |
|
| 175 |
#define VECT_CSTN_s8 { 0, foo_s8 (), 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 } |
| 176 |
#define VECT_CSTN_s16 { 0, foo_s16 (), 2, 3, 4, 5, 6, 7 } |
| 177 |
#define VECT_CSTN_s32 { 0, foo_s32 (), 2, 3 } |
| 178 |
#define VECT_CSTN_s64 { 0, foo_s64 () } |
| 179 |
|
| 180 |
#define DECL_FUNC_INIT(type, su, sz, nelem) \ |
| 181 |
__attribute__ ((noipa)) \ |
| 182 |
type func_ ## type ## _init1() { \ |
| 183 |
type temp = VECT_CST_ ## su ## sz; \ |
| 184 |
return temp; \ |
| 185 |
} \ |
| 186 |
__attribute__ ((noipa)) \ |
| 187 |
type func_ ## type ## _init2() { \ |
| 188 |
type temp = { 0 }; \ |
| 189 |
return temp; \ |
| 190 |
} \ |
| 191 |
__attribute__ ((noipa)) \ |
| 192 |
type func_ ## type ## _init3() { \ |
| 193 |
type temp = { }; \ |
| 194 |
return temp; \ |
| 195 |
} \ |
| 196 |
__attribute__ ((noipa)) \ |
| 197 |
int ## sz ## _t foo_ ## su ## sz () { \ |
| 198 |
return 1; \ |
| 199 |
} \ |
| 200 |
__attribute__ ((noipa)) \ |
| 201 |
type func_ ## type ## _init4() { \ |
| 202 |
type temp = VECT_CSTN_ ## su ## sz; \ |
| 203 |
return temp; \ |
| 204 |
} \ |
| 205 |
void checkfunc_ ## type ## _init() { \ |
| 206 |
svbool_t all_true = svptrue_b ## sz (); \ |
| 207 |
int ## sz ## _t mem[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }; \ |
| 208 |
svbool_t cmp ## sz = svptrue_pat_b ## sz (SV_VL ## nelem); \ |
| 209 |
type init1 = svld1_ ## su ## sz (cmp ## sz, mem); \ |
| 210 |
type init2 = svindex_ ## su ## sz (0, 0); \ |
| 211 |
type init3 = svindex_ ## su ## sz (0, 0); \ |
| 212 |
type init4 = svld1_ ## su ## sz (cmp ## sz, mem); \ |
| 213 |
\ |
| 214 |
type res_init1 = func_ ## type ## _init1 (); \ |
| 215 |
svbool_t cmp = svcmpne_ ## su ## sz (cmp ## sz, init1, res_init1); \ |
| 216 |
if (svptest_any (all_true, cmp)) \ |
| 217 |
__builtin_abort (); \ |
| 218 |
\ |
| 219 |
type res_init2 = func_ ## type ## _init2 (); \ |
| 220 |
cmp = svcmpne_ ## su ## sz (cmp ## sz, init2, res_init2); \ |
| 221 |
if (svptest_any (all_true, cmp)) \ |
| 222 |
__builtin_abort (); \ |
| 223 |
\ |
| 224 |
type res_init3 = func_ ## type ## _init3 (); \ |
| 225 |
cmp = svcmpne_ ## su ## sz (cmp ## sz, init3, res_init3); \ |
| 226 |
if (svptest_any (all_true, cmp)) \ |
| 227 |
__builtin_abort (); \ |
| 228 |
\ |
| 229 |
type res_init4 = func_ ## type ## _init4 (); \ |
| 230 |
cmp = svcmpne_ ## su ## sz (cmp ## sz, init4, res_init4); \ |
| 231 |
if (svptest_any (all_true, cmp)) \ |
| 232 |
__builtin_abort (); \ |
| 233 |
} |
| 234 |
|
| 235 |
#define DECL_FUNC_TERNARY_FLOAT(type, su, sz) \ |
| 236 |
__attribute__ ((noipa)) \ |
| 237 |
type func_ ## type ## _ternary(type p, type q, type a, type b) { \ |
| 238 |
return (p >= q) ? a : b; \ |
| 239 |
} \ |
| 240 |
void checkfunc_ ## type ## _ternary() { \ |
| 241 |
type p = svdup_n_ ## su ## sz (2.0); \ |
| 242 |
type q = svdup_n_ ## su ## sz (1.0); \ |
| 243 |
type a = svdup_n_ ## su ## sz (3.0); \ |
| 244 |
type b = svdup_n_ ## su ## sz (4.0); \ |
| 245 |
svbool_t all_true = svptrue_b ## sz (); \ |
| 246 |
svbool_t cmp = svcmpge_ ## su ## sz (all_true, p, q); \ |
| 247 |
type res = svsel_ ## su ## sz (cmp, a, b); \ |
| 248 |
type actual = func_ ## type ## _ternary(p, q, a, b); \ |
| 249 |
svbool_t pgc = svcmpeq_ ## su ## sz (all_true, res, actual); \ |
| 250 |
if (svptest_any (all_true, svnot_b_z (all_true, pgc))) \ |
| 251 |
__builtin_abort (); \ |
| 252 |
} |
| 253 |
|
| 254 |
#define DECL_FUNC_BINARY_SCALAR(scalar, type, name, op, intr, su, sz) \ |
| 255 |
__attribute__ ((noipa)) \ |
| 256 |
type func_ ## name ## type ## _binary_cscalar(type a) { \ |
| 257 |
return (a) op scalar; \ |
| 258 |
} \ |
| 259 |
__attribute__ ((noipa)) \ |
| 260 |
type func_ ## name ## type ## _binary_vscalar(type a, int b) { \ |
| 261 |
return (a) op b; \ |
| 262 |
} \ |
| 263 |
void checkfunc_ ## name ## type ## _binary_cscalar () { \ |
| 264 |
type a = svindex_ ## su ## sz (0, 1); \ |
| 265 |
svbool_t pg = svptrue_b ## sz (); \ |
| 266 |
type exp = intr ## su ## sz ## _z (pg, a, scalar); \ |
| 267 |
type actual = func_ ## name ## type ## _binary_cscalar (a); \ |
| 268 |
svbool_t res = svcmpeq_ ## su ## sz (pg, exp, actual); \ |
| 269 |
if (svptest_any (pg, svnot_b_z (pg, res))) \ |
| 270 |
__builtin_abort (); \ |
| 271 |
} \ |
| 272 |
void checkfunc_ ## name ## type ## _binary_vscalar () { \ |
| 273 |
type a = svindex_ ## su ## sz (0, 1); \ |
| 274 |
svbool_t pg = svptrue_b ## sz (); \ |
| 275 |
uint ## sz ## _t b = scalar; \ |
| 276 |
type exp = intr ## su ## sz ## _z (pg, a, b); \ |
| 277 |
type actual = func_ ## name ## type ## _binary_vscalar (a, b); \ |
| 278 |
svbool_t res = svcmpeq_ ## su ## sz (pg, exp, actual); \ |
| 279 |
if (svptest_any (pg, svnot_b_z (pg, res))) \ |
| 280 |
__builtin_abort (); \ |
| 281 |
} |
| 282 |
|
| 283 |
#define DECL_FUNC_UNARY_RET_FLOAT(rtype, type, name, op, intr, su, sz) \ |
| 284 |
__attribute__ ((noipa)) \ |
| 285 |
rtype func_ ## name ## rtype ## type ## _unary(type a) { \ |
| 286 |
return op (a); \ |
| 287 |
} \ |
| 288 |
void checkfunc_ ## name ## rtype ## type ## _unary () { \ |
| 289 |
type a = svdup_n_ ## su ## sz (2.0); \ |
| 290 |
svbool_t pg = svptrue_b ## sz (); \ |
| 291 |
rtype exp = intr ## su ## sz ## _z (a); \ |
| 292 |
rtype actual = func_ ## name ## type ## _unary (a); \ |
| 293 |
svbool_t res = svcmpeq_ ## su ## sz (pg, exp, actual); \ |
| 294 |
if (svptest_any (pg, svnot_b_z (pg, res))) \ |
| 295 |
__builtin_abort (); \ |
| 296 |
} |
| 297 |
|
| 298 |
#define DECL_FUNC_BINARY_RET_FLOAT_CMP(rtype, type, name, op, intr, su, sz) \ |
| 299 |
__attribute__ ((noipa)) \ |
| 300 |
rtype func_ ## name ## rtype ## type ## _binary_cmp(type a, type b) { \ |
| 301 |
return (a) op (b); \ |
| 302 |
} \ |
| 303 |
void checkfunc_ ## name ## rtype ## type ## _binary_cmp () { \ |
| 304 |
type a = svdup_n_ ## su ## sz (2.0); \ |
| 305 |
type b = svdup_n_ ## su ## sz (3.0); \ |
| 306 |
svbool_t all_true = svptrue_b ## sz (); \ |
| 307 |
rtype cmp = func_ ## name ## rtype ## type ## _binary_cmp (a, b); \ |
| 308 |
svbool_t pgc = intr ## su ## sz (all_true, a, b) ; \ |
| 309 |
svbool_t pg = svcmpne_n_s ## sz (all_true, cmp, 0); \ |
| 310 |
svbool_t res = sveor_b_z (all_true, pg, pgc); \ |
| 311 |
if (svptest_any (all_true, res)) \ |
| 312 |
__builtin_abort (); \ |
| 313 |
} |
| 314 |
|
| 315 |
#define DECL_FUNC_BINARY_RET_COND(rtype, type, name, op, intr, su, sz) \ |
| 316 |
__attribute__ ((noipa)) \ |
| 317 |
rtype func_ ## name ## rtype ## type ## _binary_cond(type a, type b) { \ |
| 318 |
return (a) op (b); \ |
| 319 |
} \ |
| 320 |
__attribute__ ((noipa)) \ |
| 321 |
svbool_t name ## intr ## su ## sz (svbool_t t, type a, type b) { \ |
| 322 |
svbool_t pgl = svcmpne_n_ ## su ## sz (t, a, 0); \ |
| 323 |
svbool_t pgr = svcmpne_n_ ## su ## sz (t, b, 0); \ |
| 324 |
return intr ## b_z (t, pgl, pgr); \ |
| 325 |
} \ |
| 326 |
void checkfunc_ ## name ## rtype ## type ## _binary_cond () { \ |
| 327 |
type a = svdup_n_ ## su ## sz (2); \ |
| 328 |
type b = svdup_n_ ## su ## sz (3); \ |
| 329 |
svbool_t all_true = svptrue_b ## sz (); \ |
| 330 |
rtype cmp = func_ ## name ## rtype ## type ## _binary_cond (a, b); \ |
| 331 |
svbool_t pgc = name ## intr ## su ## sz (all_true, a, b) ; \ |
| 332 |
svbool_t pg = svcmpne_n_s ## sz (all_true, cmp, 0); \ |
| 333 |
svbool_t res = sveor_b_z (all_true, pg, pgc); \ |
| 334 |
if (svptest_any (all_true, res)) \ |
| 335 |
__builtin_abort (); \ |
| 336 |
} |
| 337 |
|
| 338 |
#define DECL_FUNC_UNARY_RET_COND(rtype, type, name, op, intr, su, sz) \ |
| 339 |
__attribute__ ((noipa)) \ |
| 340 |
rtype func_ ## name ## rtype ## type ## _unary_cond (type a) { \ |
| 341 |
return op (a); \ |
| 342 |
} \ |
| 343 |
__attribute__ ((noipa)) \ |
| 344 |
svbool_t name ## intr ## su ## sz (svbool_t t, type a) { \ |
| 345 |
svbool_t pgl = svcmpeq_n_ ## su ## sz (t, a, 0); \ |
| 346 |
return pgl; \ |
| 347 |
} \ |
| 348 |
void checkfunc_ ## name ## rtype ## type ## _unary_cond () { \ |
| 349 |
type a = svdup_n_ ## su ## sz (2); \ |
| 350 |
svbool_t all_true = svptrue_b ## sz (); \ |
| 351 |
rtype cmp = func_ ## name ## rtype ## type ## _unary_cond (a); \ |
| 352 |
svbool_t pgc = name ## intr ## su ## sz (all_true, a) ; \ |
| 353 |
svbool_t pg = svcmpne_n_s ## sz (all_true, cmp, 0); \ |
| 354 |
svbool_t res = sveor_b_z (all_true, pg, pgc); \ |
| 355 |
if (svptest_any (all_true, res)) \ |
| 356 |
__builtin_abort (); \ |
| 357 |
} |
| 358 |
|
| 359 |
#define TYPES_UNARY(name, op, intr, id) \ |
| 360 |
DECL_FUNC_UNARY (svint8_t, name, op, intr, s, 8, id) \ |
| 361 |
DECL_FUNC_UNARY (svint16_t, name, op, intr, s, 16, id) \ |
| 362 |
DECL_FUNC_UNARY (svint32_t, name, op, intr, s, 32, id) \ |
| 363 |
DECL_FUNC_UNARY (svint64_t, name, op, intr, s, 64, id) \ |
| 364 |
DECL_FUNC_UNARY_FLOAT (svfloat32_t, name, op, intr, f, 32, id) \ |
| 365 |
DECL_FUNC_UNARY_FLOAT (svfloat64_t, name, op, intr, f, 64, id) |
| 366 |
|
| 367 |
#define TYPES_INT_UNARY(name, op, intr, id) \ |
| 368 |
DECL_FUNC_UNARY (svint8_t, name, op, intr, s, 8, id) \ |
| 369 |
DECL_FUNC_UNARY (svint16_t, name, op, intr, s, 16, id) \ |
| 370 |
DECL_FUNC_UNARY (svint32_t, name, op, intr, s, 32, id) \ |
| 371 |
DECL_FUNC_UNARY (svint64_t, name, op, intr, s, 64, id) |
| 372 |
|
| 373 |
#define TYPES_BINARY(name, op, intr) \ |
| 374 |
DECL_FUNC_BINARY (svint8_t, name, op, intr, s, 8) \ |
| 375 |
DECL_FUNC_BINARY (svint16_t, name, op, intr, s, 16) \ |
| 376 |
DECL_FUNC_BINARY (svint32_t, name, op, intr, s, 32) \ |
| 377 |
DECL_FUNC_BINARY (svint64_t, name, op, intr, s, 64) \ |
| 378 |
DECL_FUNC_BINARY_FLOAT (svfloat32_t, name, op, intr, f, 32) \ |
| 379 |
DECL_FUNC_BINARY_FLOAT (svfloat64_t, name, op, intr, f, 64) |
| 380 |
|
| 381 |
#define TYPES_BINARY32_64(name, op, intr) \ |
| 382 |
DECL_FUNC_BINARY (svint32_t, name, op, intr, s, 32) \ |
| 383 |
DECL_FUNC_BINARY (svint64_t, name, op, intr, s, 64) |
| 384 |
|
| 385 |
#define TYPES_TERNARY() \ |
| 386 |
DECL_FUNC_TERNARY (svint8_t, s, 8) \ |
| 387 |
DECL_FUNC_TERNARY (svint16_t, s, 16) \ |
| 388 |
DECL_FUNC_TERNARY (svint32_t, s, 32) \ |
| 389 |
DECL_FUNC_TERNARY (svint64_t, s, 64) \ |
| 390 |
DECL_FUNC_TERNARY_FLOAT (svfloat32_t, f, 32) \ |
| 391 |
DECL_FUNC_TERNARY_FLOAT (svfloat64_t, f, 64) |
| 392 |
|
| 393 |
#define TYPES_INDEX(intr) \ |
| 394 |
DECL_FUNC_INDEX (int8_t, svint8_t, intr, s, 8) \ |
| 395 |
DECL_FUNC_INDEX (int16_t, svint16_t, intr, s, 16) \ |
| 396 |
DECL_FUNC_INDEX (int32_t, svint32_t, intr, s, 32) \ |
| 397 |
DECL_FUNC_INDEX (int64_t, svint64_t, intr, s, 64) \ |
| 398 |
DECL_FUNC_INDEX_FLOAT (float32_t, svfloat32_t, intr, f, 32) \ |
| 399 |
DECL_FUNC_INDEX_FLOAT (float64_t, svfloat64_t, intr, f, 64) |
| 400 |
|
| 401 |
#define TYPES_INT_BINARY(name, op, intr) \ |
| 402 |
DECL_FUNC_BINARY (svint8_t, name, op, intr, s, 8) \ |
| 403 |
DECL_FUNC_BINARY (svint16_t, name, op, intr, s, 16) \ |
| 404 |
DECL_FUNC_BINARY (svint32_t, name, op, intr, s, 32) \ |
| 405 |
DECL_FUNC_BINARY (svint64_t, name, op, intr, s, 64) |
| 406 |
|
| 407 |
#define TYPES_INT_BINARY_SHIFT(name, op, intr) \ |
| 408 |
DECL_FUNC_BINARY_SHIFT (svint8_t, name, op, intr, s, 8) \ |
| 409 |
DECL_FUNC_BINARY_SHIFT (svint16_t, name, op, intr, s, 16) \ |
| 410 |
DECL_FUNC_BINARY_SHIFT (svint32_t, name, op, intr, s, 32) \ |
| 411 |
DECL_FUNC_BINARY_SHIFT (svint64_t, name, op, intr, s, 64) |
| 412 |
|
| 413 |
#define TYPES_INT_BINARY_CMP(name, op, intr) \ |
| 414 |
DECL_FUNC_BINARY_CMP (svint8_t, name, op, intr, s, 8) \ |
| 415 |
DECL_FUNC_BINARY_CMP (svint16_t, name, op, intr, s, 16) \ |
| 416 |
DECL_FUNC_BINARY_CMP (svint32_t, name, op, intr, s, 32) \ |
| 417 |
DECL_FUNC_BINARY_CMP (svint64_t, name, op, intr, s, 64) \ |
| 418 |
|
| 419 |
#define TYPES_INT_BINARY_SCALAR(c, name, op, intr) \ |
| 420 |
DECL_FUNC_BINARY_SCALAR (c, svint8_t, name, op, intr, s, 8) \ |
| 421 |
DECL_FUNC_BINARY_SCALAR (c, svint16_t, name, op, intr, s, 16) \ |
| 422 |
DECL_FUNC_BINARY_SCALAR (c, svint32_t, name, op, intr, s, 32) \ |
| 423 |
DECL_FUNC_BINARY_SCALAR (c, svint64_t, name, op, intr, s, 64) |
| 424 |
|
| 425 |
#define TYPES_FLOAT_BINARY_RET_CMP(name, op, intr) \ |
| 426 |
DECL_FUNC_BINARY_RET_FLOAT_CMP (svint32_t, svfloat32_t, name, op, intr, f, 32) \ |
| 427 |
DECL_FUNC_BINARY_RET_FLOAT_CMP (svint64_t, svfloat64_t, name, op, intr, f, 64) |
| 428 |
|
| 429 |
#define TYPES_FLOAT_UNARY_RET(name, op, intr) \ |
| 430 |
DECL_FUNC_UNARY_RET_FLOAT (svint32_t, svfloat32_t, name, op, intr, f, 32) \ |
| 431 |
DECL_FUNC_UNARY_RET_FLOAT (svint64_t, svfloat64_t, name, op, intr, f, 64) |
| 432 |
|
| 433 |
#define TYPES_BINARY_RET_COND(name, op, intr) \ |
| 434 |
DECL_FUNC_BINARY_RET_COND (svint8_t, svint8_t, name, op, intr, s, 8) \ |
| 435 |
DECL_FUNC_BINARY_RET_COND (svint16_t, svint16_t, name, op, intr, s, 16) \ |
| 436 |
DECL_FUNC_BINARY_RET_COND (svint32_t, svint32_t, name, op, intr, s, 32) \ |
| 437 |
DECL_FUNC_BINARY_RET_COND (svint64_t, svint64_t, name, op, intr, s, 64) \ |
| 438 |
DECL_FUNC_BINARY_RET_COND (svint32_t, svfloat32_t, name, op, intr, f, 32) \ |
| 439 |
DECL_FUNC_BINARY_RET_COND (svint64_t, svfloat64_t, name, op, intr, f, 64) |
| 440 |
|
| 441 |
#define TYPES_UNARY_RET_COND(name, op, intr) \ |
| 442 |
DECL_FUNC_UNARY_RET_COND (svint8_t, svint8_t, name, op, intr, s, 8) \ |
| 443 |
DECL_FUNC_UNARY_RET_COND (svint16_t, svint16_t, name, op, intr, s, 16) \ |
| 444 |
DECL_FUNC_UNARY_RET_COND (svint32_t, svint32_t, name, op, intr, s, 32) \ |
| 445 |
DECL_FUNC_UNARY_RET_COND (svint64_t, svint64_t, name, op, intr, s, 64) \ |
| 446 |
DECL_FUNC_UNARY_RET_COND (svint32_t, svfloat32_t, name, op, intr, f, 32) \ |
| 447 |
DECL_FUNC_UNARY_RET_COND (svint64_t, svfloat64_t, name, op, intr, f, 64) |
| 448 |
|
| 449 |
#define TYPES_INIT() \ |
| 450 |
DECL_FUNC_INIT (svint8_t, s, 8, 16) \ |
| 451 |
DECL_FUNC_INIT (svint16_t, s, 16, 8) \ |
| 452 |
DECL_FUNC_INIT (svint32_t, s, 32, 4) \ |
| 453 |
DECL_FUNC_INIT (svint64_t, s, 64, 2) |
| 454 |
|
| 455 |
#define C_TYPES \ |
| 456 |
TYPES_INIT () \ |
| 457 |
TYPES_UNARY (plus, +, svadd_, zr) \ |
| 458 |
TYPES_UNARY (minus, -, svsub_, zr) \ |
| 459 |
TYPES_UNARY (plus_plus, ++, svadd_, one) \ |
| 460 |
TYPES_UNARY (minus_minus, --, svadd_, mone) \ |
| 461 |
TYPES_INDEX (svget_lane_) \ |
| 462 |
TYPES_BINARY (plus, +, svadd_) \ |
| 463 |
TYPES_BINARY (minus, -, svsub_) \ |
| 464 |
TYPES_BINARY (mult, *, svmul_) \ |
| 465 |
TYPES_BINARY32_64 (div, /, svdiv_) \ |
| 466 |
TYPES_INT_BINARY (and, &, svand_) \ |
| 467 |
TYPES_INT_BINARY (orr, |, svorr_) \ |
| 468 |
TYPES_INT_UNARY (not, ~, sveor_, mone) \ |
| 469 |
TYPES_INT_BINARY (eor, ^, sveor_) \ |
| 470 |
TYPES_INT_BINARY_SHIFT (lshift, <<, svlsl_) \ |
| 471 |
TYPES_INT_BINARY_SHIFT (rshift, >>, svasr_) \ |
| 472 |
TYPES_INT_BINARY_SCALAR (2, lshift, <<, svlsl_n_) \ |
| 473 |
TYPES_INT_BINARY_SCALAR (2, rshift, >>, svasr_n_) \ |
| 474 |
TYPES_INT_BINARY_CMP (eq, ==, svcmpeq_) \ |
| 475 |
TYPES_INT_BINARY_CMP (ne, !=, svcmpne_) \ |
| 476 |
TYPES_INT_BINARY_CMP (gt, >, svcmpgt_) \ |
| 477 |
TYPES_INT_BINARY_CMP (lt, <, svcmplt_) \ |
| 478 |
TYPES_INT_BINARY_CMP (ge, >=, svcmpge_) \ |
| 479 |
TYPES_INT_BINARY_CMP (le, <=, svcmple_) \ |
| 480 |
TYPES_FLOAT_BINARY_RET_CMP (eq, ==, svcmpeq_) \ |
| 481 |
TYPES_FLOAT_BINARY_RET_CMP (ne, !=, svcmpne_) \ |
| 482 |
TYPES_FLOAT_BINARY_RET_CMP (gt, >, svcmpgt_) \ |
| 483 |
TYPES_FLOAT_BINARY_RET_CMP (lt, <, svcmplt_) \ |
| 484 |
TYPES_FLOAT_BINARY_RET_CMP (ge, >=, svcmpge_) \ |
| 485 |
TYPES_FLOAT_BINARY_RET_CMP (le, <=, svcmple_) \ |
| 486 |
|
| 487 |
#ifdef __cplusplus |
| 488 |
#define CPP_TYPES \ |
| 489 |
TYPES_BINARY_RET_COND (and_and, &&, svand_) \ |
| 490 |
TYPES_BINARY_RET_COND (or_or, ||, svorr_) \ |
| 491 |
TYPES_UNARY_RET_COND (lnot, !, svnot_z_) \ |
| 492 |
TYPES_TERNARY () |
| 493 |
#endif |
| 494 |
|
| 495 |
/* Declare and define functions. */ |
| 496 |
C_TYPES |
| 497 |
|
| 498 |
#ifdef __cplusplus |
| 499 |
CPP_TYPES |
| 500 |
#endif |
| 501 |
|
| 502 |
#undef DECL_FUNC_UNARY |
| 503 |
#define DECL_FUNC_UNARY(type, name, op, intr, su, sz, id) \ |
| 504 |
checkfunc_ ## name ## type ## _unary (); |
| 505 |
|
| 506 |
#undef DECL_FUNC_UNARY_FLOAT |
| 507 |
#define DECL_FUNC_UNARY_FLOAT(type, name, op, intr, su, sz, id) \ |
| 508 |
checkfunc_ ## name ## type ## _unary (); |
| 509 |
|
| 510 |
#undef DECL_FUNC_UNARY_RET_FLOAT |
| 511 |
#define DECL_FUNC_UNARY_RET_FLOAT(type, name, op, intr, su, sz, id) \ |
| 512 |
checkfunc_ ## name ## type ## _unary (); |
| 513 |
|
| 514 |
#undef DECL_FUNC_INDEX |
| 515 |
#define DECL_FUNC_INDEX(rtype, type, intr, su, sz) \ |
| 516 |
checkfunc_ ## rtype ## type ## _vindex (); \ |
| 517 |
checkfunc_ ## rtype ## type ## _cindex (); |
| 518 |
|
| 519 |
#undef DECL_FUNC_INDEX_FLOAT |
| 520 |
#define DECL_FUNC_INDEX_FLOAT(rtype, type, intr, su, sz) \ |
| 521 |
checkfunc_ ## rtype ## type ## _vindex (); \ |
| 522 |
checkfunc_ ## rtype ## type ## _cindex (); |
| 523 |
|
| 524 |
#undef DECL_FUNC_BINARY |
| 525 |
#define DECL_FUNC_BINARY(type, name, op, intr, su, sz) \ |
| 526 |
checkfunc_ ## name ## type ## _binary (); |
| 527 |
|
| 528 |
#undef DECL_FUNC_BINARY_SHIFT |
| 529 |
#define DECL_FUNC_BINARY_SHIFT(type, name, op, intr, su, sz) \ |
| 530 |
checkfunc_ ## name ## type ## _binary (); |
| 531 |
|
| 532 |
#undef DECL_FUNC_BINARY_FLOAT |
| 533 |
#define DECL_FUNC_BINARY_FLOAT(type, name, op, intr, su, sz) \ |
| 534 |
checkfunc_ ## name ## type ## _binary (); |
| 535 |
|
| 536 |
#undef DECL_FUNC_BINARY_CMP |
| 537 |
#define DECL_FUNC_BINARY_CMP(type, name, op, intr, su, sz) \ |
| 538 |
checkfunc_ ## name ## type ## _binary_cmp (); |
| 539 |
|
| 540 |
#undef DECL_FUNC_TERNARY |
| 541 |
#define DECL_FUNC_TERNARY(type, su, sz) \ |
| 542 |
checkfunc_ ## type ## _ternary (); |
| 543 |
|
| 544 |
#undef DECL_FUNC_INIT |
| 545 |
#define DECL_FUNC_INIT(type, su, sz, nelem) \ |
| 546 |
checkfunc_ ## type ## _init (); |
| 547 |
|
| 548 |
#undef DECL_FUNC_TERNARY_FLOAT |
| 549 |
#define DECL_FUNC_TERNARY_FLOAT(type, su, sz) \ |
| 550 |
checkfunc_ ## type ## _ternary (); |
| 551 |
|
| 552 |
#undef DECL_FUNC_BINARY_SCALAR |
| 553 |
#define DECL_FUNC_BINARY_SCALAR(scalar, type, name, op, intr, su, sz) \ |
| 554 |
checkfunc_ ## name ## type ## _binary_cscalar (); \ |
| 555 |
checkfunc_ ## name ## type ## _binary_vscalar (); |
| 556 |
|
| 557 |
#undef DECL_FUNC_BINARY_RET_FLOAT_CMP |
| 558 |
#define DECL_FUNC_BINARY_RET_FLOAT_CMP(rtype, type, name, op, intr, su, sz) \ |
| 559 |
checkfunc_ ## name ## rtype ## type ## _binary_cmp (); |
| 560 |
|
| 561 |
#undef DECL_FUNC_BINARY_RET_COND |
| 562 |
#define DECL_FUNC_BINARY_RET_COND(rtype, type, name, op, intr, su, sz) \ |
| 563 |
checkfunc_ ## name ## rtype ## type ## _binary_cond (); |
| 564 |
|
| 565 |
#undef DECL_FUNC_UNARY_RET_COND |
| 566 |
#define DECL_FUNC_UNARY_RET_COND(rtype, type, name, op, intr, su, sz) \ |
| 567 |
checkfunc_ ## name ## rtype ## type ## _unary_cond (); |
| 568 |
|
| 569 |
int |
| 570 |
main (void) |
| 571 |
{ |
| 572 |
C_TYPES |
| 573 |
|
| 574 |
#ifdef __cplusplus |
| 575 |
CPP_TYPES |
| 576 |
#endif |
| 577 |
|
| 578 |
return 0; |
| 579 |
} |