diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 5918ab5..e5c9280 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -30,6 +30,7 @@ jobs: uses: actions/checkout@v5 with: repository: dstogov/ir + ref: simd path: ir - name: make ir run: | @@ -73,6 +74,7 @@ jobs: uses: actions/checkout@v5 with: repository: dstogov/ir + ref: simd path: ir - name: make ir run: | @@ -103,6 +105,7 @@ jobs: uses: actions/checkout@v5 with: repository: dstogov/ir + ref: simd path: ir - name: make ir run: | @@ -128,6 +131,7 @@ jobs: uses: actions/checkout@v5 with: repository: dstogov/ir + ref: simd path: ir - name: Prepare env shell: powershell diff --git a/c.g b/c.g index eaa9a11..1a82b1c 100644 --- a/c.g +++ b/c.g @@ -487,7 +487,7 @@ attrib(rcc_ctx *rcc, c_dcl *d): {c_name name = sym;} "(" constant_expression(rcc, &v) ")" {c_gcc_attribute_regparm(rcc, d, name, &v);} | ("unused"|"__unused__") {d->attr |= C_ATTR_UNUSED;} | ("vector_size"|"__vector_size__") {c_value_clear(&v);} - ( "(" constant_expression(rcc, &v) ")" )? {yy_error_fmt("unsupported attribute \"%s\"", yy_sym2str(rcc, name));} + ( "(" constant_expression(rcc, &v) ")" )? {c_gcc_attribute_vector_size(rcc, d, name, &v);} | ("weak"|"__weak__") {d->attr |= C_ATTR_WEAK;} | ID(rcc, &name) {sym = c_gcc_attribute(rcc, d, name, sym);} )? @@ -1205,6 +1205,8 @@ unary_expression(rcc_ctx *rcc, c_value *val): | "__builtin_umul_overflow" | "__builtin_umull_overflow" | "__builtin_umulll_overflow" + | "__builtin_shuffle" + | "__builtin_shufflevector" ) "(" builtin_parameters(rcc, &v, name) ")" | {ir_ref old = c_do_nocode(rcc);} @@ -1218,6 +1220,12 @@ unary_expression(rcc_ctx *rcc, c_value *val): "," type_name(rcc, &t) {c_do_builtin_va_arg(rcc, &v, t);} ")" + | "__builtin_convertvector" + "(" + assignment_expression(rcc, &v) + "," + type_name(rcc, &t) {c_do_builtin_convertvector(rcc, &v, t);} + ")" ) ( {c_value dim;} {c_value_clear(&dim);} diff --git a/rcc.c b/rcc.c index ddd0143..4ad3c9d 100644 --- a/rcc.c +++ b/rcc.c @@ -73,6 +73,8 @@ #define C_DUMP_LIVE_RANGES (1<<25) +#define C_DUMP_C (1<<26) + #define C_SINGLE_FILE (1<<29) #define C_DO_LINK_INTERNAL (1<<30) #define C_DO_LINK_EXTERNAL (1U<<31) @@ -595,9 +597,15 @@ static void* c_linker_resolve_sym_name(ir_loader *loader, ir_ctx *ctx, ir_str _n return NULL; } -void *c_linker_allocate_data(rcc_ctx *rcc, c_name name, size_t size, size_t align) +void *c_linker_allocate_data(rcc_ctx *rcc, c_name name, size_t size, size_t align, bool is_array) { - void *data = ir_arena_alloc_aligned(&rcc->c_linker_arena, size, align); + void *data; + + if (is_array && size >= 16 && align < 16) { + /* global array variable of length at least 16 bytes always has alignment of at least 16 byte */ + align = 16; + } + data = ir_arena_alloc_aligned(&rcc->c_linker_arena, size, align); if (UNEXPECTED(!data)) yy_error("not enough memory to allocate data"); if (align < 8) { align = 8; @@ -1144,7 +1152,7 @@ static void rcc_fix_flexible_data(rcc_ctx *rcc) p->sym->value.type = type; p->sym->value.u.optx = IR_OPT(C_VAL_CONST, IR_ADDR); - p->sym->value.u.val.ptr = c_linker_allocate_data(rcc, i, type->size, c_attr2align(type->attr)); + p->sym->value.u.val.ptr = c_linker_allocate_data(rcc, i, type->size, c_attr2align(type->attr), 1); p->sym->is_implemented = 1; //yy_warning_fmt("array \"%s\" assumed to have one element", p->str); // error position ??? @@ -1303,6 +1311,15 @@ static size_t rcc_emit_ir_data(rcc_ctx *rcc, FILE *f, const c_type *type, const offset++; } return offset; + } else if (type->kind == C_TYPE_VECTOR) { + size_t offset = 0, el_offset = 0; + int i; + + for (i = 0; i < type->vec.length; el_offset += type->vec.type->size, i++) { + IR_ASSERT(offset == el_offset); + offset += rcc_emit_ir_data(rcc, f, type->vec.type, (const char*)addr + el_offset, base + el_offset, rel); + } + return offset; } else { IR_ASSERT(0); } @@ -1389,7 +1406,9 @@ static void rcc_emit_ir(rcc_ctx *rcc, FILE *f) if (p->sym && p->sym->kind == C_SYM_VAR) { size_t size; - if (p->sym->linkage == C_LINK_INTERNAL) { + if (p->sym->linkage == C_LINK_NONE) { + continue; + } else if (p->sym->linkage == C_LINK_INTERNAL) { fprintf(f, "static "); } else if (p->sym->is_external || !c_value_is_set(&p->sym->value)) { if (p->sym->alias) continue; @@ -1493,6 +1512,80 @@ static void rcc_emit_llvm(rcc_ctx *rcc, FILE *f) } } +static void rcc_emit_c_proto(rcc_ctx *rcc, const char *name, c_sym *func, FILE *f) +{ + const c_type *t = func->value.type; + uint32_t flags; + ir_type ret_type; + uint32_t params_count; + uint8_t *param_types; + + IR_ASSERT(t->kind == C_TYPE_FUNC); + param_types = alloca(t->func.num_params + 16); + c_type2proto_ex(rcc, t, &flags, &ret_type, ¶ms_count, param_types); + if (func->linkage == C_LINK_INTERNAL) { + flags |= IR_STATIC; + } else if (func->linkage == C_LINK_BUILTIN) { + flags |= IR_CC_BUILTIN; + } + ir_emit_c_func_decl(name, flags, ret_type, params_count, param_types, f); +} + +static void rcc_emit_c(rcc_ctx *rcc, FILE *f) +{ + uint32_t i; + yy_hash_bucket *p; + + for (i = YY_LAST_KEYWORD + 1, p = rcc->yy_hash.data + i; i < rcc->yy_hash.count; p++, i++) { + if (p->sym && p->sym->kind == C_SYM_FUNC && !p->sym->ctx) { + if ((p->sym->is_external || !p->sym->ctx) && p->sym->alias) continue; + rcc_emit_c_proto(rcc, p->str, p->sym, f); + } + } + + for (i = YY_LAST_KEYWORD + 1, p = rcc->yy_hash.data + i; i < rcc->yy_hash.count; p++, i++) { + if (p->sym && p->sym->kind == C_SYM_VAR) { + uint32_t flags = 0; + const char *str; + + if (p->sym->linkage == C_LINK_INTERNAL) { + flags |= IR_STATIC; + } else if (p->sym->is_external || !c_value_is_set(&p->sym->value)) { + flags |= IR_EXTERN; + } + if (c_is_type_const(p->sym->value.type)) { + flags |= IR_CONST; + } + if (p->sym->alias) { + str = rcc->yy_hash.data[p->sym->alias].str; + } else { + str = p->str; + } + //TODO: type ??? + ir_emit_c_sym_decl(str, flags, f); + //TODO: initializer ??? + } + } + + for (i = YY_LAST_KEYWORD + 1, p = rcc->yy_hash.data + i; i < rcc->yy_hash.count; p++, i++) { + if (p->sym && p->sym->kind == C_SYM_FUNC && p->sym->ctx) { + ir_ctx *ctx = p->sym->ctx; + bool cleanup = 0; + + if (!ctx->vregs) { + ir_assign_virtual_registers(ctx); + ir_compute_dessa_moves(ctx); + cleanup = 1; + } + ir_emit_c(ctx, p->str, f); + if (cleanup) { + ir_mem_free(ctx->vregs); + ctx->vregs = NULL; + } + } + } +} + static int rcc_preprocess(rcc_ctx *rcc, const char *file_name, FILE *f) { if (!rcc_read(rcc, file_name)) { @@ -1520,6 +1613,9 @@ static int rcc_compile(rcc_ctx *rcc, const char *file_name) if (rcc->c_flags & C_DUMP_LLVM) { rcc_emit_llvm(rcc, rcc->output); } + if (rcc->c_flags & C_DUMP_C) { + rcc_emit_c(rcc, rcc->output); + } if (ir_list_capasity(&rcc->codegen_queue)) { do { c_name name = ir_list_pop(&rcc->codegen_queue); @@ -1852,6 +1948,7 @@ static void rcc_help(const char *cmd) " -m[no-]sse4 - enable/disable SSE4 instruction set\n" " -m[no-]sse4.1 - enable/disable SSE4.1 instruction set\n" " -m[no-]sse4.2 - enable/disable SSE4.2 instruction set\n" + " -m[no-]avx2 - enable/disable AVX2 instruction set\n" #endif " -muse-fp - use base frame pointer register\n" #if defined(IR_TARGET_X86) @@ -2091,6 +2188,12 @@ static int rcc_parse_option(rcc_ctx *rcc, const char *opt, const char *arg, bool } else if (strcmp(opt, "-mno-sse4.2") == 0) { rcc->ir_mflags &= ~IR_X86_SSE42; rcc->ir_mflags_disabled |= IR_X86_SSE42; + } else if (strcmp(opt, "-mavx2") == 0) { + rcc->ir_mflags |= IR_X86_AVX2; + rcc->ir_mflags_disabled &= ~IR_X86_AVX2; + } else if (strcmp(opt, "-mno-avx2") == 0) { + rcc->ir_mflags &= ~IR_X86_AVX2; + rcc->ir_mflags_disabled |= IR_X86_AVX2; #endif } else if (strcmp(opt, "-muse-fp") == 0) { rcc->ir_flags |= IR_USE_FRAME_POINTER; @@ -2316,6 +2419,8 @@ int main(int argc, const char **argv) rcc->c_flags |= C_DUMP_IR; } else if (strcmp(argv[i], "--emit-llvm") == 0) { rcc->c_flags |= C_DUMP_LLVM; + } else if (strcmp(argv[i], "--emit-c") == 0) { + rcc->c_flags |= C_DUMP_C; } else if (strcmp(argv[i], "-S") == 0) { rcc->c_flags |= C_DUMP_ASM; } else if (strcmp(argv[i], "--dump-size") == 0) { @@ -2479,7 +2584,7 @@ int main(int argc, const char **argv) return 1; } } - rcc->ir_mflags |= (cpuinfo & (IR_X86_SSE3|IR_X86_SSSE3|IR_X86_SSE41|IR_X86_SSE42|IR_X86_BMI1)) & ~rcc->ir_mflags_disabled; + rcc->ir_mflags |= (cpuinfo & (IR_X86_SSE3|IR_X86_SSSE3|IR_X86_SSE41|IR_X86_SSE42|IR_X86_AVX2|IR_X86_BMI1)) & ~rcc->ir_mflags_disabled; #endif } diff --git a/rcc.h b/rcc.h index fdb8147..cf3a79a 100644 --- a/rcc.h +++ b/rcc.h @@ -233,6 +233,9 @@ _("__builtin_umul_overflow", YY___BUILTIN_UMUL_OVERFLOW) \ _("__builtin_umull_overflow", YY___BUILTIN_UMULL_OVERFLOW) \ _("__builtin_umulll_overflow", YY___BUILTIN_UMULLL_OVERFLOW) \ + _("__builtin_convertvector", YY___BUILTIN_CONVERTVECTOR) \ + _("__builtin_shuffle", YY___BUILTIN_SHUFFLE) \ + _("__builtin_shufflevector", YY___BUILTIN_SHUFFLEVECTOR) \ _("__builtin_expect", YY___BUILTIN_EXPECT) \ _("__builtin_prefetch", YY___BUILTIN_PREFETCH) \ _("__builtin_unreachable", YY___BUILTIN_UNREACHABLE) \ @@ -730,6 +733,7 @@ typedef enum { C_TYPE_ARRAY, C_TYPE_STRUCT, C_TYPE_UNION, + C_TYPE_VECTOR, C_TYPE_FLOAT_COMPLEX, C_TYPE_DOUBLE_COMPLEX, C_TYPE_LONG_DOUBLE_COMPLEX, @@ -756,6 +760,7 @@ typedef enum { C_TYPE_INPROGRESS = (1<<1), /* incomplete (not completely defined) struct, union */ C_TYPE_GLOBAL = (1<<2), C_TYPE_IN_FUNC = (1<<3), + C_TYPE_OPAQUE = (1<<4), /* opaque vector */ } c_type_flag; typedef yy_sym c_name; @@ -797,6 +802,10 @@ struct _c_type { const c_type *ret_type; c_param *params; } func; + struct { + const c_type *type; + int32_t length; + } vec; c_name tag; }; }; @@ -824,6 +833,7 @@ struct _c_dcl { c_name cleanup_func; /* may be set for local variables */ int8_t reg; uint32_t attr2; + uint32_t vector_size; }; typedef enum { @@ -892,7 +902,8 @@ struct _c_tag { #define C_CODE_STARTED 2 #define C_CODE_DONE 3 -#define C_IS_BIT_FIELD(bit_field) ((bit_field) != 0) +#define C_IS_SIMPLE_VAL(bit_field) ((bit_field) == 0) +#define C_IS_BIT_FIELD(bit_field) ((bit_field) & (1 << 12)) #define C_BIT_FIELD(start, lenght) ((1 << 12) | ((start) << 6) | (lenght)) #define C_BIT_FIELD_START(bit_field) (((bit_field) >> 6) & 0x3f) #define C_BIT_FIELD_SIZE(bit_field) ((bit_field) & 0x3f) @@ -900,6 +911,10 @@ struct _c_tag { #define C_IS_BIT_FIELD_PACKED(bit_field) ((bit_field) & (1 << 13)) #define C_SET_BIT_FIELD_PACKED(bit_field) do {(bit_field) |= (1 << 13);} while (0) +#define C_IS_VECTOR_DIM(proto) ((proto) & (1 << 14)) +#define C_VECTOR_DIM(type) ((1 << 14) | (type)) +#define C_VECTOR_DIM_TYPE(proto) (proto & 0xff) + struct _c_field { c_name name; uint16_t bit_field; /* 1-bit - is bit-field, 6-bits - first bit, 6-bits - bit lenght */ @@ -1099,6 +1114,7 @@ void c_gcc_attribute_aligned(rcc_ctx *rcc, c_dcl *d, c_name attr, c_value *v); void c_gcc_attribute_packed(rcc_ctx *rcc, c_dcl *d, c_name attr); void c_gcc_attribute_cleanup(rcc_ctx *rcc, c_dcl *d, c_name attr, c_name func); void c_gcc_attribute_regparm(rcc_ctx *rcc, c_dcl *d, c_name attr, c_value *v); +void c_gcc_attribute_vector_size(rcc_ctx *rcc, c_dcl *d, c_name attr, c_value *v); yy_sym c_gcc_attribute(rcc_ctx *rcc, c_dcl *dcl, c_name attr, yy_sym sym); void c_gcc_attribute_alias(rcc_ctx *rcc, c_dcl *d, c_name attr, c_value *v); void c_asm_alias(rcc_ctx *rcc, c_dcl *d, c_value *v); @@ -1143,6 +1159,7 @@ c_value *c_do_grow_actual_parameters(c_value *args, int32_t num_args); void c_do_builtin(rcc_ctx *rcc, c_value *val, c_name name, int32_t num_args, c_value *args); void c_do_builtin_constant_p(rcc_ctx *rcc, c_value *val); void c_do_builtin_va_arg(rcc_ctx *rcc, c_value *val, const c_type *type); +void c_do_builtin_convertvector(rcc_ctx *rcc, c_value *val, const c_type *type); void c_do_call(rcc_ctx *rcc, c_value *func, int32_t num_args, c_value *args, c_value *res); void c_do_binary_op(rcc_ctx *rcc, yy_sym sym, c_value *v, c_value *op2); void c_do_assign_op(rcc_ctx *rcc, yy_sym sym, c_value *v, c_value *op2); @@ -1288,7 +1305,7 @@ void yy_warning_(rcc_ctx *rcc, uint32_t kind, const char *msg); void yy_warning_fmt_(rcc_ctx *rcc, uint32_t kind, const char *fmt, ...); /* Linker */ -void *c_linker_allocate_data(rcc_ctx *rcc, c_name name, size_t size, size_t align); +void *c_linker_allocate_data(rcc_ctx *rcc, c_name name, size_t size, size_t align, bool is_array); bool c_linker_fix_reloc(rcc_ctx *rcc, c_sym *obj, size_t obj_offset, c_value *val); void c_linker_del_reloc(rcc_ctx *rcc, c_sym *obj, size_t obj_offset); diff --git a/rcc_parser.c b/rcc_parser.c index e0d0c5c..540ea4c 100644 --- a/rcc_parser.c +++ b/rcc_parser.c @@ -315,7 +315,7 @@ static yy_sym parse_declaration(yy_sym sym, rcc_ctx *rcc, uint32_t flags) { /* Use IR_TAILCALL in val.u.proto to prevent inlining */ val.u.proto = IR_TAILCALL; sym = get_sym(); - if (sym == YY__LPAREN || C_IS_ID(sym) || sym == YY_DECIMAL_NUMBER || sym == YY_OCTAL_NUMBER || sym == YY_HEXADECIMAL_NUMBER || sym == YY_BINARY_NUMBER || sym == YY_FLOATING_NUMBER || sym == YY_HEXADECIMAL_FLOATING_NUMBER || sym == YY_CHARACTER || sym == YY_STRING || sym == YY__GENERIC || sym == YY___EXTENSION__ || sym == YY__PLUS_PLUS || sym == YY__MINUS_MINUS || sym == YY__AND || sym == YY__STAR || sym == YY__PLUS || sym == YY__MINUS || sym == YY__TILDE || sym == YY__BANG || sym == YY_SIZEOF || sym == YY__ALIGNOF || sym == YY___ALIGNOF__ || sym == YY___ALIGNOF || sym == YY__AND_AND || sym == YY___BUILTIN_VA_START || sym == YY___BUILTIN_VA_END || sym == YY___BUILTIN_VA_COPY || sym == YY___BUILTIN_ALLOCA || sym == YY___BUILTIN_ABORT || sym == YY___BUILTIN_TRAP || sym == YY___BUILTIN_DEBUGTRAP || sym == YY___BUILTIN_FRAME_ADDRESS || sym == YY___BUILTIN_ABS || sym == YY___BUILTIN_LABS || sym == YY___BUILTIN_LLABS || sym == YY___BUILTIN_FABS || sym == YY___BUILTIN_FABSF || sym == YY___BUILTIN_BSWAP16 || sym == YY___BUILTIN_BSWAP32 || sym == YY___BUILTIN_BSWAP64 || sym == YY___BUILTIN_POPCOUNT || sym == YY___BUILTIN_POPCOUNTL || sym == YY___BUILTIN_POPCOUNTLL || sym == YY___BUILTIN_CLZ || sym == YY___BUILTIN_CLZL || sym == YY___BUILTIN_CLZLL || sym == YY___BUILTIN_CTZ || sym == YY___BUILTIN_CTZL || sym == YY___BUILTIN_CTZLL || sym == YY___BUILTIN_FFS || sym == YY___BUILTIN_FFSL || sym == YY___BUILTIN_FFSLL || sym == YY___BUILTIN_MEMCPY || sym == YY___BUILTIN_MEMSET || sym == YY___BUILTIN_EXPECT || sym == YY___BUILTIN_PREFETCH || sym == YY___BUILTIN_UNREACHABLE || sym == YY___BUILTIN_HUGE_VAL || sym == YY___BUILTIN_HUGE_VALF || sym == YY___BUILTIN_INF || sym == YY___BUILTIN_INFF || sym == YY___BUILTIN_ISUNORDERED || sym == YY___BUILTIN_NAN || sym == YY___BUILTIN_NANF || sym == YY___BUILTIN_ADD_OVERFLOW || sym == YY___BUILTIN_ADD_OVERFLOW_P || sym == YY___BUILTIN_SADD_OVERFLOW || sym == YY___BUILTIN_SADDL_OVERFLOW || sym == YY___BUILTIN_SADDLL_OVERFLOW || sym == YY___BUILTIN_UADD_OVERFLOW || sym == YY___BUILTIN_UADDL_OVERFLOW || sym == YY___BUILTIN_UADDLL_OVERFLOW || sym == YY___BUILTIN_SUB_OVERFLOW || sym == YY___BUILTIN_SUB_OVERFLOW_P || sym == YY___BUILTIN_SSUB_OVERFLOW || sym == YY___BUILTIN_SSUBL_OVERFLOW || sym == YY___BUILTIN_SSUBLL_OVERFLOW || sym == YY___BUILTIN_USUB_OVERFLOW || sym == YY___BUILTIN_USUBL_OVERFLOW || sym == YY___BUILTIN_USUBLL_OVERFLOW || sym == YY___BUILTIN_MUL_OVERFLOW || sym == YY___BUILTIN_MUL_OVERFLOW_P || sym == YY___BUILTIN_SMUL_OVERFLOW || sym == YY___BUILTIN_SMULL_OVERFLOW || sym == YY___BUILTIN_SMULLL_OVERFLOW || sym == YY___BUILTIN_UMUL_OVERFLOW || sym == YY___BUILTIN_UMULL_OVERFLOW || sym == YY___BUILTIN_UMULLL_OVERFLOW || sym == YY___BUILTIN_CONSTANT_P || sym == YY___BUILTIN_VA_ARG) { + if (sym == YY__LPAREN || C_IS_ID(sym) || sym == YY_DECIMAL_NUMBER || sym == YY_OCTAL_NUMBER || sym == YY_HEXADECIMAL_NUMBER || sym == YY_BINARY_NUMBER || sym == YY_FLOATING_NUMBER || sym == YY_HEXADECIMAL_FLOATING_NUMBER || sym == YY_CHARACTER || sym == YY_STRING || sym == YY__GENERIC || sym == YY___EXTENSION__ || sym == YY__PLUS_PLUS || sym == YY__MINUS_MINUS || sym == YY__AND || sym == YY__STAR || sym == YY__PLUS || sym == YY__MINUS || sym == YY__TILDE || sym == YY__BANG || sym == YY_SIZEOF || sym == YY__ALIGNOF || sym == YY___ALIGNOF__ || sym == YY___ALIGNOF || sym == YY__AND_AND || sym == YY___BUILTIN_VA_START || sym == YY___BUILTIN_VA_END || sym == YY___BUILTIN_VA_COPY || sym == YY___BUILTIN_ALLOCA || sym == YY___BUILTIN_ABORT || sym == YY___BUILTIN_TRAP || sym == YY___BUILTIN_DEBUGTRAP || sym == YY___BUILTIN_FRAME_ADDRESS || sym == YY___BUILTIN_ABS || sym == YY___BUILTIN_LABS || sym == YY___BUILTIN_LLABS || sym == YY___BUILTIN_FABS || sym == YY___BUILTIN_FABSF || sym == YY___BUILTIN_BSWAP16 || sym == YY___BUILTIN_BSWAP32 || sym == YY___BUILTIN_BSWAP64 || sym == YY___BUILTIN_POPCOUNT || sym == YY___BUILTIN_POPCOUNTL || sym == YY___BUILTIN_POPCOUNTLL || sym == YY___BUILTIN_CLZ || sym == YY___BUILTIN_CLZL || sym == YY___BUILTIN_CLZLL || sym == YY___BUILTIN_CTZ || sym == YY___BUILTIN_CTZL || sym == YY___BUILTIN_CTZLL || sym == YY___BUILTIN_FFS || sym == YY___BUILTIN_FFSL || sym == YY___BUILTIN_FFSLL || sym == YY___BUILTIN_MEMCPY || sym == YY___BUILTIN_MEMSET || sym == YY___BUILTIN_EXPECT || sym == YY___BUILTIN_PREFETCH || sym == YY___BUILTIN_UNREACHABLE || sym == YY___BUILTIN_HUGE_VAL || sym == YY___BUILTIN_HUGE_VALF || sym == YY___BUILTIN_INF || sym == YY___BUILTIN_INFF || sym == YY___BUILTIN_ISUNORDERED || sym == YY___BUILTIN_NAN || sym == YY___BUILTIN_NANF || sym == YY___BUILTIN_ADD_OVERFLOW || sym == YY___BUILTIN_ADD_OVERFLOW_P || sym == YY___BUILTIN_SADD_OVERFLOW || sym == YY___BUILTIN_SADDL_OVERFLOW || sym == YY___BUILTIN_SADDLL_OVERFLOW || sym == YY___BUILTIN_UADD_OVERFLOW || sym == YY___BUILTIN_UADDL_OVERFLOW || sym == YY___BUILTIN_UADDLL_OVERFLOW || sym == YY___BUILTIN_SUB_OVERFLOW || sym == YY___BUILTIN_SUB_OVERFLOW_P || sym == YY___BUILTIN_SSUB_OVERFLOW || sym == YY___BUILTIN_SSUBL_OVERFLOW || sym == YY___BUILTIN_SSUBLL_OVERFLOW || sym == YY___BUILTIN_USUB_OVERFLOW || sym == YY___BUILTIN_USUBL_OVERFLOW || sym == YY___BUILTIN_USUBLL_OVERFLOW || sym == YY___BUILTIN_MUL_OVERFLOW || sym == YY___BUILTIN_MUL_OVERFLOW_P || sym == YY___BUILTIN_SMUL_OVERFLOW || sym == YY___BUILTIN_SMULL_OVERFLOW || sym == YY___BUILTIN_SMULLL_OVERFLOW || sym == YY___BUILTIN_UMUL_OVERFLOW || sym == YY___BUILTIN_UMULL_OVERFLOW || sym == YY___BUILTIN_UMULLL_OVERFLOW || sym == YY___BUILTIN_SHUFFLE || sym == YY___BUILTIN_SHUFFLEVECTOR || sym == YY___BUILTIN_CONSTANT_P || sym == YY___BUILTIN_VA_ARG || sym == YY___BUILTIN_CONVERTVECTOR) { sym = parse_expression(sym, rcc, &val); } if (sym != YY__SEMICOLON) { @@ -597,7 +597,7 @@ static yy_sym parse_type_specifier_or_qualifier(yy_sym sym, rcc_ctx *rcc, c_dcl sym = get_sym(); if ((sym == YY_VOID || sym == YY_CHAR || sym == YY_SHORT || sym == YY_INT || sym == YY_LONG || sym == YY_FLOAT || sym == YY_DOUBLE || sym == YY_SIGNED || sym == YY___SIGNED || sym == YY___SIGNED__ || sym == YY_UNSIGNED || sym == YY__BOOL || sym == YY__COMPLEX || sym == YY___COMPLEX || sym == YY___COMPLEX__ || sym == YY__ATOMIC || sym == YY_TYPEOF || sym == YY___TYPEOF || sym == YY___TYPEOF__ || sym == YY_STRUCT || sym == YY_UNION || sym == YY_ENUM || C_IS_ID(sym) || sym == YY_CONST || sym == YY___CONST || sym == YY___CONST__ || sym == YY_RESTRICT || sym == YY___RESTRICT || sym == YY___RESTRICT__ || sym == YY_VOLATILE || sym == YY___VOLATILE || sym == YY___VOLATILE__ || sym == YY___ATTRIBUTE || sym == YY___ATTRIBUTE__ || sym == YY___DECLSPEC || sym == YY___CDECL || sym == YY___FASTCALL || sym == YY___UNALIGNED) && (!C_IS_ID(sym) || is_typedef_name(rcc, sym))) { sym = parse_type_name(sym, rcc, &d->type); - } else if (sym == YY__LPAREN || C_IS_ID(sym) || sym == YY_DECIMAL_NUMBER || sym == YY_OCTAL_NUMBER || sym == YY_HEXADECIMAL_NUMBER || sym == YY_BINARY_NUMBER || sym == YY_FLOATING_NUMBER || sym == YY_HEXADECIMAL_FLOATING_NUMBER || sym == YY_CHARACTER || sym == YY_STRING || sym == YY__GENERIC || sym == YY___EXTENSION__ || sym == YY__PLUS_PLUS || sym == YY__MINUS_MINUS || sym == YY__AND || sym == YY__STAR || sym == YY__PLUS || sym == YY__MINUS || sym == YY__TILDE || sym == YY__BANG || sym == YY_SIZEOF || sym == YY__ALIGNOF || sym == YY___ALIGNOF__ || sym == YY___ALIGNOF || sym == YY__AND_AND || sym == YY___BUILTIN_VA_START || sym == YY___BUILTIN_VA_END || sym == YY___BUILTIN_VA_COPY || sym == YY___BUILTIN_ALLOCA || sym == YY___BUILTIN_ABORT || sym == YY___BUILTIN_TRAP || sym == YY___BUILTIN_DEBUGTRAP || sym == YY___BUILTIN_FRAME_ADDRESS || sym == YY___BUILTIN_ABS || sym == YY___BUILTIN_LABS || sym == YY___BUILTIN_LLABS || sym == YY___BUILTIN_FABS || sym == YY___BUILTIN_FABSF || sym == YY___BUILTIN_BSWAP16 || sym == YY___BUILTIN_BSWAP32 || sym == YY___BUILTIN_BSWAP64 || sym == YY___BUILTIN_POPCOUNT || sym == YY___BUILTIN_POPCOUNTL || sym == YY___BUILTIN_POPCOUNTLL || sym == YY___BUILTIN_CLZ || sym == YY___BUILTIN_CLZL || sym == YY___BUILTIN_CLZLL || sym == YY___BUILTIN_CTZ || sym == YY___BUILTIN_CTZL || sym == YY___BUILTIN_CTZLL || sym == YY___BUILTIN_FFS || sym == YY___BUILTIN_FFSL || sym == YY___BUILTIN_FFSLL || sym == YY___BUILTIN_MEMCPY || sym == YY___BUILTIN_MEMSET || sym == YY___BUILTIN_EXPECT || sym == YY___BUILTIN_PREFETCH || sym == YY___BUILTIN_UNREACHABLE || sym == YY___BUILTIN_HUGE_VAL || sym == YY___BUILTIN_HUGE_VALF || sym == YY___BUILTIN_INF || sym == YY___BUILTIN_INFF || sym == YY___BUILTIN_ISUNORDERED || sym == YY___BUILTIN_NAN || sym == YY___BUILTIN_NANF || sym == YY___BUILTIN_ADD_OVERFLOW || sym == YY___BUILTIN_ADD_OVERFLOW_P || sym == YY___BUILTIN_SADD_OVERFLOW || sym == YY___BUILTIN_SADDL_OVERFLOW || sym == YY___BUILTIN_SADDLL_OVERFLOW || sym == YY___BUILTIN_UADD_OVERFLOW || sym == YY___BUILTIN_UADDL_OVERFLOW || sym == YY___BUILTIN_UADDLL_OVERFLOW || sym == YY___BUILTIN_SUB_OVERFLOW || sym == YY___BUILTIN_SUB_OVERFLOW_P || sym == YY___BUILTIN_SSUB_OVERFLOW || sym == YY___BUILTIN_SSUBL_OVERFLOW || sym == YY___BUILTIN_SSUBLL_OVERFLOW || sym == YY___BUILTIN_USUB_OVERFLOW || sym == YY___BUILTIN_USUBL_OVERFLOW || sym == YY___BUILTIN_USUBLL_OVERFLOW || sym == YY___BUILTIN_MUL_OVERFLOW || sym == YY___BUILTIN_MUL_OVERFLOW_P || sym == YY___BUILTIN_SMUL_OVERFLOW || sym == YY___BUILTIN_SMULL_OVERFLOW || sym == YY___BUILTIN_SMULLL_OVERFLOW || sym == YY___BUILTIN_UMUL_OVERFLOW || sym == YY___BUILTIN_UMULL_OVERFLOW || sym == YY___BUILTIN_UMULLL_OVERFLOW || sym == YY___BUILTIN_CONSTANT_P || sym == YY___BUILTIN_VA_ARG) { + } else if (sym == YY__LPAREN || C_IS_ID(sym) || sym == YY_DECIMAL_NUMBER || sym == YY_OCTAL_NUMBER || sym == YY_HEXADECIMAL_NUMBER || sym == YY_BINARY_NUMBER || sym == YY_FLOATING_NUMBER || sym == YY_HEXADECIMAL_FLOATING_NUMBER || sym == YY_CHARACTER || sym == YY_STRING || sym == YY__GENERIC || sym == YY___EXTENSION__ || sym == YY__PLUS_PLUS || sym == YY__MINUS_MINUS || sym == YY__AND || sym == YY__STAR || sym == YY__PLUS || sym == YY__MINUS || sym == YY__TILDE || sym == YY__BANG || sym == YY_SIZEOF || sym == YY__ALIGNOF || sym == YY___ALIGNOF__ || sym == YY___ALIGNOF || sym == YY__AND_AND || sym == YY___BUILTIN_VA_START || sym == YY___BUILTIN_VA_END || sym == YY___BUILTIN_VA_COPY || sym == YY___BUILTIN_ALLOCA || sym == YY___BUILTIN_ABORT || sym == YY___BUILTIN_TRAP || sym == YY___BUILTIN_DEBUGTRAP || sym == YY___BUILTIN_FRAME_ADDRESS || sym == YY___BUILTIN_ABS || sym == YY___BUILTIN_LABS || sym == YY___BUILTIN_LLABS || sym == YY___BUILTIN_FABS || sym == YY___BUILTIN_FABSF || sym == YY___BUILTIN_BSWAP16 || sym == YY___BUILTIN_BSWAP32 || sym == YY___BUILTIN_BSWAP64 || sym == YY___BUILTIN_POPCOUNT || sym == YY___BUILTIN_POPCOUNTL || sym == YY___BUILTIN_POPCOUNTLL || sym == YY___BUILTIN_CLZ || sym == YY___BUILTIN_CLZL || sym == YY___BUILTIN_CLZLL || sym == YY___BUILTIN_CTZ || sym == YY___BUILTIN_CTZL || sym == YY___BUILTIN_CTZLL || sym == YY___BUILTIN_FFS || sym == YY___BUILTIN_FFSL || sym == YY___BUILTIN_FFSLL || sym == YY___BUILTIN_MEMCPY || sym == YY___BUILTIN_MEMSET || sym == YY___BUILTIN_EXPECT || sym == YY___BUILTIN_PREFETCH || sym == YY___BUILTIN_UNREACHABLE || sym == YY___BUILTIN_HUGE_VAL || sym == YY___BUILTIN_HUGE_VALF || sym == YY___BUILTIN_INF || sym == YY___BUILTIN_INFF || sym == YY___BUILTIN_ISUNORDERED || sym == YY___BUILTIN_NAN || sym == YY___BUILTIN_NANF || sym == YY___BUILTIN_ADD_OVERFLOW || sym == YY___BUILTIN_ADD_OVERFLOW_P || sym == YY___BUILTIN_SADD_OVERFLOW || sym == YY___BUILTIN_SADDL_OVERFLOW || sym == YY___BUILTIN_SADDLL_OVERFLOW || sym == YY___BUILTIN_UADD_OVERFLOW || sym == YY___BUILTIN_UADDL_OVERFLOW || sym == YY___BUILTIN_UADDLL_OVERFLOW || sym == YY___BUILTIN_SUB_OVERFLOW || sym == YY___BUILTIN_SUB_OVERFLOW_P || sym == YY___BUILTIN_SSUB_OVERFLOW || sym == YY___BUILTIN_SSUBL_OVERFLOW || sym == YY___BUILTIN_SSUBLL_OVERFLOW || sym == YY___BUILTIN_USUB_OVERFLOW || sym == YY___BUILTIN_USUBL_OVERFLOW || sym == YY___BUILTIN_USUBLL_OVERFLOW || sym == YY___BUILTIN_MUL_OVERFLOW || sym == YY___BUILTIN_MUL_OVERFLOW_P || sym == YY___BUILTIN_SMUL_OVERFLOW || sym == YY___BUILTIN_SMULL_OVERFLOW || sym == YY___BUILTIN_SMULLL_OVERFLOW || sym == YY___BUILTIN_UMUL_OVERFLOW || sym == YY___BUILTIN_UMULL_OVERFLOW || sym == YY___BUILTIN_UMULLL_OVERFLOW || sym == YY___BUILTIN_SHUFFLE || sym == YY___BUILTIN_SHUFFLEVECTOR || sym == YY___BUILTIN_CONSTANT_P || sym == YY___BUILTIN_VA_ARG || sym == YY___BUILTIN_CONVERTVECTOR) { c_value v; ir_ref old = c_do_nocode(rcc); c_value_clear(&v); @@ -687,7 +687,7 @@ static yy_sym parse_alignment_specifier(yy_sym sym, rcc_ctx *rcc, c_dcl *d) { const c_type *t; sym = parse_type_name(sym, rcc, &t); d->attr |= t->attr & C_ATTR_ALIGN_MASK; - } else if (sym == YY__LPAREN || C_IS_ID(sym) || sym == YY_DECIMAL_NUMBER || sym == YY_OCTAL_NUMBER || sym == YY_HEXADECIMAL_NUMBER || sym == YY_BINARY_NUMBER || sym == YY_FLOATING_NUMBER || sym == YY_HEXADECIMAL_FLOATING_NUMBER || sym == YY_CHARACTER || sym == YY_STRING || sym == YY__GENERIC || sym == YY___EXTENSION__ || sym == YY__PLUS_PLUS || sym == YY__MINUS_MINUS || sym == YY__AND || sym == YY__STAR || sym == YY__PLUS || sym == YY__MINUS || sym == YY__TILDE || sym == YY__BANG || sym == YY_SIZEOF || sym == YY__ALIGNOF || sym == YY___ALIGNOF__ || sym == YY___ALIGNOF || sym == YY__AND_AND || sym == YY___BUILTIN_VA_START || sym == YY___BUILTIN_VA_END || sym == YY___BUILTIN_VA_COPY || sym == YY___BUILTIN_ALLOCA || sym == YY___BUILTIN_ABORT || sym == YY___BUILTIN_TRAP || sym == YY___BUILTIN_DEBUGTRAP || sym == YY___BUILTIN_FRAME_ADDRESS || sym == YY___BUILTIN_ABS || sym == YY___BUILTIN_LABS || sym == YY___BUILTIN_LLABS || sym == YY___BUILTIN_FABS || sym == YY___BUILTIN_FABSF || sym == YY___BUILTIN_BSWAP16 || sym == YY___BUILTIN_BSWAP32 || sym == YY___BUILTIN_BSWAP64 || sym == YY___BUILTIN_POPCOUNT || sym == YY___BUILTIN_POPCOUNTL || sym == YY___BUILTIN_POPCOUNTLL || sym == YY___BUILTIN_CLZ || sym == YY___BUILTIN_CLZL || sym == YY___BUILTIN_CLZLL || sym == YY___BUILTIN_CTZ || sym == YY___BUILTIN_CTZL || sym == YY___BUILTIN_CTZLL || sym == YY___BUILTIN_FFS || sym == YY___BUILTIN_FFSL || sym == YY___BUILTIN_FFSLL || sym == YY___BUILTIN_MEMCPY || sym == YY___BUILTIN_MEMSET || sym == YY___BUILTIN_EXPECT || sym == YY___BUILTIN_PREFETCH || sym == YY___BUILTIN_UNREACHABLE || sym == YY___BUILTIN_HUGE_VAL || sym == YY___BUILTIN_HUGE_VALF || sym == YY___BUILTIN_INF || sym == YY___BUILTIN_INFF || sym == YY___BUILTIN_ISUNORDERED || sym == YY___BUILTIN_NAN || sym == YY___BUILTIN_NANF || sym == YY___BUILTIN_ADD_OVERFLOW || sym == YY___BUILTIN_ADD_OVERFLOW_P || sym == YY___BUILTIN_SADD_OVERFLOW || sym == YY___BUILTIN_SADDL_OVERFLOW || sym == YY___BUILTIN_SADDLL_OVERFLOW || sym == YY___BUILTIN_UADD_OVERFLOW || sym == YY___BUILTIN_UADDL_OVERFLOW || sym == YY___BUILTIN_UADDLL_OVERFLOW || sym == YY___BUILTIN_SUB_OVERFLOW || sym == YY___BUILTIN_SUB_OVERFLOW_P || sym == YY___BUILTIN_SSUB_OVERFLOW || sym == YY___BUILTIN_SSUBL_OVERFLOW || sym == YY___BUILTIN_SSUBLL_OVERFLOW || sym == YY___BUILTIN_USUB_OVERFLOW || sym == YY___BUILTIN_USUBL_OVERFLOW || sym == YY___BUILTIN_USUBLL_OVERFLOW || sym == YY___BUILTIN_MUL_OVERFLOW || sym == YY___BUILTIN_MUL_OVERFLOW_P || sym == YY___BUILTIN_SMUL_OVERFLOW || sym == YY___BUILTIN_SMULL_OVERFLOW || sym == YY___BUILTIN_SMULLL_OVERFLOW || sym == YY___BUILTIN_UMUL_OVERFLOW || sym == YY___BUILTIN_UMULL_OVERFLOW || sym == YY___BUILTIN_UMULLL_OVERFLOW || sym == YY___BUILTIN_CONSTANT_P || sym == YY___BUILTIN_VA_ARG) { + } else if (sym == YY__LPAREN || C_IS_ID(sym) || sym == YY_DECIMAL_NUMBER || sym == YY_OCTAL_NUMBER || sym == YY_HEXADECIMAL_NUMBER || sym == YY_BINARY_NUMBER || sym == YY_FLOATING_NUMBER || sym == YY_HEXADECIMAL_FLOATING_NUMBER || sym == YY_CHARACTER || sym == YY_STRING || sym == YY__GENERIC || sym == YY___EXTENSION__ || sym == YY__PLUS_PLUS || sym == YY__MINUS_MINUS || sym == YY__AND || sym == YY__STAR || sym == YY__PLUS || sym == YY__MINUS || sym == YY__TILDE || sym == YY__BANG || sym == YY_SIZEOF || sym == YY__ALIGNOF || sym == YY___ALIGNOF__ || sym == YY___ALIGNOF || sym == YY__AND_AND || sym == YY___BUILTIN_VA_START || sym == YY___BUILTIN_VA_END || sym == YY___BUILTIN_VA_COPY || sym == YY___BUILTIN_ALLOCA || sym == YY___BUILTIN_ABORT || sym == YY___BUILTIN_TRAP || sym == YY___BUILTIN_DEBUGTRAP || sym == YY___BUILTIN_FRAME_ADDRESS || sym == YY___BUILTIN_ABS || sym == YY___BUILTIN_LABS || sym == YY___BUILTIN_LLABS || sym == YY___BUILTIN_FABS || sym == YY___BUILTIN_FABSF || sym == YY___BUILTIN_BSWAP16 || sym == YY___BUILTIN_BSWAP32 || sym == YY___BUILTIN_BSWAP64 || sym == YY___BUILTIN_POPCOUNT || sym == YY___BUILTIN_POPCOUNTL || sym == YY___BUILTIN_POPCOUNTLL || sym == YY___BUILTIN_CLZ || sym == YY___BUILTIN_CLZL || sym == YY___BUILTIN_CLZLL || sym == YY___BUILTIN_CTZ || sym == YY___BUILTIN_CTZL || sym == YY___BUILTIN_CTZLL || sym == YY___BUILTIN_FFS || sym == YY___BUILTIN_FFSL || sym == YY___BUILTIN_FFSLL || sym == YY___BUILTIN_MEMCPY || sym == YY___BUILTIN_MEMSET || sym == YY___BUILTIN_EXPECT || sym == YY___BUILTIN_PREFETCH || sym == YY___BUILTIN_UNREACHABLE || sym == YY___BUILTIN_HUGE_VAL || sym == YY___BUILTIN_HUGE_VALF || sym == YY___BUILTIN_INF || sym == YY___BUILTIN_INFF || sym == YY___BUILTIN_ISUNORDERED || sym == YY___BUILTIN_NAN || sym == YY___BUILTIN_NANF || sym == YY___BUILTIN_ADD_OVERFLOW || sym == YY___BUILTIN_ADD_OVERFLOW_P || sym == YY___BUILTIN_SADD_OVERFLOW || sym == YY___BUILTIN_SADDL_OVERFLOW || sym == YY___BUILTIN_SADDLL_OVERFLOW || sym == YY___BUILTIN_UADD_OVERFLOW || sym == YY___BUILTIN_UADDL_OVERFLOW || sym == YY___BUILTIN_UADDLL_OVERFLOW || sym == YY___BUILTIN_SUB_OVERFLOW || sym == YY___BUILTIN_SUB_OVERFLOW_P || sym == YY___BUILTIN_SSUB_OVERFLOW || sym == YY___BUILTIN_SSUBL_OVERFLOW || sym == YY___BUILTIN_SSUBLL_OVERFLOW || sym == YY___BUILTIN_USUB_OVERFLOW || sym == YY___BUILTIN_USUBL_OVERFLOW || sym == YY___BUILTIN_USUBLL_OVERFLOW || sym == YY___BUILTIN_MUL_OVERFLOW || sym == YY___BUILTIN_MUL_OVERFLOW_P || sym == YY___BUILTIN_SMUL_OVERFLOW || sym == YY___BUILTIN_SMULL_OVERFLOW || sym == YY___BUILTIN_SMULLL_OVERFLOW || sym == YY___BUILTIN_UMUL_OVERFLOW || sym == YY___BUILTIN_UMULL_OVERFLOW || sym == YY___BUILTIN_UMULLL_OVERFLOW || sym == YY___BUILTIN_SHUFFLE || sym == YY___BUILTIN_SHUFFLEVECTOR || sym == YY___BUILTIN_CONSTANT_P || sym == YY___BUILTIN_VA_ARG || sym == YY___BUILTIN_CONVERTVECTOR) { c_value_clear(&v); sym = parse_constant_expression(sym, rcc, &v); c_alignas_expr(rcc, d, &v); @@ -960,7 +960,7 @@ static yy_sym parse_attrib(yy_sym sym, rcc_ctx *rcc, c_dcl *d) { } sym = get_sym(); } - yy_error_fmt("unsupported attribute \"%s\"", yy_sym2str(rcc, name)); + c_gcc_attribute_vector_size(rcc, d, name, &v); } else if (sym == YY_WEAK || sym == YY___WEAK__) { sym = get_sym(); d->attr |= C_ATTR_WEAK; @@ -1356,7 +1356,7 @@ static yy_sym parse_array_declarator(yy_sym sym, rcc_ctx *rcc, c_dcl *d, bool is attr |= C_ATTR_VLA; } else if (sym == YY__RBRACK) { attr |= C_ATTR_FLEXIBLE; - } else if (sym == YY__LPAREN || C_IS_ID(sym) || sym == YY_DECIMAL_NUMBER || sym == YY_OCTAL_NUMBER || sym == YY_HEXADECIMAL_NUMBER || sym == YY_BINARY_NUMBER || sym == YY_FLOATING_NUMBER || sym == YY_HEXADECIMAL_FLOATING_NUMBER || sym == YY_CHARACTER || sym == YY_STRING || sym == YY__GENERIC || sym == YY___EXTENSION__ || sym == YY__PLUS_PLUS || sym == YY__MINUS_MINUS || sym == YY__AND || sym == YY__STAR || sym == YY__PLUS || sym == YY__MINUS || sym == YY__TILDE || sym == YY__BANG || sym == YY_SIZEOF || sym == YY__ALIGNOF || sym == YY___ALIGNOF__ || sym == YY___ALIGNOF || sym == YY__AND_AND || sym == YY___BUILTIN_VA_START || sym == YY___BUILTIN_VA_END || sym == YY___BUILTIN_VA_COPY || sym == YY___BUILTIN_ALLOCA || sym == YY___BUILTIN_ABORT || sym == YY___BUILTIN_TRAP || sym == YY___BUILTIN_DEBUGTRAP || sym == YY___BUILTIN_FRAME_ADDRESS || sym == YY___BUILTIN_ABS || sym == YY___BUILTIN_LABS || sym == YY___BUILTIN_LLABS || sym == YY___BUILTIN_FABS || sym == YY___BUILTIN_FABSF || sym == YY___BUILTIN_BSWAP16 || sym == YY___BUILTIN_BSWAP32 || sym == YY___BUILTIN_BSWAP64 || sym == YY___BUILTIN_POPCOUNT || sym == YY___BUILTIN_POPCOUNTL || sym == YY___BUILTIN_POPCOUNTLL || sym == YY___BUILTIN_CLZ || sym == YY___BUILTIN_CLZL || sym == YY___BUILTIN_CLZLL || sym == YY___BUILTIN_CTZ || sym == YY___BUILTIN_CTZL || sym == YY___BUILTIN_CTZLL || sym == YY___BUILTIN_FFS || sym == YY___BUILTIN_FFSL || sym == YY___BUILTIN_FFSLL || sym == YY___BUILTIN_MEMCPY || sym == YY___BUILTIN_MEMSET || sym == YY___BUILTIN_EXPECT || sym == YY___BUILTIN_PREFETCH || sym == YY___BUILTIN_UNREACHABLE || sym == YY___BUILTIN_HUGE_VAL || sym == YY___BUILTIN_HUGE_VALF || sym == YY___BUILTIN_INF || sym == YY___BUILTIN_INFF || sym == YY___BUILTIN_ISUNORDERED || sym == YY___BUILTIN_NAN || sym == YY___BUILTIN_NANF || sym == YY___BUILTIN_ADD_OVERFLOW || sym == YY___BUILTIN_ADD_OVERFLOW_P || sym == YY___BUILTIN_SADD_OVERFLOW || sym == YY___BUILTIN_SADDL_OVERFLOW || sym == YY___BUILTIN_SADDLL_OVERFLOW || sym == YY___BUILTIN_UADD_OVERFLOW || sym == YY___BUILTIN_UADDL_OVERFLOW || sym == YY___BUILTIN_UADDLL_OVERFLOW || sym == YY___BUILTIN_SUB_OVERFLOW || sym == YY___BUILTIN_SUB_OVERFLOW_P || sym == YY___BUILTIN_SSUB_OVERFLOW || sym == YY___BUILTIN_SSUBL_OVERFLOW || sym == YY___BUILTIN_SSUBLL_OVERFLOW || sym == YY___BUILTIN_USUB_OVERFLOW || sym == YY___BUILTIN_USUBL_OVERFLOW || sym == YY___BUILTIN_USUBLL_OVERFLOW || sym == YY___BUILTIN_MUL_OVERFLOW || sym == YY___BUILTIN_MUL_OVERFLOW_P || sym == YY___BUILTIN_SMUL_OVERFLOW || sym == YY___BUILTIN_SMULL_OVERFLOW || sym == YY___BUILTIN_SMULLL_OVERFLOW || sym == YY___BUILTIN_UMUL_OVERFLOW || sym == YY___BUILTIN_UMULL_OVERFLOW || sym == YY___BUILTIN_UMULLL_OVERFLOW || sym == YY___BUILTIN_CONSTANT_P || sym == YY___BUILTIN_VA_ARG) { + } else if (sym == YY__LPAREN || C_IS_ID(sym) || sym == YY_DECIMAL_NUMBER || sym == YY_OCTAL_NUMBER || sym == YY_HEXADECIMAL_NUMBER || sym == YY_BINARY_NUMBER || sym == YY_FLOATING_NUMBER || sym == YY_HEXADECIMAL_FLOATING_NUMBER || sym == YY_CHARACTER || sym == YY_STRING || sym == YY__GENERIC || sym == YY___EXTENSION__ || sym == YY__PLUS_PLUS || sym == YY__MINUS_MINUS || sym == YY__AND || sym == YY__STAR || sym == YY__PLUS || sym == YY__MINUS || sym == YY__TILDE || sym == YY__BANG || sym == YY_SIZEOF || sym == YY__ALIGNOF || sym == YY___ALIGNOF__ || sym == YY___ALIGNOF || sym == YY__AND_AND || sym == YY___BUILTIN_VA_START || sym == YY___BUILTIN_VA_END || sym == YY___BUILTIN_VA_COPY || sym == YY___BUILTIN_ALLOCA || sym == YY___BUILTIN_ABORT || sym == YY___BUILTIN_TRAP || sym == YY___BUILTIN_DEBUGTRAP || sym == YY___BUILTIN_FRAME_ADDRESS || sym == YY___BUILTIN_ABS || sym == YY___BUILTIN_LABS || sym == YY___BUILTIN_LLABS || sym == YY___BUILTIN_FABS || sym == YY___BUILTIN_FABSF || sym == YY___BUILTIN_BSWAP16 || sym == YY___BUILTIN_BSWAP32 || sym == YY___BUILTIN_BSWAP64 || sym == YY___BUILTIN_POPCOUNT || sym == YY___BUILTIN_POPCOUNTL || sym == YY___BUILTIN_POPCOUNTLL || sym == YY___BUILTIN_CLZ || sym == YY___BUILTIN_CLZL || sym == YY___BUILTIN_CLZLL || sym == YY___BUILTIN_CTZ || sym == YY___BUILTIN_CTZL || sym == YY___BUILTIN_CTZLL || sym == YY___BUILTIN_FFS || sym == YY___BUILTIN_FFSL || sym == YY___BUILTIN_FFSLL || sym == YY___BUILTIN_MEMCPY || sym == YY___BUILTIN_MEMSET || sym == YY___BUILTIN_EXPECT || sym == YY___BUILTIN_PREFETCH || sym == YY___BUILTIN_UNREACHABLE || sym == YY___BUILTIN_HUGE_VAL || sym == YY___BUILTIN_HUGE_VALF || sym == YY___BUILTIN_INF || sym == YY___BUILTIN_INFF || sym == YY___BUILTIN_ISUNORDERED || sym == YY___BUILTIN_NAN || sym == YY___BUILTIN_NANF || sym == YY___BUILTIN_ADD_OVERFLOW || sym == YY___BUILTIN_ADD_OVERFLOW_P || sym == YY___BUILTIN_SADD_OVERFLOW || sym == YY___BUILTIN_SADDL_OVERFLOW || sym == YY___BUILTIN_SADDLL_OVERFLOW || sym == YY___BUILTIN_UADD_OVERFLOW || sym == YY___BUILTIN_UADDL_OVERFLOW || sym == YY___BUILTIN_UADDLL_OVERFLOW || sym == YY___BUILTIN_SUB_OVERFLOW || sym == YY___BUILTIN_SUB_OVERFLOW_P || sym == YY___BUILTIN_SSUB_OVERFLOW || sym == YY___BUILTIN_SSUBL_OVERFLOW || sym == YY___BUILTIN_SSUBLL_OVERFLOW || sym == YY___BUILTIN_USUB_OVERFLOW || sym == YY___BUILTIN_USUBL_OVERFLOW || sym == YY___BUILTIN_USUBLL_OVERFLOW || sym == YY___BUILTIN_MUL_OVERFLOW || sym == YY___BUILTIN_MUL_OVERFLOW_P || sym == YY___BUILTIN_SMUL_OVERFLOW || sym == YY___BUILTIN_SMULL_OVERFLOW || sym == YY___BUILTIN_SMULLL_OVERFLOW || sym == YY___BUILTIN_UMUL_OVERFLOW || sym == YY___BUILTIN_UMULL_OVERFLOW || sym == YY___BUILTIN_UMULLL_OVERFLOW || sym == YY___BUILTIN_SHUFFLE || sym == YY___BUILTIN_SHUFFLEVECTOR || sym == YY___BUILTIN_CONSTANT_P || sym == YY___BUILTIN_VA_ARG || sym == YY___BUILTIN_CONVERTVECTOR) { if (!is_param || (sym = parse_vla_param(sym, rcc, &len)) != YY__RBRACK) sym = parse_assignment_expression(sym, rcc, &len); } else if (sym == YY_CONST || sym == YY___CONST || sym == YY___CONST__ || sym == YY_RESTRICT || sym == YY___RESTRICT || sym == YY___RESTRICT__ || sym == YY_VOLATILE || sym == YY___VOLATILE || sym == YY___VOLATILE__ || sym == YY__ATOMIC || sym == YY___ATTRIBUTE || sym == YY___ATTRIBUTE__ || sym == YY___DECLSPEC || sym == YY___CDECL || sym == YY___FASTCALL || sym == YY___UNALIGNED) { @@ -1368,7 +1368,7 @@ static yy_sym parse_array_declarator(yy_sym sym, rcc_ctx *rcc, c_dcl *d, bool is attr |= C_ATTR_VLA; } else if (sym == YY__RBRACK) { attr |= C_ATTR_FLEXIBLE; - } else if (sym == YY_STATIC || sym == YY__LPAREN || C_IS_ID(sym) || sym == YY_DECIMAL_NUMBER || sym == YY_OCTAL_NUMBER || sym == YY_HEXADECIMAL_NUMBER || sym == YY_BINARY_NUMBER || sym == YY_FLOATING_NUMBER || sym == YY_HEXADECIMAL_FLOATING_NUMBER || sym == YY_CHARACTER || sym == YY_STRING || sym == YY__GENERIC || sym == YY___EXTENSION__ || sym == YY__PLUS_PLUS || sym == YY__MINUS_MINUS || sym == YY__AND || sym == YY__STAR || sym == YY__PLUS || sym == YY__MINUS || sym == YY__TILDE || sym == YY__BANG || sym == YY_SIZEOF || sym == YY__ALIGNOF || sym == YY___ALIGNOF__ || sym == YY___ALIGNOF || sym == YY__AND_AND || sym == YY___BUILTIN_VA_START || sym == YY___BUILTIN_VA_END || sym == YY___BUILTIN_VA_COPY || sym == YY___BUILTIN_ALLOCA || sym == YY___BUILTIN_ABORT || sym == YY___BUILTIN_TRAP || sym == YY___BUILTIN_DEBUGTRAP || sym == YY___BUILTIN_FRAME_ADDRESS || sym == YY___BUILTIN_ABS || sym == YY___BUILTIN_LABS || sym == YY___BUILTIN_LLABS || sym == YY___BUILTIN_FABS || sym == YY___BUILTIN_FABSF || sym == YY___BUILTIN_BSWAP16 || sym == YY___BUILTIN_BSWAP32 || sym == YY___BUILTIN_BSWAP64 || sym == YY___BUILTIN_POPCOUNT || sym == YY___BUILTIN_POPCOUNTL || sym == YY___BUILTIN_POPCOUNTLL || sym == YY___BUILTIN_CLZ || sym == YY___BUILTIN_CLZL || sym == YY___BUILTIN_CLZLL || sym == YY___BUILTIN_CTZ || sym == YY___BUILTIN_CTZL || sym == YY___BUILTIN_CTZLL || sym == YY___BUILTIN_FFS || sym == YY___BUILTIN_FFSL || sym == YY___BUILTIN_FFSLL || sym == YY___BUILTIN_MEMCPY || sym == YY___BUILTIN_MEMSET || sym == YY___BUILTIN_EXPECT || sym == YY___BUILTIN_PREFETCH || sym == YY___BUILTIN_UNREACHABLE || sym == YY___BUILTIN_HUGE_VAL || sym == YY___BUILTIN_HUGE_VALF || sym == YY___BUILTIN_INF || sym == YY___BUILTIN_INFF || sym == YY___BUILTIN_ISUNORDERED || sym == YY___BUILTIN_NAN || sym == YY___BUILTIN_NANF || sym == YY___BUILTIN_ADD_OVERFLOW || sym == YY___BUILTIN_ADD_OVERFLOW_P || sym == YY___BUILTIN_SADD_OVERFLOW || sym == YY___BUILTIN_SADDL_OVERFLOW || sym == YY___BUILTIN_SADDLL_OVERFLOW || sym == YY___BUILTIN_UADD_OVERFLOW || sym == YY___BUILTIN_UADDL_OVERFLOW || sym == YY___BUILTIN_UADDLL_OVERFLOW || sym == YY___BUILTIN_SUB_OVERFLOW || sym == YY___BUILTIN_SUB_OVERFLOW_P || sym == YY___BUILTIN_SSUB_OVERFLOW || sym == YY___BUILTIN_SSUBL_OVERFLOW || sym == YY___BUILTIN_SSUBLL_OVERFLOW || sym == YY___BUILTIN_USUB_OVERFLOW || sym == YY___BUILTIN_USUBL_OVERFLOW || sym == YY___BUILTIN_USUBLL_OVERFLOW || sym == YY___BUILTIN_MUL_OVERFLOW || sym == YY___BUILTIN_MUL_OVERFLOW_P || sym == YY___BUILTIN_SMUL_OVERFLOW || sym == YY___BUILTIN_SMULL_OVERFLOW || sym == YY___BUILTIN_SMULLL_OVERFLOW || sym == YY___BUILTIN_UMUL_OVERFLOW || sym == YY___BUILTIN_UMULL_OVERFLOW || sym == YY___BUILTIN_UMULLL_OVERFLOW || sym == YY___BUILTIN_CONSTANT_P || sym == YY___BUILTIN_VA_ARG) { + } else if (sym == YY_STATIC || sym == YY__LPAREN || C_IS_ID(sym) || sym == YY_DECIMAL_NUMBER || sym == YY_OCTAL_NUMBER || sym == YY_HEXADECIMAL_NUMBER || sym == YY_BINARY_NUMBER || sym == YY_FLOATING_NUMBER || sym == YY_HEXADECIMAL_FLOATING_NUMBER || sym == YY_CHARACTER || sym == YY_STRING || sym == YY__GENERIC || sym == YY___EXTENSION__ || sym == YY__PLUS_PLUS || sym == YY__MINUS_MINUS || sym == YY__AND || sym == YY__STAR || sym == YY__PLUS || sym == YY__MINUS || sym == YY__TILDE || sym == YY__BANG || sym == YY_SIZEOF || sym == YY__ALIGNOF || sym == YY___ALIGNOF__ || sym == YY___ALIGNOF || sym == YY__AND_AND || sym == YY___BUILTIN_VA_START || sym == YY___BUILTIN_VA_END || sym == YY___BUILTIN_VA_COPY || sym == YY___BUILTIN_ALLOCA || sym == YY___BUILTIN_ABORT || sym == YY___BUILTIN_TRAP || sym == YY___BUILTIN_DEBUGTRAP || sym == YY___BUILTIN_FRAME_ADDRESS || sym == YY___BUILTIN_ABS || sym == YY___BUILTIN_LABS || sym == YY___BUILTIN_LLABS || sym == YY___BUILTIN_FABS || sym == YY___BUILTIN_FABSF || sym == YY___BUILTIN_BSWAP16 || sym == YY___BUILTIN_BSWAP32 || sym == YY___BUILTIN_BSWAP64 || sym == YY___BUILTIN_POPCOUNT || sym == YY___BUILTIN_POPCOUNTL || sym == YY___BUILTIN_POPCOUNTLL || sym == YY___BUILTIN_CLZ || sym == YY___BUILTIN_CLZL || sym == YY___BUILTIN_CLZLL || sym == YY___BUILTIN_CTZ || sym == YY___BUILTIN_CTZL || sym == YY___BUILTIN_CTZLL || sym == YY___BUILTIN_FFS || sym == YY___BUILTIN_FFSL || sym == YY___BUILTIN_FFSLL || sym == YY___BUILTIN_MEMCPY || sym == YY___BUILTIN_MEMSET || sym == YY___BUILTIN_EXPECT || sym == YY___BUILTIN_PREFETCH || sym == YY___BUILTIN_UNREACHABLE || sym == YY___BUILTIN_HUGE_VAL || sym == YY___BUILTIN_HUGE_VALF || sym == YY___BUILTIN_INF || sym == YY___BUILTIN_INFF || sym == YY___BUILTIN_ISUNORDERED || sym == YY___BUILTIN_NAN || sym == YY___BUILTIN_NANF || sym == YY___BUILTIN_ADD_OVERFLOW || sym == YY___BUILTIN_ADD_OVERFLOW_P || sym == YY___BUILTIN_SADD_OVERFLOW || sym == YY___BUILTIN_SADDL_OVERFLOW || sym == YY___BUILTIN_SADDLL_OVERFLOW || sym == YY___BUILTIN_UADD_OVERFLOW || sym == YY___BUILTIN_UADDL_OVERFLOW || sym == YY___BUILTIN_UADDLL_OVERFLOW || sym == YY___BUILTIN_SUB_OVERFLOW || sym == YY___BUILTIN_SUB_OVERFLOW_P || sym == YY___BUILTIN_SSUB_OVERFLOW || sym == YY___BUILTIN_SSUBL_OVERFLOW || sym == YY___BUILTIN_SSUBLL_OVERFLOW || sym == YY___BUILTIN_USUB_OVERFLOW || sym == YY___BUILTIN_USUBL_OVERFLOW || sym == YY___BUILTIN_USUBLL_OVERFLOW || sym == YY___BUILTIN_MUL_OVERFLOW || sym == YY___BUILTIN_MUL_OVERFLOW_P || sym == YY___BUILTIN_SMUL_OVERFLOW || sym == YY___BUILTIN_SMULL_OVERFLOW || sym == YY___BUILTIN_SMULLL_OVERFLOW || sym == YY___BUILTIN_UMUL_OVERFLOW || sym == YY___BUILTIN_UMULL_OVERFLOW || sym == YY___BUILTIN_UMULLL_OVERFLOW || sym == YY___BUILTIN_SHUFFLE || sym == YY___BUILTIN_SHUFFLEVECTOR || sym == YY___BUILTIN_CONSTANT_P || sym == YY___BUILTIN_VA_ARG || sym == YY___BUILTIN_CONVERTVECTOR) { if (sym == YY_STATIC) { sym = get_sym(); } @@ -1482,7 +1482,7 @@ static yy_sym parse_type_name(yy_sym sym, rcc_ctx *rcc, const c_type **t) { static yy_sym parse_initializer(yy_sym sym, rcc_ctx *rcc, c_sym *obj) { rcc->c_static_data = (obj && obj->linkage); - if (sym == YY__LPAREN || C_IS_ID(sym) || sym == YY_DECIMAL_NUMBER || sym == YY_OCTAL_NUMBER || sym == YY_HEXADECIMAL_NUMBER || sym == YY_BINARY_NUMBER || sym == YY_FLOATING_NUMBER || sym == YY_HEXADECIMAL_FLOATING_NUMBER || sym == YY_CHARACTER || sym == YY_STRING || sym == YY__GENERIC || sym == YY___EXTENSION__ || sym == YY__PLUS_PLUS || sym == YY__MINUS_MINUS || sym == YY__AND || sym == YY__STAR || sym == YY__PLUS || sym == YY__MINUS || sym == YY__TILDE || sym == YY__BANG || sym == YY_SIZEOF || sym == YY__ALIGNOF || sym == YY___ALIGNOF__ || sym == YY___ALIGNOF || sym == YY__AND_AND || sym == YY___BUILTIN_VA_START || sym == YY___BUILTIN_VA_END || sym == YY___BUILTIN_VA_COPY || sym == YY___BUILTIN_ALLOCA || sym == YY___BUILTIN_ABORT || sym == YY___BUILTIN_TRAP || sym == YY___BUILTIN_DEBUGTRAP || sym == YY___BUILTIN_FRAME_ADDRESS || sym == YY___BUILTIN_ABS || sym == YY___BUILTIN_LABS || sym == YY___BUILTIN_LLABS || sym == YY___BUILTIN_FABS || sym == YY___BUILTIN_FABSF || sym == YY___BUILTIN_BSWAP16 || sym == YY___BUILTIN_BSWAP32 || sym == YY___BUILTIN_BSWAP64 || sym == YY___BUILTIN_POPCOUNT || sym == YY___BUILTIN_POPCOUNTL || sym == YY___BUILTIN_POPCOUNTLL || sym == YY___BUILTIN_CLZ || sym == YY___BUILTIN_CLZL || sym == YY___BUILTIN_CLZLL || sym == YY___BUILTIN_CTZ || sym == YY___BUILTIN_CTZL || sym == YY___BUILTIN_CTZLL || sym == YY___BUILTIN_FFS || sym == YY___BUILTIN_FFSL || sym == YY___BUILTIN_FFSLL || sym == YY___BUILTIN_MEMCPY || sym == YY___BUILTIN_MEMSET || sym == YY___BUILTIN_EXPECT || sym == YY___BUILTIN_PREFETCH || sym == YY___BUILTIN_UNREACHABLE || sym == YY___BUILTIN_HUGE_VAL || sym == YY___BUILTIN_HUGE_VALF || sym == YY___BUILTIN_INF || sym == YY___BUILTIN_INFF || sym == YY___BUILTIN_ISUNORDERED || sym == YY___BUILTIN_NAN || sym == YY___BUILTIN_NANF || sym == YY___BUILTIN_ADD_OVERFLOW || sym == YY___BUILTIN_ADD_OVERFLOW_P || sym == YY___BUILTIN_SADD_OVERFLOW || sym == YY___BUILTIN_SADDL_OVERFLOW || sym == YY___BUILTIN_SADDLL_OVERFLOW || sym == YY___BUILTIN_UADD_OVERFLOW || sym == YY___BUILTIN_UADDL_OVERFLOW || sym == YY___BUILTIN_UADDLL_OVERFLOW || sym == YY___BUILTIN_SUB_OVERFLOW || sym == YY___BUILTIN_SUB_OVERFLOW_P || sym == YY___BUILTIN_SSUB_OVERFLOW || sym == YY___BUILTIN_SSUBL_OVERFLOW || sym == YY___BUILTIN_SSUBLL_OVERFLOW || sym == YY___BUILTIN_USUB_OVERFLOW || sym == YY___BUILTIN_USUBL_OVERFLOW || sym == YY___BUILTIN_USUBLL_OVERFLOW || sym == YY___BUILTIN_MUL_OVERFLOW || sym == YY___BUILTIN_MUL_OVERFLOW_P || sym == YY___BUILTIN_SMUL_OVERFLOW || sym == YY___BUILTIN_SMULL_OVERFLOW || sym == YY___BUILTIN_SMULLL_OVERFLOW || sym == YY___BUILTIN_UMUL_OVERFLOW || sym == YY___BUILTIN_UMULL_OVERFLOW || sym == YY___BUILTIN_UMULLL_OVERFLOW || sym == YY___BUILTIN_CONSTANT_P || sym == YY___BUILTIN_VA_ARG) { + if (sym == YY__LPAREN || C_IS_ID(sym) || sym == YY_DECIMAL_NUMBER || sym == YY_OCTAL_NUMBER || sym == YY_HEXADECIMAL_NUMBER || sym == YY_BINARY_NUMBER || sym == YY_FLOATING_NUMBER || sym == YY_HEXADECIMAL_FLOATING_NUMBER || sym == YY_CHARACTER || sym == YY_STRING || sym == YY__GENERIC || sym == YY___EXTENSION__ || sym == YY__PLUS_PLUS || sym == YY__MINUS_MINUS || sym == YY__AND || sym == YY__STAR || sym == YY__PLUS || sym == YY__MINUS || sym == YY__TILDE || sym == YY__BANG || sym == YY_SIZEOF || sym == YY__ALIGNOF || sym == YY___ALIGNOF__ || sym == YY___ALIGNOF || sym == YY__AND_AND || sym == YY___BUILTIN_VA_START || sym == YY___BUILTIN_VA_END || sym == YY___BUILTIN_VA_COPY || sym == YY___BUILTIN_ALLOCA || sym == YY___BUILTIN_ABORT || sym == YY___BUILTIN_TRAP || sym == YY___BUILTIN_DEBUGTRAP || sym == YY___BUILTIN_FRAME_ADDRESS || sym == YY___BUILTIN_ABS || sym == YY___BUILTIN_LABS || sym == YY___BUILTIN_LLABS || sym == YY___BUILTIN_FABS || sym == YY___BUILTIN_FABSF || sym == YY___BUILTIN_BSWAP16 || sym == YY___BUILTIN_BSWAP32 || sym == YY___BUILTIN_BSWAP64 || sym == YY___BUILTIN_POPCOUNT || sym == YY___BUILTIN_POPCOUNTL || sym == YY___BUILTIN_POPCOUNTLL || sym == YY___BUILTIN_CLZ || sym == YY___BUILTIN_CLZL || sym == YY___BUILTIN_CLZLL || sym == YY___BUILTIN_CTZ || sym == YY___BUILTIN_CTZL || sym == YY___BUILTIN_CTZLL || sym == YY___BUILTIN_FFS || sym == YY___BUILTIN_FFSL || sym == YY___BUILTIN_FFSLL || sym == YY___BUILTIN_MEMCPY || sym == YY___BUILTIN_MEMSET || sym == YY___BUILTIN_EXPECT || sym == YY___BUILTIN_PREFETCH || sym == YY___BUILTIN_UNREACHABLE || sym == YY___BUILTIN_HUGE_VAL || sym == YY___BUILTIN_HUGE_VALF || sym == YY___BUILTIN_INF || sym == YY___BUILTIN_INFF || sym == YY___BUILTIN_ISUNORDERED || sym == YY___BUILTIN_NAN || sym == YY___BUILTIN_NANF || sym == YY___BUILTIN_ADD_OVERFLOW || sym == YY___BUILTIN_ADD_OVERFLOW_P || sym == YY___BUILTIN_SADD_OVERFLOW || sym == YY___BUILTIN_SADDL_OVERFLOW || sym == YY___BUILTIN_SADDLL_OVERFLOW || sym == YY___BUILTIN_UADD_OVERFLOW || sym == YY___BUILTIN_UADDL_OVERFLOW || sym == YY___BUILTIN_UADDLL_OVERFLOW || sym == YY___BUILTIN_SUB_OVERFLOW || sym == YY___BUILTIN_SUB_OVERFLOW_P || sym == YY___BUILTIN_SSUB_OVERFLOW || sym == YY___BUILTIN_SSUBL_OVERFLOW || sym == YY___BUILTIN_SSUBLL_OVERFLOW || sym == YY___BUILTIN_USUB_OVERFLOW || sym == YY___BUILTIN_USUBL_OVERFLOW || sym == YY___BUILTIN_USUBLL_OVERFLOW || sym == YY___BUILTIN_MUL_OVERFLOW || sym == YY___BUILTIN_MUL_OVERFLOW_P || sym == YY___BUILTIN_SMUL_OVERFLOW || sym == YY___BUILTIN_SMULL_OVERFLOW || sym == YY___BUILTIN_SMULLL_OVERFLOW || sym == YY___BUILTIN_UMUL_OVERFLOW || sym == YY___BUILTIN_UMULL_OVERFLOW || sym == YY___BUILTIN_UMULLL_OVERFLOW || sym == YY___BUILTIN_SHUFFLE || sym == YY___BUILTIN_SHUFFLEVECTOR || sym == YY___BUILTIN_CONSTANT_P || sym == YY___BUILTIN_VA_ARG || sym == YY___BUILTIN_CONVERTVECTOR) { c_value v; c_value_clear(&v); sym = parse_assignment_expression(sym, rcc, &v); @@ -1507,7 +1507,7 @@ static yy_sym parse_initializer_contents(yy_sym sym, rcc_ctx *rcc, c_sym *obj, s } static yy_sym parse_nested_initializer(yy_sym sym, rcc_ctx *rcc, c_sym *obj, c_init *init, bool b) { - if (sym == YY__LPAREN || C_IS_ID(sym) || sym == YY_DECIMAL_NUMBER || sym == YY_OCTAL_NUMBER || sym == YY_HEXADECIMAL_NUMBER || sym == YY_BINARY_NUMBER || sym == YY_FLOATING_NUMBER || sym == YY_HEXADECIMAL_FLOATING_NUMBER || sym == YY_CHARACTER || sym == YY_STRING || sym == YY__GENERIC || sym == YY___EXTENSION__ || sym == YY__PLUS_PLUS || sym == YY__MINUS_MINUS || sym == YY__AND || sym == YY__STAR || sym == YY__PLUS || sym == YY__MINUS || sym == YY__TILDE || sym == YY__BANG || sym == YY_SIZEOF || sym == YY__ALIGNOF || sym == YY___ALIGNOF__ || sym == YY___ALIGNOF || sym == YY__AND_AND || sym == YY___BUILTIN_VA_START || sym == YY___BUILTIN_VA_END || sym == YY___BUILTIN_VA_COPY || sym == YY___BUILTIN_ALLOCA || sym == YY___BUILTIN_ABORT || sym == YY___BUILTIN_TRAP || sym == YY___BUILTIN_DEBUGTRAP || sym == YY___BUILTIN_FRAME_ADDRESS || sym == YY___BUILTIN_ABS || sym == YY___BUILTIN_LABS || sym == YY___BUILTIN_LLABS || sym == YY___BUILTIN_FABS || sym == YY___BUILTIN_FABSF || sym == YY___BUILTIN_BSWAP16 || sym == YY___BUILTIN_BSWAP32 || sym == YY___BUILTIN_BSWAP64 || sym == YY___BUILTIN_POPCOUNT || sym == YY___BUILTIN_POPCOUNTL || sym == YY___BUILTIN_POPCOUNTLL || sym == YY___BUILTIN_CLZ || sym == YY___BUILTIN_CLZL || sym == YY___BUILTIN_CLZLL || sym == YY___BUILTIN_CTZ || sym == YY___BUILTIN_CTZL || sym == YY___BUILTIN_CTZLL || sym == YY___BUILTIN_FFS || sym == YY___BUILTIN_FFSL || sym == YY___BUILTIN_FFSLL || sym == YY___BUILTIN_MEMCPY || sym == YY___BUILTIN_MEMSET || sym == YY___BUILTIN_EXPECT || sym == YY___BUILTIN_PREFETCH || sym == YY___BUILTIN_UNREACHABLE || sym == YY___BUILTIN_HUGE_VAL || sym == YY___BUILTIN_HUGE_VALF || sym == YY___BUILTIN_INF || sym == YY___BUILTIN_INFF || sym == YY___BUILTIN_ISUNORDERED || sym == YY___BUILTIN_NAN || sym == YY___BUILTIN_NANF || sym == YY___BUILTIN_ADD_OVERFLOW || sym == YY___BUILTIN_ADD_OVERFLOW_P || sym == YY___BUILTIN_SADD_OVERFLOW || sym == YY___BUILTIN_SADDL_OVERFLOW || sym == YY___BUILTIN_SADDLL_OVERFLOW || sym == YY___BUILTIN_UADD_OVERFLOW || sym == YY___BUILTIN_UADDL_OVERFLOW || sym == YY___BUILTIN_UADDLL_OVERFLOW || sym == YY___BUILTIN_SUB_OVERFLOW || sym == YY___BUILTIN_SUB_OVERFLOW_P || sym == YY___BUILTIN_SSUB_OVERFLOW || sym == YY___BUILTIN_SSUBL_OVERFLOW || sym == YY___BUILTIN_SSUBLL_OVERFLOW || sym == YY___BUILTIN_USUB_OVERFLOW || sym == YY___BUILTIN_USUBL_OVERFLOW || sym == YY___BUILTIN_USUBLL_OVERFLOW || sym == YY___BUILTIN_MUL_OVERFLOW || sym == YY___BUILTIN_MUL_OVERFLOW_P || sym == YY___BUILTIN_SMUL_OVERFLOW || sym == YY___BUILTIN_SMULL_OVERFLOW || sym == YY___BUILTIN_SMULLL_OVERFLOW || sym == YY___BUILTIN_UMUL_OVERFLOW || sym == YY___BUILTIN_UMULL_OVERFLOW || sym == YY___BUILTIN_UMULLL_OVERFLOW || sym == YY___BUILTIN_CONSTANT_P || sym == YY___BUILTIN_VA_ARG) { + if (sym == YY__LPAREN || C_IS_ID(sym) || sym == YY_DECIMAL_NUMBER || sym == YY_OCTAL_NUMBER || sym == YY_HEXADECIMAL_NUMBER || sym == YY_BINARY_NUMBER || sym == YY_FLOATING_NUMBER || sym == YY_HEXADECIMAL_FLOATING_NUMBER || sym == YY_CHARACTER || sym == YY_STRING || sym == YY__GENERIC || sym == YY___EXTENSION__ || sym == YY__PLUS_PLUS || sym == YY__MINUS_MINUS || sym == YY__AND || sym == YY__STAR || sym == YY__PLUS || sym == YY__MINUS || sym == YY__TILDE || sym == YY__BANG || sym == YY_SIZEOF || sym == YY__ALIGNOF || sym == YY___ALIGNOF__ || sym == YY___ALIGNOF || sym == YY__AND_AND || sym == YY___BUILTIN_VA_START || sym == YY___BUILTIN_VA_END || sym == YY___BUILTIN_VA_COPY || sym == YY___BUILTIN_ALLOCA || sym == YY___BUILTIN_ABORT || sym == YY___BUILTIN_TRAP || sym == YY___BUILTIN_DEBUGTRAP || sym == YY___BUILTIN_FRAME_ADDRESS || sym == YY___BUILTIN_ABS || sym == YY___BUILTIN_LABS || sym == YY___BUILTIN_LLABS || sym == YY___BUILTIN_FABS || sym == YY___BUILTIN_FABSF || sym == YY___BUILTIN_BSWAP16 || sym == YY___BUILTIN_BSWAP32 || sym == YY___BUILTIN_BSWAP64 || sym == YY___BUILTIN_POPCOUNT || sym == YY___BUILTIN_POPCOUNTL || sym == YY___BUILTIN_POPCOUNTLL || sym == YY___BUILTIN_CLZ || sym == YY___BUILTIN_CLZL || sym == YY___BUILTIN_CLZLL || sym == YY___BUILTIN_CTZ || sym == YY___BUILTIN_CTZL || sym == YY___BUILTIN_CTZLL || sym == YY___BUILTIN_FFS || sym == YY___BUILTIN_FFSL || sym == YY___BUILTIN_FFSLL || sym == YY___BUILTIN_MEMCPY || sym == YY___BUILTIN_MEMSET || sym == YY___BUILTIN_EXPECT || sym == YY___BUILTIN_PREFETCH || sym == YY___BUILTIN_UNREACHABLE || sym == YY___BUILTIN_HUGE_VAL || sym == YY___BUILTIN_HUGE_VALF || sym == YY___BUILTIN_INF || sym == YY___BUILTIN_INFF || sym == YY___BUILTIN_ISUNORDERED || sym == YY___BUILTIN_NAN || sym == YY___BUILTIN_NANF || sym == YY___BUILTIN_ADD_OVERFLOW || sym == YY___BUILTIN_ADD_OVERFLOW_P || sym == YY___BUILTIN_SADD_OVERFLOW || sym == YY___BUILTIN_SADDL_OVERFLOW || sym == YY___BUILTIN_SADDLL_OVERFLOW || sym == YY___BUILTIN_UADD_OVERFLOW || sym == YY___BUILTIN_UADDL_OVERFLOW || sym == YY___BUILTIN_UADDLL_OVERFLOW || sym == YY___BUILTIN_SUB_OVERFLOW || sym == YY___BUILTIN_SUB_OVERFLOW_P || sym == YY___BUILTIN_SSUB_OVERFLOW || sym == YY___BUILTIN_SSUBL_OVERFLOW || sym == YY___BUILTIN_SSUBLL_OVERFLOW || sym == YY___BUILTIN_USUB_OVERFLOW || sym == YY___BUILTIN_USUBL_OVERFLOW || sym == YY___BUILTIN_USUBLL_OVERFLOW || sym == YY___BUILTIN_MUL_OVERFLOW || sym == YY___BUILTIN_MUL_OVERFLOW_P || sym == YY___BUILTIN_SMUL_OVERFLOW || sym == YY___BUILTIN_SMULL_OVERFLOW || sym == YY___BUILTIN_SMULLL_OVERFLOW || sym == YY___BUILTIN_UMUL_OVERFLOW || sym == YY___BUILTIN_UMULL_OVERFLOW || sym == YY___BUILTIN_UMULLL_OVERFLOW || sym == YY___BUILTIN_SHUFFLE || sym == YY___BUILTIN_SHUFFLEVECTOR || sym == YY___BUILTIN_CONSTANT_P || sym == YY___BUILTIN_VA_ARG || sym == YY___BUILTIN_CONVERTVECTOR) { c_value v; c_value_clear(&v); sym = parse_assignment_expression(sym, rcc, &v); @@ -1528,10 +1528,10 @@ static yy_sym parse_nested_initializer_contents(yy_sym sym, rcc_ctx *rcc, c_sym yy_error_sym("'{' expected, got", sym); } sym = get_sym(); - if (C_IS_ID(sym) || sym == YY__LPAREN || sym == YY_DECIMAL_NUMBER || sym == YY_OCTAL_NUMBER || sym == YY_HEXADECIMAL_NUMBER || sym == YY_BINARY_NUMBER || sym == YY_FLOATING_NUMBER || sym == YY_HEXADECIMAL_FLOATING_NUMBER || sym == YY_CHARACTER || sym == YY_STRING || sym == YY__GENERIC || sym == YY___EXTENSION__ || sym == YY__PLUS_PLUS || sym == YY__MINUS_MINUS || sym == YY__AND || sym == YY__STAR || sym == YY__PLUS || sym == YY__MINUS || sym == YY__TILDE || sym == YY__BANG || sym == YY_SIZEOF || sym == YY__ALIGNOF || sym == YY___ALIGNOF__ || sym == YY___ALIGNOF || sym == YY__AND_AND || sym == YY___BUILTIN_VA_START || sym == YY___BUILTIN_VA_END || sym == YY___BUILTIN_VA_COPY || sym == YY___BUILTIN_ALLOCA || sym == YY___BUILTIN_ABORT || sym == YY___BUILTIN_TRAP || sym == YY___BUILTIN_DEBUGTRAP || sym == YY___BUILTIN_FRAME_ADDRESS || sym == YY___BUILTIN_ABS || sym == YY___BUILTIN_LABS || sym == YY___BUILTIN_LLABS || sym == YY___BUILTIN_FABS || sym == YY___BUILTIN_FABSF || sym == YY___BUILTIN_BSWAP16 || sym == YY___BUILTIN_BSWAP32 || sym == YY___BUILTIN_BSWAP64 || sym == YY___BUILTIN_POPCOUNT || sym == YY___BUILTIN_POPCOUNTL || sym == YY___BUILTIN_POPCOUNTLL || sym == YY___BUILTIN_CLZ || sym == YY___BUILTIN_CLZL || sym == YY___BUILTIN_CLZLL || sym == YY___BUILTIN_CTZ || sym == YY___BUILTIN_CTZL || sym == YY___BUILTIN_CTZLL || sym == YY___BUILTIN_FFS || sym == YY___BUILTIN_FFSL || sym == YY___BUILTIN_FFSLL || sym == YY___BUILTIN_MEMCPY || sym == YY___BUILTIN_MEMSET || sym == YY___BUILTIN_EXPECT || sym == YY___BUILTIN_PREFETCH || sym == YY___BUILTIN_UNREACHABLE || sym == YY___BUILTIN_HUGE_VAL || sym == YY___BUILTIN_HUGE_VALF || sym == YY___BUILTIN_INF || sym == YY___BUILTIN_INFF || sym == YY___BUILTIN_ISUNORDERED || sym == YY___BUILTIN_NAN || sym == YY___BUILTIN_NANF || sym == YY___BUILTIN_ADD_OVERFLOW || sym == YY___BUILTIN_ADD_OVERFLOW_P || sym == YY___BUILTIN_SADD_OVERFLOW || sym == YY___BUILTIN_SADDL_OVERFLOW || sym == YY___BUILTIN_SADDLL_OVERFLOW || sym == YY___BUILTIN_UADD_OVERFLOW || sym == YY___BUILTIN_UADDL_OVERFLOW || sym == YY___BUILTIN_UADDLL_OVERFLOW || sym == YY___BUILTIN_SUB_OVERFLOW || sym == YY___BUILTIN_SUB_OVERFLOW_P || sym == YY___BUILTIN_SSUB_OVERFLOW || sym == YY___BUILTIN_SSUBL_OVERFLOW || sym == YY___BUILTIN_SSUBLL_OVERFLOW || sym == YY___BUILTIN_USUB_OVERFLOW || sym == YY___BUILTIN_USUBL_OVERFLOW || sym == YY___BUILTIN_USUBLL_OVERFLOW || sym == YY___BUILTIN_MUL_OVERFLOW || sym == YY___BUILTIN_MUL_OVERFLOW_P || sym == YY___BUILTIN_SMUL_OVERFLOW || sym == YY___BUILTIN_SMULL_OVERFLOW || sym == YY___BUILTIN_SMULLL_OVERFLOW || sym == YY___BUILTIN_UMUL_OVERFLOW || sym == YY___BUILTIN_UMULL_OVERFLOW || sym == YY___BUILTIN_UMULLL_OVERFLOW || sym == YY___BUILTIN_CONSTANT_P || sym == YY___BUILTIN_VA_ARG || sym == YY__LBRACE || sym == YY__LBRACK || sym == YY__POINT) { + if (C_IS_ID(sym) || sym == YY__LPAREN || sym == YY_DECIMAL_NUMBER || sym == YY_OCTAL_NUMBER || sym == YY_HEXADECIMAL_NUMBER || sym == YY_BINARY_NUMBER || sym == YY_FLOATING_NUMBER || sym == YY_HEXADECIMAL_FLOATING_NUMBER || sym == YY_CHARACTER || sym == YY_STRING || sym == YY__GENERIC || sym == YY___EXTENSION__ || sym == YY__PLUS_PLUS || sym == YY__MINUS_MINUS || sym == YY__AND || sym == YY__STAR || sym == YY__PLUS || sym == YY__MINUS || sym == YY__TILDE || sym == YY__BANG || sym == YY_SIZEOF || sym == YY__ALIGNOF || sym == YY___ALIGNOF__ || sym == YY___ALIGNOF || sym == YY__AND_AND || sym == YY___BUILTIN_VA_START || sym == YY___BUILTIN_VA_END || sym == YY___BUILTIN_VA_COPY || sym == YY___BUILTIN_ALLOCA || sym == YY___BUILTIN_ABORT || sym == YY___BUILTIN_TRAP || sym == YY___BUILTIN_DEBUGTRAP || sym == YY___BUILTIN_FRAME_ADDRESS || sym == YY___BUILTIN_ABS || sym == YY___BUILTIN_LABS || sym == YY___BUILTIN_LLABS || sym == YY___BUILTIN_FABS || sym == YY___BUILTIN_FABSF || sym == YY___BUILTIN_BSWAP16 || sym == YY___BUILTIN_BSWAP32 || sym == YY___BUILTIN_BSWAP64 || sym == YY___BUILTIN_POPCOUNT || sym == YY___BUILTIN_POPCOUNTL || sym == YY___BUILTIN_POPCOUNTLL || sym == YY___BUILTIN_CLZ || sym == YY___BUILTIN_CLZL || sym == YY___BUILTIN_CLZLL || sym == YY___BUILTIN_CTZ || sym == YY___BUILTIN_CTZL || sym == YY___BUILTIN_CTZLL || sym == YY___BUILTIN_FFS || sym == YY___BUILTIN_FFSL || sym == YY___BUILTIN_FFSLL || sym == YY___BUILTIN_MEMCPY || sym == YY___BUILTIN_MEMSET || sym == YY___BUILTIN_EXPECT || sym == YY___BUILTIN_PREFETCH || sym == YY___BUILTIN_UNREACHABLE || sym == YY___BUILTIN_HUGE_VAL || sym == YY___BUILTIN_HUGE_VALF || sym == YY___BUILTIN_INF || sym == YY___BUILTIN_INFF || sym == YY___BUILTIN_ISUNORDERED || sym == YY___BUILTIN_NAN || sym == YY___BUILTIN_NANF || sym == YY___BUILTIN_ADD_OVERFLOW || sym == YY___BUILTIN_ADD_OVERFLOW_P || sym == YY___BUILTIN_SADD_OVERFLOW || sym == YY___BUILTIN_SADDL_OVERFLOW || sym == YY___BUILTIN_SADDLL_OVERFLOW || sym == YY___BUILTIN_UADD_OVERFLOW || sym == YY___BUILTIN_UADDL_OVERFLOW || sym == YY___BUILTIN_UADDLL_OVERFLOW || sym == YY___BUILTIN_SUB_OVERFLOW || sym == YY___BUILTIN_SUB_OVERFLOW_P || sym == YY___BUILTIN_SSUB_OVERFLOW || sym == YY___BUILTIN_SSUBL_OVERFLOW || sym == YY___BUILTIN_SSUBLL_OVERFLOW || sym == YY___BUILTIN_USUB_OVERFLOW || sym == YY___BUILTIN_USUBL_OVERFLOW || sym == YY___BUILTIN_USUBLL_OVERFLOW || sym == YY___BUILTIN_MUL_OVERFLOW || sym == YY___BUILTIN_MUL_OVERFLOW_P || sym == YY___BUILTIN_SMUL_OVERFLOW || sym == YY___BUILTIN_SMULL_OVERFLOW || sym == YY___BUILTIN_SMULLL_OVERFLOW || sym == YY___BUILTIN_UMUL_OVERFLOW || sym == YY___BUILTIN_UMULL_OVERFLOW || sym == YY___BUILTIN_UMULLL_OVERFLOW || sym == YY___BUILTIN_SHUFFLE || sym == YY___BUILTIN_SHUFFLEVECTOR || sym == YY___BUILTIN_CONSTANT_P || sym == YY___BUILTIN_VA_ARG || sym == YY___BUILTIN_CONVERTVECTOR || sym == YY__LBRACE || sym == YY__LBRACK || sym == YY__POINT) { if ((C_IS_ID(sym)) && (!C_IS_ID(sym) || is_label(rcc, sym))) { sym = parse_gcc_field_initializer(sym, rcc, obj, init); - } else if (sym == YY__LPAREN || C_IS_ID(sym) || sym == YY_DECIMAL_NUMBER || sym == YY_OCTAL_NUMBER || sym == YY_HEXADECIMAL_NUMBER || sym == YY_BINARY_NUMBER || sym == YY_FLOATING_NUMBER || sym == YY_HEXADECIMAL_FLOATING_NUMBER || sym == YY_CHARACTER || sym == YY_STRING || sym == YY__GENERIC || sym == YY___EXTENSION__ || sym == YY__PLUS_PLUS || sym == YY__MINUS_MINUS || sym == YY__AND || sym == YY__STAR || sym == YY__PLUS || sym == YY__MINUS || sym == YY__TILDE || sym == YY__BANG || sym == YY_SIZEOF || sym == YY__ALIGNOF || sym == YY___ALIGNOF__ || sym == YY___ALIGNOF || sym == YY__AND_AND || sym == YY___BUILTIN_VA_START || sym == YY___BUILTIN_VA_END || sym == YY___BUILTIN_VA_COPY || sym == YY___BUILTIN_ALLOCA || sym == YY___BUILTIN_ABORT || sym == YY___BUILTIN_TRAP || sym == YY___BUILTIN_DEBUGTRAP || sym == YY___BUILTIN_FRAME_ADDRESS || sym == YY___BUILTIN_ABS || sym == YY___BUILTIN_LABS || sym == YY___BUILTIN_LLABS || sym == YY___BUILTIN_FABS || sym == YY___BUILTIN_FABSF || sym == YY___BUILTIN_BSWAP16 || sym == YY___BUILTIN_BSWAP32 || sym == YY___BUILTIN_BSWAP64 || sym == YY___BUILTIN_POPCOUNT || sym == YY___BUILTIN_POPCOUNTL || sym == YY___BUILTIN_POPCOUNTLL || sym == YY___BUILTIN_CLZ || sym == YY___BUILTIN_CLZL || sym == YY___BUILTIN_CLZLL || sym == YY___BUILTIN_CTZ || sym == YY___BUILTIN_CTZL || sym == YY___BUILTIN_CTZLL || sym == YY___BUILTIN_FFS || sym == YY___BUILTIN_FFSL || sym == YY___BUILTIN_FFSLL || sym == YY___BUILTIN_MEMCPY || sym == YY___BUILTIN_MEMSET || sym == YY___BUILTIN_EXPECT || sym == YY___BUILTIN_PREFETCH || sym == YY___BUILTIN_UNREACHABLE || sym == YY___BUILTIN_HUGE_VAL || sym == YY___BUILTIN_HUGE_VALF || sym == YY___BUILTIN_INF || sym == YY___BUILTIN_INFF || sym == YY___BUILTIN_ISUNORDERED || sym == YY___BUILTIN_NAN || sym == YY___BUILTIN_NANF || sym == YY___BUILTIN_ADD_OVERFLOW || sym == YY___BUILTIN_ADD_OVERFLOW_P || sym == YY___BUILTIN_SADD_OVERFLOW || sym == YY___BUILTIN_SADDL_OVERFLOW || sym == YY___BUILTIN_SADDLL_OVERFLOW || sym == YY___BUILTIN_UADD_OVERFLOW || sym == YY___BUILTIN_UADDL_OVERFLOW || sym == YY___BUILTIN_UADDLL_OVERFLOW || sym == YY___BUILTIN_SUB_OVERFLOW || sym == YY___BUILTIN_SUB_OVERFLOW_P || sym == YY___BUILTIN_SSUB_OVERFLOW || sym == YY___BUILTIN_SSUBL_OVERFLOW || sym == YY___BUILTIN_SSUBLL_OVERFLOW || sym == YY___BUILTIN_USUB_OVERFLOW || sym == YY___BUILTIN_USUBL_OVERFLOW || sym == YY___BUILTIN_USUBLL_OVERFLOW || sym == YY___BUILTIN_MUL_OVERFLOW || sym == YY___BUILTIN_MUL_OVERFLOW_P || sym == YY___BUILTIN_SMUL_OVERFLOW || sym == YY___BUILTIN_SMULL_OVERFLOW || sym == YY___BUILTIN_SMULLL_OVERFLOW || sym == YY___BUILTIN_UMUL_OVERFLOW || sym == YY___BUILTIN_UMULL_OVERFLOW || sym == YY___BUILTIN_UMULLL_OVERFLOW || sym == YY___BUILTIN_CONSTANT_P || sym == YY___BUILTIN_VA_ARG || sym == YY__LBRACE) { + } else if (sym == YY__LPAREN || C_IS_ID(sym) || sym == YY_DECIMAL_NUMBER || sym == YY_OCTAL_NUMBER || sym == YY_HEXADECIMAL_NUMBER || sym == YY_BINARY_NUMBER || sym == YY_FLOATING_NUMBER || sym == YY_HEXADECIMAL_FLOATING_NUMBER || sym == YY_CHARACTER || sym == YY_STRING || sym == YY__GENERIC || sym == YY___EXTENSION__ || sym == YY__PLUS_PLUS || sym == YY__MINUS_MINUS || sym == YY__AND || sym == YY__STAR || sym == YY__PLUS || sym == YY__MINUS || sym == YY__TILDE || sym == YY__BANG || sym == YY_SIZEOF || sym == YY__ALIGNOF || sym == YY___ALIGNOF__ || sym == YY___ALIGNOF || sym == YY__AND_AND || sym == YY___BUILTIN_VA_START || sym == YY___BUILTIN_VA_END || sym == YY___BUILTIN_VA_COPY || sym == YY___BUILTIN_ALLOCA || sym == YY___BUILTIN_ABORT || sym == YY___BUILTIN_TRAP || sym == YY___BUILTIN_DEBUGTRAP || sym == YY___BUILTIN_FRAME_ADDRESS || sym == YY___BUILTIN_ABS || sym == YY___BUILTIN_LABS || sym == YY___BUILTIN_LLABS || sym == YY___BUILTIN_FABS || sym == YY___BUILTIN_FABSF || sym == YY___BUILTIN_BSWAP16 || sym == YY___BUILTIN_BSWAP32 || sym == YY___BUILTIN_BSWAP64 || sym == YY___BUILTIN_POPCOUNT || sym == YY___BUILTIN_POPCOUNTL || sym == YY___BUILTIN_POPCOUNTLL || sym == YY___BUILTIN_CLZ || sym == YY___BUILTIN_CLZL || sym == YY___BUILTIN_CLZLL || sym == YY___BUILTIN_CTZ || sym == YY___BUILTIN_CTZL || sym == YY___BUILTIN_CTZLL || sym == YY___BUILTIN_FFS || sym == YY___BUILTIN_FFSL || sym == YY___BUILTIN_FFSLL || sym == YY___BUILTIN_MEMCPY || sym == YY___BUILTIN_MEMSET || sym == YY___BUILTIN_EXPECT || sym == YY___BUILTIN_PREFETCH || sym == YY___BUILTIN_UNREACHABLE || sym == YY___BUILTIN_HUGE_VAL || sym == YY___BUILTIN_HUGE_VALF || sym == YY___BUILTIN_INF || sym == YY___BUILTIN_INFF || sym == YY___BUILTIN_ISUNORDERED || sym == YY___BUILTIN_NAN || sym == YY___BUILTIN_NANF || sym == YY___BUILTIN_ADD_OVERFLOW || sym == YY___BUILTIN_ADD_OVERFLOW_P || sym == YY___BUILTIN_SADD_OVERFLOW || sym == YY___BUILTIN_SADDL_OVERFLOW || sym == YY___BUILTIN_SADDLL_OVERFLOW || sym == YY___BUILTIN_UADD_OVERFLOW || sym == YY___BUILTIN_UADDL_OVERFLOW || sym == YY___BUILTIN_UADDLL_OVERFLOW || sym == YY___BUILTIN_SUB_OVERFLOW || sym == YY___BUILTIN_SUB_OVERFLOW_P || sym == YY___BUILTIN_SSUB_OVERFLOW || sym == YY___BUILTIN_SSUBL_OVERFLOW || sym == YY___BUILTIN_SSUBLL_OVERFLOW || sym == YY___BUILTIN_USUB_OVERFLOW || sym == YY___BUILTIN_USUBL_OVERFLOW || sym == YY___BUILTIN_USUBLL_OVERFLOW || sym == YY___BUILTIN_MUL_OVERFLOW || sym == YY___BUILTIN_MUL_OVERFLOW_P || sym == YY___BUILTIN_SMUL_OVERFLOW || sym == YY___BUILTIN_SMULL_OVERFLOW || sym == YY___BUILTIN_SMULLL_OVERFLOW || sym == YY___BUILTIN_UMUL_OVERFLOW || sym == YY___BUILTIN_UMULL_OVERFLOW || sym == YY___BUILTIN_UMULLL_OVERFLOW || sym == YY___BUILTIN_SHUFFLE || sym == YY___BUILTIN_SHUFFLEVECTOR || sym == YY___BUILTIN_CONSTANT_P || sym == YY___BUILTIN_VA_ARG || sym == YY___BUILTIN_CONVERTVECTOR || sym == YY__LBRACE) { sym = parse_nested_initializer(sym, rcc, obj, init, 0); } else { sym = parse_designated_initializer(sym, rcc, obj, init); @@ -1543,7 +1543,7 @@ static yy_sym parse_nested_initializer_contents(yy_sym sym, rcc_ctx *rcc, c_sym sym = get_sym(); } else if ((C_IS_ID(sym)) && (!C_IS_ID(sym) || is_label(rcc, sym))) { sym = parse_gcc_field_initializer(sym, rcc, obj, init); - } else if (sym == YY__LPAREN || C_IS_ID(sym) || sym == YY_DECIMAL_NUMBER || sym == YY_OCTAL_NUMBER || sym == YY_HEXADECIMAL_NUMBER || sym == YY_BINARY_NUMBER || sym == YY_FLOATING_NUMBER || sym == YY_HEXADECIMAL_FLOATING_NUMBER || sym == YY_CHARACTER || sym == YY_STRING || sym == YY__GENERIC || sym == YY___EXTENSION__ || sym == YY__PLUS_PLUS || sym == YY__MINUS_MINUS || sym == YY__AND || sym == YY__STAR || sym == YY__PLUS || sym == YY__MINUS || sym == YY__TILDE || sym == YY__BANG || sym == YY_SIZEOF || sym == YY__ALIGNOF || sym == YY___ALIGNOF__ || sym == YY___ALIGNOF || sym == YY__AND_AND || sym == YY___BUILTIN_VA_START || sym == YY___BUILTIN_VA_END || sym == YY___BUILTIN_VA_COPY || sym == YY___BUILTIN_ALLOCA || sym == YY___BUILTIN_ABORT || sym == YY___BUILTIN_TRAP || sym == YY___BUILTIN_DEBUGTRAP || sym == YY___BUILTIN_FRAME_ADDRESS || sym == YY___BUILTIN_ABS || sym == YY___BUILTIN_LABS || sym == YY___BUILTIN_LLABS || sym == YY___BUILTIN_FABS || sym == YY___BUILTIN_FABSF || sym == YY___BUILTIN_BSWAP16 || sym == YY___BUILTIN_BSWAP32 || sym == YY___BUILTIN_BSWAP64 || sym == YY___BUILTIN_POPCOUNT || sym == YY___BUILTIN_POPCOUNTL || sym == YY___BUILTIN_POPCOUNTLL || sym == YY___BUILTIN_CLZ || sym == YY___BUILTIN_CLZL || sym == YY___BUILTIN_CLZLL || sym == YY___BUILTIN_CTZ || sym == YY___BUILTIN_CTZL || sym == YY___BUILTIN_CTZLL || sym == YY___BUILTIN_FFS || sym == YY___BUILTIN_FFSL || sym == YY___BUILTIN_FFSLL || sym == YY___BUILTIN_MEMCPY || sym == YY___BUILTIN_MEMSET || sym == YY___BUILTIN_EXPECT || sym == YY___BUILTIN_PREFETCH || sym == YY___BUILTIN_UNREACHABLE || sym == YY___BUILTIN_HUGE_VAL || sym == YY___BUILTIN_HUGE_VALF || sym == YY___BUILTIN_INF || sym == YY___BUILTIN_INFF || sym == YY___BUILTIN_ISUNORDERED || sym == YY___BUILTIN_NAN || sym == YY___BUILTIN_NANF || sym == YY___BUILTIN_ADD_OVERFLOW || sym == YY___BUILTIN_ADD_OVERFLOW_P || sym == YY___BUILTIN_SADD_OVERFLOW || sym == YY___BUILTIN_SADDL_OVERFLOW || sym == YY___BUILTIN_SADDLL_OVERFLOW || sym == YY___BUILTIN_UADD_OVERFLOW || sym == YY___BUILTIN_UADDL_OVERFLOW || sym == YY___BUILTIN_UADDLL_OVERFLOW || sym == YY___BUILTIN_SUB_OVERFLOW || sym == YY___BUILTIN_SUB_OVERFLOW_P || sym == YY___BUILTIN_SSUB_OVERFLOW || sym == YY___BUILTIN_SSUBL_OVERFLOW || sym == YY___BUILTIN_SSUBLL_OVERFLOW || sym == YY___BUILTIN_USUB_OVERFLOW || sym == YY___BUILTIN_USUBL_OVERFLOW || sym == YY___BUILTIN_USUBLL_OVERFLOW || sym == YY___BUILTIN_MUL_OVERFLOW || sym == YY___BUILTIN_MUL_OVERFLOW_P || sym == YY___BUILTIN_SMUL_OVERFLOW || sym == YY___BUILTIN_SMULL_OVERFLOW || sym == YY___BUILTIN_SMULLL_OVERFLOW || sym == YY___BUILTIN_UMUL_OVERFLOW || sym == YY___BUILTIN_UMULL_OVERFLOW || sym == YY___BUILTIN_UMULLL_OVERFLOW || sym == YY___BUILTIN_CONSTANT_P || sym == YY___BUILTIN_VA_ARG || sym == YY__LBRACE) { + } else if (sym == YY__LPAREN || C_IS_ID(sym) || sym == YY_DECIMAL_NUMBER || sym == YY_OCTAL_NUMBER || sym == YY_HEXADECIMAL_NUMBER || sym == YY_BINARY_NUMBER || sym == YY_FLOATING_NUMBER || sym == YY_HEXADECIMAL_FLOATING_NUMBER || sym == YY_CHARACTER || sym == YY_STRING || sym == YY__GENERIC || sym == YY___EXTENSION__ || sym == YY__PLUS_PLUS || sym == YY__MINUS_MINUS || sym == YY__AND || sym == YY__STAR || sym == YY__PLUS || sym == YY__MINUS || sym == YY__TILDE || sym == YY__BANG || sym == YY_SIZEOF || sym == YY__ALIGNOF || sym == YY___ALIGNOF__ || sym == YY___ALIGNOF || sym == YY__AND_AND || sym == YY___BUILTIN_VA_START || sym == YY___BUILTIN_VA_END || sym == YY___BUILTIN_VA_COPY || sym == YY___BUILTIN_ALLOCA || sym == YY___BUILTIN_ABORT || sym == YY___BUILTIN_TRAP || sym == YY___BUILTIN_DEBUGTRAP || sym == YY___BUILTIN_FRAME_ADDRESS || sym == YY___BUILTIN_ABS || sym == YY___BUILTIN_LABS || sym == YY___BUILTIN_LLABS || sym == YY___BUILTIN_FABS || sym == YY___BUILTIN_FABSF || sym == YY___BUILTIN_BSWAP16 || sym == YY___BUILTIN_BSWAP32 || sym == YY___BUILTIN_BSWAP64 || sym == YY___BUILTIN_POPCOUNT || sym == YY___BUILTIN_POPCOUNTL || sym == YY___BUILTIN_POPCOUNTLL || sym == YY___BUILTIN_CLZ || sym == YY___BUILTIN_CLZL || sym == YY___BUILTIN_CLZLL || sym == YY___BUILTIN_CTZ || sym == YY___BUILTIN_CTZL || sym == YY___BUILTIN_CTZLL || sym == YY___BUILTIN_FFS || sym == YY___BUILTIN_FFSL || sym == YY___BUILTIN_FFSLL || sym == YY___BUILTIN_MEMCPY || sym == YY___BUILTIN_MEMSET || sym == YY___BUILTIN_EXPECT || sym == YY___BUILTIN_PREFETCH || sym == YY___BUILTIN_UNREACHABLE || sym == YY___BUILTIN_HUGE_VAL || sym == YY___BUILTIN_HUGE_VALF || sym == YY___BUILTIN_INF || sym == YY___BUILTIN_INFF || sym == YY___BUILTIN_ISUNORDERED || sym == YY___BUILTIN_NAN || sym == YY___BUILTIN_NANF || sym == YY___BUILTIN_ADD_OVERFLOW || sym == YY___BUILTIN_ADD_OVERFLOW_P || sym == YY___BUILTIN_SADD_OVERFLOW || sym == YY___BUILTIN_SADDL_OVERFLOW || sym == YY___BUILTIN_SADDLL_OVERFLOW || sym == YY___BUILTIN_UADD_OVERFLOW || sym == YY___BUILTIN_UADDL_OVERFLOW || sym == YY___BUILTIN_UADDLL_OVERFLOW || sym == YY___BUILTIN_SUB_OVERFLOW || sym == YY___BUILTIN_SUB_OVERFLOW_P || sym == YY___BUILTIN_SSUB_OVERFLOW || sym == YY___BUILTIN_SSUBL_OVERFLOW || sym == YY___BUILTIN_SSUBLL_OVERFLOW || sym == YY___BUILTIN_USUB_OVERFLOW || sym == YY___BUILTIN_USUBL_OVERFLOW || sym == YY___BUILTIN_USUBLL_OVERFLOW || sym == YY___BUILTIN_MUL_OVERFLOW || sym == YY___BUILTIN_MUL_OVERFLOW_P || sym == YY___BUILTIN_SMUL_OVERFLOW || sym == YY___BUILTIN_SMULL_OVERFLOW || sym == YY___BUILTIN_SMULLL_OVERFLOW || sym == YY___BUILTIN_UMUL_OVERFLOW || sym == YY___BUILTIN_UMULL_OVERFLOW || sym == YY___BUILTIN_UMULLL_OVERFLOW || sym == YY___BUILTIN_SHUFFLE || sym == YY___BUILTIN_SHUFFLEVECTOR || sym == YY___BUILTIN_CONSTANT_P || sym == YY___BUILTIN_VA_ARG || sym == YY___BUILTIN_CONVERTVECTOR || sym == YY__LBRACE) { c_do_init_next(rcc, obj, init); sym = parse_nested_initializer(sym, rcc, obj, init, 0); } else if (sym == YY__LBRACK || sym == YY__POINT) { @@ -1654,14 +1654,14 @@ static yy_sym parse_compound_statement(yy_sym sym, rcc_ctx *rcc) { } sym = get_sym(); } - while (sym == YY__LBRACE || sym == YY_IF || sym == YY_SWITCH || sym == YY_WHILE || sym == YY_DO || sym == YY_FOR || sym == YY_GOTO || sym == YY_CONTINUE || sym == YY_BREAK || sym == YY_RETURN || sym == YY_ASM || sym == YY___ASM || sym == YY___ASM__ || C_IS_ID(sym) || sym == YY_CASE || sym == YY_DEFAULT || sym == YY__LPAREN || sym == YY_DECIMAL_NUMBER || sym == YY_OCTAL_NUMBER || sym == YY_HEXADECIMAL_NUMBER || sym == YY_BINARY_NUMBER || sym == YY_FLOATING_NUMBER || sym == YY_HEXADECIMAL_FLOATING_NUMBER || sym == YY_CHARACTER || sym == YY_STRING || sym == YY__GENERIC || sym == YY___EXTENSION__ || sym == YY__PLUS_PLUS || sym == YY__MINUS_MINUS || sym == YY__AND || sym == YY__STAR || sym == YY__PLUS || sym == YY__MINUS || sym == YY__TILDE || sym == YY__BANG || sym == YY_SIZEOF || sym == YY__ALIGNOF || sym == YY___ALIGNOF__ || sym == YY___ALIGNOF || sym == YY__AND_AND || sym == YY___BUILTIN_VA_START || sym == YY___BUILTIN_VA_END || sym == YY___BUILTIN_VA_COPY || sym == YY___BUILTIN_ALLOCA || sym == YY___BUILTIN_ABORT || sym == YY___BUILTIN_TRAP || sym == YY___BUILTIN_DEBUGTRAP || sym == YY___BUILTIN_FRAME_ADDRESS || sym == YY___BUILTIN_ABS || sym == YY___BUILTIN_LABS || sym == YY___BUILTIN_LLABS || sym == YY___BUILTIN_FABS || sym == YY___BUILTIN_FABSF || sym == YY___BUILTIN_BSWAP16 || sym == YY___BUILTIN_BSWAP32 || sym == YY___BUILTIN_BSWAP64 || sym == YY___BUILTIN_POPCOUNT || sym == YY___BUILTIN_POPCOUNTL || sym == YY___BUILTIN_POPCOUNTLL || sym == YY___BUILTIN_CLZ || sym == YY___BUILTIN_CLZL || sym == YY___BUILTIN_CLZLL || sym == YY___BUILTIN_CTZ || sym == YY___BUILTIN_CTZL || sym == YY___BUILTIN_CTZLL || sym == YY___BUILTIN_FFS || sym == YY___BUILTIN_FFSL || sym == YY___BUILTIN_FFSLL || sym == YY___BUILTIN_MEMCPY || sym == YY___BUILTIN_MEMSET || sym == YY___BUILTIN_EXPECT || sym == YY___BUILTIN_PREFETCH || sym == YY___BUILTIN_UNREACHABLE || sym == YY___BUILTIN_HUGE_VAL || sym == YY___BUILTIN_HUGE_VALF || sym == YY___BUILTIN_INF || sym == YY___BUILTIN_INFF || sym == YY___BUILTIN_ISUNORDERED || sym == YY___BUILTIN_NAN || sym == YY___BUILTIN_NANF || sym == YY___BUILTIN_ADD_OVERFLOW || sym == YY___BUILTIN_ADD_OVERFLOW_P || sym == YY___BUILTIN_SADD_OVERFLOW || sym == YY___BUILTIN_SADDL_OVERFLOW || sym == YY___BUILTIN_SADDLL_OVERFLOW || sym == YY___BUILTIN_UADD_OVERFLOW || sym == YY___BUILTIN_UADDL_OVERFLOW || sym == YY___BUILTIN_UADDLL_OVERFLOW || sym == YY___BUILTIN_SUB_OVERFLOW || sym == YY___BUILTIN_SUB_OVERFLOW_P || sym == YY___BUILTIN_SSUB_OVERFLOW || sym == YY___BUILTIN_SSUBL_OVERFLOW || sym == YY___BUILTIN_SSUBLL_OVERFLOW || sym == YY___BUILTIN_USUB_OVERFLOW || sym == YY___BUILTIN_USUBL_OVERFLOW || sym == YY___BUILTIN_USUBLL_OVERFLOW || sym == YY___BUILTIN_MUL_OVERFLOW || sym == YY___BUILTIN_MUL_OVERFLOW_P || sym == YY___BUILTIN_SMUL_OVERFLOW || sym == YY___BUILTIN_SMULL_OVERFLOW || sym == YY___BUILTIN_SMULLL_OVERFLOW || sym == YY___BUILTIN_UMUL_OVERFLOW || sym == YY___BUILTIN_UMULL_OVERFLOW || sym == YY___BUILTIN_UMULLL_OVERFLOW || sym == YY___BUILTIN_CONSTANT_P || sym == YY___BUILTIN_VA_ARG || sym == YY__STATIC_ASSERT || sym == YY_TYPEDEF || sym == YY_EXTERN || sym == YY_STATIC || sym == YY_AUTO || sym == YY_REGISTER || sym == YY__THREAD_LOCAL || sym == YY_VOID || sym == YY_CHAR || sym == YY_SHORT || sym == YY_INT || sym == YY_LONG || sym == YY_FLOAT || sym == YY_DOUBLE || sym == YY_SIGNED || sym == YY___SIGNED || sym == YY___SIGNED__ || sym == YY_UNSIGNED || sym == YY__BOOL || sym == YY__COMPLEX || sym == YY___COMPLEX || sym == YY___COMPLEX__ || sym == YY__ATOMIC || sym == YY_TYPEOF || sym == YY___TYPEOF || sym == YY___TYPEOF__ || sym == YY_STRUCT || sym == YY_UNION || sym == YY_ENUM || sym == YY_CONST || sym == YY___CONST || sym == YY___CONST__ || sym == YY_RESTRICT || sym == YY___RESTRICT || sym == YY___RESTRICT__ || sym == YY_VOLATILE || sym == YY___VOLATILE || sym == YY___VOLATILE__ || sym == YY_INLINE || sym == YY___INLINE || sym == YY___INLINE__ || sym == YY__NORETURN || sym == YY___FORCEINLINE || sym == YY__ALIGNAS || sym == YY___ATTRIBUTE || sym == YY___ATTRIBUTE__ || sym == YY___DECLSPEC || sym == YY___CDECL || sym == YY___FASTCALL || sym == YY___UNALIGNED || sym == YY__SEMICOLON) { + while (sym == YY__LBRACE || sym == YY_IF || sym == YY_SWITCH || sym == YY_WHILE || sym == YY_DO || sym == YY_FOR || sym == YY_GOTO || sym == YY_CONTINUE || sym == YY_BREAK || sym == YY_RETURN || sym == YY_ASM || sym == YY___ASM || sym == YY___ASM__ || C_IS_ID(sym) || sym == YY_CASE || sym == YY_DEFAULT || sym == YY__LPAREN || sym == YY_DECIMAL_NUMBER || sym == YY_OCTAL_NUMBER || sym == YY_HEXADECIMAL_NUMBER || sym == YY_BINARY_NUMBER || sym == YY_FLOATING_NUMBER || sym == YY_HEXADECIMAL_FLOATING_NUMBER || sym == YY_CHARACTER || sym == YY_STRING || sym == YY__GENERIC || sym == YY___EXTENSION__ || sym == YY__PLUS_PLUS || sym == YY__MINUS_MINUS || sym == YY__AND || sym == YY__STAR || sym == YY__PLUS || sym == YY__MINUS || sym == YY__TILDE || sym == YY__BANG || sym == YY_SIZEOF || sym == YY__ALIGNOF || sym == YY___ALIGNOF__ || sym == YY___ALIGNOF || sym == YY__AND_AND || sym == YY___BUILTIN_VA_START || sym == YY___BUILTIN_VA_END || sym == YY___BUILTIN_VA_COPY || sym == YY___BUILTIN_ALLOCA || sym == YY___BUILTIN_ABORT || sym == YY___BUILTIN_TRAP || sym == YY___BUILTIN_DEBUGTRAP || sym == YY___BUILTIN_FRAME_ADDRESS || sym == YY___BUILTIN_ABS || sym == YY___BUILTIN_LABS || sym == YY___BUILTIN_LLABS || sym == YY___BUILTIN_FABS || sym == YY___BUILTIN_FABSF || sym == YY___BUILTIN_BSWAP16 || sym == YY___BUILTIN_BSWAP32 || sym == YY___BUILTIN_BSWAP64 || sym == YY___BUILTIN_POPCOUNT || sym == YY___BUILTIN_POPCOUNTL || sym == YY___BUILTIN_POPCOUNTLL || sym == YY___BUILTIN_CLZ || sym == YY___BUILTIN_CLZL || sym == YY___BUILTIN_CLZLL || sym == YY___BUILTIN_CTZ || sym == YY___BUILTIN_CTZL || sym == YY___BUILTIN_CTZLL || sym == YY___BUILTIN_FFS || sym == YY___BUILTIN_FFSL || sym == YY___BUILTIN_FFSLL || sym == YY___BUILTIN_MEMCPY || sym == YY___BUILTIN_MEMSET || sym == YY___BUILTIN_EXPECT || sym == YY___BUILTIN_PREFETCH || sym == YY___BUILTIN_UNREACHABLE || sym == YY___BUILTIN_HUGE_VAL || sym == YY___BUILTIN_HUGE_VALF || sym == YY___BUILTIN_INF || sym == YY___BUILTIN_INFF || sym == YY___BUILTIN_ISUNORDERED || sym == YY___BUILTIN_NAN || sym == YY___BUILTIN_NANF || sym == YY___BUILTIN_ADD_OVERFLOW || sym == YY___BUILTIN_ADD_OVERFLOW_P || sym == YY___BUILTIN_SADD_OVERFLOW || sym == YY___BUILTIN_SADDL_OVERFLOW || sym == YY___BUILTIN_SADDLL_OVERFLOW || sym == YY___BUILTIN_UADD_OVERFLOW || sym == YY___BUILTIN_UADDL_OVERFLOW || sym == YY___BUILTIN_UADDLL_OVERFLOW || sym == YY___BUILTIN_SUB_OVERFLOW || sym == YY___BUILTIN_SUB_OVERFLOW_P || sym == YY___BUILTIN_SSUB_OVERFLOW || sym == YY___BUILTIN_SSUBL_OVERFLOW || sym == YY___BUILTIN_SSUBLL_OVERFLOW || sym == YY___BUILTIN_USUB_OVERFLOW || sym == YY___BUILTIN_USUBL_OVERFLOW || sym == YY___BUILTIN_USUBLL_OVERFLOW || sym == YY___BUILTIN_MUL_OVERFLOW || sym == YY___BUILTIN_MUL_OVERFLOW_P || sym == YY___BUILTIN_SMUL_OVERFLOW || sym == YY___BUILTIN_SMULL_OVERFLOW || sym == YY___BUILTIN_SMULLL_OVERFLOW || sym == YY___BUILTIN_UMUL_OVERFLOW || sym == YY___BUILTIN_UMULL_OVERFLOW || sym == YY___BUILTIN_UMULLL_OVERFLOW || sym == YY___BUILTIN_SHUFFLE || sym == YY___BUILTIN_SHUFFLEVECTOR || sym == YY___BUILTIN_CONSTANT_P || sym == YY___BUILTIN_VA_ARG || sym == YY___BUILTIN_CONVERTVECTOR || sym == YY__STATIC_ASSERT || sym == YY_TYPEDEF || sym == YY_EXTERN || sym == YY_STATIC || sym == YY_AUTO || sym == YY_REGISTER || sym == YY__THREAD_LOCAL || sym == YY_VOID || sym == YY_CHAR || sym == YY_SHORT || sym == YY_INT || sym == YY_LONG || sym == YY_FLOAT || sym == YY_DOUBLE || sym == YY_SIGNED || sym == YY___SIGNED || sym == YY___SIGNED__ || sym == YY_UNSIGNED || sym == YY__BOOL || sym == YY__COMPLEX || sym == YY___COMPLEX || sym == YY___COMPLEX__ || sym == YY__ATOMIC || sym == YY_TYPEOF || sym == YY___TYPEOF || sym == YY___TYPEOF__ || sym == YY_STRUCT || sym == YY_UNION || sym == YY_ENUM || sym == YY_CONST || sym == YY___CONST || sym == YY___CONST__ || sym == YY_RESTRICT || sym == YY___RESTRICT || sym == YY___RESTRICT__ || sym == YY_VOLATILE || sym == YY___VOLATILE || sym == YY___VOLATILE__ || sym == YY_INLINE || sym == YY___INLINE || sym == YY___INLINE__ || sym == YY__NORETURN || sym == YY___FORCEINLINE || sym == YY__ALIGNAS || sym == YY___ATTRIBUTE || sym == YY___ATTRIBUTE__ || sym == YY___DECLSPEC || sym == YY___CDECL || sym == YY___FASTCALL || sym == YY___UNALIGNED || sym == YY__SEMICOLON) { if ((C_IS_ID(sym) || sym == YY_CASE || sym == YY_DEFAULT) && (!C_IS_ID(sym) || is_label(rcc, sym))) { sym = parse_labels(sym, rcc); } else if (sym == YY__LBRACE || sym == YY_IF || sym == YY_SWITCH || sym == YY_WHILE || sym == YY_DO || sym == YY_FOR || sym == YY_GOTO || sym == YY_CONTINUE || sym == YY_BREAK || sym == YY_RETURN || sym == YY_ASM || sym == YY___ASM || sym == YY___ASM__) { sym = parse_c_statement(sym, rcc); } else { if (sym == YY___EXTENSION__) sym = yy_next(rcc); - if ((sym == YY__LPAREN || C_IS_ID(sym) || sym == YY_DECIMAL_NUMBER || sym == YY_OCTAL_NUMBER || sym == YY_HEXADECIMAL_NUMBER || sym == YY_BINARY_NUMBER || sym == YY_FLOATING_NUMBER || sym == YY_HEXADECIMAL_FLOATING_NUMBER || sym == YY_CHARACTER || sym == YY_STRING || sym == YY__GENERIC || sym == YY___EXTENSION__ || sym == YY__PLUS_PLUS || sym == YY__MINUS_MINUS || sym == YY__AND || sym == YY__STAR || sym == YY__PLUS || sym == YY__MINUS || sym == YY__TILDE || sym == YY__BANG || sym == YY_SIZEOF || sym == YY__ALIGNOF || sym == YY___ALIGNOF__ || sym == YY___ALIGNOF || sym == YY__AND_AND || sym == YY___BUILTIN_VA_START || sym == YY___BUILTIN_VA_END || sym == YY___BUILTIN_VA_COPY || sym == YY___BUILTIN_ALLOCA || sym == YY___BUILTIN_ABORT || sym == YY___BUILTIN_TRAP || sym == YY___BUILTIN_DEBUGTRAP || sym == YY___BUILTIN_FRAME_ADDRESS || sym == YY___BUILTIN_ABS || sym == YY___BUILTIN_LABS || sym == YY___BUILTIN_LLABS || sym == YY___BUILTIN_FABS || sym == YY___BUILTIN_FABSF || sym == YY___BUILTIN_BSWAP16 || sym == YY___BUILTIN_BSWAP32 || sym == YY___BUILTIN_BSWAP64 || sym == YY___BUILTIN_POPCOUNT || sym == YY___BUILTIN_POPCOUNTL || sym == YY___BUILTIN_POPCOUNTLL || sym == YY___BUILTIN_CLZ || sym == YY___BUILTIN_CLZL || sym == YY___BUILTIN_CLZLL || sym == YY___BUILTIN_CTZ || sym == YY___BUILTIN_CTZL || sym == YY___BUILTIN_CTZLL || sym == YY___BUILTIN_FFS || sym == YY___BUILTIN_FFSL || sym == YY___BUILTIN_FFSLL || sym == YY___BUILTIN_MEMCPY || sym == YY___BUILTIN_MEMSET || sym == YY___BUILTIN_EXPECT || sym == YY___BUILTIN_PREFETCH || sym == YY___BUILTIN_UNREACHABLE || sym == YY___BUILTIN_HUGE_VAL || sym == YY___BUILTIN_HUGE_VALF || sym == YY___BUILTIN_INF || sym == YY___BUILTIN_INFF || sym == YY___BUILTIN_ISUNORDERED || sym == YY___BUILTIN_NAN || sym == YY___BUILTIN_NANF || sym == YY___BUILTIN_ADD_OVERFLOW || sym == YY___BUILTIN_ADD_OVERFLOW_P || sym == YY___BUILTIN_SADD_OVERFLOW || sym == YY___BUILTIN_SADDL_OVERFLOW || sym == YY___BUILTIN_SADDLL_OVERFLOW || sym == YY___BUILTIN_UADD_OVERFLOW || sym == YY___BUILTIN_UADDL_OVERFLOW || sym == YY___BUILTIN_UADDLL_OVERFLOW || sym == YY___BUILTIN_SUB_OVERFLOW || sym == YY___BUILTIN_SUB_OVERFLOW_P || sym == YY___BUILTIN_SSUB_OVERFLOW || sym == YY___BUILTIN_SSUBL_OVERFLOW || sym == YY___BUILTIN_SSUBLL_OVERFLOW || sym == YY___BUILTIN_USUB_OVERFLOW || sym == YY___BUILTIN_USUBL_OVERFLOW || sym == YY___BUILTIN_USUBLL_OVERFLOW || sym == YY___BUILTIN_MUL_OVERFLOW || sym == YY___BUILTIN_MUL_OVERFLOW_P || sym == YY___BUILTIN_SMUL_OVERFLOW || sym == YY___BUILTIN_SMULL_OVERFLOW || sym == YY___BUILTIN_SMULLL_OVERFLOW || sym == YY___BUILTIN_UMUL_OVERFLOW || sym == YY___BUILTIN_UMULL_OVERFLOW || sym == YY___BUILTIN_UMULLL_OVERFLOW || sym == YY___BUILTIN_CONSTANT_P || sym == YY___BUILTIN_VA_ARG) && (!C_IS_ID(sym) || !is_typedef_name(rcc, sym))) { + if ((sym == YY__LPAREN || C_IS_ID(sym) || sym == YY_DECIMAL_NUMBER || sym == YY_OCTAL_NUMBER || sym == YY_HEXADECIMAL_NUMBER || sym == YY_BINARY_NUMBER || sym == YY_FLOATING_NUMBER || sym == YY_HEXADECIMAL_FLOATING_NUMBER || sym == YY_CHARACTER || sym == YY_STRING || sym == YY__GENERIC || sym == YY___EXTENSION__ || sym == YY__PLUS_PLUS || sym == YY__MINUS_MINUS || sym == YY__AND || sym == YY__STAR || sym == YY__PLUS || sym == YY__MINUS || sym == YY__TILDE || sym == YY__BANG || sym == YY_SIZEOF || sym == YY__ALIGNOF || sym == YY___ALIGNOF__ || sym == YY___ALIGNOF || sym == YY__AND_AND || sym == YY___BUILTIN_VA_START || sym == YY___BUILTIN_VA_END || sym == YY___BUILTIN_VA_COPY || sym == YY___BUILTIN_ALLOCA || sym == YY___BUILTIN_ABORT || sym == YY___BUILTIN_TRAP || sym == YY___BUILTIN_DEBUGTRAP || sym == YY___BUILTIN_FRAME_ADDRESS || sym == YY___BUILTIN_ABS || sym == YY___BUILTIN_LABS || sym == YY___BUILTIN_LLABS || sym == YY___BUILTIN_FABS || sym == YY___BUILTIN_FABSF || sym == YY___BUILTIN_BSWAP16 || sym == YY___BUILTIN_BSWAP32 || sym == YY___BUILTIN_BSWAP64 || sym == YY___BUILTIN_POPCOUNT || sym == YY___BUILTIN_POPCOUNTL || sym == YY___BUILTIN_POPCOUNTLL || sym == YY___BUILTIN_CLZ || sym == YY___BUILTIN_CLZL || sym == YY___BUILTIN_CLZLL || sym == YY___BUILTIN_CTZ || sym == YY___BUILTIN_CTZL || sym == YY___BUILTIN_CTZLL || sym == YY___BUILTIN_FFS || sym == YY___BUILTIN_FFSL || sym == YY___BUILTIN_FFSLL || sym == YY___BUILTIN_MEMCPY || sym == YY___BUILTIN_MEMSET || sym == YY___BUILTIN_EXPECT || sym == YY___BUILTIN_PREFETCH || sym == YY___BUILTIN_UNREACHABLE || sym == YY___BUILTIN_HUGE_VAL || sym == YY___BUILTIN_HUGE_VALF || sym == YY___BUILTIN_INF || sym == YY___BUILTIN_INFF || sym == YY___BUILTIN_ISUNORDERED || sym == YY___BUILTIN_NAN || sym == YY___BUILTIN_NANF || sym == YY___BUILTIN_ADD_OVERFLOW || sym == YY___BUILTIN_ADD_OVERFLOW_P || sym == YY___BUILTIN_SADD_OVERFLOW || sym == YY___BUILTIN_SADDL_OVERFLOW || sym == YY___BUILTIN_SADDLL_OVERFLOW || sym == YY___BUILTIN_UADD_OVERFLOW || sym == YY___BUILTIN_UADDL_OVERFLOW || sym == YY___BUILTIN_UADDLL_OVERFLOW || sym == YY___BUILTIN_SUB_OVERFLOW || sym == YY___BUILTIN_SUB_OVERFLOW_P || sym == YY___BUILTIN_SSUB_OVERFLOW || sym == YY___BUILTIN_SSUBL_OVERFLOW || sym == YY___BUILTIN_SSUBLL_OVERFLOW || sym == YY___BUILTIN_USUB_OVERFLOW || sym == YY___BUILTIN_USUBL_OVERFLOW || sym == YY___BUILTIN_USUBLL_OVERFLOW || sym == YY___BUILTIN_MUL_OVERFLOW || sym == YY___BUILTIN_MUL_OVERFLOW_P || sym == YY___BUILTIN_SMUL_OVERFLOW || sym == YY___BUILTIN_SMULL_OVERFLOW || sym == YY___BUILTIN_SMULLL_OVERFLOW || sym == YY___BUILTIN_UMUL_OVERFLOW || sym == YY___BUILTIN_UMULL_OVERFLOW || sym == YY___BUILTIN_UMULLL_OVERFLOW || sym == YY___BUILTIN_SHUFFLE || sym == YY___BUILTIN_SHUFFLEVECTOR || sym == YY___BUILTIN_CONSTANT_P || sym == YY___BUILTIN_VA_ARG || sym == YY___BUILTIN_CONVERTVECTOR) && (!C_IS_ID(sym) || !is_typedef_name(rcc, sym))) { sym = parse_expression(sym, rcc, &val); if (sym != YY__SEMICOLON) { yy_error_sym("';' expected, got", sym); @@ -1691,7 +1691,7 @@ static yy_sym parse_expression_statement(yy_sym sym, rcc_ctx *rcc, c_value *val) } sym = get_sym(); } - while (sym == YY__LBRACE || sym == YY_IF || sym == YY_SWITCH || sym == YY_WHILE || sym == YY_DO || sym == YY_FOR || sym == YY_GOTO || sym == YY_CONTINUE || sym == YY_BREAK || sym == YY_RETURN || sym == YY_ASM || sym == YY___ASM || sym == YY___ASM__ || C_IS_ID(sym) || sym == YY_CASE || sym == YY_DEFAULT || sym == YY__LPAREN || sym == YY_DECIMAL_NUMBER || sym == YY_OCTAL_NUMBER || sym == YY_HEXADECIMAL_NUMBER || sym == YY_BINARY_NUMBER || sym == YY_FLOATING_NUMBER || sym == YY_HEXADECIMAL_FLOATING_NUMBER || sym == YY_CHARACTER || sym == YY_STRING || sym == YY__GENERIC || sym == YY___EXTENSION__ || sym == YY__PLUS_PLUS || sym == YY__MINUS_MINUS || sym == YY__AND || sym == YY__STAR || sym == YY__PLUS || sym == YY__MINUS || sym == YY__TILDE || sym == YY__BANG || sym == YY_SIZEOF || sym == YY__ALIGNOF || sym == YY___ALIGNOF__ || sym == YY___ALIGNOF || sym == YY__AND_AND || sym == YY___BUILTIN_VA_START || sym == YY___BUILTIN_VA_END || sym == YY___BUILTIN_VA_COPY || sym == YY___BUILTIN_ALLOCA || sym == YY___BUILTIN_ABORT || sym == YY___BUILTIN_TRAP || sym == YY___BUILTIN_DEBUGTRAP || sym == YY___BUILTIN_FRAME_ADDRESS || sym == YY___BUILTIN_ABS || sym == YY___BUILTIN_LABS || sym == YY___BUILTIN_LLABS || sym == YY___BUILTIN_FABS || sym == YY___BUILTIN_FABSF || sym == YY___BUILTIN_BSWAP16 || sym == YY___BUILTIN_BSWAP32 || sym == YY___BUILTIN_BSWAP64 || sym == YY___BUILTIN_POPCOUNT || sym == YY___BUILTIN_POPCOUNTL || sym == YY___BUILTIN_POPCOUNTLL || sym == YY___BUILTIN_CLZ || sym == YY___BUILTIN_CLZL || sym == YY___BUILTIN_CLZLL || sym == YY___BUILTIN_CTZ || sym == YY___BUILTIN_CTZL || sym == YY___BUILTIN_CTZLL || sym == YY___BUILTIN_FFS || sym == YY___BUILTIN_FFSL || sym == YY___BUILTIN_FFSLL || sym == YY___BUILTIN_MEMCPY || sym == YY___BUILTIN_MEMSET || sym == YY___BUILTIN_EXPECT || sym == YY___BUILTIN_PREFETCH || sym == YY___BUILTIN_UNREACHABLE || sym == YY___BUILTIN_HUGE_VAL || sym == YY___BUILTIN_HUGE_VALF || sym == YY___BUILTIN_INF || sym == YY___BUILTIN_INFF || sym == YY___BUILTIN_ISUNORDERED || sym == YY___BUILTIN_NAN || sym == YY___BUILTIN_NANF || sym == YY___BUILTIN_ADD_OVERFLOW || sym == YY___BUILTIN_ADD_OVERFLOW_P || sym == YY___BUILTIN_SADD_OVERFLOW || sym == YY___BUILTIN_SADDL_OVERFLOW || sym == YY___BUILTIN_SADDLL_OVERFLOW || sym == YY___BUILTIN_UADD_OVERFLOW || sym == YY___BUILTIN_UADDL_OVERFLOW || sym == YY___BUILTIN_UADDLL_OVERFLOW || sym == YY___BUILTIN_SUB_OVERFLOW || sym == YY___BUILTIN_SUB_OVERFLOW_P || sym == YY___BUILTIN_SSUB_OVERFLOW || sym == YY___BUILTIN_SSUBL_OVERFLOW || sym == YY___BUILTIN_SSUBLL_OVERFLOW || sym == YY___BUILTIN_USUB_OVERFLOW || sym == YY___BUILTIN_USUBL_OVERFLOW || sym == YY___BUILTIN_USUBLL_OVERFLOW || sym == YY___BUILTIN_MUL_OVERFLOW || sym == YY___BUILTIN_MUL_OVERFLOW_P || sym == YY___BUILTIN_SMUL_OVERFLOW || sym == YY___BUILTIN_SMULL_OVERFLOW || sym == YY___BUILTIN_SMULLL_OVERFLOW || sym == YY___BUILTIN_UMUL_OVERFLOW || sym == YY___BUILTIN_UMULL_OVERFLOW || sym == YY___BUILTIN_UMULLL_OVERFLOW || sym == YY___BUILTIN_CONSTANT_P || sym == YY___BUILTIN_VA_ARG || sym == YY__STATIC_ASSERT || sym == YY_TYPEDEF || sym == YY_EXTERN || sym == YY_STATIC || sym == YY_AUTO || sym == YY_REGISTER || sym == YY__THREAD_LOCAL || sym == YY_VOID || sym == YY_CHAR || sym == YY_SHORT || sym == YY_INT || sym == YY_LONG || sym == YY_FLOAT || sym == YY_DOUBLE || sym == YY_SIGNED || sym == YY___SIGNED || sym == YY___SIGNED__ || sym == YY_UNSIGNED || sym == YY__BOOL || sym == YY__COMPLEX || sym == YY___COMPLEX || sym == YY___COMPLEX__ || sym == YY__ATOMIC || sym == YY_TYPEOF || sym == YY___TYPEOF || sym == YY___TYPEOF__ || sym == YY_STRUCT || sym == YY_UNION || sym == YY_ENUM || sym == YY_CONST || sym == YY___CONST || sym == YY___CONST__ || sym == YY_RESTRICT || sym == YY___RESTRICT || sym == YY___RESTRICT__ || sym == YY_VOLATILE || sym == YY___VOLATILE || sym == YY___VOLATILE__ || sym == YY_INLINE || sym == YY___INLINE || sym == YY___INLINE__ || sym == YY__NORETURN || sym == YY___FORCEINLINE || sym == YY__ALIGNAS || sym == YY___ATTRIBUTE || sym == YY___ATTRIBUTE__ || sym == YY___DECLSPEC || sym == YY___CDECL || sym == YY___FASTCALL || sym == YY___UNALIGNED || sym == YY__SEMICOLON) { + while (sym == YY__LBRACE || sym == YY_IF || sym == YY_SWITCH || sym == YY_WHILE || sym == YY_DO || sym == YY_FOR || sym == YY_GOTO || sym == YY_CONTINUE || sym == YY_BREAK || sym == YY_RETURN || sym == YY_ASM || sym == YY___ASM || sym == YY___ASM__ || C_IS_ID(sym) || sym == YY_CASE || sym == YY_DEFAULT || sym == YY__LPAREN || sym == YY_DECIMAL_NUMBER || sym == YY_OCTAL_NUMBER || sym == YY_HEXADECIMAL_NUMBER || sym == YY_BINARY_NUMBER || sym == YY_FLOATING_NUMBER || sym == YY_HEXADECIMAL_FLOATING_NUMBER || sym == YY_CHARACTER || sym == YY_STRING || sym == YY__GENERIC || sym == YY___EXTENSION__ || sym == YY__PLUS_PLUS || sym == YY__MINUS_MINUS || sym == YY__AND || sym == YY__STAR || sym == YY__PLUS || sym == YY__MINUS || sym == YY__TILDE || sym == YY__BANG || sym == YY_SIZEOF || sym == YY__ALIGNOF || sym == YY___ALIGNOF__ || sym == YY___ALIGNOF || sym == YY__AND_AND || sym == YY___BUILTIN_VA_START || sym == YY___BUILTIN_VA_END || sym == YY___BUILTIN_VA_COPY || sym == YY___BUILTIN_ALLOCA || sym == YY___BUILTIN_ABORT || sym == YY___BUILTIN_TRAP || sym == YY___BUILTIN_DEBUGTRAP || sym == YY___BUILTIN_FRAME_ADDRESS || sym == YY___BUILTIN_ABS || sym == YY___BUILTIN_LABS || sym == YY___BUILTIN_LLABS || sym == YY___BUILTIN_FABS || sym == YY___BUILTIN_FABSF || sym == YY___BUILTIN_BSWAP16 || sym == YY___BUILTIN_BSWAP32 || sym == YY___BUILTIN_BSWAP64 || sym == YY___BUILTIN_POPCOUNT || sym == YY___BUILTIN_POPCOUNTL || sym == YY___BUILTIN_POPCOUNTLL || sym == YY___BUILTIN_CLZ || sym == YY___BUILTIN_CLZL || sym == YY___BUILTIN_CLZLL || sym == YY___BUILTIN_CTZ || sym == YY___BUILTIN_CTZL || sym == YY___BUILTIN_CTZLL || sym == YY___BUILTIN_FFS || sym == YY___BUILTIN_FFSL || sym == YY___BUILTIN_FFSLL || sym == YY___BUILTIN_MEMCPY || sym == YY___BUILTIN_MEMSET || sym == YY___BUILTIN_EXPECT || sym == YY___BUILTIN_PREFETCH || sym == YY___BUILTIN_UNREACHABLE || sym == YY___BUILTIN_HUGE_VAL || sym == YY___BUILTIN_HUGE_VALF || sym == YY___BUILTIN_INF || sym == YY___BUILTIN_INFF || sym == YY___BUILTIN_ISUNORDERED || sym == YY___BUILTIN_NAN || sym == YY___BUILTIN_NANF || sym == YY___BUILTIN_ADD_OVERFLOW || sym == YY___BUILTIN_ADD_OVERFLOW_P || sym == YY___BUILTIN_SADD_OVERFLOW || sym == YY___BUILTIN_SADDL_OVERFLOW || sym == YY___BUILTIN_SADDLL_OVERFLOW || sym == YY___BUILTIN_UADD_OVERFLOW || sym == YY___BUILTIN_UADDL_OVERFLOW || sym == YY___BUILTIN_UADDLL_OVERFLOW || sym == YY___BUILTIN_SUB_OVERFLOW || sym == YY___BUILTIN_SUB_OVERFLOW_P || sym == YY___BUILTIN_SSUB_OVERFLOW || sym == YY___BUILTIN_SSUBL_OVERFLOW || sym == YY___BUILTIN_SSUBLL_OVERFLOW || sym == YY___BUILTIN_USUB_OVERFLOW || sym == YY___BUILTIN_USUBL_OVERFLOW || sym == YY___BUILTIN_USUBLL_OVERFLOW || sym == YY___BUILTIN_MUL_OVERFLOW || sym == YY___BUILTIN_MUL_OVERFLOW_P || sym == YY___BUILTIN_SMUL_OVERFLOW || sym == YY___BUILTIN_SMULL_OVERFLOW || sym == YY___BUILTIN_SMULLL_OVERFLOW || sym == YY___BUILTIN_UMUL_OVERFLOW || sym == YY___BUILTIN_UMULL_OVERFLOW || sym == YY___BUILTIN_UMULLL_OVERFLOW || sym == YY___BUILTIN_SHUFFLE || sym == YY___BUILTIN_SHUFFLEVECTOR || sym == YY___BUILTIN_CONSTANT_P || sym == YY___BUILTIN_VA_ARG || sym == YY___BUILTIN_CONVERTVECTOR || sym == YY__STATIC_ASSERT || sym == YY_TYPEDEF || sym == YY_EXTERN || sym == YY_STATIC || sym == YY_AUTO || sym == YY_REGISTER || sym == YY__THREAD_LOCAL || sym == YY_VOID || sym == YY_CHAR || sym == YY_SHORT || sym == YY_INT || sym == YY_LONG || sym == YY_FLOAT || sym == YY_DOUBLE || sym == YY_SIGNED || sym == YY___SIGNED || sym == YY___SIGNED__ || sym == YY_UNSIGNED || sym == YY__BOOL || sym == YY__COMPLEX || sym == YY___COMPLEX || sym == YY___COMPLEX__ || sym == YY__ATOMIC || sym == YY_TYPEOF || sym == YY___TYPEOF || sym == YY___TYPEOF__ || sym == YY_STRUCT || sym == YY_UNION || sym == YY_ENUM || sym == YY_CONST || sym == YY___CONST || sym == YY___CONST__ || sym == YY_RESTRICT || sym == YY___RESTRICT || sym == YY___RESTRICT__ || sym == YY_VOLATILE || sym == YY___VOLATILE || sym == YY___VOLATILE__ || sym == YY_INLINE || sym == YY___INLINE || sym == YY___INLINE__ || sym == YY__NORETURN || sym == YY___FORCEINLINE || sym == YY__ALIGNAS || sym == YY___ATTRIBUTE || sym == YY___ATTRIBUTE__ || sym == YY___DECLSPEC || sym == YY___CDECL || sym == YY___FASTCALL || sym == YY___UNALIGNED || sym == YY__SEMICOLON) { c_value_clear(val); if ((C_IS_ID(sym) || sym == YY_CASE || sym == YY_DEFAULT) && (!C_IS_ID(sym) || is_label(rcc, sym))) { sym = parse_labels(sym, rcc); @@ -1699,7 +1699,7 @@ static yy_sym parse_expression_statement(yy_sym sym, rcc_ctx *rcc, c_value *val) sym = parse_c_statement(sym, rcc); } else { if (sym == YY___EXTENSION__) sym = yy_next(rcc); - if ((sym == YY__LPAREN || C_IS_ID(sym) || sym == YY_DECIMAL_NUMBER || sym == YY_OCTAL_NUMBER || sym == YY_HEXADECIMAL_NUMBER || sym == YY_BINARY_NUMBER || sym == YY_FLOATING_NUMBER || sym == YY_HEXADECIMAL_FLOATING_NUMBER || sym == YY_CHARACTER || sym == YY_STRING || sym == YY__GENERIC || sym == YY___EXTENSION__ || sym == YY__PLUS_PLUS || sym == YY__MINUS_MINUS || sym == YY__AND || sym == YY__STAR || sym == YY__PLUS || sym == YY__MINUS || sym == YY__TILDE || sym == YY__BANG || sym == YY_SIZEOF || sym == YY__ALIGNOF || sym == YY___ALIGNOF__ || sym == YY___ALIGNOF || sym == YY__AND_AND || sym == YY___BUILTIN_VA_START || sym == YY___BUILTIN_VA_END || sym == YY___BUILTIN_VA_COPY || sym == YY___BUILTIN_ALLOCA || sym == YY___BUILTIN_ABORT || sym == YY___BUILTIN_TRAP || sym == YY___BUILTIN_DEBUGTRAP || sym == YY___BUILTIN_FRAME_ADDRESS || sym == YY___BUILTIN_ABS || sym == YY___BUILTIN_LABS || sym == YY___BUILTIN_LLABS || sym == YY___BUILTIN_FABS || sym == YY___BUILTIN_FABSF || sym == YY___BUILTIN_BSWAP16 || sym == YY___BUILTIN_BSWAP32 || sym == YY___BUILTIN_BSWAP64 || sym == YY___BUILTIN_POPCOUNT || sym == YY___BUILTIN_POPCOUNTL || sym == YY___BUILTIN_POPCOUNTLL || sym == YY___BUILTIN_CLZ || sym == YY___BUILTIN_CLZL || sym == YY___BUILTIN_CLZLL || sym == YY___BUILTIN_CTZ || sym == YY___BUILTIN_CTZL || sym == YY___BUILTIN_CTZLL || sym == YY___BUILTIN_FFS || sym == YY___BUILTIN_FFSL || sym == YY___BUILTIN_FFSLL || sym == YY___BUILTIN_MEMCPY || sym == YY___BUILTIN_MEMSET || sym == YY___BUILTIN_EXPECT || sym == YY___BUILTIN_PREFETCH || sym == YY___BUILTIN_UNREACHABLE || sym == YY___BUILTIN_HUGE_VAL || sym == YY___BUILTIN_HUGE_VALF || sym == YY___BUILTIN_INF || sym == YY___BUILTIN_INFF || sym == YY___BUILTIN_ISUNORDERED || sym == YY___BUILTIN_NAN || sym == YY___BUILTIN_NANF || sym == YY___BUILTIN_ADD_OVERFLOW || sym == YY___BUILTIN_ADD_OVERFLOW_P || sym == YY___BUILTIN_SADD_OVERFLOW || sym == YY___BUILTIN_SADDL_OVERFLOW || sym == YY___BUILTIN_SADDLL_OVERFLOW || sym == YY___BUILTIN_UADD_OVERFLOW || sym == YY___BUILTIN_UADDL_OVERFLOW || sym == YY___BUILTIN_UADDLL_OVERFLOW || sym == YY___BUILTIN_SUB_OVERFLOW || sym == YY___BUILTIN_SUB_OVERFLOW_P || sym == YY___BUILTIN_SSUB_OVERFLOW || sym == YY___BUILTIN_SSUBL_OVERFLOW || sym == YY___BUILTIN_SSUBLL_OVERFLOW || sym == YY___BUILTIN_USUB_OVERFLOW || sym == YY___BUILTIN_USUBL_OVERFLOW || sym == YY___BUILTIN_USUBLL_OVERFLOW || sym == YY___BUILTIN_MUL_OVERFLOW || sym == YY___BUILTIN_MUL_OVERFLOW_P || sym == YY___BUILTIN_SMUL_OVERFLOW || sym == YY___BUILTIN_SMULL_OVERFLOW || sym == YY___BUILTIN_SMULLL_OVERFLOW || sym == YY___BUILTIN_UMUL_OVERFLOW || sym == YY___BUILTIN_UMULL_OVERFLOW || sym == YY___BUILTIN_UMULLL_OVERFLOW || sym == YY___BUILTIN_CONSTANT_P || sym == YY___BUILTIN_VA_ARG) && (!C_IS_ID(sym) || !is_typedef_name(rcc, sym))) { + if ((sym == YY__LPAREN || C_IS_ID(sym) || sym == YY_DECIMAL_NUMBER || sym == YY_OCTAL_NUMBER || sym == YY_HEXADECIMAL_NUMBER || sym == YY_BINARY_NUMBER || sym == YY_FLOATING_NUMBER || sym == YY_HEXADECIMAL_FLOATING_NUMBER || sym == YY_CHARACTER || sym == YY_STRING || sym == YY__GENERIC || sym == YY___EXTENSION__ || sym == YY__PLUS_PLUS || sym == YY__MINUS_MINUS || sym == YY__AND || sym == YY__STAR || sym == YY__PLUS || sym == YY__MINUS || sym == YY__TILDE || sym == YY__BANG || sym == YY_SIZEOF || sym == YY__ALIGNOF || sym == YY___ALIGNOF__ || sym == YY___ALIGNOF || sym == YY__AND_AND || sym == YY___BUILTIN_VA_START || sym == YY___BUILTIN_VA_END || sym == YY___BUILTIN_VA_COPY || sym == YY___BUILTIN_ALLOCA || sym == YY___BUILTIN_ABORT || sym == YY___BUILTIN_TRAP || sym == YY___BUILTIN_DEBUGTRAP || sym == YY___BUILTIN_FRAME_ADDRESS || sym == YY___BUILTIN_ABS || sym == YY___BUILTIN_LABS || sym == YY___BUILTIN_LLABS || sym == YY___BUILTIN_FABS || sym == YY___BUILTIN_FABSF || sym == YY___BUILTIN_BSWAP16 || sym == YY___BUILTIN_BSWAP32 || sym == YY___BUILTIN_BSWAP64 || sym == YY___BUILTIN_POPCOUNT || sym == YY___BUILTIN_POPCOUNTL || sym == YY___BUILTIN_POPCOUNTLL || sym == YY___BUILTIN_CLZ || sym == YY___BUILTIN_CLZL || sym == YY___BUILTIN_CLZLL || sym == YY___BUILTIN_CTZ || sym == YY___BUILTIN_CTZL || sym == YY___BUILTIN_CTZLL || sym == YY___BUILTIN_FFS || sym == YY___BUILTIN_FFSL || sym == YY___BUILTIN_FFSLL || sym == YY___BUILTIN_MEMCPY || sym == YY___BUILTIN_MEMSET || sym == YY___BUILTIN_EXPECT || sym == YY___BUILTIN_PREFETCH || sym == YY___BUILTIN_UNREACHABLE || sym == YY___BUILTIN_HUGE_VAL || sym == YY___BUILTIN_HUGE_VALF || sym == YY___BUILTIN_INF || sym == YY___BUILTIN_INFF || sym == YY___BUILTIN_ISUNORDERED || sym == YY___BUILTIN_NAN || sym == YY___BUILTIN_NANF || sym == YY___BUILTIN_ADD_OVERFLOW || sym == YY___BUILTIN_ADD_OVERFLOW_P || sym == YY___BUILTIN_SADD_OVERFLOW || sym == YY___BUILTIN_SADDL_OVERFLOW || sym == YY___BUILTIN_SADDLL_OVERFLOW || sym == YY___BUILTIN_UADD_OVERFLOW || sym == YY___BUILTIN_UADDL_OVERFLOW || sym == YY___BUILTIN_UADDLL_OVERFLOW || sym == YY___BUILTIN_SUB_OVERFLOW || sym == YY___BUILTIN_SUB_OVERFLOW_P || sym == YY___BUILTIN_SSUB_OVERFLOW || sym == YY___BUILTIN_SSUBL_OVERFLOW || sym == YY___BUILTIN_SSUBLL_OVERFLOW || sym == YY___BUILTIN_USUB_OVERFLOW || sym == YY___BUILTIN_USUBL_OVERFLOW || sym == YY___BUILTIN_USUBLL_OVERFLOW || sym == YY___BUILTIN_MUL_OVERFLOW || sym == YY___BUILTIN_MUL_OVERFLOW_P || sym == YY___BUILTIN_SMUL_OVERFLOW || sym == YY___BUILTIN_SMULL_OVERFLOW || sym == YY___BUILTIN_SMULLL_OVERFLOW || sym == YY___BUILTIN_UMUL_OVERFLOW || sym == YY___BUILTIN_UMULL_OVERFLOW || sym == YY___BUILTIN_UMULLL_OVERFLOW || sym == YY___BUILTIN_SHUFFLE || sym == YY___BUILTIN_SHUFFLEVECTOR || sym == YY___BUILTIN_CONSTANT_P || sym == YY___BUILTIN_VA_ARG || sym == YY___BUILTIN_CONVERTVECTOR) && (!C_IS_ID(sym) || !is_typedef_name(rcc, sym))) { sym = parse_expression(sym, rcc, val); if (sym != YY__SEMICOLON) { yy_error_sym("';' expected, got", sym); @@ -1720,7 +1720,7 @@ static yy_sym parse_statement(yy_sym sym, rcc_ctx *rcc) { } if (sym == YY__LBRACE || sym == YY_IF || sym == YY_SWITCH || sym == YY_WHILE || sym == YY_DO || sym == YY_FOR || sym == YY_GOTO || sym == YY_CONTINUE || sym == YY_BREAK || sym == YY_RETURN || sym == YY_ASM || sym == YY___ASM || sym == YY___ASM__) { sym = parse_c_statement(sym, rcc); - } else if (sym == YY__LPAREN || C_IS_ID(sym) || sym == YY_DECIMAL_NUMBER || sym == YY_OCTAL_NUMBER || sym == YY_HEXADECIMAL_NUMBER || sym == YY_BINARY_NUMBER || sym == YY_FLOATING_NUMBER || sym == YY_HEXADECIMAL_FLOATING_NUMBER || sym == YY_CHARACTER || sym == YY_STRING || sym == YY__GENERIC || sym == YY___EXTENSION__ || sym == YY__PLUS_PLUS || sym == YY__MINUS_MINUS || sym == YY__AND || sym == YY__STAR || sym == YY__PLUS || sym == YY__MINUS || sym == YY__TILDE || sym == YY__BANG || sym == YY_SIZEOF || sym == YY__ALIGNOF || sym == YY___ALIGNOF__ || sym == YY___ALIGNOF || sym == YY__AND_AND || sym == YY___BUILTIN_VA_START || sym == YY___BUILTIN_VA_END || sym == YY___BUILTIN_VA_COPY || sym == YY___BUILTIN_ALLOCA || sym == YY___BUILTIN_ABORT || sym == YY___BUILTIN_TRAP || sym == YY___BUILTIN_DEBUGTRAP || sym == YY___BUILTIN_FRAME_ADDRESS || sym == YY___BUILTIN_ABS || sym == YY___BUILTIN_LABS || sym == YY___BUILTIN_LLABS || sym == YY___BUILTIN_FABS || sym == YY___BUILTIN_FABSF || sym == YY___BUILTIN_BSWAP16 || sym == YY___BUILTIN_BSWAP32 || sym == YY___BUILTIN_BSWAP64 || sym == YY___BUILTIN_POPCOUNT || sym == YY___BUILTIN_POPCOUNTL || sym == YY___BUILTIN_POPCOUNTLL || sym == YY___BUILTIN_CLZ || sym == YY___BUILTIN_CLZL || sym == YY___BUILTIN_CLZLL || sym == YY___BUILTIN_CTZ || sym == YY___BUILTIN_CTZL || sym == YY___BUILTIN_CTZLL || sym == YY___BUILTIN_FFS || sym == YY___BUILTIN_FFSL || sym == YY___BUILTIN_FFSLL || sym == YY___BUILTIN_MEMCPY || sym == YY___BUILTIN_MEMSET || sym == YY___BUILTIN_EXPECT || sym == YY___BUILTIN_PREFETCH || sym == YY___BUILTIN_UNREACHABLE || sym == YY___BUILTIN_HUGE_VAL || sym == YY___BUILTIN_HUGE_VALF || sym == YY___BUILTIN_INF || sym == YY___BUILTIN_INFF || sym == YY___BUILTIN_ISUNORDERED || sym == YY___BUILTIN_NAN || sym == YY___BUILTIN_NANF || sym == YY___BUILTIN_ADD_OVERFLOW || sym == YY___BUILTIN_ADD_OVERFLOW_P || sym == YY___BUILTIN_SADD_OVERFLOW || sym == YY___BUILTIN_SADDL_OVERFLOW || sym == YY___BUILTIN_SADDLL_OVERFLOW || sym == YY___BUILTIN_UADD_OVERFLOW || sym == YY___BUILTIN_UADDL_OVERFLOW || sym == YY___BUILTIN_UADDLL_OVERFLOW || sym == YY___BUILTIN_SUB_OVERFLOW || sym == YY___BUILTIN_SUB_OVERFLOW_P || sym == YY___BUILTIN_SSUB_OVERFLOW || sym == YY___BUILTIN_SSUBL_OVERFLOW || sym == YY___BUILTIN_SSUBLL_OVERFLOW || sym == YY___BUILTIN_USUB_OVERFLOW || sym == YY___BUILTIN_USUBL_OVERFLOW || sym == YY___BUILTIN_USUBLL_OVERFLOW || sym == YY___BUILTIN_MUL_OVERFLOW || sym == YY___BUILTIN_MUL_OVERFLOW_P || sym == YY___BUILTIN_SMUL_OVERFLOW || sym == YY___BUILTIN_SMULL_OVERFLOW || sym == YY___BUILTIN_SMULLL_OVERFLOW || sym == YY___BUILTIN_UMUL_OVERFLOW || sym == YY___BUILTIN_UMULL_OVERFLOW || sym == YY___BUILTIN_UMULLL_OVERFLOW || sym == YY___BUILTIN_CONSTANT_P || sym == YY___BUILTIN_VA_ARG) { + } else if (sym == YY__LPAREN || C_IS_ID(sym) || sym == YY_DECIMAL_NUMBER || sym == YY_OCTAL_NUMBER || sym == YY_HEXADECIMAL_NUMBER || sym == YY_BINARY_NUMBER || sym == YY_FLOATING_NUMBER || sym == YY_HEXADECIMAL_FLOATING_NUMBER || sym == YY_CHARACTER || sym == YY_STRING || sym == YY__GENERIC || sym == YY___EXTENSION__ || sym == YY__PLUS_PLUS || sym == YY__MINUS_MINUS || sym == YY__AND || sym == YY__STAR || sym == YY__PLUS || sym == YY__MINUS || sym == YY__TILDE || sym == YY__BANG || sym == YY_SIZEOF || sym == YY__ALIGNOF || sym == YY___ALIGNOF__ || sym == YY___ALIGNOF || sym == YY__AND_AND || sym == YY___BUILTIN_VA_START || sym == YY___BUILTIN_VA_END || sym == YY___BUILTIN_VA_COPY || sym == YY___BUILTIN_ALLOCA || sym == YY___BUILTIN_ABORT || sym == YY___BUILTIN_TRAP || sym == YY___BUILTIN_DEBUGTRAP || sym == YY___BUILTIN_FRAME_ADDRESS || sym == YY___BUILTIN_ABS || sym == YY___BUILTIN_LABS || sym == YY___BUILTIN_LLABS || sym == YY___BUILTIN_FABS || sym == YY___BUILTIN_FABSF || sym == YY___BUILTIN_BSWAP16 || sym == YY___BUILTIN_BSWAP32 || sym == YY___BUILTIN_BSWAP64 || sym == YY___BUILTIN_POPCOUNT || sym == YY___BUILTIN_POPCOUNTL || sym == YY___BUILTIN_POPCOUNTLL || sym == YY___BUILTIN_CLZ || sym == YY___BUILTIN_CLZL || sym == YY___BUILTIN_CLZLL || sym == YY___BUILTIN_CTZ || sym == YY___BUILTIN_CTZL || sym == YY___BUILTIN_CTZLL || sym == YY___BUILTIN_FFS || sym == YY___BUILTIN_FFSL || sym == YY___BUILTIN_FFSLL || sym == YY___BUILTIN_MEMCPY || sym == YY___BUILTIN_MEMSET || sym == YY___BUILTIN_EXPECT || sym == YY___BUILTIN_PREFETCH || sym == YY___BUILTIN_UNREACHABLE || sym == YY___BUILTIN_HUGE_VAL || sym == YY___BUILTIN_HUGE_VALF || sym == YY___BUILTIN_INF || sym == YY___BUILTIN_INFF || sym == YY___BUILTIN_ISUNORDERED || sym == YY___BUILTIN_NAN || sym == YY___BUILTIN_NANF || sym == YY___BUILTIN_ADD_OVERFLOW || sym == YY___BUILTIN_ADD_OVERFLOW_P || sym == YY___BUILTIN_SADD_OVERFLOW || sym == YY___BUILTIN_SADDL_OVERFLOW || sym == YY___BUILTIN_SADDLL_OVERFLOW || sym == YY___BUILTIN_UADD_OVERFLOW || sym == YY___BUILTIN_UADDL_OVERFLOW || sym == YY___BUILTIN_UADDLL_OVERFLOW || sym == YY___BUILTIN_SUB_OVERFLOW || sym == YY___BUILTIN_SUB_OVERFLOW_P || sym == YY___BUILTIN_SSUB_OVERFLOW || sym == YY___BUILTIN_SSUBL_OVERFLOW || sym == YY___BUILTIN_SSUBLL_OVERFLOW || sym == YY___BUILTIN_USUB_OVERFLOW || sym == YY___BUILTIN_USUBL_OVERFLOW || sym == YY___BUILTIN_USUBLL_OVERFLOW || sym == YY___BUILTIN_MUL_OVERFLOW || sym == YY___BUILTIN_MUL_OVERFLOW_P || sym == YY___BUILTIN_SMUL_OVERFLOW || sym == YY___BUILTIN_SMULL_OVERFLOW || sym == YY___BUILTIN_SMULLL_OVERFLOW || sym == YY___BUILTIN_UMUL_OVERFLOW || sym == YY___BUILTIN_UMULL_OVERFLOW || sym == YY___BUILTIN_UMULLL_OVERFLOW || sym == YY___BUILTIN_SHUFFLE || sym == YY___BUILTIN_SHUFFLEVECTOR || sym == YY___BUILTIN_CONSTANT_P || sym == YY___BUILTIN_VA_ARG || sym == YY___BUILTIN_CONVERTVECTOR) { c_value_clear(&val); sym = parse_expression(sym, rcc, &val); if (sym != YY__SEMICOLON) { @@ -1890,8 +1890,8 @@ static yy_sym parse_c_statement(yy_sym sym, rcc_ctx *rcc) { yy_error_sym("'(' expected, got", sym); } sym = get_sym(); - if ((sym == YY__LPAREN || C_IS_ID(sym) || sym == YY_DECIMAL_NUMBER || sym == YY_OCTAL_NUMBER || sym == YY_HEXADECIMAL_NUMBER || sym == YY_BINARY_NUMBER || sym == YY_FLOATING_NUMBER || sym == YY_HEXADECIMAL_FLOATING_NUMBER || sym == YY_CHARACTER || sym == YY_STRING || sym == YY__GENERIC || sym == YY___EXTENSION__ || sym == YY__PLUS_PLUS || sym == YY__MINUS_MINUS || sym == YY__AND || sym == YY__STAR || sym == YY__PLUS || sym == YY__MINUS || sym == YY__TILDE || sym == YY__BANG || sym == YY_SIZEOF || sym == YY__ALIGNOF || sym == YY___ALIGNOF__ || sym == YY___ALIGNOF || sym == YY__AND_AND || sym == YY___BUILTIN_VA_START || sym == YY___BUILTIN_VA_END || sym == YY___BUILTIN_VA_COPY || sym == YY___BUILTIN_ALLOCA || sym == YY___BUILTIN_ABORT || sym == YY___BUILTIN_TRAP || sym == YY___BUILTIN_DEBUGTRAP || sym == YY___BUILTIN_FRAME_ADDRESS || sym == YY___BUILTIN_ABS || sym == YY___BUILTIN_LABS || sym == YY___BUILTIN_LLABS || sym == YY___BUILTIN_FABS || sym == YY___BUILTIN_FABSF || sym == YY___BUILTIN_BSWAP16 || sym == YY___BUILTIN_BSWAP32 || sym == YY___BUILTIN_BSWAP64 || sym == YY___BUILTIN_POPCOUNT || sym == YY___BUILTIN_POPCOUNTL || sym == YY___BUILTIN_POPCOUNTLL || sym == YY___BUILTIN_CLZ || sym == YY___BUILTIN_CLZL || sym == YY___BUILTIN_CLZLL || sym == YY___BUILTIN_CTZ || sym == YY___BUILTIN_CTZL || sym == YY___BUILTIN_CTZLL || sym == YY___BUILTIN_FFS || sym == YY___BUILTIN_FFSL || sym == YY___BUILTIN_FFSLL || sym == YY___BUILTIN_MEMCPY || sym == YY___BUILTIN_MEMSET || sym == YY___BUILTIN_EXPECT || sym == YY___BUILTIN_PREFETCH || sym == YY___BUILTIN_UNREACHABLE || sym == YY___BUILTIN_HUGE_VAL || sym == YY___BUILTIN_HUGE_VALF || sym == YY___BUILTIN_INF || sym == YY___BUILTIN_INFF || sym == YY___BUILTIN_ISUNORDERED || sym == YY___BUILTIN_NAN || sym == YY___BUILTIN_NANF || sym == YY___BUILTIN_ADD_OVERFLOW || sym == YY___BUILTIN_ADD_OVERFLOW_P || sym == YY___BUILTIN_SADD_OVERFLOW || sym == YY___BUILTIN_SADDL_OVERFLOW || sym == YY___BUILTIN_SADDLL_OVERFLOW || sym == YY___BUILTIN_UADD_OVERFLOW || sym == YY___BUILTIN_UADDL_OVERFLOW || sym == YY___BUILTIN_UADDLL_OVERFLOW || sym == YY___BUILTIN_SUB_OVERFLOW || sym == YY___BUILTIN_SUB_OVERFLOW_P || sym == YY___BUILTIN_SSUB_OVERFLOW || sym == YY___BUILTIN_SSUBL_OVERFLOW || sym == YY___BUILTIN_SSUBLL_OVERFLOW || sym == YY___BUILTIN_USUB_OVERFLOW || sym == YY___BUILTIN_USUBL_OVERFLOW || sym == YY___BUILTIN_USUBLL_OVERFLOW || sym == YY___BUILTIN_MUL_OVERFLOW || sym == YY___BUILTIN_MUL_OVERFLOW_P || sym == YY___BUILTIN_SMUL_OVERFLOW || sym == YY___BUILTIN_SMULL_OVERFLOW || sym == YY___BUILTIN_SMULLL_OVERFLOW || sym == YY___BUILTIN_UMUL_OVERFLOW || sym == YY___BUILTIN_UMULL_OVERFLOW || sym == YY___BUILTIN_UMULLL_OVERFLOW || sym == YY___BUILTIN_CONSTANT_P || sym == YY___BUILTIN_VA_ARG || sym == YY__SEMICOLON) && (!C_IS_ID(sym) || !is_typedef_name(rcc, sym))) { - if (sym == YY__LPAREN || C_IS_ID(sym) || sym == YY_DECIMAL_NUMBER || sym == YY_OCTAL_NUMBER || sym == YY_HEXADECIMAL_NUMBER || sym == YY_BINARY_NUMBER || sym == YY_FLOATING_NUMBER || sym == YY_HEXADECIMAL_FLOATING_NUMBER || sym == YY_CHARACTER || sym == YY_STRING || sym == YY__GENERIC || sym == YY___EXTENSION__ || sym == YY__PLUS_PLUS || sym == YY__MINUS_MINUS || sym == YY__AND || sym == YY__STAR || sym == YY__PLUS || sym == YY__MINUS || sym == YY__TILDE || sym == YY__BANG || sym == YY_SIZEOF || sym == YY__ALIGNOF || sym == YY___ALIGNOF__ || sym == YY___ALIGNOF || sym == YY__AND_AND || sym == YY___BUILTIN_VA_START || sym == YY___BUILTIN_VA_END || sym == YY___BUILTIN_VA_COPY || sym == YY___BUILTIN_ALLOCA || sym == YY___BUILTIN_ABORT || sym == YY___BUILTIN_TRAP || sym == YY___BUILTIN_DEBUGTRAP || sym == YY___BUILTIN_FRAME_ADDRESS || sym == YY___BUILTIN_ABS || sym == YY___BUILTIN_LABS || sym == YY___BUILTIN_LLABS || sym == YY___BUILTIN_FABS || sym == YY___BUILTIN_FABSF || sym == YY___BUILTIN_BSWAP16 || sym == YY___BUILTIN_BSWAP32 || sym == YY___BUILTIN_BSWAP64 || sym == YY___BUILTIN_POPCOUNT || sym == YY___BUILTIN_POPCOUNTL || sym == YY___BUILTIN_POPCOUNTLL || sym == YY___BUILTIN_CLZ || sym == YY___BUILTIN_CLZL || sym == YY___BUILTIN_CLZLL || sym == YY___BUILTIN_CTZ || sym == YY___BUILTIN_CTZL || sym == YY___BUILTIN_CTZLL || sym == YY___BUILTIN_FFS || sym == YY___BUILTIN_FFSL || sym == YY___BUILTIN_FFSLL || sym == YY___BUILTIN_MEMCPY || sym == YY___BUILTIN_MEMSET || sym == YY___BUILTIN_EXPECT || sym == YY___BUILTIN_PREFETCH || sym == YY___BUILTIN_UNREACHABLE || sym == YY___BUILTIN_HUGE_VAL || sym == YY___BUILTIN_HUGE_VALF || sym == YY___BUILTIN_INF || sym == YY___BUILTIN_INFF || sym == YY___BUILTIN_ISUNORDERED || sym == YY___BUILTIN_NAN || sym == YY___BUILTIN_NANF || sym == YY___BUILTIN_ADD_OVERFLOW || sym == YY___BUILTIN_ADD_OVERFLOW_P || sym == YY___BUILTIN_SADD_OVERFLOW || sym == YY___BUILTIN_SADDL_OVERFLOW || sym == YY___BUILTIN_SADDLL_OVERFLOW || sym == YY___BUILTIN_UADD_OVERFLOW || sym == YY___BUILTIN_UADDL_OVERFLOW || sym == YY___BUILTIN_UADDLL_OVERFLOW || sym == YY___BUILTIN_SUB_OVERFLOW || sym == YY___BUILTIN_SUB_OVERFLOW_P || sym == YY___BUILTIN_SSUB_OVERFLOW || sym == YY___BUILTIN_SSUBL_OVERFLOW || sym == YY___BUILTIN_SSUBLL_OVERFLOW || sym == YY___BUILTIN_USUB_OVERFLOW || sym == YY___BUILTIN_USUBL_OVERFLOW || sym == YY___BUILTIN_USUBLL_OVERFLOW || sym == YY___BUILTIN_MUL_OVERFLOW || sym == YY___BUILTIN_MUL_OVERFLOW_P || sym == YY___BUILTIN_SMUL_OVERFLOW || sym == YY___BUILTIN_SMULL_OVERFLOW || sym == YY___BUILTIN_SMULLL_OVERFLOW || sym == YY___BUILTIN_UMUL_OVERFLOW || sym == YY___BUILTIN_UMULL_OVERFLOW || sym == YY___BUILTIN_UMULLL_OVERFLOW || sym == YY___BUILTIN_CONSTANT_P || sym == YY___BUILTIN_VA_ARG) { + if ((sym == YY__LPAREN || C_IS_ID(sym) || sym == YY_DECIMAL_NUMBER || sym == YY_OCTAL_NUMBER || sym == YY_HEXADECIMAL_NUMBER || sym == YY_BINARY_NUMBER || sym == YY_FLOATING_NUMBER || sym == YY_HEXADECIMAL_FLOATING_NUMBER || sym == YY_CHARACTER || sym == YY_STRING || sym == YY__GENERIC || sym == YY___EXTENSION__ || sym == YY__PLUS_PLUS || sym == YY__MINUS_MINUS || sym == YY__AND || sym == YY__STAR || sym == YY__PLUS || sym == YY__MINUS || sym == YY__TILDE || sym == YY__BANG || sym == YY_SIZEOF || sym == YY__ALIGNOF || sym == YY___ALIGNOF__ || sym == YY___ALIGNOF || sym == YY__AND_AND || sym == YY___BUILTIN_VA_START || sym == YY___BUILTIN_VA_END || sym == YY___BUILTIN_VA_COPY || sym == YY___BUILTIN_ALLOCA || sym == YY___BUILTIN_ABORT || sym == YY___BUILTIN_TRAP || sym == YY___BUILTIN_DEBUGTRAP || sym == YY___BUILTIN_FRAME_ADDRESS || sym == YY___BUILTIN_ABS || sym == YY___BUILTIN_LABS || sym == YY___BUILTIN_LLABS || sym == YY___BUILTIN_FABS || sym == YY___BUILTIN_FABSF || sym == YY___BUILTIN_BSWAP16 || sym == YY___BUILTIN_BSWAP32 || sym == YY___BUILTIN_BSWAP64 || sym == YY___BUILTIN_POPCOUNT || sym == YY___BUILTIN_POPCOUNTL || sym == YY___BUILTIN_POPCOUNTLL || sym == YY___BUILTIN_CLZ || sym == YY___BUILTIN_CLZL || sym == YY___BUILTIN_CLZLL || sym == YY___BUILTIN_CTZ || sym == YY___BUILTIN_CTZL || sym == YY___BUILTIN_CTZLL || sym == YY___BUILTIN_FFS || sym == YY___BUILTIN_FFSL || sym == YY___BUILTIN_FFSLL || sym == YY___BUILTIN_MEMCPY || sym == YY___BUILTIN_MEMSET || sym == YY___BUILTIN_EXPECT || sym == YY___BUILTIN_PREFETCH || sym == YY___BUILTIN_UNREACHABLE || sym == YY___BUILTIN_HUGE_VAL || sym == YY___BUILTIN_HUGE_VALF || sym == YY___BUILTIN_INF || sym == YY___BUILTIN_INFF || sym == YY___BUILTIN_ISUNORDERED || sym == YY___BUILTIN_NAN || sym == YY___BUILTIN_NANF || sym == YY___BUILTIN_ADD_OVERFLOW || sym == YY___BUILTIN_ADD_OVERFLOW_P || sym == YY___BUILTIN_SADD_OVERFLOW || sym == YY___BUILTIN_SADDL_OVERFLOW || sym == YY___BUILTIN_SADDLL_OVERFLOW || sym == YY___BUILTIN_UADD_OVERFLOW || sym == YY___BUILTIN_UADDL_OVERFLOW || sym == YY___BUILTIN_UADDLL_OVERFLOW || sym == YY___BUILTIN_SUB_OVERFLOW || sym == YY___BUILTIN_SUB_OVERFLOW_P || sym == YY___BUILTIN_SSUB_OVERFLOW || sym == YY___BUILTIN_SSUBL_OVERFLOW || sym == YY___BUILTIN_SSUBLL_OVERFLOW || sym == YY___BUILTIN_USUB_OVERFLOW || sym == YY___BUILTIN_USUBL_OVERFLOW || sym == YY___BUILTIN_USUBLL_OVERFLOW || sym == YY___BUILTIN_MUL_OVERFLOW || sym == YY___BUILTIN_MUL_OVERFLOW_P || sym == YY___BUILTIN_SMUL_OVERFLOW || sym == YY___BUILTIN_SMULL_OVERFLOW || sym == YY___BUILTIN_SMULLL_OVERFLOW || sym == YY___BUILTIN_UMUL_OVERFLOW || sym == YY___BUILTIN_UMULL_OVERFLOW || sym == YY___BUILTIN_UMULLL_OVERFLOW || sym == YY___BUILTIN_SHUFFLE || sym == YY___BUILTIN_SHUFFLEVECTOR || sym == YY___BUILTIN_CONSTANT_P || sym == YY___BUILTIN_VA_ARG || sym == YY___BUILTIN_CONVERTVECTOR || sym == YY__SEMICOLON) && (!C_IS_ID(sym) || !is_typedef_name(rcc, sym))) { + if (sym == YY__LPAREN || C_IS_ID(sym) || sym == YY_DECIMAL_NUMBER || sym == YY_OCTAL_NUMBER || sym == YY_HEXADECIMAL_NUMBER || sym == YY_BINARY_NUMBER || sym == YY_FLOATING_NUMBER || sym == YY_HEXADECIMAL_FLOATING_NUMBER || sym == YY_CHARACTER || sym == YY_STRING || sym == YY__GENERIC || sym == YY___EXTENSION__ || sym == YY__PLUS_PLUS || sym == YY__MINUS_MINUS || sym == YY__AND || sym == YY__STAR || sym == YY__PLUS || sym == YY__MINUS || sym == YY__TILDE || sym == YY__BANG || sym == YY_SIZEOF || sym == YY__ALIGNOF || sym == YY___ALIGNOF__ || sym == YY___ALIGNOF || sym == YY__AND_AND || sym == YY___BUILTIN_VA_START || sym == YY___BUILTIN_VA_END || sym == YY___BUILTIN_VA_COPY || sym == YY___BUILTIN_ALLOCA || sym == YY___BUILTIN_ABORT || sym == YY___BUILTIN_TRAP || sym == YY___BUILTIN_DEBUGTRAP || sym == YY___BUILTIN_FRAME_ADDRESS || sym == YY___BUILTIN_ABS || sym == YY___BUILTIN_LABS || sym == YY___BUILTIN_LLABS || sym == YY___BUILTIN_FABS || sym == YY___BUILTIN_FABSF || sym == YY___BUILTIN_BSWAP16 || sym == YY___BUILTIN_BSWAP32 || sym == YY___BUILTIN_BSWAP64 || sym == YY___BUILTIN_POPCOUNT || sym == YY___BUILTIN_POPCOUNTL || sym == YY___BUILTIN_POPCOUNTLL || sym == YY___BUILTIN_CLZ || sym == YY___BUILTIN_CLZL || sym == YY___BUILTIN_CLZLL || sym == YY___BUILTIN_CTZ || sym == YY___BUILTIN_CTZL || sym == YY___BUILTIN_CTZLL || sym == YY___BUILTIN_FFS || sym == YY___BUILTIN_FFSL || sym == YY___BUILTIN_FFSLL || sym == YY___BUILTIN_MEMCPY || sym == YY___BUILTIN_MEMSET || sym == YY___BUILTIN_EXPECT || sym == YY___BUILTIN_PREFETCH || sym == YY___BUILTIN_UNREACHABLE || sym == YY___BUILTIN_HUGE_VAL || sym == YY___BUILTIN_HUGE_VALF || sym == YY___BUILTIN_INF || sym == YY___BUILTIN_INFF || sym == YY___BUILTIN_ISUNORDERED || sym == YY___BUILTIN_NAN || sym == YY___BUILTIN_NANF || sym == YY___BUILTIN_ADD_OVERFLOW || sym == YY___BUILTIN_ADD_OVERFLOW_P || sym == YY___BUILTIN_SADD_OVERFLOW || sym == YY___BUILTIN_SADDL_OVERFLOW || sym == YY___BUILTIN_SADDLL_OVERFLOW || sym == YY___BUILTIN_UADD_OVERFLOW || sym == YY___BUILTIN_UADDL_OVERFLOW || sym == YY___BUILTIN_UADDLL_OVERFLOW || sym == YY___BUILTIN_SUB_OVERFLOW || sym == YY___BUILTIN_SUB_OVERFLOW_P || sym == YY___BUILTIN_SSUB_OVERFLOW || sym == YY___BUILTIN_SSUBL_OVERFLOW || sym == YY___BUILTIN_SSUBLL_OVERFLOW || sym == YY___BUILTIN_USUB_OVERFLOW || sym == YY___BUILTIN_USUBL_OVERFLOW || sym == YY___BUILTIN_USUBLL_OVERFLOW || sym == YY___BUILTIN_MUL_OVERFLOW || sym == YY___BUILTIN_MUL_OVERFLOW_P || sym == YY___BUILTIN_SMUL_OVERFLOW || sym == YY___BUILTIN_SMULL_OVERFLOW || sym == YY___BUILTIN_SMULLL_OVERFLOW || sym == YY___BUILTIN_UMUL_OVERFLOW || sym == YY___BUILTIN_UMULL_OVERFLOW || sym == YY___BUILTIN_UMULLL_OVERFLOW || sym == YY___BUILTIN_SHUFFLE || sym == YY___BUILTIN_SHUFFLEVECTOR || sym == YY___BUILTIN_CONSTANT_P || sym == YY___BUILTIN_VA_ARG || sym == YY___BUILTIN_CONVERTVECTOR) { sym = parse_expression(sym, rcc, &val); } if (sym != YY__SEMICOLON) { @@ -1904,7 +1904,7 @@ static yy_sym parse_c_statement(yy_sym sym, rcc_ctx *rcc) { yy_error_sym("unexpected", sym); } c_do_loop_start(rcc, &loop); - if (sym == YY__LPAREN || C_IS_ID(sym) || sym == YY_DECIMAL_NUMBER || sym == YY_OCTAL_NUMBER || sym == YY_HEXADECIMAL_NUMBER || sym == YY_BINARY_NUMBER || sym == YY_FLOATING_NUMBER || sym == YY_HEXADECIMAL_FLOATING_NUMBER || sym == YY_CHARACTER || sym == YY_STRING || sym == YY__GENERIC || sym == YY___EXTENSION__ || sym == YY__PLUS_PLUS || sym == YY__MINUS_MINUS || sym == YY__AND || sym == YY__STAR || sym == YY__PLUS || sym == YY__MINUS || sym == YY__TILDE || sym == YY__BANG || sym == YY_SIZEOF || sym == YY__ALIGNOF || sym == YY___ALIGNOF__ || sym == YY___ALIGNOF || sym == YY__AND_AND || sym == YY___BUILTIN_VA_START || sym == YY___BUILTIN_VA_END || sym == YY___BUILTIN_VA_COPY || sym == YY___BUILTIN_ALLOCA || sym == YY___BUILTIN_ABORT || sym == YY___BUILTIN_TRAP || sym == YY___BUILTIN_DEBUGTRAP || sym == YY___BUILTIN_FRAME_ADDRESS || sym == YY___BUILTIN_ABS || sym == YY___BUILTIN_LABS || sym == YY___BUILTIN_LLABS || sym == YY___BUILTIN_FABS || sym == YY___BUILTIN_FABSF || sym == YY___BUILTIN_BSWAP16 || sym == YY___BUILTIN_BSWAP32 || sym == YY___BUILTIN_BSWAP64 || sym == YY___BUILTIN_POPCOUNT || sym == YY___BUILTIN_POPCOUNTL || sym == YY___BUILTIN_POPCOUNTLL || sym == YY___BUILTIN_CLZ || sym == YY___BUILTIN_CLZL || sym == YY___BUILTIN_CLZLL || sym == YY___BUILTIN_CTZ || sym == YY___BUILTIN_CTZL || sym == YY___BUILTIN_CTZLL || sym == YY___BUILTIN_FFS || sym == YY___BUILTIN_FFSL || sym == YY___BUILTIN_FFSLL || sym == YY___BUILTIN_MEMCPY || sym == YY___BUILTIN_MEMSET || sym == YY___BUILTIN_EXPECT || sym == YY___BUILTIN_PREFETCH || sym == YY___BUILTIN_UNREACHABLE || sym == YY___BUILTIN_HUGE_VAL || sym == YY___BUILTIN_HUGE_VALF || sym == YY___BUILTIN_INF || sym == YY___BUILTIN_INFF || sym == YY___BUILTIN_ISUNORDERED || sym == YY___BUILTIN_NAN || sym == YY___BUILTIN_NANF || sym == YY___BUILTIN_ADD_OVERFLOW || sym == YY___BUILTIN_ADD_OVERFLOW_P || sym == YY___BUILTIN_SADD_OVERFLOW || sym == YY___BUILTIN_SADDL_OVERFLOW || sym == YY___BUILTIN_SADDLL_OVERFLOW || sym == YY___BUILTIN_UADD_OVERFLOW || sym == YY___BUILTIN_UADDL_OVERFLOW || sym == YY___BUILTIN_UADDLL_OVERFLOW || sym == YY___BUILTIN_SUB_OVERFLOW || sym == YY___BUILTIN_SUB_OVERFLOW_P || sym == YY___BUILTIN_SSUB_OVERFLOW || sym == YY___BUILTIN_SSUBL_OVERFLOW || sym == YY___BUILTIN_SSUBLL_OVERFLOW || sym == YY___BUILTIN_USUB_OVERFLOW || sym == YY___BUILTIN_USUBL_OVERFLOW || sym == YY___BUILTIN_USUBLL_OVERFLOW || sym == YY___BUILTIN_MUL_OVERFLOW || sym == YY___BUILTIN_MUL_OVERFLOW_P || sym == YY___BUILTIN_SMUL_OVERFLOW || sym == YY___BUILTIN_SMULL_OVERFLOW || sym == YY___BUILTIN_SMULLL_OVERFLOW || sym == YY___BUILTIN_UMUL_OVERFLOW || sym == YY___BUILTIN_UMULL_OVERFLOW || sym == YY___BUILTIN_UMULLL_OVERFLOW || sym == YY___BUILTIN_CONSTANT_P || sym == YY___BUILTIN_VA_ARG) { + if (sym == YY__LPAREN || C_IS_ID(sym) || sym == YY_DECIMAL_NUMBER || sym == YY_OCTAL_NUMBER || sym == YY_HEXADECIMAL_NUMBER || sym == YY_BINARY_NUMBER || sym == YY_FLOATING_NUMBER || sym == YY_HEXADECIMAL_FLOATING_NUMBER || sym == YY_CHARACTER || sym == YY_STRING || sym == YY__GENERIC || sym == YY___EXTENSION__ || sym == YY__PLUS_PLUS || sym == YY__MINUS_MINUS || sym == YY__AND || sym == YY__STAR || sym == YY__PLUS || sym == YY__MINUS || sym == YY__TILDE || sym == YY__BANG || sym == YY_SIZEOF || sym == YY__ALIGNOF || sym == YY___ALIGNOF__ || sym == YY___ALIGNOF || sym == YY__AND_AND || sym == YY___BUILTIN_VA_START || sym == YY___BUILTIN_VA_END || sym == YY___BUILTIN_VA_COPY || sym == YY___BUILTIN_ALLOCA || sym == YY___BUILTIN_ABORT || sym == YY___BUILTIN_TRAP || sym == YY___BUILTIN_DEBUGTRAP || sym == YY___BUILTIN_FRAME_ADDRESS || sym == YY___BUILTIN_ABS || sym == YY___BUILTIN_LABS || sym == YY___BUILTIN_LLABS || sym == YY___BUILTIN_FABS || sym == YY___BUILTIN_FABSF || sym == YY___BUILTIN_BSWAP16 || sym == YY___BUILTIN_BSWAP32 || sym == YY___BUILTIN_BSWAP64 || sym == YY___BUILTIN_POPCOUNT || sym == YY___BUILTIN_POPCOUNTL || sym == YY___BUILTIN_POPCOUNTLL || sym == YY___BUILTIN_CLZ || sym == YY___BUILTIN_CLZL || sym == YY___BUILTIN_CLZLL || sym == YY___BUILTIN_CTZ || sym == YY___BUILTIN_CTZL || sym == YY___BUILTIN_CTZLL || sym == YY___BUILTIN_FFS || sym == YY___BUILTIN_FFSL || sym == YY___BUILTIN_FFSLL || sym == YY___BUILTIN_MEMCPY || sym == YY___BUILTIN_MEMSET || sym == YY___BUILTIN_EXPECT || sym == YY___BUILTIN_PREFETCH || sym == YY___BUILTIN_UNREACHABLE || sym == YY___BUILTIN_HUGE_VAL || sym == YY___BUILTIN_HUGE_VALF || sym == YY___BUILTIN_INF || sym == YY___BUILTIN_INFF || sym == YY___BUILTIN_ISUNORDERED || sym == YY___BUILTIN_NAN || sym == YY___BUILTIN_NANF || sym == YY___BUILTIN_ADD_OVERFLOW || sym == YY___BUILTIN_ADD_OVERFLOW_P || sym == YY___BUILTIN_SADD_OVERFLOW || sym == YY___BUILTIN_SADDL_OVERFLOW || sym == YY___BUILTIN_SADDLL_OVERFLOW || sym == YY___BUILTIN_UADD_OVERFLOW || sym == YY___BUILTIN_UADDL_OVERFLOW || sym == YY___BUILTIN_UADDLL_OVERFLOW || sym == YY___BUILTIN_SUB_OVERFLOW || sym == YY___BUILTIN_SUB_OVERFLOW_P || sym == YY___BUILTIN_SSUB_OVERFLOW || sym == YY___BUILTIN_SSUBL_OVERFLOW || sym == YY___BUILTIN_SSUBLL_OVERFLOW || sym == YY___BUILTIN_USUB_OVERFLOW || sym == YY___BUILTIN_USUBL_OVERFLOW || sym == YY___BUILTIN_USUBLL_OVERFLOW || sym == YY___BUILTIN_MUL_OVERFLOW || sym == YY___BUILTIN_MUL_OVERFLOW_P || sym == YY___BUILTIN_SMUL_OVERFLOW || sym == YY___BUILTIN_SMULL_OVERFLOW || sym == YY___BUILTIN_SMULLL_OVERFLOW || sym == YY___BUILTIN_UMUL_OVERFLOW || sym == YY___BUILTIN_UMULL_OVERFLOW || sym == YY___BUILTIN_UMULLL_OVERFLOW || sym == YY___BUILTIN_SHUFFLE || sym == YY___BUILTIN_SHUFFLEVECTOR || sym == YY___BUILTIN_CONSTANT_P || sym == YY___BUILTIN_VA_ARG || sym == YY___BUILTIN_CONVERTVECTOR) { sym = parse_expression(sym, rcc, &val); c_do_loop_check(rcc, &loop, &val); } @@ -1912,7 +1912,7 @@ static yy_sym parse_c_statement(yy_sym sym, rcc_ctx *rcc) { yy_error_sym("';' expected, got", sym); } sym = get_sym(); - if (sym == YY__LPAREN || C_IS_ID(sym) || sym == YY_DECIMAL_NUMBER || sym == YY_OCTAL_NUMBER || sym == YY_HEXADECIMAL_NUMBER || sym == YY_BINARY_NUMBER || sym == YY_FLOATING_NUMBER || sym == YY_HEXADECIMAL_FLOATING_NUMBER || sym == YY_CHARACTER || sym == YY_STRING || sym == YY__GENERIC || sym == YY___EXTENSION__ || sym == YY__PLUS_PLUS || sym == YY__MINUS_MINUS || sym == YY__AND || sym == YY__STAR || sym == YY__PLUS || sym == YY__MINUS || sym == YY__TILDE || sym == YY__BANG || sym == YY_SIZEOF || sym == YY__ALIGNOF || sym == YY___ALIGNOF__ || sym == YY___ALIGNOF || sym == YY__AND_AND || sym == YY___BUILTIN_VA_START || sym == YY___BUILTIN_VA_END || sym == YY___BUILTIN_VA_COPY || sym == YY___BUILTIN_ALLOCA || sym == YY___BUILTIN_ABORT || sym == YY___BUILTIN_TRAP || sym == YY___BUILTIN_DEBUGTRAP || sym == YY___BUILTIN_FRAME_ADDRESS || sym == YY___BUILTIN_ABS || sym == YY___BUILTIN_LABS || sym == YY___BUILTIN_LLABS || sym == YY___BUILTIN_FABS || sym == YY___BUILTIN_FABSF || sym == YY___BUILTIN_BSWAP16 || sym == YY___BUILTIN_BSWAP32 || sym == YY___BUILTIN_BSWAP64 || sym == YY___BUILTIN_POPCOUNT || sym == YY___BUILTIN_POPCOUNTL || sym == YY___BUILTIN_POPCOUNTLL || sym == YY___BUILTIN_CLZ || sym == YY___BUILTIN_CLZL || sym == YY___BUILTIN_CLZLL || sym == YY___BUILTIN_CTZ || sym == YY___BUILTIN_CTZL || sym == YY___BUILTIN_CTZLL || sym == YY___BUILTIN_FFS || sym == YY___BUILTIN_FFSL || sym == YY___BUILTIN_FFSLL || sym == YY___BUILTIN_MEMCPY || sym == YY___BUILTIN_MEMSET || sym == YY___BUILTIN_EXPECT || sym == YY___BUILTIN_PREFETCH || sym == YY___BUILTIN_UNREACHABLE || sym == YY___BUILTIN_HUGE_VAL || sym == YY___BUILTIN_HUGE_VALF || sym == YY___BUILTIN_INF || sym == YY___BUILTIN_INFF || sym == YY___BUILTIN_ISUNORDERED || sym == YY___BUILTIN_NAN || sym == YY___BUILTIN_NANF || sym == YY___BUILTIN_ADD_OVERFLOW || sym == YY___BUILTIN_ADD_OVERFLOW_P || sym == YY___BUILTIN_SADD_OVERFLOW || sym == YY___BUILTIN_SADDL_OVERFLOW || sym == YY___BUILTIN_SADDLL_OVERFLOW || sym == YY___BUILTIN_UADD_OVERFLOW || sym == YY___BUILTIN_UADDL_OVERFLOW || sym == YY___BUILTIN_UADDLL_OVERFLOW || sym == YY___BUILTIN_SUB_OVERFLOW || sym == YY___BUILTIN_SUB_OVERFLOW_P || sym == YY___BUILTIN_SSUB_OVERFLOW || sym == YY___BUILTIN_SSUBL_OVERFLOW || sym == YY___BUILTIN_SSUBLL_OVERFLOW || sym == YY___BUILTIN_USUB_OVERFLOW || sym == YY___BUILTIN_USUBL_OVERFLOW || sym == YY___BUILTIN_USUBLL_OVERFLOW || sym == YY___BUILTIN_MUL_OVERFLOW || sym == YY___BUILTIN_MUL_OVERFLOW_P || sym == YY___BUILTIN_SMUL_OVERFLOW || sym == YY___BUILTIN_SMULL_OVERFLOW || sym == YY___BUILTIN_SMULLL_OVERFLOW || sym == YY___BUILTIN_UMUL_OVERFLOW || sym == YY___BUILTIN_UMULL_OVERFLOW || sym == YY___BUILTIN_UMULLL_OVERFLOW || sym == YY___BUILTIN_CONSTANT_P || sym == YY___BUILTIN_VA_ARG) { + if (sym == YY__LPAREN || C_IS_ID(sym) || sym == YY_DECIMAL_NUMBER || sym == YY_OCTAL_NUMBER || sym == YY_HEXADECIMAL_NUMBER || sym == YY_BINARY_NUMBER || sym == YY_FLOATING_NUMBER || sym == YY_HEXADECIMAL_FLOATING_NUMBER || sym == YY_CHARACTER || sym == YY_STRING || sym == YY__GENERIC || sym == YY___EXTENSION__ || sym == YY__PLUS_PLUS || sym == YY__MINUS_MINUS || sym == YY__AND || sym == YY__STAR || sym == YY__PLUS || sym == YY__MINUS || sym == YY__TILDE || sym == YY__BANG || sym == YY_SIZEOF || sym == YY__ALIGNOF || sym == YY___ALIGNOF__ || sym == YY___ALIGNOF || sym == YY__AND_AND || sym == YY___BUILTIN_VA_START || sym == YY___BUILTIN_VA_END || sym == YY___BUILTIN_VA_COPY || sym == YY___BUILTIN_ALLOCA || sym == YY___BUILTIN_ABORT || sym == YY___BUILTIN_TRAP || sym == YY___BUILTIN_DEBUGTRAP || sym == YY___BUILTIN_FRAME_ADDRESS || sym == YY___BUILTIN_ABS || sym == YY___BUILTIN_LABS || sym == YY___BUILTIN_LLABS || sym == YY___BUILTIN_FABS || sym == YY___BUILTIN_FABSF || sym == YY___BUILTIN_BSWAP16 || sym == YY___BUILTIN_BSWAP32 || sym == YY___BUILTIN_BSWAP64 || sym == YY___BUILTIN_POPCOUNT || sym == YY___BUILTIN_POPCOUNTL || sym == YY___BUILTIN_POPCOUNTLL || sym == YY___BUILTIN_CLZ || sym == YY___BUILTIN_CLZL || sym == YY___BUILTIN_CLZLL || sym == YY___BUILTIN_CTZ || sym == YY___BUILTIN_CTZL || sym == YY___BUILTIN_CTZLL || sym == YY___BUILTIN_FFS || sym == YY___BUILTIN_FFSL || sym == YY___BUILTIN_FFSLL || sym == YY___BUILTIN_MEMCPY || sym == YY___BUILTIN_MEMSET || sym == YY___BUILTIN_EXPECT || sym == YY___BUILTIN_PREFETCH || sym == YY___BUILTIN_UNREACHABLE || sym == YY___BUILTIN_HUGE_VAL || sym == YY___BUILTIN_HUGE_VALF || sym == YY___BUILTIN_INF || sym == YY___BUILTIN_INFF || sym == YY___BUILTIN_ISUNORDERED || sym == YY___BUILTIN_NAN || sym == YY___BUILTIN_NANF || sym == YY___BUILTIN_ADD_OVERFLOW || sym == YY___BUILTIN_ADD_OVERFLOW_P || sym == YY___BUILTIN_SADD_OVERFLOW || sym == YY___BUILTIN_SADDL_OVERFLOW || sym == YY___BUILTIN_SADDLL_OVERFLOW || sym == YY___BUILTIN_UADD_OVERFLOW || sym == YY___BUILTIN_UADDL_OVERFLOW || sym == YY___BUILTIN_UADDLL_OVERFLOW || sym == YY___BUILTIN_SUB_OVERFLOW || sym == YY___BUILTIN_SUB_OVERFLOW_P || sym == YY___BUILTIN_SSUB_OVERFLOW || sym == YY___BUILTIN_SSUBL_OVERFLOW || sym == YY___BUILTIN_SSUBLL_OVERFLOW || sym == YY___BUILTIN_USUB_OVERFLOW || sym == YY___BUILTIN_USUBL_OVERFLOW || sym == YY___BUILTIN_USUBLL_OVERFLOW || sym == YY___BUILTIN_MUL_OVERFLOW || sym == YY___BUILTIN_MUL_OVERFLOW_P || sym == YY___BUILTIN_SMUL_OVERFLOW || sym == YY___BUILTIN_SMULL_OVERFLOW || sym == YY___BUILTIN_SMULLL_OVERFLOW || sym == YY___BUILTIN_UMUL_OVERFLOW || sym == YY___BUILTIN_UMULL_OVERFLOW || sym == YY___BUILTIN_UMULLL_OVERFLOW || sym == YY___BUILTIN_SHUFFLE || sym == YY___BUILTIN_SHUFFLEVECTOR || sym == YY___BUILTIN_CONSTANT_P || sym == YY___BUILTIN_VA_ARG || sym == YY___BUILTIN_CONVERTVECTOR) { c_do_for_next_start(rcc, &loop); sym = parse_expression(sym, rcc, &val); c_do_for_next_end(rcc, &loop); @@ -1956,7 +1956,7 @@ static yy_sym parse_c_statement(yy_sym sym, rcc_ctx *rcc) { c_do_break(rcc); } else if (sym == YY_RETURN) { sym = get_sym(); - if (sym == YY__LPAREN || C_IS_ID(sym) || sym == YY_DECIMAL_NUMBER || sym == YY_OCTAL_NUMBER || sym == YY_HEXADECIMAL_NUMBER || sym == YY_BINARY_NUMBER || sym == YY_FLOATING_NUMBER || sym == YY_HEXADECIMAL_FLOATING_NUMBER || sym == YY_CHARACTER || sym == YY_STRING || sym == YY__GENERIC || sym == YY___EXTENSION__ || sym == YY__PLUS_PLUS || sym == YY__MINUS_MINUS || sym == YY__AND || sym == YY__STAR || sym == YY__PLUS || sym == YY__MINUS || sym == YY__TILDE || sym == YY__BANG || sym == YY_SIZEOF || sym == YY__ALIGNOF || sym == YY___ALIGNOF__ || sym == YY___ALIGNOF || sym == YY__AND_AND || sym == YY___BUILTIN_VA_START || sym == YY___BUILTIN_VA_END || sym == YY___BUILTIN_VA_COPY || sym == YY___BUILTIN_ALLOCA || sym == YY___BUILTIN_ABORT || sym == YY___BUILTIN_TRAP || sym == YY___BUILTIN_DEBUGTRAP || sym == YY___BUILTIN_FRAME_ADDRESS || sym == YY___BUILTIN_ABS || sym == YY___BUILTIN_LABS || sym == YY___BUILTIN_LLABS || sym == YY___BUILTIN_FABS || sym == YY___BUILTIN_FABSF || sym == YY___BUILTIN_BSWAP16 || sym == YY___BUILTIN_BSWAP32 || sym == YY___BUILTIN_BSWAP64 || sym == YY___BUILTIN_POPCOUNT || sym == YY___BUILTIN_POPCOUNTL || sym == YY___BUILTIN_POPCOUNTLL || sym == YY___BUILTIN_CLZ || sym == YY___BUILTIN_CLZL || sym == YY___BUILTIN_CLZLL || sym == YY___BUILTIN_CTZ || sym == YY___BUILTIN_CTZL || sym == YY___BUILTIN_CTZLL || sym == YY___BUILTIN_FFS || sym == YY___BUILTIN_FFSL || sym == YY___BUILTIN_FFSLL || sym == YY___BUILTIN_MEMCPY || sym == YY___BUILTIN_MEMSET || sym == YY___BUILTIN_EXPECT || sym == YY___BUILTIN_PREFETCH || sym == YY___BUILTIN_UNREACHABLE || sym == YY___BUILTIN_HUGE_VAL || sym == YY___BUILTIN_HUGE_VALF || sym == YY___BUILTIN_INF || sym == YY___BUILTIN_INFF || sym == YY___BUILTIN_ISUNORDERED || sym == YY___BUILTIN_NAN || sym == YY___BUILTIN_NANF || sym == YY___BUILTIN_ADD_OVERFLOW || sym == YY___BUILTIN_ADD_OVERFLOW_P || sym == YY___BUILTIN_SADD_OVERFLOW || sym == YY___BUILTIN_SADDL_OVERFLOW || sym == YY___BUILTIN_SADDLL_OVERFLOW || sym == YY___BUILTIN_UADD_OVERFLOW || sym == YY___BUILTIN_UADDL_OVERFLOW || sym == YY___BUILTIN_UADDLL_OVERFLOW || sym == YY___BUILTIN_SUB_OVERFLOW || sym == YY___BUILTIN_SUB_OVERFLOW_P || sym == YY___BUILTIN_SSUB_OVERFLOW || sym == YY___BUILTIN_SSUBL_OVERFLOW || sym == YY___BUILTIN_SSUBLL_OVERFLOW || sym == YY___BUILTIN_USUB_OVERFLOW || sym == YY___BUILTIN_USUBL_OVERFLOW || sym == YY___BUILTIN_USUBLL_OVERFLOW || sym == YY___BUILTIN_MUL_OVERFLOW || sym == YY___BUILTIN_MUL_OVERFLOW_P || sym == YY___BUILTIN_SMUL_OVERFLOW || sym == YY___BUILTIN_SMULL_OVERFLOW || sym == YY___BUILTIN_SMULLL_OVERFLOW || sym == YY___BUILTIN_UMUL_OVERFLOW || sym == YY___BUILTIN_UMULL_OVERFLOW || sym == YY___BUILTIN_UMULLL_OVERFLOW || sym == YY___BUILTIN_CONSTANT_P || sym == YY___BUILTIN_VA_ARG) { + if (sym == YY__LPAREN || C_IS_ID(sym) || sym == YY_DECIMAL_NUMBER || sym == YY_OCTAL_NUMBER || sym == YY_HEXADECIMAL_NUMBER || sym == YY_BINARY_NUMBER || sym == YY_FLOATING_NUMBER || sym == YY_HEXADECIMAL_FLOATING_NUMBER || sym == YY_CHARACTER || sym == YY_STRING || sym == YY__GENERIC || sym == YY___EXTENSION__ || sym == YY__PLUS_PLUS || sym == YY__MINUS_MINUS || sym == YY__AND || sym == YY__STAR || sym == YY__PLUS || sym == YY__MINUS || sym == YY__TILDE || sym == YY__BANG || sym == YY_SIZEOF || sym == YY__ALIGNOF || sym == YY___ALIGNOF__ || sym == YY___ALIGNOF || sym == YY__AND_AND || sym == YY___BUILTIN_VA_START || sym == YY___BUILTIN_VA_END || sym == YY___BUILTIN_VA_COPY || sym == YY___BUILTIN_ALLOCA || sym == YY___BUILTIN_ABORT || sym == YY___BUILTIN_TRAP || sym == YY___BUILTIN_DEBUGTRAP || sym == YY___BUILTIN_FRAME_ADDRESS || sym == YY___BUILTIN_ABS || sym == YY___BUILTIN_LABS || sym == YY___BUILTIN_LLABS || sym == YY___BUILTIN_FABS || sym == YY___BUILTIN_FABSF || sym == YY___BUILTIN_BSWAP16 || sym == YY___BUILTIN_BSWAP32 || sym == YY___BUILTIN_BSWAP64 || sym == YY___BUILTIN_POPCOUNT || sym == YY___BUILTIN_POPCOUNTL || sym == YY___BUILTIN_POPCOUNTLL || sym == YY___BUILTIN_CLZ || sym == YY___BUILTIN_CLZL || sym == YY___BUILTIN_CLZLL || sym == YY___BUILTIN_CTZ || sym == YY___BUILTIN_CTZL || sym == YY___BUILTIN_CTZLL || sym == YY___BUILTIN_FFS || sym == YY___BUILTIN_FFSL || sym == YY___BUILTIN_FFSLL || sym == YY___BUILTIN_MEMCPY || sym == YY___BUILTIN_MEMSET || sym == YY___BUILTIN_EXPECT || sym == YY___BUILTIN_PREFETCH || sym == YY___BUILTIN_UNREACHABLE || sym == YY___BUILTIN_HUGE_VAL || sym == YY___BUILTIN_HUGE_VALF || sym == YY___BUILTIN_INF || sym == YY___BUILTIN_INFF || sym == YY___BUILTIN_ISUNORDERED || sym == YY___BUILTIN_NAN || sym == YY___BUILTIN_NANF || sym == YY___BUILTIN_ADD_OVERFLOW || sym == YY___BUILTIN_ADD_OVERFLOW_P || sym == YY___BUILTIN_SADD_OVERFLOW || sym == YY___BUILTIN_SADDL_OVERFLOW || sym == YY___BUILTIN_SADDLL_OVERFLOW || sym == YY___BUILTIN_UADD_OVERFLOW || sym == YY___BUILTIN_UADDL_OVERFLOW || sym == YY___BUILTIN_UADDLL_OVERFLOW || sym == YY___BUILTIN_SUB_OVERFLOW || sym == YY___BUILTIN_SUB_OVERFLOW_P || sym == YY___BUILTIN_SSUB_OVERFLOW || sym == YY___BUILTIN_SSUBL_OVERFLOW || sym == YY___BUILTIN_SSUBLL_OVERFLOW || sym == YY___BUILTIN_USUB_OVERFLOW || sym == YY___BUILTIN_USUBL_OVERFLOW || sym == YY___BUILTIN_USUBLL_OVERFLOW || sym == YY___BUILTIN_MUL_OVERFLOW || sym == YY___BUILTIN_MUL_OVERFLOW_P || sym == YY___BUILTIN_SMUL_OVERFLOW || sym == YY___BUILTIN_SMULL_OVERFLOW || sym == YY___BUILTIN_SMULLL_OVERFLOW || sym == YY___BUILTIN_UMUL_OVERFLOW || sym == YY___BUILTIN_UMULL_OVERFLOW || sym == YY___BUILTIN_UMULLL_OVERFLOW || sym == YY___BUILTIN_SHUFFLE || sym == YY___BUILTIN_SHUFFLEVECTOR || sym == YY___BUILTIN_CONSTANT_P || sym == YY___BUILTIN_VA_ARG || sym == YY___BUILTIN_CONVERTVECTOR) { sym = parse_expression(sym, rcc, &val); } if (sym != YY__SEMICOLON) { @@ -2122,7 +2122,7 @@ static yy_sym parse_strings(yy_sym sym, rcc_ctx *rcc, c_value *val) { static yy_sym parse_actual_parameters(yy_sym sym, rcc_ctx *rcc, c_value *func, c_value *res) { int32_t num_args = 0; c_value *args = alloca(sizeof(c_value) * C_ALLOCA_PARAMS); - if (sym == YY__LPAREN || C_IS_ID(sym) || sym == YY_DECIMAL_NUMBER || sym == YY_OCTAL_NUMBER || sym == YY_HEXADECIMAL_NUMBER || sym == YY_BINARY_NUMBER || sym == YY_FLOATING_NUMBER || sym == YY_HEXADECIMAL_FLOATING_NUMBER || sym == YY_CHARACTER || sym == YY_STRING || sym == YY__GENERIC || sym == YY___EXTENSION__ || sym == YY__PLUS_PLUS || sym == YY__MINUS_MINUS || sym == YY__AND || sym == YY__STAR || sym == YY__PLUS || sym == YY__MINUS || sym == YY__TILDE || sym == YY__BANG || sym == YY_SIZEOF || sym == YY__ALIGNOF || sym == YY___ALIGNOF__ || sym == YY___ALIGNOF || sym == YY__AND_AND || sym == YY___BUILTIN_VA_START || sym == YY___BUILTIN_VA_END || sym == YY___BUILTIN_VA_COPY || sym == YY___BUILTIN_ALLOCA || sym == YY___BUILTIN_ABORT || sym == YY___BUILTIN_TRAP || sym == YY___BUILTIN_DEBUGTRAP || sym == YY___BUILTIN_FRAME_ADDRESS || sym == YY___BUILTIN_ABS || sym == YY___BUILTIN_LABS || sym == YY___BUILTIN_LLABS || sym == YY___BUILTIN_FABS || sym == YY___BUILTIN_FABSF || sym == YY___BUILTIN_BSWAP16 || sym == YY___BUILTIN_BSWAP32 || sym == YY___BUILTIN_BSWAP64 || sym == YY___BUILTIN_POPCOUNT || sym == YY___BUILTIN_POPCOUNTL || sym == YY___BUILTIN_POPCOUNTLL || sym == YY___BUILTIN_CLZ || sym == YY___BUILTIN_CLZL || sym == YY___BUILTIN_CLZLL || sym == YY___BUILTIN_CTZ || sym == YY___BUILTIN_CTZL || sym == YY___BUILTIN_CTZLL || sym == YY___BUILTIN_FFS || sym == YY___BUILTIN_FFSL || sym == YY___BUILTIN_FFSLL || sym == YY___BUILTIN_MEMCPY || sym == YY___BUILTIN_MEMSET || sym == YY___BUILTIN_EXPECT || sym == YY___BUILTIN_PREFETCH || sym == YY___BUILTIN_UNREACHABLE || sym == YY___BUILTIN_HUGE_VAL || sym == YY___BUILTIN_HUGE_VALF || sym == YY___BUILTIN_INF || sym == YY___BUILTIN_INFF || sym == YY___BUILTIN_ISUNORDERED || sym == YY___BUILTIN_NAN || sym == YY___BUILTIN_NANF || sym == YY___BUILTIN_ADD_OVERFLOW || sym == YY___BUILTIN_ADD_OVERFLOW_P || sym == YY___BUILTIN_SADD_OVERFLOW || sym == YY___BUILTIN_SADDL_OVERFLOW || sym == YY___BUILTIN_SADDLL_OVERFLOW || sym == YY___BUILTIN_UADD_OVERFLOW || sym == YY___BUILTIN_UADDL_OVERFLOW || sym == YY___BUILTIN_UADDLL_OVERFLOW || sym == YY___BUILTIN_SUB_OVERFLOW || sym == YY___BUILTIN_SUB_OVERFLOW_P || sym == YY___BUILTIN_SSUB_OVERFLOW || sym == YY___BUILTIN_SSUBL_OVERFLOW || sym == YY___BUILTIN_SSUBLL_OVERFLOW || sym == YY___BUILTIN_USUB_OVERFLOW || sym == YY___BUILTIN_USUBL_OVERFLOW || sym == YY___BUILTIN_USUBLL_OVERFLOW || sym == YY___BUILTIN_MUL_OVERFLOW || sym == YY___BUILTIN_MUL_OVERFLOW_P || sym == YY___BUILTIN_SMUL_OVERFLOW || sym == YY___BUILTIN_SMULL_OVERFLOW || sym == YY___BUILTIN_SMULLL_OVERFLOW || sym == YY___BUILTIN_UMUL_OVERFLOW || sym == YY___BUILTIN_UMULL_OVERFLOW || sym == YY___BUILTIN_UMULLL_OVERFLOW || sym == YY___BUILTIN_CONSTANT_P || sym == YY___BUILTIN_VA_ARG) { + if (sym == YY__LPAREN || C_IS_ID(sym) || sym == YY_DECIMAL_NUMBER || sym == YY_OCTAL_NUMBER || sym == YY_HEXADECIMAL_NUMBER || sym == YY_BINARY_NUMBER || sym == YY_FLOATING_NUMBER || sym == YY_HEXADECIMAL_FLOATING_NUMBER || sym == YY_CHARACTER || sym == YY_STRING || sym == YY__GENERIC || sym == YY___EXTENSION__ || sym == YY__PLUS_PLUS || sym == YY__MINUS_MINUS || sym == YY__AND || sym == YY__STAR || sym == YY__PLUS || sym == YY__MINUS || sym == YY__TILDE || sym == YY__BANG || sym == YY_SIZEOF || sym == YY__ALIGNOF || sym == YY___ALIGNOF__ || sym == YY___ALIGNOF || sym == YY__AND_AND || sym == YY___BUILTIN_VA_START || sym == YY___BUILTIN_VA_END || sym == YY___BUILTIN_VA_COPY || sym == YY___BUILTIN_ALLOCA || sym == YY___BUILTIN_ABORT || sym == YY___BUILTIN_TRAP || sym == YY___BUILTIN_DEBUGTRAP || sym == YY___BUILTIN_FRAME_ADDRESS || sym == YY___BUILTIN_ABS || sym == YY___BUILTIN_LABS || sym == YY___BUILTIN_LLABS || sym == YY___BUILTIN_FABS || sym == YY___BUILTIN_FABSF || sym == YY___BUILTIN_BSWAP16 || sym == YY___BUILTIN_BSWAP32 || sym == YY___BUILTIN_BSWAP64 || sym == YY___BUILTIN_POPCOUNT || sym == YY___BUILTIN_POPCOUNTL || sym == YY___BUILTIN_POPCOUNTLL || sym == YY___BUILTIN_CLZ || sym == YY___BUILTIN_CLZL || sym == YY___BUILTIN_CLZLL || sym == YY___BUILTIN_CTZ || sym == YY___BUILTIN_CTZL || sym == YY___BUILTIN_CTZLL || sym == YY___BUILTIN_FFS || sym == YY___BUILTIN_FFSL || sym == YY___BUILTIN_FFSLL || sym == YY___BUILTIN_MEMCPY || sym == YY___BUILTIN_MEMSET || sym == YY___BUILTIN_EXPECT || sym == YY___BUILTIN_PREFETCH || sym == YY___BUILTIN_UNREACHABLE || sym == YY___BUILTIN_HUGE_VAL || sym == YY___BUILTIN_HUGE_VALF || sym == YY___BUILTIN_INF || sym == YY___BUILTIN_INFF || sym == YY___BUILTIN_ISUNORDERED || sym == YY___BUILTIN_NAN || sym == YY___BUILTIN_NANF || sym == YY___BUILTIN_ADD_OVERFLOW || sym == YY___BUILTIN_ADD_OVERFLOW_P || sym == YY___BUILTIN_SADD_OVERFLOW || sym == YY___BUILTIN_SADDL_OVERFLOW || sym == YY___BUILTIN_SADDLL_OVERFLOW || sym == YY___BUILTIN_UADD_OVERFLOW || sym == YY___BUILTIN_UADDL_OVERFLOW || sym == YY___BUILTIN_UADDLL_OVERFLOW || sym == YY___BUILTIN_SUB_OVERFLOW || sym == YY___BUILTIN_SUB_OVERFLOW_P || sym == YY___BUILTIN_SSUB_OVERFLOW || sym == YY___BUILTIN_SSUBL_OVERFLOW || sym == YY___BUILTIN_SSUBLL_OVERFLOW || sym == YY___BUILTIN_USUB_OVERFLOW || sym == YY___BUILTIN_USUBL_OVERFLOW || sym == YY___BUILTIN_USUBLL_OVERFLOW || sym == YY___BUILTIN_MUL_OVERFLOW || sym == YY___BUILTIN_MUL_OVERFLOW_P || sym == YY___BUILTIN_SMUL_OVERFLOW || sym == YY___BUILTIN_SMULL_OVERFLOW || sym == YY___BUILTIN_SMULLL_OVERFLOW || sym == YY___BUILTIN_UMUL_OVERFLOW || sym == YY___BUILTIN_UMULL_OVERFLOW || sym == YY___BUILTIN_UMULLL_OVERFLOW || sym == YY___BUILTIN_SHUFFLE || sym == YY___BUILTIN_SHUFFLEVECTOR || sym == YY___BUILTIN_CONSTANT_P || sym == YY___BUILTIN_VA_ARG || sym == YY___BUILTIN_CONVERTVECTOR) { c_value_clear(&args[num_args]); sym = parse_assignment_expression(sym, rcc, &args[num_args]); num_args++; @@ -2141,7 +2141,7 @@ static yy_sym parse_actual_parameters(yy_sym sym, rcc_ctx *rcc, c_value *func, c static yy_sym parse_builtin_parameters(yy_sym sym, rcc_ctx *rcc, c_value *val, c_name name) { int32_t num_args = 0; c_value *args = alloca(sizeof(c_value) * C_ALLOCA_PARAMS); - if (sym == YY__LPAREN || C_IS_ID(sym) || sym == YY_DECIMAL_NUMBER || sym == YY_OCTAL_NUMBER || sym == YY_HEXADECIMAL_NUMBER || sym == YY_BINARY_NUMBER || sym == YY_FLOATING_NUMBER || sym == YY_HEXADECIMAL_FLOATING_NUMBER || sym == YY_CHARACTER || sym == YY_STRING || sym == YY__GENERIC || sym == YY___EXTENSION__ || sym == YY__PLUS_PLUS || sym == YY__MINUS_MINUS || sym == YY__AND || sym == YY__STAR || sym == YY__PLUS || sym == YY__MINUS || sym == YY__TILDE || sym == YY__BANG || sym == YY_SIZEOF || sym == YY__ALIGNOF || sym == YY___ALIGNOF__ || sym == YY___ALIGNOF || sym == YY__AND_AND || sym == YY___BUILTIN_VA_START || sym == YY___BUILTIN_VA_END || sym == YY___BUILTIN_VA_COPY || sym == YY___BUILTIN_ALLOCA || sym == YY___BUILTIN_ABORT || sym == YY___BUILTIN_TRAP || sym == YY___BUILTIN_DEBUGTRAP || sym == YY___BUILTIN_FRAME_ADDRESS || sym == YY___BUILTIN_ABS || sym == YY___BUILTIN_LABS || sym == YY___BUILTIN_LLABS || sym == YY___BUILTIN_FABS || sym == YY___BUILTIN_FABSF || sym == YY___BUILTIN_BSWAP16 || sym == YY___BUILTIN_BSWAP32 || sym == YY___BUILTIN_BSWAP64 || sym == YY___BUILTIN_POPCOUNT || sym == YY___BUILTIN_POPCOUNTL || sym == YY___BUILTIN_POPCOUNTLL || sym == YY___BUILTIN_CLZ || sym == YY___BUILTIN_CLZL || sym == YY___BUILTIN_CLZLL || sym == YY___BUILTIN_CTZ || sym == YY___BUILTIN_CTZL || sym == YY___BUILTIN_CTZLL || sym == YY___BUILTIN_FFS || sym == YY___BUILTIN_FFSL || sym == YY___BUILTIN_FFSLL || sym == YY___BUILTIN_MEMCPY || sym == YY___BUILTIN_MEMSET || sym == YY___BUILTIN_EXPECT || sym == YY___BUILTIN_PREFETCH || sym == YY___BUILTIN_UNREACHABLE || sym == YY___BUILTIN_HUGE_VAL || sym == YY___BUILTIN_HUGE_VALF || sym == YY___BUILTIN_INF || sym == YY___BUILTIN_INFF || sym == YY___BUILTIN_ISUNORDERED || sym == YY___BUILTIN_NAN || sym == YY___BUILTIN_NANF || sym == YY___BUILTIN_ADD_OVERFLOW || sym == YY___BUILTIN_ADD_OVERFLOW_P || sym == YY___BUILTIN_SADD_OVERFLOW || sym == YY___BUILTIN_SADDL_OVERFLOW || sym == YY___BUILTIN_SADDLL_OVERFLOW || sym == YY___BUILTIN_UADD_OVERFLOW || sym == YY___BUILTIN_UADDL_OVERFLOW || sym == YY___BUILTIN_UADDLL_OVERFLOW || sym == YY___BUILTIN_SUB_OVERFLOW || sym == YY___BUILTIN_SUB_OVERFLOW_P || sym == YY___BUILTIN_SSUB_OVERFLOW || sym == YY___BUILTIN_SSUBL_OVERFLOW || sym == YY___BUILTIN_SSUBLL_OVERFLOW || sym == YY___BUILTIN_USUB_OVERFLOW || sym == YY___BUILTIN_USUBL_OVERFLOW || sym == YY___BUILTIN_USUBLL_OVERFLOW || sym == YY___BUILTIN_MUL_OVERFLOW || sym == YY___BUILTIN_MUL_OVERFLOW_P || sym == YY___BUILTIN_SMUL_OVERFLOW || sym == YY___BUILTIN_SMULL_OVERFLOW || sym == YY___BUILTIN_SMULLL_OVERFLOW || sym == YY___BUILTIN_UMUL_OVERFLOW || sym == YY___BUILTIN_UMULL_OVERFLOW || sym == YY___BUILTIN_UMULLL_OVERFLOW || sym == YY___BUILTIN_CONSTANT_P || sym == YY___BUILTIN_VA_ARG) { + if (sym == YY__LPAREN || C_IS_ID(sym) || sym == YY_DECIMAL_NUMBER || sym == YY_OCTAL_NUMBER || sym == YY_HEXADECIMAL_NUMBER || sym == YY_BINARY_NUMBER || sym == YY_FLOATING_NUMBER || sym == YY_HEXADECIMAL_FLOATING_NUMBER || sym == YY_CHARACTER || sym == YY_STRING || sym == YY__GENERIC || sym == YY___EXTENSION__ || sym == YY__PLUS_PLUS || sym == YY__MINUS_MINUS || sym == YY__AND || sym == YY__STAR || sym == YY__PLUS || sym == YY__MINUS || sym == YY__TILDE || sym == YY__BANG || sym == YY_SIZEOF || sym == YY__ALIGNOF || sym == YY___ALIGNOF__ || sym == YY___ALIGNOF || sym == YY__AND_AND || sym == YY___BUILTIN_VA_START || sym == YY___BUILTIN_VA_END || sym == YY___BUILTIN_VA_COPY || sym == YY___BUILTIN_ALLOCA || sym == YY___BUILTIN_ABORT || sym == YY___BUILTIN_TRAP || sym == YY___BUILTIN_DEBUGTRAP || sym == YY___BUILTIN_FRAME_ADDRESS || sym == YY___BUILTIN_ABS || sym == YY___BUILTIN_LABS || sym == YY___BUILTIN_LLABS || sym == YY___BUILTIN_FABS || sym == YY___BUILTIN_FABSF || sym == YY___BUILTIN_BSWAP16 || sym == YY___BUILTIN_BSWAP32 || sym == YY___BUILTIN_BSWAP64 || sym == YY___BUILTIN_POPCOUNT || sym == YY___BUILTIN_POPCOUNTL || sym == YY___BUILTIN_POPCOUNTLL || sym == YY___BUILTIN_CLZ || sym == YY___BUILTIN_CLZL || sym == YY___BUILTIN_CLZLL || sym == YY___BUILTIN_CTZ || sym == YY___BUILTIN_CTZL || sym == YY___BUILTIN_CTZLL || sym == YY___BUILTIN_FFS || sym == YY___BUILTIN_FFSL || sym == YY___BUILTIN_FFSLL || sym == YY___BUILTIN_MEMCPY || sym == YY___BUILTIN_MEMSET || sym == YY___BUILTIN_EXPECT || sym == YY___BUILTIN_PREFETCH || sym == YY___BUILTIN_UNREACHABLE || sym == YY___BUILTIN_HUGE_VAL || sym == YY___BUILTIN_HUGE_VALF || sym == YY___BUILTIN_INF || sym == YY___BUILTIN_INFF || sym == YY___BUILTIN_ISUNORDERED || sym == YY___BUILTIN_NAN || sym == YY___BUILTIN_NANF || sym == YY___BUILTIN_ADD_OVERFLOW || sym == YY___BUILTIN_ADD_OVERFLOW_P || sym == YY___BUILTIN_SADD_OVERFLOW || sym == YY___BUILTIN_SADDL_OVERFLOW || sym == YY___BUILTIN_SADDLL_OVERFLOW || sym == YY___BUILTIN_UADD_OVERFLOW || sym == YY___BUILTIN_UADDL_OVERFLOW || sym == YY___BUILTIN_UADDLL_OVERFLOW || sym == YY___BUILTIN_SUB_OVERFLOW || sym == YY___BUILTIN_SUB_OVERFLOW_P || sym == YY___BUILTIN_SSUB_OVERFLOW || sym == YY___BUILTIN_SSUBL_OVERFLOW || sym == YY___BUILTIN_SSUBLL_OVERFLOW || sym == YY___BUILTIN_USUB_OVERFLOW || sym == YY___BUILTIN_USUBL_OVERFLOW || sym == YY___BUILTIN_USUBLL_OVERFLOW || sym == YY___BUILTIN_MUL_OVERFLOW || sym == YY___BUILTIN_MUL_OVERFLOW_P || sym == YY___BUILTIN_SMUL_OVERFLOW || sym == YY___BUILTIN_SMULL_OVERFLOW || sym == YY___BUILTIN_SMULLL_OVERFLOW || sym == YY___BUILTIN_UMUL_OVERFLOW || sym == YY___BUILTIN_UMULL_OVERFLOW || sym == YY___BUILTIN_UMULLL_OVERFLOW || sym == YY___BUILTIN_SHUFFLE || sym == YY___BUILTIN_SHUFFLEVECTOR || sym == YY___BUILTIN_CONSTANT_P || sym == YY___BUILTIN_VA_ARG || sym == YY___BUILTIN_CONVERTVECTOR) { sym = parse_assignment_expression(sym, rcc, &args[num_args]); num_args++; while (sym == YY__COMMA) { @@ -2187,14 +2187,14 @@ static yy_sym parse_unary_expression(yy_sym sym, rcc_ctx *rcc, c_value *val) { c_do_init_expr_start(rcc, &obj, t); sym = parse_initializer_contents(sym, rcc, &obj, &size); c_do_init_expr_end(rcc, &v, &obj, size); - } else if (sym == YY__LPAREN || C_IS_ID(sym) || sym == YY_DECIMAL_NUMBER || sym == YY_OCTAL_NUMBER || sym == YY_HEXADECIMAL_NUMBER || sym == YY_BINARY_NUMBER || sym == YY_FLOATING_NUMBER || sym == YY_HEXADECIMAL_FLOATING_NUMBER || sym == YY_CHARACTER || sym == YY_STRING || sym == YY__GENERIC || sym == YY___EXTENSION__ || sym == YY__PLUS_PLUS || sym == YY__MINUS_MINUS || sym == YY__AND || sym == YY__STAR || sym == YY__PLUS || sym == YY__MINUS || sym == YY__TILDE || sym == YY__BANG || sym == YY_SIZEOF || sym == YY__ALIGNOF || sym == YY___ALIGNOF__ || sym == YY___ALIGNOF || sym == YY__AND_AND || sym == YY___BUILTIN_VA_START || sym == YY___BUILTIN_VA_END || sym == YY___BUILTIN_VA_COPY || sym == YY___BUILTIN_ALLOCA || sym == YY___BUILTIN_ABORT || sym == YY___BUILTIN_TRAP || sym == YY___BUILTIN_DEBUGTRAP || sym == YY___BUILTIN_FRAME_ADDRESS || sym == YY___BUILTIN_ABS || sym == YY___BUILTIN_LABS || sym == YY___BUILTIN_LLABS || sym == YY___BUILTIN_FABS || sym == YY___BUILTIN_FABSF || sym == YY___BUILTIN_BSWAP16 || sym == YY___BUILTIN_BSWAP32 || sym == YY___BUILTIN_BSWAP64 || sym == YY___BUILTIN_POPCOUNT || sym == YY___BUILTIN_POPCOUNTL || sym == YY___BUILTIN_POPCOUNTLL || sym == YY___BUILTIN_CLZ || sym == YY___BUILTIN_CLZL || sym == YY___BUILTIN_CLZLL || sym == YY___BUILTIN_CTZ || sym == YY___BUILTIN_CTZL || sym == YY___BUILTIN_CTZLL || sym == YY___BUILTIN_FFS || sym == YY___BUILTIN_FFSL || sym == YY___BUILTIN_FFSLL || sym == YY___BUILTIN_MEMCPY || sym == YY___BUILTIN_MEMSET || sym == YY___BUILTIN_EXPECT || sym == YY___BUILTIN_PREFETCH || sym == YY___BUILTIN_UNREACHABLE || sym == YY___BUILTIN_HUGE_VAL || sym == YY___BUILTIN_HUGE_VALF || sym == YY___BUILTIN_INF || sym == YY___BUILTIN_INFF || sym == YY___BUILTIN_ISUNORDERED || sym == YY___BUILTIN_NAN || sym == YY___BUILTIN_NANF || sym == YY___BUILTIN_ADD_OVERFLOW || sym == YY___BUILTIN_ADD_OVERFLOW_P || sym == YY___BUILTIN_SADD_OVERFLOW || sym == YY___BUILTIN_SADDL_OVERFLOW || sym == YY___BUILTIN_SADDLL_OVERFLOW || sym == YY___BUILTIN_UADD_OVERFLOW || sym == YY___BUILTIN_UADDL_OVERFLOW || sym == YY___BUILTIN_UADDLL_OVERFLOW || sym == YY___BUILTIN_SUB_OVERFLOW || sym == YY___BUILTIN_SUB_OVERFLOW_P || sym == YY___BUILTIN_SSUB_OVERFLOW || sym == YY___BUILTIN_SSUBL_OVERFLOW || sym == YY___BUILTIN_SSUBLL_OVERFLOW || sym == YY___BUILTIN_USUB_OVERFLOW || sym == YY___BUILTIN_USUBL_OVERFLOW || sym == YY___BUILTIN_USUBLL_OVERFLOW || sym == YY___BUILTIN_MUL_OVERFLOW || sym == YY___BUILTIN_MUL_OVERFLOW_P || sym == YY___BUILTIN_SMUL_OVERFLOW || sym == YY___BUILTIN_SMULL_OVERFLOW || sym == YY___BUILTIN_SMULLL_OVERFLOW || sym == YY___BUILTIN_UMUL_OVERFLOW || sym == YY___BUILTIN_UMULL_OVERFLOW || sym == YY___BUILTIN_UMULLL_OVERFLOW || sym == YY___BUILTIN_CONSTANT_P || sym == YY___BUILTIN_VA_ARG) { + } else if (sym == YY__LPAREN || C_IS_ID(sym) || sym == YY_DECIMAL_NUMBER || sym == YY_OCTAL_NUMBER || sym == YY_HEXADECIMAL_NUMBER || sym == YY_BINARY_NUMBER || sym == YY_FLOATING_NUMBER || sym == YY_HEXADECIMAL_FLOATING_NUMBER || sym == YY_CHARACTER || sym == YY_STRING || sym == YY__GENERIC || sym == YY___EXTENSION__ || sym == YY__PLUS_PLUS || sym == YY__MINUS_MINUS || sym == YY__AND || sym == YY__STAR || sym == YY__PLUS || sym == YY__MINUS || sym == YY__TILDE || sym == YY__BANG || sym == YY_SIZEOF || sym == YY__ALIGNOF || sym == YY___ALIGNOF__ || sym == YY___ALIGNOF || sym == YY__AND_AND || sym == YY___BUILTIN_VA_START || sym == YY___BUILTIN_VA_END || sym == YY___BUILTIN_VA_COPY || sym == YY___BUILTIN_ALLOCA || sym == YY___BUILTIN_ABORT || sym == YY___BUILTIN_TRAP || sym == YY___BUILTIN_DEBUGTRAP || sym == YY___BUILTIN_FRAME_ADDRESS || sym == YY___BUILTIN_ABS || sym == YY___BUILTIN_LABS || sym == YY___BUILTIN_LLABS || sym == YY___BUILTIN_FABS || sym == YY___BUILTIN_FABSF || sym == YY___BUILTIN_BSWAP16 || sym == YY___BUILTIN_BSWAP32 || sym == YY___BUILTIN_BSWAP64 || sym == YY___BUILTIN_POPCOUNT || sym == YY___BUILTIN_POPCOUNTL || sym == YY___BUILTIN_POPCOUNTLL || sym == YY___BUILTIN_CLZ || sym == YY___BUILTIN_CLZL || sym == YY___BUILTIN_CLZLL || sym == YY___BUILTIN_CTZ || sym == YY___BUILTIN_CTZL || sym == YY___BUILTIN_CTZLL || sym == YY___BUILTIN_FFS || sym == YY___BUILTIN_FFSL || sym == YY___BUILTIN_FFSLL || sym == YY___BUILTIN_MEMCPY || sym == YY___BUILTIN_MEMSET || sym == YY___BUILTIN_EXPECT || sym == YY___BUILTIN_PREFETCH || sym == YY___BUILTIN_UNREACHABLE || sym == YY___BUILTIN_HUGE_VAL || sym == YY___BUILTIN_HUGE_VALF || sym == YY___BUILTIN_INF || sym == YY___BUILTIN_INFF || sym == YY___BUILTIN_ISUNORDERED || sym == YY___BUILTIN_NAN || sym == YY___BUILTIN_NANF || sym == YY___BUILTIN_ADD_OVERFLOW || sym == YY___BUILTIN_ADD_OVERFLOW_P || sym == YY___BUILTIN_SADD_OVERFLOW || sym == YY___BUILTIN_SADDL_OVERFLOW || sym == YY___BUILTIN_SADDLL_OVERFLOW || sym == YY___BUILTIN_UADD_OVERFLOW || sym == YY___BUILTIN_UADDL_OVERFLOW || sym == YY___BUILTIN_UADDLL_OVERFLOW || sym == YY___BUILTIN_SUB_OVERFLOW || sym == YY___BUILTIN_SUB_OVERFLOW_P || sym == YY___BUILTIN_SSUB_OVERFLOW || sym == YY___BUILTIN_SSUBL_OVERFLOW || sym == YY___BUILTIN_SSUBLL_OVERFLOW || sym == YY___BUILTIN_USUB_OVERFLOW || sym == YY___BUILTIN_USUBL_OVERFLOW || sym == YY___BUILTIN_USUBLL_OVERFLOW || sym == YY___BUILTIN_MUL_OVERFLOW || sym == YY___BUILTIN_MUL_OVERFLOW_P || sym == YY___BUILTIN_SMUL_OVERFLOW || sym == YY___BUILTIN_SMULL_OVERFLOW || sym == YY___BUILTIN_SMULLL_OVERFLOW || sym == YY___BUILTIN_UMUL_OVERFLOW || sym == YY___BUILTIN_UMULL_OVERFLOW || sym == YY___BUILTIN_UMULLL_OVERFLOW || sym == YY___BUILTIN_SHUFFLE || sym == YY___BUILTIN_SHUFFLEVECTOR || sym == YY___BUILTIN_CONSTANT_P || sym == YY___BUILTIN_VA_ARG || sym == YY___BUILTIN_CONVERTVECTOR) { c_value_clear(&v); sym = parse_unary_expression(sym, rcc, &v); c_do_cast(rcc, t, &v); } else { yy_error_sym("unexpected", sym); } - } else if (sym == YY__LPAREN || C_IS_ID(sym) || sym == YY_DECIMAL_NUMBER || sym == YY_OCTAL_NUMBER || sym == YY_HEXADECIMAL_NUMBER || sym == YY_BINARY_NUMBER || sym == YY_FLOATING_NUMBER || sym == YY_HEXADECIMAL_FLOATING_NUMBER || sym == YY_CHARACTER || sym == YY_STRING || sym == YY__GENERIC || sym == YY___EXTENSION__ || sym == YY__PLUS_PLUS || sym == YY__MINUS_MINUS || sym == YY__AND || sym == YY__STAR || sym == YY__PLUS || sym == YY__MINUS || sym == YY__TILDE || sym == YY__BANG || sym == YY_SIZEOF || sym == YY__ALIGNOF || sym == YY___ALIGNOF__ || sym == YY___ALIGNOF || sym == YY__AND_AND || sym == YY___BUILTIN_VA_START || sym == YY___BUILTIN_VA_END || sym == YY___BUILTIN_VA_COPY || sym == YY___BUILTIN_ALLOCA || sym == YY___BUILTIN_ABORT || sym == YY___BUILTIN_TRAP || sym == YY___BUILTIN_DEBUGTRAP || sym == YY___BUILTIN_FRAME_ADDRESS || sym == YY___BUILTIN_ABS || sym == YY___BUILTIN_LABS || sym == YY___BUILTIN_LLABS || sym == YY___BUILTIN_FABS || sym == YY___BUILTIN_FABSF || sym == YY___BUILTIN_BSWAP16 || sym == YY___BUILTIN_BSWAP32 || sym == YY___BUILTIN_BSWAP64 || sym == YY___BUILTIN_POPCOUNT || sym == YY___BUILTIN_POPCOUNTL || sym == YY___BUILTIN_POPCOUNTLL || sym == YY___BUILTIN_CLZ || sym == YY___BUILTIN_CLZL || sym == YY___BUILTIN_CLZLL || sym == YY___BUILTIN_CTZ || sym == YY___BUILTIN_CTZL || sym == YY___BUILTIN_CTZLL || sym == YY___BUILTIN_FFS || sym == YY___BUILTIN_FFSL || sym == YY___BUILTIN_FFSLL || sym == YY___BUILTIN_MEMCPY || sym == YY___BUILTIN_MEMSET || sym == YY___BUILTIN_EXPECT || sym == YY___BUILTIN_PREFETCH || sym == YY___BUILTIN_UNREACHABLE || sym == YY___BUILTIN_HUGE_VAL || sym == YY___BUILTIN_HUGE_VALF || sym == YY___BUILTIN_INF || sym == YY___BUILTIN_INFF || sym == YY___BUILTIN_ISUNORDERED || sym == YY___BUILTIN_NAN || sym == YY___BUILTIN_NANF || sym == YY___BUILTIN_ADD_OVERFLOW || sym == YY___BUILTIN_ADD_OVERFLOW_P || sym == YY___BUILTIN_SADD_OVERFLOW || sym == YY___BUILTIN_SADDL_OVERFLOW || sym == YY___BUILTIN_SADDLL_OVERFLOW || sym == YY___BUILTIN_UADD_OVERFLOW || sym == YY___BUILTIN_UADDL_OVERFLOW || sym == YY___BUILTIN_UADDLL_OVERFLOW || sym == YY___BUILTIN_SUB_OVERFLOW || sym == YY___BUILTIN_SUB_OVERFLOW_P || sym == YY___BUILTIN_SSUB_OVERFLOW || sym == YY___BUILTIN_SSUBL_OVERFLOW || sym == YY___BUILTIN_SSUBLL_OVERFLOW || sym == YY___BUILTIN_USUB_OVERFLOW || sym == YY___BUILTIN_USUBL_OVERFLOW || sym == YY___BUILTIN_USUBLL_OVERFLOW || sym == YY___BUILTIN_MUL_OVERFLOW || sym == YY___BUILTIN_MUL_OVERFLOW_P || sym == YY___BUILTIN_SMUL_OVERFLOW || sym == YY___BUILTIN_SMULL_OVERFLOW || sym == YY___BUILTIN_SMULLL_OVERFLOW || sym == YY___BUILTIN_UMUL_OVERFLOW || sym == YY___BUILTIN_UMULL_OVERFLOW || sym == YY___BUILTIN_UMULLL_OVERFLOW || sym == YY___BUILTIN_CONSTANT_P || sym == YY___BUILTIN_VA_ARG) { + } else if (sym == YY__LPAREN || C_IS_ID(sym) || sym == YY_DECIMAL_NUMBER || sym == YY_OCTAL_NUMBER || sym == YY_HEXADECIMAL_NUMBER || sym == YY_BINARY_NUMBER || sym == YY_FLOATING_NUMBER || sym == YY_HEXADECIMAL_FLOATING_NUMBER || sym == YY_CHARACTER || sym == YY_STRING || sym == YY__GENERIC || sym == YY___EXTENSION__ || sym == YY__PLUS_PLUS || sym == YY__MINUS_MINUS || sym == YY__AND || sym == YY__STAR || sym == YY__PLUS || sym == YY__MINUS || sym == YY__TILDE || sym == YY__BANG || sym == YY_SIZEOF || sym == YY__ALIGNOF || sym == YY___ALIGNOF__ || sym == YY___ALIGNOF || sym == YY__AND_AND || sym == YY___BUILTIN_VA_START || sym == YY___BUILTIN_VA_END || sym == YY___BUILTIN_VA_COPY || sym == YY___BUILTIN_ALLOCA || sym == YY___BUILTIN_ABORT || sym == YY___BUILTIN_TRAP || sym == YY___BUILTIN_DEBUGTRAP || sym == YY___BUILTIN_FRAME_ADDRESS || sym == YY___BUILTIN_ABS || sym == YY___BUILTIN_LABS || sym == YY___BUILTIN_LLABS || sym == YY___BUILTIN_FABS || sym == YY___BUILTIN_FABSF || sym == YY___BUILTIN_BSWAP16 || sym == YY___BUILTIN_BSWAP32 || sym == YY___BUILTIN_BSWAP64 || sym == YY___BUILTIN_POPCOUNT || sym == YY___BUILTIN_POPCOUNTL || sym == YY___BUILTIN_POPCOUNTLL || sym == YY___BUILTIN_CLZ || sym == YY___BUILTIN_CLZL || sym == YY___BUILTIN_CLZLL || sym == YY___BUILTIN_CTZ || sym == YY___BUILTIN_CTZL || sym == YY___BUILTIN_CTZLL || sym == YY___BUILTIN_FFS || sym == YY___BUILTIN_FFSL || sym == YY___BUILTIN_FFSLL || sym == YY___BUILTIN_MEMCPY || sym == YY___BUILTIN_MEMSET || sym == YY___BUILTIN_EXPECT || sym == YY___BUILTIN_PREFETCH || sym == YY___BUILTIN_UNREACHABLE || sym == YY___BUILTIN_HUGE_VAL || sym == YY___BUILTIN_HUGE_VALF || sym == YY___BUILTIN_INF || sym == YY___BUILTIN_INFF || sym == YY___BUILTIN_ISUNORDERED || sym == YY___BUILTIN_NAN || sym == YY___BUILTIN_NANF || sym == YY___BUILTIN_ADD_OVERFLOW || sym == YY___BUILTIN_ADD_OVERFLOW_P || sym == YY___BUILTIN_SADD_OVERFLOW || sym == YY___BUILTIN_SADDL_OVERFLOW || sym == YY___BUILTIN_SADDLL_OVERFLOW || sym == YY___BUILTIN_UADD_OVERFLOW || sym == YY___BUILTIN_UADDL_OVERFLOW || sym == YY___BUILTIN_UADDLL_OVERFLOW || sym == YY___BUILTIN_SUB_OVERFLOW || sym == YY___BUILTIN_SUB_OVERFLOW_P || sym == YY___BUILTIN_SSUB_OVERFLOW || sym == YY___BUILTIN_SSUBL_OVERFLOW || sym == YY___BUILTIN_SSUBLL_OVERFLOW || sym == YY___BUILTIN_USUB_OVERFLOW || sym == YY___BUILTIN_USUBL_OVERFLOW || sym == YY___BUILTIN_USUBLL_OVERFLOW || sym == YY___BUILTIN_MUL_OVERFLOW || sym == YY___BUILTIN_MUL_OVERFLOW_P || sym == YY___BUILTIN_SMUL_OVERFLOW || sym == YY___BUILTIN_SMULL_OVERFLOW || sym == YY___BUILTIN_SMULLL_OVERFLOW || sym == YY___BUILTIN_UMUL_OVERFLOW || sym == YY___BUILTIN_UMULL_OVERFLOW || sym == YY___BUILTIN_UMULLL_OVERFLOW || sym == YY___BUILTIN_SHUFFLE || sym == YY___BUILTIN_SHUFFLEVECTOR || sym == YY___BUILTIN_CONSTANT_P || sym == YY___BUILTIN_VA_ARG || sym == YY___BUILTIN_CONVERTVECTOR) { v.u.optx = val->u.optx; sym = parse_expression(sym, rcc, &v); if (sym != YY__RPAREN) { @@ -2328,7 +2328,7 @@ static yy_sym parse_unary_expression(yy_sym sym, rcc_ctx *rcc, c_value *val) { sym = parse_dummy_value(sym, rcc, t); } c_sizeof_type(rcc, &v, t); - } else if (sym == YY__LPAREN || C_IS_ID(sym) || sym == YY_DECIMAL_NUMBER || sym == YY_OCTAL_NUMBER || sym == YY_HEXADECIMAL_NUMBER || sym == YY_BINARY_NUMBER || sym == YY_FLOATING_NUMBER || sym == YY_HEXADECIMAL_FLOATING_NUMBER || sym == YY_CHARACTER || sym == YY_STRING || sym == YY__GENERIC || sym == YY___EXTENSION__ || sym == YY__PLUS_PLUS || sym == YY__MINUS_MINUS || sym == YY__AND || sym == YY__STAR || sym == YY__PLUS || sym == YY__MINUS || sym == YY__TILDE || sym == YY__BANG || sym == YY_SIZEOF || sym == YY__ALIGNOF || sym == YY___ALIGNOF__ || sym == YY___ALIGNOF || sym == YY__AND_AND || sym == YY___BUILTIN_VA_START || sym == YY___BUILTIN_VA_END || sym == YY___BUILTIN_VA_COPY || sym == YY___BUILTIN_ALLOCA || sym == YY___BUILTIN_ABORT || sym == YY___BUILTIN_TRAP || sym == YY___BUILTIN_DEBUGTRAP || sym == YY___BUILTIN_FRAME_ADDRESS || sym == YY___BUILTIN_ABS || sym == YY___BUILTIN_LABS || sym == YY___BUILTIN_LLABS || sym == YY___BUILTIN_FABS || sym == YY___BUILTIN_FABSF || sym == YY___BUILTIN_BSWAP16 || sym == YY___BUILTIN_BSWAP32 || sym == YY___BUILTIN_BSWAP64 || sym == YY___BUILTIN_POPCOUNT || sym == YY___BUILTIN_POPCOUNTL || sym == YY___BUILTIN_POPCOUNTLL || sym == YY___BUILTIN_CLZ || sym == YY___BUILTIN_CLZL || sym == YY___BUILTIN_CLZLL || sym == YY___BUILTIN_CTZ || sym == YY___BUILTIN_CTZL || sym == YY___BUILTIN_CTZLL || sym == YY___BUILTIN_FFS || sym == YY___BUILTIN_FFSL || sym == YY___BUILTIN_FFSLL || sym == YY___BUILTIN_MEMCPY || sym == YY___BUILTIN_MEMSET || sym == YY___BUILTIN_EXPECT || sym == YY___BUILTIN_PREFETCH || sym == YY___BUILTIN_UNREACHABLE || sym == YY___BUILTIN_HUGE_VAL || sym == YY___BUILTIN_HUGE_VALF || sym == YY___BUILTIN_INF || sym == YY___BUILTIN_INFF || sym == YY___BUILTIN_ISUNORDERED || sym == YY___BUILTIN_NAN || sym == YY___BUILTIN_NANF || sym == YY___BUILTIN_ADD_OVERFLOW || sym == YY___BUILTIN_ADD_OVERFLOW_P || sym == YY___BUILTIN_SADD_OVERFLOW || sym == YY___BUILTIN_SADDL_OVERFLOW || sym == YY___BUILTIN_SADDLL_OVERFLOW || sym == YY___BUILTIN_UADD_OVERFLOW || sym == YY___BUILTIN_UADDL_OVERFLOW || sym == YY___BUILTIN_UADDLL_OVERFLOW || sym == YY___BUILTIN_SUB_OVERFLOW || sym == YY___BUILTIN_SUB_OVERFLOW_P || sym == YY___BUILTIN_SSUB_OVERFLOW || sym == YY___BUILTIN_SSUBL_OVERFLOW || sym == YY___BUILTIN_SSUBLL_OVERFLOW || sym == YY___BUILTIN_USUB_OVERFLOW || sym == YY___BUILTIN_USUBL_OVERFLOW || sym == YY___BUILTIN_USUBLL_OVERFLOW || sym == YY___BUILTIN_MUL_OVERFLOW || sym == YY___BUILTIN_MUL_OVERFLOW_P || sym == YY___BUILTIN_SMUL_OVERFLOW || sym == YY___BUILTIN_SMULL_OVERFLOW || sym == YY___BUILTIN_SMULLL_OVERFLOW || sym == YY___BUILTIN_UMUL_OVERFLOW || sym == YY___BUILTIN_UMULL_OVERFLOW || sym == YY___BUILTIN_UMULLL_OVERFLOW || sym == YY___BUILTIN_CONSTANT_P || sym == YY___BUILTIN_VA_ARG) { + } else if (sym == YY__LPAREN || C_IS_ID(sym) || sym == YY_DECIMAL_NUMBER || sym == YY_OCTAL_NUMBER || sym == YY_HEXADECIMAL_NUMBER || sym == YY_BINARY_NUMBER || sym == YY_FLOATING_NUMBER || sym == YY_HEXADECIMAL_FLOATING_NUMBER || sym == YY_CHARACTER || sym == YY_STRING || sym == YY__GENERIC || sym == YY___EXTENSION__ || sym == YY__PLUS_PLUS || sym == YY__MINUS_MINUS || sym == YY__AND || sym == YY__STAR || sym == YY__PLUS || sym == YY__MINUS || sym == YY__TILDE || sym == YY__BANG || sym == YY_SIZEOF || sym == YY__ALIGNOF || sym == YY___ALIGNOF__ || sym == YY___ALIGNOF || sym == YY__AND_AND || sym == YY___BUILTIN_VA_START || sym == YY___BUILTIN_VA_END || sym == YY___BUILTIN_VA_COPY || sym == YY___BUILTIN_ALLOCA || sym == YY___BUILTIN_ABORT || sym == YY___BUILTIN_TRAP || sym == YY___BUILTIN_DEBUGTRAP || sym == YY___BUILTIN_FRAME_ADDRESS || sym == YY___BUILTIN_ABS || sym == YY___BUILTIN_LABS || sym == YY___BUILTIN_LLABS || sym == YY___BUILTIN_FABS || sym == YY___BUILTIN_FABSF || sym == YY___BUILTIN_BSWAP16 || sym == YY___BUILTIN_BSWAP32 || sym == YY___BUILTIN_BSWAP64 || sym == YY___BUILTIN_POPCOUNT || sym == YY___BUILTIN_POPCOUNTL || sym == YY___BUILTIN_POPCOUNTLL || sym == YY___BUILTIN_CLZ || sym == YY___BUILTIN_CLZL || sym == YY___BUILTIN_CLZLL || sym == YY___BUILTIN_CTZ || sym == YY___BUILTIN_CTZL || sym == YY___BUILTIN_CTZLL || sym == YY___BUILTIN_FFS || sym == YY___BUILTIN_FFSL || sym == YY___BUILTIN_FFSLL || sym == YY___BUILTIN_MEMCPY || sym == YY___BUILTIN_MEMSET || sym == YY___BUILTIN_EXPECT || sym == YY___BUILTIN_PREFETCH || sym == YY___BUILTIN_UNREACHABLE || sym == YY___BUILTIN_HUGE_VAL || sym == YY___BUILTIN_HUGE_VALF || sym == YY___BUILTIN_INF || sym == YY___BUILTIN_INFF || sym == YY___BUILTIN_ISUNORDERED || sym == YY___BUILTIN_NAN || sym == YY___BUILTIN_NANF || sym == YY___BUILTIN_ADD_OVERFLOW || sym == YY___BUILTIN_ADD_OVERFLOW_P || sym == YY___BUILTIN_SADD_OVERFLOW || sym == YY___BUILTIN_SADDL_OVERFLOW || sym == YY___BUILTIN_SADDLL_OVERFLOW || sym == YY___BUILTIN_UADD_OVERFLOW || sym == YY___BUILTIN_UADDL_OVERFLOW || sym == YY___BUILTIN_UADDLL_OVERFLOW || sym == YY___BUILTIN_SUB_OVERFLOW || sym == YY___BUILTIN_SUB_OVERFLOW_P || sym == YY___BUILTIN_SSUB_OVERFLOW || sym == YY___BUILTIN_SSUBL_OVERFLOW || sym == YY___BUILTIN_SSUBLL_OVERFLOW || sym == YY___BUILTIN_USUB_OVERFLOW || sym == YY___BUILTIN_USUBL_OVERFLOW || sym == YY___BUILTIN_USUBLL_OVERFLOW || sym == YY___BUILTIN_MUL_OVERFLOW || sym == YY___BUILTIN_MUL_OVERFLOW_P || sym == YY___BUILTIN_SMUL_OVERFLOW || sym == YY___BUILTIN_SMULL_OVERFLOW || sym == YY___BUILTIN_SMULLL_OVERFLOW || sym == YY___BUILTIN_UMUL_OVERFLOW || sym == YY___BUILTIN_UMULL_OVERFLOW || sym == YY___BUILTIN_UMULLL_OVERFLOW || sym == YY___BUILTIN_SHUFFLE || sym == YY___BUILTIN_SHUFFLEVECTOR || sym == YY___BUILTIN_CONSTANT_P || sym == YY___BUILTIN_VA_ARG || sym == YY___BUILTIN_CONVERTVECTOR) { old_control = c_do_nocode(rcc); c_value_clear(&v); sym = parse_expression(sym, rcc, &v); @@ -2353,7 +2353,7 @@ static yy_sym parse_unary_expression(yy_sym sym, rcc_ctx *rcc, c_value *val) { } else { yy_error_sym("unexpected", sym); } - } else if (sym == YY__LPAREN || C_IS_ID(sym) || sym == YY_DECIMAL_NUMBER || sym == YY_OCTAL_NUMBER || sym == YY_HEXADECIMAL_NUMBER || sym == YY_BINARY_NUMBER || sym == YY_FLOATING_NUMBER || sym == YY_HEXADECIMAL_FLOATING_NUMBER || sym == YY_CHARACTER || sym == YY_STRING || sym == YY__GENERIC || sym == YY___EXTENSION__ || sym == YY__PLUS_PLUS || sym == YY__MINUS_MINUS || sym == YY__AND || sym == YY__STAR || sym == YY__PLUS || sym == YY__MINUS || sym == YY__TILDE || sym == YY__BANG || sym == YY_SIZEOF || sym == YY__ALIGNOF || sym == YY___ALIGNOF__ || sym == YY___ALIGNOF || sym == YY__AND_AND || sym == YY___BUILTIN_VA_START || sym == YY___BUILTIN_VA_END || sym == YY___BUILTIN_VA_COPY || sym == YY___BUILTIN_ALLOCA || sym == YY___BUILTIN_ABORT || sym == YY___BUILTIN_TRAP || sym == YY___BUILTIN_DEBUGTRAP || sym == YY___BUILTIN_FRAME_ADDRESS || sym == YY___BUILTIN_ABS || sym == YY___BUILTIN_LABS || sym == YY___BUILTIN_LLABS || sym == YY___BUILTIN_FABS || sym == YY___BUILTIN_FABSF || sym == YY___BUILTIN_BSWAP16 || sym == YY___BUILTIN_BSWAP32 || sym == YY___BUILTIN_BSWAP64 || sym == YY___BUILTIN_POPCOUNT || sym == YY___BUILTIN_POPCOUNTL || sym == YY___BUILTIN_POPCOUNTLL || sym == YY___BUILTIN_CLZ || sym == YY___BUILTIN_CLZL || sym == YY___BUILTIN_CLZLL || sym == YY___BUILTIN_CTZ || sym == YY___BUILTIN_CTZL || sym == YY___BUILTIN_CTZLL || sym == YY___BUILTIN_FFS || sym == YY___BUILTIN_FFSL || sym == YY___BUILTIN_FFSLL || sym == YY___BUILTIN_MEMCPY || sym == YY___BUILTIN_MEMSET || sym == YY___BUILTIN_EXPECT || sym == YY___BUILTIN_PREFETCH || sym == YY___BUILTIN_UNREACHABLE || sym == YY___BUILTIN_HUGE_VAL || sym == YY___BUILTIN_HUGE_VALF || sym == YY___BUILTIN_INF || sym == YY___BUILTIN_INFF || sym == YY___BUILTIN_ISUNORDERED || sym == YY___BUILTIN_NAN || sym == YY___BUILTIN_NANF || sym == YY___BUILTIN_ADD_OVERFLOW || sym == YY___BUILTIN_ADD_OVERFLOW_P || sym == YY___BUILTIN_SADD_OVERFLOW || sym == YY___BUILTIN_SADDL_OVERFLOW || sym == YY___BUILTIN_SADDLL_OVERFLOW || sym == YY___BUILTIN_UADD_OVERFLOW || sym == YY___BUILTIN_UADDL_OVERFLOW || sym == YY___BUILTIN_UADDLL_OVERFLOW || sym == YY___BUILTIN_SUB_OVERFLOW || sym == YY___BUILTIN_SUB_OVERFLOW_P || sym == YY___BUILTIN_SSUB_OVERFLOW || sym == YY___BUILTIN_SSUBL_OVERFLOW || sym == YY___BUILTIN_SSUBLL_OVERFLOW || sym == YY___BUILTIN_USUB_OVERFLOW || sym == YY___BUILTIN_USUBL_OVERFLOW || sym == YY___BUILTIN_USUBLL_OVERFLOW || sym == YY___BUILTIN_MUL_OVERFLOW || sym == YY___BUILTIN_MUL_OVERFLOW_P || sym == YY___BUILTIN_SMUL_OVERFLOW || sym == YY___BUILTIN_SMULL_OVERFLOW || sym == YY___BUILTIN_SMULLL_OVERFLOW || sym == YY___BUILTIN_UMUL_OVERFLOW || sym == YY___BUILTIN_UMULL_OVERFLOW || sym == YY___BUILTIN_UMULLL_OVERFLOW || sym == YY___BUILTIN_CONSTANT_P || sym == YY___BUILTIN_VA_ARG) { + } else if (sym == YY__LPAREN || C_IS_ID(sym) || sym == YY_DECIMAL_NUMBER || sym == YY_OCTAL_NUMBER || sym == YY_HEXADECIMAL_NUMBER || sym == YY_BINARY_NUMBER || sym == YY_FLOATING_NUMBER || sym == YY_HEXADECIMAL_FLOATING_NUMBER || sym == YY_CHARACTER || sym == YY_STRING || sym == YY__GENERIC || sym == YY___EXTENSION__ || sym == YY__PLUS_PLUS || sym == YY__MINUS_MINUS || sym == YY__AND || sym == YY__STAR || sym == YY__PLUS || sym == YY__MINUS || sym == YY__TILDE || sym == YY__BANG || sym == YY_SIZEOF || sym == YY__ALIGNOF || sym == YY___ALIGNOF__ || sym == YY___ALIGNOF || sym == YY__AND_AND || sym == YY___BUILTIN_VA_START || sym == YY___BUILTIN_VA_END || sym == YY___BUILTIN_VA_COPY || sym == YY___BUILTIN_ALLOCA || sym == YY___BUILTIN_ABORT || sym == YY___BUILTIN_TRAP || sym == YY___BUILTIN_DEBUGTRAP || sym == YY___BUILTIN_FRAME_ADDRESS || sym == YY___BUILTIN_ABS || sym == YY___BUILTIN_LABS || sym == YY___BUILTIN_LLABS || sym == YY___BUILTIN_FABS || sym == YY___BUILTIN_FABSF || sym == YY___BUILTIN_BSWAP16 || sym == YY___BUILTIN_BSWAP32 || sym == YY___BUILTIN_BSWAP64 || sym == YY___BUILTIN_POPCOUNT || sym == YY___BUILTIN_POPCOUNTL || sym == YY___BUILTIN_POPCOUNTLL || sym == YY___BUILTIN_CLZ || sym == YY___BUILTIN_CLZL || sym == YY___BUILTIN_CLZLL || sym == YY___BUILTIN_CTZ || sym == YY___BUILTIN_CTZL || sym == YY___BUILTIN_CTZLL || sym == YY___BUILTIN_FFS || sym == YY___BUILTIN_FFSL || sym == YY___BUILTIN_FFSLL || sym == YY___BUILTIN_MEMCPY || sym == YY___BUILTIN_MEMSET || sym == YY___BUILTIN_EXPECT || sym == YY___BUILTIN_PREFETCH || sym == YY___BUILTIN_UNREACHABLE || sym == YY___BUILTIN_HUGE_VAL || sym == YY___BUILTIN_HUGE_VALF || sym == YY___BUILTIN_INF || sym == YY___BUILTIN_INFF || sym == YY___BUILTIN_ISUNORDERED || sym == YY___BUILTIN_NAN || sym == YY___BUILTIN_NANF || sym == YY___BUILTIN_ADD_OVERFLOW || sym == YY___BUILTIN_ADD_OVERFLOW_P || sym == YY___BUILTIN_SADD_OVERFLOW || sym == YY___BUILTIN_SADDL_OVERFLOW || sym == YY___BUILTIN_SADDLL_OVERFLOW || sym == YY___BUILTIN_UADD_OVERFLOW || sym == YY___BUILTIN_UADDL_OVERFLOW || sym == YY___BUILTIN_UADDLL_OVERFLOW || sym == YY___BUILTIN_SUB_OVERFLOW || sym == YY___BUILTIN_SUB_OVERFLOW_P || sym == YY___BUILTIN_SSUB_OVERFLOW || sym == YY___BUILTIN_SSUBL_OVERFLOW || sym == YY___BUILTIN_SSUBLL_OVERFLOW || sym == YY___BUILTIN_USUB_OVERFLOW || sym == YY___BUILTIN_USUBL_OVERFLOW || sym == YY___BUILTIN_USUBLL_OVERFLOW || sym == YY___BUILTIN_MUL_OVERFLOW || sym == YY___BUILTIN_MUL_OVERFLOW_P || sym == YY___BUILTIN_SMUL_OVERFLOW || sym == YY___BUILTIN_SMULL_OVERFLOW || sym == YY___BUILTIN_SMULLL_OVERFLOW || sym == YY___BUILTIN_UMUL_OVERFLOW || sym == YY___BUILTIN_UMULL_OVERFLOW || sym == YY___BUILTIN_UMULLL_OVERFLOW || sym == YY___BUILTIN_SHUFFLE || sym == YY___BUILTIN_SHUFFLEVECTOR || sym == YY___BUILTIN_CONSTANT_P || sym == YY___BUILTIN_VA_ARG || sym == YY___BUILTIN_CONVERTVECTOR) { ir_ref old = c_do_nocode(rcc); c_value_clear(&v); sym = parse_unary_expression(sym, rcc, &v); @@ -2387,7 +2387,7 @@ static yy_sym parse_unary_expression(yy_sym sym, rcc_ctx *rcc, c_value *val) { sym = parse_dummy_value(sym, rcc, t); } c_alignof_type(rcc, &v, t); - } else if (sym == YY__LPAREN || C_IS_ID(sym) || sym == YY_DECIMAL_NUMBER || sym == YY_OCTAL_NUMBER || sym == YY_HEXADECIMAL_NUMBER || sym == YY_BINARY_NUMBER || sym == YY_FLOATING_NUMBER || sym == YY_HEXADECIMAL_FLOATING_NUMBER || sym == YY_CHARACTER || sym == YY_STRING || sym == YY__GENERIC || sym == YY___EXTENSION__ || sym == YY__PLUS_PLUS || sym == YY__MINUS_MINUS || sym == YY__AND || sym == YY__STAR || sym == YY__PLUS || sym == YY__MINUS || sym == YY__TILDE || sym == YY__BANG || sym == YY_SIZEOF || sym == YY__ALIGNOF || sym == YY___ALIGNOF__ || sym == YY___ALIGNOF || sym == YY__AND_AND || sym == YY___BUILTIN_VA_START || sym == YY___BUILTIN_VA_END || sym == YY___BUILTIN_VA_COPY || sym == YY___BUILTIN_ALLOCA || sym == YY___BUILTIN_ABORT || sym == YY___BUILTIN_TRAP || sym == YY___BUILTIN_DEBUGTRAP || sym == YY___BUILTIN_FRAME_ADDRESS || sym == YY___BUILTIN_ABS || sym == YY___BUILTIN_LABS || sym == YY___BUILTIN_LLABS || sym == YY___BUILTIN_FABS || sym == YY___BUILTIN_FABSF || sym == YY___BUILTIN_BSWAP16 || sym == YY___BUILTIN_BSWAP32 || sym == YY___BUILTIN_BSWAP64 || sym == YY___BUILTIN_POPCOUNT || sym == YY___BUILTIN_POPCOUNTL || sym == YY___BUILTIN_POPCOUNTLL || sym == YY___BUILTIN_CLZ || sym == YY___BUILTIN_CLZL || sym == YY___BUILTIN_CLZLL || sym == YY___BUILTIN_CTZ || sym == YY___BUILTIN_CTZL || sym == YY___BUILTIN_CTZLL || sym == YY___BUILTIN_FFS || sym == YY___BUILTIN_FFSL || sym == YY___BUILTIN_FFSLL || sym == YY___BUILTIN_MEMCPY || sym == YY___BUILTIN_MEMSET || sym == YY___BUILTIN_EXPECT || sym == YY___BUILTIN_PREFETCH || sym == YY___BUILTIN_UNREACHABLE || sym == YY___BUILTIN_HUGE_VAL || sym == YY___BUILTIN_HUGE_VALF || sym == YY___BUILTIN_INF || sym == YY___BUILTIN_INFF || sym == YY___BUILTIN_ISUNORDERED || sym == YY___BUILTIN_NAN || sym == YY___BUILTIN_NANF || sym == YY___BUILTIN_ADD_OVERFLOW || sym == YY___BUILTIN_ADD_OVERFLOW_P || sym == YY___BUILTIN_SADD_OVERFLOW || sym == YY___BUILTIN_SADDL_OVERFLOW || sym == YY___BUILTIN_SADDLL_OVERFLOW || sym == YY___BUILTIN_UADD_OVERFLOW || sym == YY___BUILTIN_UADDL_OVERFLOW || sym == YY___BUILTIN_UADDLL_OVERFLOW || sym == YY___BUILTIN_SUB_OVERFLOW || sym == YY___BUILTIN_SUB_OVERFLOW_P || sym == YY___BUILTIN_SSUB_OVERFLOW || sym == YY___BUILTIN_SSUBL_OVERFLOW || sym == YY___BUILTIN_SSUBLL_OVERFLOW || sym == YY___BUILTIN_USUB_OVERFLOW || sym == YY___BUILTIN_USUBL_OVERFLOW || sym == YY___BUILTIN_USUBLL_OVERFLOW || sym == YY___BUILTIN_MUL_OVERFLOW || sym == YY___BUILTIN_MUL_OVERFLOW_P || sym == YY___BUILTIN_SMUL_OVERFLOW || sym == YY___BUILTIN_SMULL_OVERFLOW || sym == YY___BUILTIN_SMULLL_OVERFLOW || sym == YY___BUILTIN_UMUL_OVERFLOW || sym == YY___BUILTIN_UMULL_OVERFLOW || sym == YY___BUILTIN_UMULLL_OVERFLOW || sym == YY___BUILTIN_CONSTANT_P || sym == YY___BUILTIN_VA_ARG) { + } else if (sym == YY__LPAREN || C_IS_ID(sym) || sym == YY_DECIMAL_NUMBER || sym == YY_OCTAL_NUMBER || sym == YY_HEXADECIMAL_NUMBER || sym == YY_BINARY_NUMBER || sym == YY_FLOATING_NUMBER || sym == YY_HEXADECIMAL_FLOATING_NUMBER || sym == YY_CHARACTER || sym == YY_STRING || sym == YY__GENERIC || sym == YY___EXTENSION__ || sym == YY__PLUS_PLUS || sym == YY__MINUS_MINUS || sym == YY__AND || sym == YY__STAR || sym == YY__PLUS || sym == YY__MINUS || sym == YY__TILDE || sym == YY__BANG || sym == YY_SIZEOF || sym == YY__ALIGNOF || sym == YY___ALIGNOF__ || sym == YY___ALIGNOF || sym == YY__AND_AND || sym == YY___BUILTIN_VA_START || sym == YY___BUILTIN_VA_END || sym == YY___BUILTIN_VA_COPY || sym == YY___BUILTIN_ALLOCA || sym == YY___BUILTIN_ABORT || sym == YY___BUILTIN_TRAP || sym == YY___BUILTIN_DEBUGTRAP || sym == YY___BUILTIN_FRAME_ADDRESS || sym == YY___BUILTIN_ABS || sym == YY___BUILTIN_LABS || sym == YY___BUILTIN_LLABS || sym == YY___BUILTIN_FABS || sym == YY___BUILTIN_FABSF || sym == YY___BUILTIN_BSWAP16 || sym == YY___BUILTIN_BSWAP32 || sym == YY___BUILTIN_BSWAP64 || sym == YY___BUILTIN_POPCOUNT || sym == YY___BUILTIN_POPCOUNTL || sym == YY___BUILTIN_POPCOUNTLL || sym == YY___BUILTIN_CLZ || sym == YY___BUILTIN_CLZL || sym == YY___BUILTIN_CLZLL || sym == YY___BUILTIN_CTZ || sym == YY___BUILTIN_CTZL || sym == YY___BUILTIN_CTZLL || sym == YY___BUILTIN_FFS || sym == YY___BUILTIN_FFSL || sym == YY___BUILTIN_FFSLL || sym == YY___BUILTIN_MEMCPY || sym == YY___BUILTIN_MEMSET || sym == YY___BUILTIN_EXPECT || sym == YY___BUILTIN_PREFETCH || sym == YY___BUILTIN_UNREACHABLE || sym == YY___BUILTIN_HUGE_VAL || sym == YY___BUILTIN_HUGE_VALF || sym == YY___BUILTIN_INF || sym == YY___BUILTIN_INFF || sym == YY___BUILTIN_ISUNORDERED || sym == YY___BUILTIN_NAN || sym == YY___BUILTIN_NANF || sym == YY___BUILTIN_ADD_OVERFLOW || sym == YY___BUILTIN_ADD_OVERFLOW_P || sym == YY___BUILTIN_SADD_OVERFLOW || sym == YY___BUILTIN_SADDL_OVERFLOW || sym == YY___BUILTIN_SADDLL_OVERFLOW || sym == YY___BUILTIN_UADD_OVERFLOW || sym == YY___BUILTIN_UADDL_OVERFLOW || sym == YY___BUILTIN_UADDLL_OVERFLOW || sym == YY___BUILTIN_SUB_OVERFLOW || sym == YY___BUILTIN_SUB_OVERFLOW_P || sym == YY___BUILTIN_SSUB_OVERFLOW || sym == YY___BUILTIN_SSUBL_OVERFLOW || sym == YY___BUILTIN_SSUBLL_OVERFLOW || sym == YY___BUILTIN_USUB_OVERFLOW || sym == YY___BUILTIN_USUBL_OVERFLOW || sym == YY___BUILTIN_USUBLL_OVERFLOW || sym == YY___BUILTIN_MUL_OVERFLOW || sym == YY___BUILTIN_MUL_OVERFLOW_P || sym == YY___BUILTIN_SMUL_OVERFLOW || sym == YY___BUILTIN_SMULL_OVERFLOW || sym == YY___BUILTIN_SMULLL_OVERFLOW || sym == YY___BUILTIN_UMUL_OVERFLOW || sym == YY___BUILTIN_UMULL_OVERFLOW || sym == YY___BUILTIN_UMULLL_OVERFLOW || sym == YY___BUILTIN_SHUFFLE || sym == YY___BUILTIN_SHUFFLEVECTOR || sym == YY___BUILTIN_CONSTANT_P || sym == YY___BUILTIN_VA_ARG || sym == YY___BUILTIN_CONVERTVECTOR) { old_control = c_do_nocode(rcc); c_value_clear(&v); sym = parse_expression(sym, rcc, &v); @@ -2412,7 +2412,7 @@ static yy_sym parse_unary_expression(yy_sym sym, rcc_ctx *rcc, c_value *val) { } else { yy_error_sym("unexpected", sym); } - } else if (sym == YY__LPAREN || C_IS_ID(sym) || sym == YY_DECIMAL_NUMBER || sym == YY_OCTAL_NUMBER || sym == YY_HEXADECIMAL_NUMBER || sym == YY_BINARY_NUMBER || sym == YY_FLOATING_NUMBER || sym == YY_HEXADECIMAL_FLOATING_NUMBER || sym == YY_CHARACTER || sym == YY_STRING || sym == YY__GENERIC || sym == YY___EXTENSION__ || sym == YY__PLUS_PLUS || sym == YY__MINUS_MINUS || sym == YY__AND || sym == YY__STAR || sym == YY__PLUS || sym == YY__MINUS || sym == YY__TILDE || sym == YY__BANG || sym == YY_SIZEOF || sym == YY__ALIGNOF || sym == YY___ALIGNOF__ || sym == YY___ALIGNOF || sym == YY__AND_AND || sym == YY___BUILTIN_VA_START || sym == YY___BUILTIN_VA_END || sym == YY___BUILTIN_VA_COPY || sym == YY___BUILTIN_ALLOCA || sym == YY___BUILTIN_ABORT || sym == YY___BUILTIN_TRAP || sym == YY___BUILTIN_DEBUGTRAP || sym == YY___BUILTIN_FRAME_ADDRESS || sym == YY___BUILTIN_ABS || sym == YY___BUILTIN_LABS || sym == YY___BUILTIN_LLABS || sym == YY___BUILTIN_FABS || sym == YY___BUILTIN_FABSF || sym == YY___BUILTIN_BSWAP16 || sym == YY___BUILTIN_BSWAP32 || sym == YY___BUILTIN_BSWAP64 || sym == YY___BUILTIN_POPCOUNT || sym == YY___BUILTIN_POPCOUNTL || sym == YY___BUILTIN_POPCOUNTLL || sym == YY___BUILTIN_CLZ || sym == YY___BUILTIN_CLZL || sym == YY___BUILTIN_CLZLL || sym == YY___BUILTIN_CTZ || sym == YY___BUILTIN_CTZL || sym == YY___BUILTIN_CTZLL || sym == YY___BUILTIN_FFS || sym == YY___BUILTIN_FFSL || sym == YY___BUILTIN_FFSLL || sym == YY___BUILTIN_MEMCPY || sym == YY___BUILTIN_MEMSET || sym == YY___BUILTIN_EXPECT || sym == YY___BUILTIN_PREFETCH || sym == YY___BUILTIN_UNREACHABLE || sym == YY___BUILTIN_HUGE_VAL || sym == YY___BUILTIN_HUGE_VALF || sym == YY___BUILTIN_INF || sym == YY___BUILTIN_INFF || sym == YY___BUILTIN_ISUNORDERED || sym == YY___BUILTIN_NAN || sym == YY___BUILTIN_NANF || sym == YY___BUILTIN_ADD_OVERFLOW || sym == YY___BUILTIN_ADD_OVERFLOW_P || sym == YY___BUILTIN_SADD_OVERFLOW || sym == YY___BUILTIN_SADDL_OVERFLOW || sym == YY___BUILTIN_SADDLL_OVERFLOW || sym == YY___BUILTIN_UADD_OVERFLOW || sym == YY___BUILTIN_UADDL_OVERFLOW || sym == YY___BUILTIN_UADDLL_OVERFLOW || sym == YY___BUILTIN_SUB_OVERFLOW || sym == YY___BUILTIN_SUB_OVERFLOW_P || sym == YY___BUILTIN_SSUB_OVERFLOW || sym == YY___BUILTIN_SSUBL_OVERFLOW || sym == YY___BUILTIN_SSUBLL_OVERFLOW || sym == YY___BUILTIN_USUB_OVERFLOW || sym == YY___BUILTIN_USUBL_OVERFLOW || sym == YY___BUILTIN_USUBLL_OVERFLOW || sym == YY___BUILTIN_MUL_OVERFLOW || sym == YY___BUILTIN_MUL_OVERFLOW_P || sym == YY___BUILTIN_SMUL_OVERFLOW || sym == YY___BUILTIN_SMULL_OVERFLOW || sym == YY___BUILTIN_SMULLL_OVERFLOW || sym == YY___BUILTIN_UMUL_OVERFLOW || sym == YY___BUILTIN_UMULL_OVERFLOW || sym == YY___BUILTIN_UMULLL_OVERFLOW || sym == YY___BUILTIN_CONSTANT_P || sym == YY___BUILTIN_VA_ARG) { + } else if (sym == YY__LPAREN || C_IS_ID(sym) || sym == YY_DECIMAL_NUMBER || sym == YY_OCTAL_NUMBER || sym == YY_HEXADECIMAL_NUMBER || sym == YY_BINARY_NUMBER || sym == YY_FLOATING_NUMBER || sym == YY_HEXADECIMAL_FLOATING_NUMBER || sym == YY_CHARACTER || sym == YY_STRING || sym == YY__GENERIC || sym == YY___EXTENSION__ || sym == YY__PLUS_PLUS || sym == YY__MINUS_MINUS || sym == YY__AND || sym == YY__STAR || sym == YY__PLUS || sym == YY__MINUS || sym == YY__TILDE || sym == YY__BANG || sym == YY_SIZEOF || sym == YY__ALIGNOF || sym == YY___ALIGNOF__ || sym == YY___ALIGNOF || sym == YY__AND_AND || sym == YY___BUILTIN_VA_START || sym == YY___BUILTIN_VA_END || sym == YY___BUILTIN_VA_COPY || sym == YY___BUILTIN_ALLOCA || sym == YY___BUILTIN_ABORT || sym == YY___BUILTIN_TRAP || sym == YY___BUILTIN_DEBUGTRAP || sym == YY___BUILTIN_FRAME_ADDRESS || sym == YY___BUILTIN_ABS || sym == YY___BUILTIN_LABS || sym == YY___BUILTIN_LLABS || sym == YY___BUILTIN_FABS || sym == YY___BUILTIN_FABSF || sym == YY___BUILTIN_BSWAP16 || sym == YY___BUILTIN_BSWAP32 || sym == YY___BUILTIN_BSWAP64 || sym == YY___BUILTIN_POPCOUNT || sym == YY___BUILTIN_POPCOUNTL || sym == YY___BUILTIN_POPCOUNTLL || sym == YY___BUILTIN_CLZ || sym == YY___BUILTIN_CLZL || sym == YY___BUILTIN_CLZLL || sym == YY___BUILTIN_CTZ || sym == YY___BUILTIN_CTZL || sym == YY___BUILTIN_CTZLL || sym == YY___BUILTIN_FFS || sym == YY___BUILTIN_FFSL || sym == YY___BUILTIN_FFSLL || sym == YY___BUILTIN_MEMCPY || sym == YY___BUILTIN_MEMSET || sym == YY___BUILTIN_EXPECT || sym == YY___BUILTIN_PREFETCH || sym == YY___BUILTIN_UNREACHABLE || sym == YY___BUILTIN_HUGE_VAL || sym == YY___BUILTIN_HUGE_VALF || sym == YY___BUILTIN_INF || sym == YY___BUILTIN_INFF || sym == YY___BUILTIN_ISUNORDERED || sym == YY___BUILTIN_NAN || sym == YY___BUILTIN_NANF || sym == YY___BUILTIN_ADD_OVERFLOW || sym == YY___BUILTIN_ADD_OVERFLOW_P || sym == YY___BUILTIN_SADD_OVERFLOW || sym == YY___BUILTIN_SADDL_OVERFLOW || sym == YY___BUILTIN_SADDLL_OVERFLOW || sym == YY___BUILTIN_UADD_OVERFLOW || sym == YY___BUILTIN_UADDL_OVERFLOW || sym == YY___BUILTIN_UADDLL_OVERFLOW || sym == YY___BUILTIN_SUB_OVERFLOW || sym == YY___BUILTIN_SUB_OVERFLOW_P || sym == YY___BUILTIN_SSUB_OVERFLOW || sym == YY___BUILTIN_SSUBL_OVERFLOW || sym == YY___BUILTIN_SSUBLL_OVERFLOW || sym == YY___BUILTIN_USUB_OVERFLOW || sym == YY___BUILTIN_USUBL_OVERFLOW || sym == YY___BUILTIN_USUBLL_OVERFLOW || sym == YY___BUILTIN_MUL_OVERFLOW || sym == YY___BUILTIN_MUL_OVERFLOW_P || sym == YY___BUILTIN_SMUL_OVERFLOW || sym == YY___BUILTIN_SMULL_OVERFLOW || sym == YY___BUILTIN_SMULLL_OVERFLOW || sym == YY___BUILTIN_UMUL_OVERFLOW || sym == YY___BUILTIN_UMULL_OVERFLOW || sym == YY___BUILTIN_UMULLL_OVERFLOW || sym == YY___BUILTIN_SHUFFLE || sym == YY___BUILTIN_SHUFFLEVECTOR || sym == YY___BUILTIN_CONSTANT_P || sym == YY___BUILTIN_VA_ARG || sym == YY___BUILTIN_CONVERTVECTOR) { ir_ref old = c_do_nocode(rcc); c_value_clear(&v); sym = parse_unary_expression(sym, rcc, &v); @@ -2424,7 +2424,7 @@ static yy_sym parse_unary_expression(yy_sym sym, rcc_ctx *rcc, c_value *val) { sym = get_sym(); sym = parse_ID(sym, rcc, &name); c_do_label_value(rcc, &v, name); - } else if (sym == YY___BUILTIN_VA_START || sym == YY___BUILTIN_VA_END || sym == YY___BUILTIN_VA_COPY || sym == YY___BUILTIN_ALLOCA || sym == YY___BUILTIN_ABORT || sym == YY___BUILTIN_TRAP || sym == YY___BUILTIN_DEBUGTRAP || sym == YY___BUILTIN_FRAME_ADDRESS || sym == YY___BUILTIN_ABS || sym == YY___BUILTIN_LABS || sym == YY___BUILTIN_LLABS || sym == YY___BUILTIN_FABS || sym == YY___BUILTIN_FABSF || sym == YY___BUILTIN_BSWAP16 || sym == YY___BUILTIN_BSWAP32 || sym == YY___BUILTIN_BSWAP64 || sym == YY___BUILTIN_POPCOUNT || sym == YY___BUILTIN_POPCOUNTL || sym == YY___BUILTIN_POPCOUNTLL || sym == YY___BUILTIN_CLZ || sym == YY___BUILTIN_CLZL || sym == YY___BUILTIN_CLZLL || sym == YY___BUILTIN_CTZ || sym == YY___BUILTIN_CTZL || sym == YY___BUILTIN_CTZLL || sym == YY___BUILTIN_FFS || sym == YY___BUILTIN_FFSL || sym == YY___BUILTIN_FFSLL || sym == YY___BUILTIN_MEMCPY || sym == YY___BUILTIN_MEMSET || sym == YY___BUILTIN_EXPECT || sym == YY___BUILTIN_PREFETCH || sym == YY___BUILTIN_UNREACHABLE || sym == YY___BUILTIN_HUGE_VAL || sym == YY___BUILTIN_HUGE_VALF || sym == YY___BUILTIN_INF || sym == YY___BUILTIN_INFF || sym == YY___BUILTIN_ISUNORDERED || sym == YY___BUILTIN_NAN || sym == YY___BUILTIN_NANF || sym == YY___BUILTIN_ADD_OVERFLOW || sym == YY___BUILTIN_ADD_OVERFLOW_P || sym == YY___BUILTIN_SADD_OVERFLOW || sym == YY___BUILTIN_SADDL_OVERFLOW || sym == YY___BUILTIN_SADDLL_OVERFLOW || sym == YY___BUILTIN_UADD_OVERFLOW || sym == YY___BUILTIN_UADDL_OVERFLOW || sym == YY___BUILTIN_UADDLL_OVERFLOW || sym == YY___BUILTIN_SUB_OVERFLOW || sym == YY___BUILTIN_SUB_OVERFLOW_P || sym == YY___BUILTIN_SSUB_OVERFLOW || sym == YY___BUILTIN_SSUBL_OVERFLOW || sym == YY___BUILTIN_SSUBLL_OVERFLOW || sym == YY___BUILTIN_USUB_OVERFLOW || sym == YY___BUILTIN_USUBL_OVERFLOW || sym == YY___BUILTIN_USUBLL_OVERFLOW || sym == YY___BUILTIN_MUL_OVERFLOW || sym == YY___BUILTIN_MUL_OVERFLOW_P || sym == YY___BUILTIN_SMUL_OVERFLOW || sym == YY___BUILTIN_SMULL_OVERFLOW || sym == YY___BUILTIN_SMULLL_OVERFLOW || sym == YY___BUILTIN_UMUL_OVERFLOW || sym == YY___BUILTIN_UMULL_OVERFLOW || sym == YY___BUILTIN_UMULLL_OVERFLOW) { + } else if (sym == YY___BUILTIN_VA_START || sym == YY___BUILTIN_VA_END || sym == YY___BUILTIN_VA_COPY || sym == YY___BUILTIN_ALLOCA || sym == YY___BUILTIN_ABORT || sym == YY___BUILTIN_TRAP || sym == YY___BUILTIN_DEBUGTRAP || sym == YY___BUILTIN_FRAME_ADDRESS || sym == YY___BUILTIN_ABS || sym == YY___BUILTIN_LABS || sym == YY___BUILTIN_LLABS || sym == YY___BUILTIN_FABS || sym == YY___BUILTIN_FABSF || sym == YY___BUILTIN_BSWAP16 || sym == YY___BUILTIN_BSWAP32 || sym == YY___BUILTIN_BSWAP64 || sym == YY___BUILTIN_POPCOUNT || sym == YY___BUILTIN_POPCOUNTL || sym == YY___BUILTIN_POPCOUNTLL || sym == YY___BUILTIN_CLZ || sym == YY___BUILTIN_CLZL || sym == YY___BUILTIN_CLZLL || sym == YY___BUILTIN_CTZ || sym == YY___BUILTIN_CTZL || sym == YY___BUILTIN_CTZLL || sym == YY___BUILTIN_FFS || sym == YY___BUILTIN_FFSL || sym == YY___BUILTIN_FFSLL || sym == YY___BUILTIN_MEMCPY || sym == YY___BUILTIN_MEMSET || sym == YY___BUILTIN_EXPECT || sym == YY___BUILTIN_PREFETCH || sym == YY___BUILTIN_UNREACHABLE || sym == YY___BUILTIN_HUGE_VAL || sym == YY___BUILTIN_HUGE_VALF || sym == YY___BUILTIN_INF || sym == YY___BUILTIN_INFF || sym == YY___BUILTIN_ISUNORDERED || sym == YY___BUILTIN_NAN || sym == YY___BUILTIN_NANF || sym == YY___BUILTIN_ADD_OVERFLOW || sym == YY___BUILTIN_ADD_OVERFLOW_P || sym == YY___BUILTIN_SADD_OVERFLOW || sym == YY___BUILTIN_SADDL_OVERFLOW || sym == YY___BUILTIN_SADDLL_OVERFLOW || sym == YY___BUILTIN_UADD_OVERFLOW || sym == YY___BUILTIN_UADDL_OVERFLOW || sym == YY___BUILTIN_UADDLL_OVERFLOW || sym == YY___BUILTIN_SUB_OVERFLOW || sym == YY___BUILTIN_SUB_OVERFLOW_P || sym == YY___BUILTIN_SSUB_OVERFLOW || sym == YY___BUILTIN_SSUBL_OVERFLOW || sym == YY___BUILTIN_SSUBLL_OVERFLOW || sym == YY___BUILTIN_USUB_OVERFLOW || sym == YY___BUILTIN_USUBL_OVERFLOW || sym == YY___BUILTIN_USUBLL_OVERFLOW || sym == YY___BUILTIN_MUL_OVERFLOW || sym == YY___BUILTIN_MUL_OVERFLOW_P || sym == YY___BUILTIN_SMUL_OVERFLOW || sym == YY___BUILTIN_SMULL_OVERFLOW || sym == YY___BUILTIN_SMULLL_OVERFLOW || sym == YY___BUILTIN_UMUL_OVERFLOW || sym == YY___BUILTIN_UMULL_OVERFLOW || sym == YY___BUILTIN_UMULLL_OVERFLOW || sym == YY___BUILTIN_SHUFFLE || sym == YY___BUILTIN_SHUFFLEVECTOR) { name = sym; sym = get_sym(); if (sym != YY__LPAREN) { @@ -2469,6 +2469,23 @@ static yy_sym parse_unary_expression(yy_sym sym, rcc_ctx *rcc, c_value *val) { yy_error_sym("')' expected, got", sym); } sym = get_sym(); + } else if (sym == YY___BUILTIN_CONVERTVECTOR) { + sym = get_sym(); + if (sym != YY__LPAREN) { + yy_error_sym("'(' expected, got", sym); + } + sym = get_sym(); + sym = parse_assignment_expression(sym, rcc, &v); + if (sym != YY__COMMA) { + yy_error_sym("',' expected, got", sym); + } + sym = get_sym(); + sym = parse_type_name(sym, rcc, &t); + c_do_builtin_convertvector(rcc, &v, t); + if (sym != YY__RPAREN) { + yy_error_sym("')' expected, got", sym); + } + sym = get_sym(); } else { yy_error_sym("unexpected", sym); } @@ -2580,7 +2597,7 @@ static yy_sym parse_conditional_expression(yy_sym sym, rcc_ctx *rcc, c_value *va } sym = get_sym(); check = c_do_if(rcc, val); - if (sym == YY__LPAREN || C_IS_ID(sym) || sym == YY_DECIMAL_NUMBER || sym == YY_OCTAL_NUMBER || sym == YY_HEXADECIMAL_NUMBER || sym == YY_BINARY_NUMBER || sym == YY_FLOATING_NUMBER || sym == YY_HEXADECIMAL_FLOATING_NUMBER || sym == YY_CHARACTER || sym == YY_STRING || sym == YY__GENERIC || sym == YY___EXTENSION__ || sym == YY__PLUS_PLUS || sym == YY__MINUS_MINUS || sym == YY__AND || sym == YY__STAR || sym == YY__PLUS || sym == YY__MINUS || sym == YY__TILDE || sym == YY__BANG || sym == YY_SIZEOF || sym == YY__ALIGNOF || sym == YY___ALIGNOF__ || sym == YY___ALIGNOF || sym == YY__AND_AND || sym == YY___BUILTIN_VA_START || sym == YY___BUILTIN_VA_END || sym == YY___BUILTIN_VA_COPY || sym == YY___BUILTIN_ALLOCA || sym == YY___BUILTIN_ABORT || sym == YY___BUILTIN_TRAP || sym == YY___BUILTIN_DEBUGTRAP || sym == YY___BUILTIN_FRAME_ADDRESS || sym == YY___BUILTIN_ABS || sym == YY___BUILTIN_LABS || sym == YY___BUILTIN_LLABS || sym == YY___BUILTIN_FABS || sym == YY___BUILTIN_FABSF || sym == YY___BUILTIN_BSWAP16 || sym == YY___BUILTIN_BSWAP32 || sym == YY___BUILTIN_BSWAP64 || sym == YY___BUILTIN_POPCOUNT || sym == YY___BUILTIN_POPCOUNTL || sym == YY___BUILTIN_POPCOUNTLL || sym == YY___BUILTIN_CLZ || sym == YY___BUILTIN_CLZL || sym == YY___BUILTIN_CLZLL || sym == YY___BUILTIN_CTZ || sym == YY___BUILTIN_CTZL || sym == YY___BUILTIN_CTZLL || sym == YY___BUILTIN_FFS || sym == YY___BUILTIN_FFSL || sym == YY___BUILTIN_FFSLL || sym == YY___BUILTIN_MEMCPY || sym == YY___BUILTIN_MEMSET || sym == YY___BUILTIN_EXPECT || sym == YY___BUILTIN_PREFETCH || sym == YY___BUILTIN_UNREACHABLE || sym == YY___BUILTIN_HUGE_VAL || sym == YY___BUILTIN_HUGE_VALF || sym == YY___BUILTIN_INF || sym == YY___BUILTIN_INFF || sym == YY___BUILTIN_ISUNORDERED || sym == YY___BUILTIN_NAN || sym == YY___BUILTIN_NANF || sym == YY___BUILTIN_ADD_OVERFLOW || sym == YY___BUILTIN_ADD_OVERFLOW_P || sym == YY___BUILTIN_SADD_OVERFLOW || sym == YY___BUILTIN_SADDL_OVERFLOW || sym == YY___BUILTIN_SADDLL_OVERFLOW || sym == YY___BUILTIN_UADD_OVERFLOW || sym == YY___BUILTIN_UADDL_OVERFLOW || sym == YY___BUILTIN_UADDLL_OVERFLOW || sym == YY___BUILTIN_SUB_OVERFLOW || sym == YY___BUILTIN_SUB_OVERFLOW_P || sym == YY___BUILTIN_SSUB_OVERFLOW || sym == YY___BUILTIN_SSUBL_OVERFLOW || sym == YY___BUILTIN_SSUBLL_OVERFLOW || sym == YY___BUILTIN_USUB_OVERFLOW || sym == YY___BUILTIN_USUBL_OVERFLOW || sym == YY___BUILTIN_USUBLL_OVERFLOW || sym == YY___BUILTIN_MUL_OVERFLOW || sym == YY___BUILTIN_MUL_OVERFLOW_P || sym == YY___BUILTIN_SMUL_OVERFLOW || sym == YY___BUILTIN_SMULL_OVERFLOW || sym == YY___BUILTIN_SMULLL_OVERFLOW || sym == YY___BUILTIN_UMUL_OVERFLOW || sym == YY___BUILTIN_UMULL_OVERFLOW || sym == YY___BUILTIN_UMULLL_OVERFLOW || sym == YY___BUILTIN_CONSTANT_P || sym == YY___BUILTIN_VA_ARG) { + if (sym == YY__LPAREN || C_IS_ID(sym) || sym == YY_DECIMAL_NUMBER || sym == YY_OCTAL_NUMBER || sym == YY_HEXADECIMAL_NUMBER || sym == YY_BINARY_NUMBER || sym == YY_FLOATING_NUMBER || sym == YY_HEXADECIMAL_FLOATING_NUMBER || sym == YY_CHARACTER || sym == YY_STRING || sym == YY__GENERIC || sym == YY___EXTENSION__ || sym == YY__PLUS_PLUS || sym == YY__MINUS_MINUS || sym == YY__AND || sym == YY__STAR || sym == YY__PLUS || sym == YY__MINUS || sym == YY__TILDE || sym == YY__BANG || sym == YY_SIZEOF || sym == YY__ALIGNOF || sym == YY___ALIGNOF__ || sym == YY___ALIGNOF || sym == YY__AND_AND || sym == YY___BUILTIN_VA_START || sym == YY___BUILTIN_VA_END || sym == YY___BUILTIN_VA_COPY || sym == YY___BUILTIN_ALLOCA || sym == YY___BUILTIN_ABORT || sym == YY___BUILTIN_TRAP || sym == YY___BUILTIN_DEBUGTRAP || sym == YY___BUILTIN_FRAME_ADDRESS || sym == YY___BUILTIN_ABS || sym == YY___BUILTIN_LABS || sym == YY___BUILTIN_LLABS || sym == YY___BUILTIN_FABS || sym == YY___BUILTIN_FABSF || sym == YY___BUILTIN_BSWAP16 || sym == YY___BUILTIN_BSWAP32 || sym == YY___BUILTIN_BSWAP64 || sym == YY___BUILTIN_POPCOUNT || sym == YY___BUILTIN_POPCOUNTL || sym == YY___BUILTIN_POPCOUNTLL || sym == YY___BUILTIN_CLZ || sym == YY___BUILTIN_CLZL || sym == YY___BUILTIN_CLZLL || sym == YY___BUILTIN_CTZ || sym == YY___BUILTIN_CTZL || sym == YY___BUILTIN_CTZLL || sym == YY___BUILTIN_FFS || sym == YY___BUILTIN_FFSL || sym == YY___BUILTIN_FFSLL || sym == YY___BUILTIN_MEMCPY || sym == YY___BUILTIN_MEMSET || sym == YY___BUILTIN_EXPECT || sym == YY___BUILTIN_PREFETCH || sym == YY___BUILTIN_UNREACHABLE || sym == YY___BUILTIN_HUGE_VAL || sym == YY___BUILTIN_HUGE_VALF || sym == YY___BUILTIN_INF || sym == YY___BUILTIN_INFF || sym == YY___BUILTIN_ISUNORDERED || sym == YY___BUILTIN_NAN || sym == YY___BUILTIN_NANF || sym == YY___BUILTIN_ADD_OVERFLOW || sym == YY___BUILTIN_ADD_OVERFLOW_P || sym == YY___BUILTIN_SADD_OVERFLOW || sym == YY___BUILTIN_SADDL_OVERFLOW || sym == YY___BUILTIN_SADDLL_OVERFLOW || sym == YY___BUILTIN_UADD_OVERFLOW || sym == YY___BUILTIN_UADDL_OVERFLOW || sym == YY___BUILTIN_UADDLL_OVERFLOW || sym == YY___BUILTIN_SUB_OVERFLOW || sym == YY___BUILTIN_SUB_OVERFLOW_P || sym == YY___BUILTIN_SSUB_OVERFLOW || sym == YY___BUILTIN_SSUBL_OVERFLOW || sym == YY___BUILTIN_SSUBLL_OVERFLOW || sym == YY___BUILTIN_USUB_OVERFLOW || sym == YY___BUILTIN_USUBL_OVERFLOW || sym == YY___BUILTIN_USUBLL_OVERFLOW || sym == YY___BUILTIN_MUL_OVERFLOW || sym == YY___BUILTIN_MUL_OVERFLOW_P || sym == YY___BUILTIN_SMUL_OVERFLOW || sym == YY___BUILTIN_SMULL_OVERFLOW || sym == YY___BUILTIN_SMULLL_OVERFLOW || sym == YY___BUILTIN_UMUL_OVERFLOW || sym == YY___BUILTIN_UMULL_OVERFLOW || sym == YY___BUILTIN_UMULLL_OVERFLOW || sym == YY___BUILTIN_SHUFFLE || sym == YY___BUILTIN_SHUFFLEVECTOR || sym == YY___BUILTIN_CONSTANT_P || sym == YY___BUILTIN_VA_ARG || sym == YY___BUILTIN_CONVERTVECTOR) { sym = parse_expression(sym, rcc, &op2); c_value_rval(rcc, &op2); } diff --git a/rcc_semantic.c b/rcc_semantic.c index b6d607b..91ee940 100644 --- a/rcc_semantic.c +++ b/rcc_semantic.c @@ -191,14 +191,36 @@ ir_type c_type2ir(rcc_ctx *rcc, const c_type *t) case C_TYPE_FUNC: return IR_ADDR; case C_TYPE_STRUCT: return IR_ADDR; case C_TYPE_UNION: return IR_ADDR; +#if IR_SIMD + case C_TYPE_VECTOR: + switch (t->vec.type->kind) { + case C_TYPE_I8: return IR_MAKE_VECTOR_TYPE(IR_I8, t->vec.length); + case C_TYPE_I16: return IR_MAKE_VECTOR_TYPE(IR_I16, t->vec.length); + case C_TYPE_I32: return IR_MAKE_VECTOR_TYPE(IR_I32, t->vec.length); + case C_TYPE_IL: return IR_MAKE_VECTOR_TYPE(IR_LONG, t->vec.length); + case C_TYPE_ILL: return IR_MAKE_VECTOR_TYPE(IR_I64, t->vec.length); + case C_TYPE_U8: return IR_MAKE_VECTOR_TYPE(IR_U8, t->vec.length); + case C_TYPE_U16: return IR_MAKE_VECTOR_TYPE(IR_U16, t->vec.length); + case C_TYPE_U32: return IR_MAKE_VECTOR_TYPE(IR_U32, t->vec.length); + case C_TYPE_UL: return IR_MAKE_VECTOR_TYPE(IR_ULONG, t->vec.length); + case C_TYPE_ULL: return IR_MAKE_VECTOR_TYPE(IR_U64, t->vec.length); + case C_TYPE_FLOAT: return IR_MAKE_VECTOR_TYPE(IR_FLOAT, t->vec.length); + case C_TYPE_DOUBLE: return IR_MAKE_VECTOR_TYPE(IR_DOUBLE, t->vec.length); + case C_TYPE_CHAR: return IR_MAKE_VECTOR_TYPE(IR_I8, t->vec.length); + default: + break; + } + break; +#endif case C_TYPE_FLOAT_COMPLEX: case C_TYPE_DOUBLE_COMPLEX: case C_TYPE_LONG_DOUBLE_COMPLEX: yy_error("complex numbers are not supported yet"); //??? default: - IR_ASSERT(0); - return IR_VOID; + break; } + IR_ASSERT(0); + return IR_VOID; } #define MAX_ABI_TYPES 2 @@ -785,6 +807,30 @@ static void c_finalize_type(rcc_ctx *rcc, c_dcl *d) c_validate_dcl(rcc, d); + if (d->vector_size) { + c_type *type; + + if (d->type->kind < C_TYPE_U8 || d->type->kind > C_TYPE_DOUBLE) { + yy_error("invalid vector type for attribute \"vector_size\")"); +#if IR_SIMD + } else if (d->vector_size / d->type->size <= 64) { + /* General IR limitation */ +#endif + } else { + yy_error_fmt("unsupported attribute \"vector_size(%u)\"", d->vector_size); + } + + type = ir_arena_alloc(&rcc->c_arena, sizeof(c_type)); + type->size = d->vector_size; + type->kind = C_TYPE_VECTOR; + type->flags = rcc->active_scope ? 0 : C_TYPE_GLOBAL; + type->attr = c_align2attr(IR_MIN(d->vector_size, 16)); /* 16 byte allgnment */ + type->vec.type = d->type; + type->vec.length = d->vector_size / d->type->size; + d->type = type; + d->vector_size = 0; + } + if ((d->flags & C_TYPE_SPEC_NAME) && (d->attr & C_TYPE_ATTRS) && (d->type->kind == C_TYPE_ARRAY)) { @@ -870,6 +916,9 @@ static bool c_compatible_types(const c_type *t1, const c_type *t2, bool unqualif if (!c_compatible_types(t1->array.type, t2->array.type, 0, 0)) return 0; } else if (t1->kind == C_TYPE_POINTER) { if (!c_compatible_types(t1->pointer.type, t2->pointer.type, 0, 0)) return 0; + } else if (t1->kind == C_TYPE_VECTOR) { + if (t1->vec.length != t2->vec.length) return 0; + if (!c_compatible_types(t1->vec.type, t2->vec.type, 0, 0)) return 0; } else if (t1->kind == C_TYPE_STRUCT || t1->kind == C_TYPE_UNION) { if (t1->record.tag != t2->record.tag) return 0; if (t1->record.tag && t2->record.tag) return 1; @@ -915,7 +964,7 @@ static void c_do_grow_flexible(rcc_ctx *rcc, c_sym *obj, size_t old_size, size_t memset((char*)obj->value.u.val.ptr + old_size, 0, size - old_size); if (c_value_is_ref(&obj->value)) { ir_str name = rcc->active_ctx->ir_base[obj->value.u.ref].val.name; - + IR_ASSERT(IR_IS_EXT_STR(name)); rcc->yy_hash.data[IR_EXT_STR(name)].sym->value.u.val.ptr = obj->value.u.val.ptr; } @@ -932,7 +981,7 @@ static void c_do_end_flexible(rcc_ctx *rcc, c_sym *obj, size_t size) IR_ASSERT(IR_IS_EXT_STR(name)); sym = IR_EXT_STR(name); - addr = c_linker_allocate_data(rcc, sym, size, c_attr2align(obj->value.type->attr)); + addr = c_linker_allocate_data(rcc, sym, size, c_attr2align(obj->value.type->attr), 1); memcpy(addr, obj->value.u.val.ptr, size); ir_mem_free(obj->value.u.val.ptr); obj->value.u.val.ptr = addr; @@ -948,7 +997,7 @@ static void c_do_end_flexible(rcc_ctx *rcc, c_sym *obj, size_t size) } } else { addr = c_linker_allocate_data(rcc, obj->value.u.ref, size, - c_attr2align(obj->value.type->attr)); + c_attr2align(obj->value.type->attr), 1); memcpy(addr, obj->value.u.val.ptr, size); ir_mem_free(obj->value.u.val.ptr); obj->value.u.val.ptr = addr; @@ -1073,7 +1122,7 @@ static void c_validate_redeclaration(rcc_ctx *rcc, c_name name, c_dcl *d, c_sym sym->value.u.ref = name; /* keep name in addition to address */ } else { sym->value.u.val.ptr = c_linker_allocate_data(rcc, name, - sym->value.type->size, c_attr2align(sym->value.type->attr)); + sym->value.type->size, c_attr2align(sym->value.type->attr), sym->value.type->kind == C_TYPE_ARRAY); } } } @@ -1238,7 +1287,7 @@ static ir_ref c_create_str_sym(rcc_ctx *rcc, c_value *res) buf[--i] = 's'; name = yy_hash_lookup(rcc, buf + i, sizeof(buf) - 1 - i); - addr = c_linker_allocate_data(rcc, name, size, 8); + addr = c_linker_allocate_data(rcc, name, size, 8, 1); memcpy(addr, str, size); /* Create a global symbol in yy_arena */ @@ -1502,7 +1551,7 @@ c_sym *c_declare(rcc_ctx *rcc, c_name name, c_dcl *d) addr = ir_mem_calloc(1, d->type->size); } else { addr = c_linker_allocate_data(rcc, name, - d->type->size, c_attr2align(d->type->attr)); + d->type->size, c_attr2align(d->type->attr), d->type->kind == C_TYPE_ARRAY); } sym->value.u.optx = IR_OPT(C_VAL_CONST, IR_ADDR); sym->value.u.val.ptr = addr; @@ -1516,7 +1565,7 @@ c_sym *c_declare(rcc_ctx *rcc, c_name name, c_dcl *d) addr = ir_mem_calloc(1, d->type->size); } else { addr = c_linker_allocate_data(rcc, sym_name, - d->type->size, c_attr2align(d->type->attr)); + d->type->size, c_attr2align(d->type->attr), d->type->kind == C_TYPE_ARRAY); } rcc->yy_hash.data[sym_name].sym->value.u.optx = IR_OPT(C_VAL_CONST, IR_ADDR); rcc->yy_hash.data[sym_name].sym->value.u.val.ptr = addr; @@ -2684,6 +2733,21 @@ void c_gcc_attribute_regparm(rcc_ctx *rcc, c_dcl *d, c_name attr, c_value *val) yy_warning_ex_fmt(E_UNSUPPORTED, "unsupported attribure \"%s(%d)\"", yy_sym2str(rcc, attr), val->u.val.u32); } +void c_gcc_attribute_vector_size(rcc_ctx *rcc, c_dcl *d, c_name attr, c_value *val) +{ + if (!c_value_is_set(val) + || !c_value_is_const(val) + || !C_IS_TYPE_INT(val->type) + || val->u.val.u64 == 0 + || (C_IS_TYPE_SIGNED(val->type) && val->u.val.i64 < 0)) { + yy_error_fmt("attribute \"%s\" value must be a positive integer constant", yy_sym2str(rcc, attr)); + } else if ((val->u.val.u64 & (val->u.val.u64 - 1)) != 0) { + yy_error_fmt("attribute \"%s\" value must be a power of two", yy_sym2str(rcc, attr)); + } + + d->vector_size = val->u.val.u32; +} + yy_sym c_gcc_attribute(rcc_ctx *rcc, c_dcl *d, c_name attr, yy_sym sym) { if (attr == YY_FORMAT @@ -3528,7 +3592,7 @@ void c_value_rval(rcc_ctx *rcc, c_value *val) } else if (c_value_is_reg(val)) { val->u.ref = ir_RLOAD(val->u.type, val->u.ref); } else if (val->type->kind != C_TYPE_STRUCT && val->type->kind != C_TYPE_UNION) { - if (!C_IS_BIT_FIELD(val->u.proto)) { + if (C_IS_SIMPLE_VAL(val->u.proto)) { if (IR_IS_CONST_REF(val->u.ref) && ((rcc->active_ctx->ir_base[val->u.ref].op == IR_SYM && ((val->type->attr & (C_ATTR_CONST|C_ATTR_VOLATILE)) == C_ATTR_CONST)) @@ -3564,10 +3628,31 @@ void c_value_rval(rcc_ctx *rcc, c_value *val) } else { val->u.ref = ir_LOAD(val->u.type, val->u.ref); } - } else if (!C_IS_BIT_FIELD_PACKED(val->u.proto)) { - c_do_load_bit_field(rcc, val, C_BIT_FIELD_START(val->u.proto), C_BIT_FIELD_SIZE(val->u.proto)); + } else if (C_IS_BIT_FIELD(val->u.proto)) { + if (!C_IS_BIT_FIELD_PACKED(val->u.proto)) { + c_do_load_bit_field(rcc, val, C_BIT_FIELD_START(val->u.proto), C_BIT_FIELD_SIZE(val->u.proto)); + } else { + c_do_load_bit_field_packed(rcc, val, C_BIT_FIELD_START(val->u.proto), C_BIT_FIELD_SIZE(val->u.proto)); + } } else { - c_do_load_bit_field_packed(rcc, val, C_BIT_FIELD_START(val->u.proto), C_BIT_FIELD_SIZE(val->u.proto)); + ir_ref ref; + ir_type t; + + IR_ASSERT(C_IS_VECTOR_DIM(val->u.proto)); + if (c_value_is_lval(val)) { + t = C_VECTOR_DIM_TYPE(val->u.proto); + if (rcc->active_ctx->ir_base[val->u.ref].op == IR_VAR) { + ref = ir_VLOAD(t, val->u.ref); + } else { + IR_ASSERT(rcc->active_ctx->ir_base[val->u.ref].type == IR_ADDR); + ref = ir_LOAD(t, val->u.ref); + } + } else { + ref = val->u.ref; + } + t = c_type2ir(rcc, val->type); + c_value_set_rval(val, val->type, t, ir_EXTRACT(t, ref, val->u.op2)); + return; } } val->u.op &= ~(C_VAL_LVAL|C_VAL_VAR|C_VAL_REG|C_VAL_VOLATILE); @@ -3619,8 +3704,8 @@ static void c_do_trunc(rcc_ctx *rcc, const c_type *t, ir_type type, c_value *v) static void c_do_bitcast(rcc_ctx *rcc, const c_type *t, ir_type type, c_value *v) { IR_ASSERT(t->size == v->type->size || (t->size == sizeof(void*) && v->type->kind == C_TYPE_ARRAY)); - IR_ASSERT(ir_type_size[type] == ir_type_size[v->u.type]); - if (c_value_is_ref(v) || c_value_is_const_str(v)) { + IR_ASSERT(ir_get_type_size(type) == ir_get_type_size(v->u.type)); + if (c_value_is_ref(v) || c_value_is_const_str(v) || t->kind == C_TYPE_VECTOR) { c_value_set_rval(v, t, type, ir_BITCAST(type, c_value_ref(rcc, v))); } else { switch (type) { @@ -3854,6 +3939,8 @@ void c_do_addr(rcc_ctx *rcc, c_value *v) } } else if (C_IS_BIT_FIELD(v->u.proto)) { yy_error("cannot take address of bit-field"); + } else if (C_IS_VECTOR_DIM(v->u.proto)) { + yy_error("cannot take address of vector element"); } type = c_create_pointer_type(rcc, v->type); @@ -4043,7 +4130,7 @@ static ir_ref c_do_store(rcc_ctx *rcc, c_value *addr, c_value *val) { ir_ref ref; - if (!C_IS_BIT_FIELD(addr->u.proto)) { + if (C_IS_SIMPLE_VAL(addr->u.proto)) { ref = c_value_ref(rcc, val); if (c_value_is_var(addr)) { if ((addr->type->attr & C_ATTR_VOLATILE) || (addr->u.op & C_VAL_VOLATILE)) { @@ -4061,15 +4148,82 @@ static ir_ref c_do_store(rcc_ctx *rcc, c_value *addr, c_value *val) } } return ref; - } else if (!C_IS_BIT_FIELD_PACKED(addr->u.proto)) { - return c_do_store_bit_field(rcc, addr->u.ref, - C_BIT_FIELD_START(addr->u.proto), C_BIT_FIELD_SIZE(addr->u.proto), val); + } else if (C_IS_BIT_FIELD(addr->u.proto)) { + if (!C_IS_BIT_FIELD_PACKED(addr->u.proto)) { + return c_do_store_bit_field(rcc, addr->u.ref, + C_BIT_FIELD_START(addr->u.proto), C_BIT_FIELD_SIZE(addr->u.proto), val); + } else { + return c_do_store_bit_field_packed(rcc, addr->u.ref, + C_BIT_FIELD_START(addr->u.proto), C_BIT_FIELD_SIZE(addr->u.proto), val); + } } else { - return c_do_store_bit_field_packed(rcc, addr->u.ref, - C_BIT_FIELD_START(addr->u.proto), C_BIT_FIELD_SIZE(addr->u.proto), val); + ir_type vt; + ir_ref vref; + + IR_ASSERT(C_IS_VECTOR_DIM(addr->u.proto) && c_value_is_lval(addr)); + vt = C_VECTOR_DIM_TYPE(addr->u.proto); + if (rcc->active_ctx->ir_base[addr->u.ref].op == IR_VAR) { + vref = ir_VLOAD(vt, addr->u.ref); + } else { + IR_ASSERT(rcc->active_ctx->ir_base[addr->u.ref].type == IR_ADDR); + vref = ir_LOAD(vt, addr->u.ref); + } + + ref = c_value_ref(rcc, val); + vref = ir_REPLACE(vt, vref, addr->u.op2, ref); + + if (rcc->active_ctx->ir_base[addr->u.ref].op == IR_VAR) { + ir_VSTORE(addr->u.ref, vref); + } else { + IR_ASSERT(rcc->active_ctx->ir_base[addr->u.ref].type == IR_ADDR); + ir_STORE(addr->u.ref, vref); + } + + return ref; } } +static const c_type *c_opaque_vector_type(rcc_ctx *rcc, const c_type *src_type) +{ + c_type *type = ir_arena_alloc(&rcc->c_arena, sizeof(c_type)); + + type->size = src_type->size; + type->kind = C_TYPE_VECTOR; + type->flags = (src_type->flags & ~C_TYPE_GLOBAL) | (rcc->active_scope ? 0 : C_TYPE_GLOBAL) | C_TYPE_OPAQUE; + type->attr = src_type->attr; + type->vec.length = src_type->vec.length; + + if (src_type->vec.type->size == 1) { + type->vec.type = &c_type_i8; + } else if (src_type->vec.type->size == 2) { + type->vec.type = &c_type_i16; + } else if (src_type->vec.type->size == 4) { + type->vec.type = &c_type_i32; + } else if (src_type->vec.type->size == 8) { + type->vec.type = &c_type_i64; + } else { + IR_ASSERT(0); + } + + return type; +} + +static void c_opaque_vector_cast(rcc_ctx *rcc, const c_type *type, c_value *val) +{ + ir_type t = c_type2ir(rcc, type); + +#if 0 + /* Update type of comparison */ + rcc->active_ctx->ir_base[val->u.ref].type = t; + val->type = type; + val->u.type = t; +#else + /* Implicit vector BITCAST */ + c_value_set_rval(val, type, t, ir_BITCAST(t, val->u.ref)); +#endif +} + + /* arg > 0 - means real argument number * arg == 0 - return value * arg == -1 - assign @@ -4187,6 +4341,18 @@ static void c_do_check_cvt(rcc_ctx *rcc, const c_type *type, c_value *val, int32 && c_compatible_types(type, val_type, 1, 0)) { val->type = type; return; + } else if (type->kind == C_TYPE_VECTOR + && val->type->kind == C_TYPE_VECTOR + && type->vec.length == val->type->vec.length) { + if (type->vec.type->kind == val->type->vec.type->kind) { + /* identicl vector types */ + return; + } else if (type->size == val->type->size && (val->type->flags & C_TYPE_OPAQUE)) { + c_opaque_vector_cast(rcc, type, val); + return; + } else { + goto incompatible; + } } else { goto incompatible; } @@ -4208,7 +4374,7 @@ void c_do_cast(rcc_ctx *rcc, const c_type *t, c_value *v) if (f->type == v->type || c_compatible_types(f->type, v->type, 1, 0)) { ir_ref addr = c_do_alloca(rcc, t->size, c_attr2align(t->attr), 0); - if (C_IS_TYPE_SCALAR_OR_PTR(v->type)) { + if (C_IS_TYPE_SCALAR_OR_PTR(v->type) || v->type->kind == C_TYPE_VECTOR) { ir_STORE(addr, c_value_ref(rcc, v)); } else { IR_ASSERT(v->type->size); @@ -4219,12 +4385,26 @@ void c_do_cast(rcc_ctx *rcc, const c_type *t, c_value *v) return; } } + } else if (t->kind == C_TYPE_VECTOR) { + if (t->size == v->type->size + && (v->type->kind == C_TYPE_VECTOR || C_IS_TYPE_KIND_SCALAR(v->type->kind))) { + c_do_bitcast(rcc, t, c_type2ir(rcc, t), v); + return; + } + yy_error("cannot convert a value to vector of different size"); } yy_error("conversion to non-scalar type requested"); } else if (t->flags & C_TYPE_INCOMPLETE) { yy_error("conversion to incomplete type"); } else if (v->type->kind == C_TYPE_VOID || v->type->kind == C_TYPE_STRUCT || v->type->kind == C_TYPE_UNION) { yy_error("conversion of non-scalar type requested"); + } else if (v->type->kind == C_TYPE_VECTOR) { + if (t->size == v->type->size + && (t->kind == C_TYPE_VECTOR || C_IS_TYPE_KIND_SCALAR(t->kind))) { + c_do_bitcast(rcc, t, c_type2ir(rcc, t), v); + return; + } + yy_error("cannot convert a vector to type of different size"); } else if (t->kind == C_TYPE_POINTER) { if (C_IS_TYPE_FP(v->type)) { yy_error("cannot convert floating point value to a pointer"); @@ -4380,7 +4560,7 @@ void c_do_unary_plus(rcc_ctx *rcc, c_value *v) if (t->size < 4) { c_do_cvt(rcc, &c_type_i32, IR_I32, v); } - } else if (!C_IS_TYPE_FP(t)) { + } else if (!C_IS_TYPE_FP(t) && t->kind != C_TYPE_VECTOR) { yy_error("invalid type argument of unary \"+\""); } } @@ -4394,11 +4574,12 @@ void c_do_neg(rcc_ctx *rcc, c_value *v) if (t->size < 4) { c_do_cvt(rcc, &c_type_i32, IR_I32, v); } - } else if (!C_IS_TYPE_FP(t)) { + } else if (!C_IS_TYPE_FP(t) && t->kind != C_TYPE_VECTOR) { yy_error("invalid type argument of unary \"-\""); } - if (c_value_is_ref(v)) { + if (c_value_is_ref(v) || t->kind == C_TYPE_VECTOR) { + // TODO: constant folding for vectors ??? v->u.ref = ir_NEG(v->u.type, c_value_ref(rcc, v)); } else { switch (v->u.type) { @@ -4422,10 +4603,11 @@ void c_do_not(rcc_ctx *rcc, c_value *v) if (t->size < 4) { c_do_cvt(rcc, &c_type_i32, IR_I32, v); } - } else { + } else if (t->kind != C_TYPE_VECTOR || !C_IS_TYPE_INT(t->vec.type)) { yy_error("invalid type argument of unary \"~\""); } - if (c_value_is_ref(v)) { + if (c_value_is_ref(v) || t->kind == C_TYPE_VECTOR) { + // TODO: constant folding for vectors ??? v->u.ref = ir_NOT(v->u.type, c_value_ref(rcc, v)); } else { switch (v->u.type) { @@ -4443,7 +4625,10 @@ void c_do_bool_not(rcc_ctx *rcc, c_value *v) ir_val val; c_value_rval(rcc, v); - if (v->type->kind == C_TYPE_VOID || v->type->kind == C_TYPE_STRUCT || v->type->kind == C_TYPE_UNION) { + if (v->type->kind == C_TYPE_VOID + || v->type->kind == C_TYPE_STRUCT + || v->type->kind == C_TYPE_UNION + || v->type->kind == C_TYPE_VECTOR) { yy_error("invalid type argument of unary \"!\""); } if (c_value_is_ref(v)) { @@ -4482,6 +4667,21 @@ void c_do_array_dim(rcc_ctx *rcc, c_value *v, c_value *dim) } type = type->pointer.type; ref = c_value_ref(rcc, v); + } else if (type->kind == C_TYPE_VECTOR) { + ir_type vt = c_type2ir(rcc, type); + + if (!C_IS_TYPE_INT(dim->type) && dim->type->kind != C_TYPE_ENUM) yy_error("array subscript is not an integer"); + // TODO: constant range check ??? + c_value_rval(rcc, dim); + if (c_value_is_lval(v)) { + c_value_set_lval(v, type->vec.type, c_type2ir(rcc, type->vec.type), v->u.ref); + v->u.proto = C_VECTOR_DIM(vt); + v->u.op2 = c_value_ref(rcc, dim); + } else { + ir_type t = c_type2ir(rcc, type->vec.type); + c_value_set_rval(v, type->vec.type, t, ir_EXTRACT(t, c_value_ref(rcc, v), c_value_ref(rcc, dim))); + } + return; } else { type = dim->type; if (type->kind == C_TYPE_ARRAY) { @@ -5056,6 +5256,93 @@ void c_do_builtin(rcc_ctx *rcc, c_value *val, c_name name, int32_t num_args, c_v if (!C_IS_TYPE_FP(args[0].type) || !C_IS_TYPE_FP(args[1].type)) yy_error_fmt("wrong arguments in %s() call", yy_sym2str(rcc, name)); ref = ir_fold2(rcc->active_ctx, IR_OPT(IR_UNORDERED, IR_BOOL), c_value_ref(rcc, &args[0]), c_value_ref(rcc, &args[1])); c_value_set_rval(val, &c_type_bool, IR_BOOL, ref); + } else if (name == YY___BUILTIN_SHUFFLE) { + uint32_t len; + ir_ref op1, op2, op3; + ir_type t; + c_type *type; + + if (num_args != 2 && num_args != 3) yy_error_fmt("wrong number of arguments in %s() call", yy_sym2str(rcc, name)); + if (args[0].type->kind != C_TYPE_VECTOR) yy_error("first argument of __builtin_shuffle() must be a vector"); + if (num_args == 2) { + if (args[1].type->kind != C_TYPE_VECTOR || !C_IS_TYPE_INT(args[1].type->vec.type)) { + yy_error("second argument of __builtin_shuffle() must be an integer vector"); + } + len = args[1].type->vec.length; + op1 = op2 = c_value_ref(rcc, &args[0]); + op3 = c_value_ref(rcc, &args[1]); + } else { + if (args[1].type->kind != C_TYPE_VECTOR) yy_error("second argument of __builtin_shuffle() must be a vector"); + if (args[0].type->vec.type->kind != args[1].type->vec.type->kind) yy_error("first and second arguments of __builtin_shuffle() are vectors of different types"); + if (args[2].type->kind != C_TYPE_VECTOR || !C_IS_TYPE_INT(args[2].type->vec.type)) { + yy_error("third argument of __builtin_shuffle() must be an integer vector"); + } + len = args[2].type->vec.length; + op1 = c_value_ref(rcc, &args[0]); + op2 = c_value_ref(rcc, &args[1]); + op3 = c_value_ref(rcc, &args[2]); + } + + if ((uint32_t)args[0].type->vec.length == len) { + type = (c_type*)args[0].type; + } else { + type = ir_arena_alloc(&rcc->c_arena, sizeof(c_type)); + type->size = IR_VECTOR_SIZE(t); + type->kind = C_TYPE_VECTOR; + type->flags = rcc->active_scope ? 0 : C_TYPE_GLOBAL; + type->attr = c_align2attr(IR_MIN(type->size, 16)); /* 16 byte allgnment */ + type->vec.type = args[0].type->vec.type; + type->vec.length = len; + } + t = c_type2ir(rcc, type); + + c_value_set_rval(val, type, t, ir_SHUFFLE(t, op1, op2, op3)); + } else if (name == YY___BUILTIN_SHUFFLEVECTOR) { + ir_ref ref; + ir_type t; + uint32_t len1, len2, len, i; + int8_t *ptr; + c_type *type; + + if (num_args < 3) yy_error_fmt("wrong number of arguments in %s() call", yy_sym2str(rcc, name)); + if (args[0].type->kind != C_TYPE_VECTOR) yy_error("first argument of __builtin_shufflevector() must be a vector"); + if (args[1].type->kind != C_TYPE_VECTOR) yy_error("second argument of __builtin_shufflevector() must be a vector"); + if (args[0].type->vec.type->kind != args[1].type->vec.type->kind) yy_error("first and second arguments of __builtin_shufflevector() are vectors of different types"); + len = num_args - 2; + if (len > 64 || (len & (len - 1)) != 0) yy_error("unsupported numver of vector elments in __builtin_shufflevector()"); + + len1 = args[0].type->vec.length; + len2 = args[1].type->vec.length; + t = IR_MAKE_VECTOR_TYPE(IR_I8, len); + ref = ir_const_vector(rcc->active_ctx, t); + ptr = ir_long_const_ptr(rcc->active_ctx, ref); + for (i = 0; i < len; i++) { + if (!C_IS_TYPE_INT(args[i + 2].type) + || !c_value_is_const(&args[i + 2]) + || (args[i + 2].u.val.u64 > len1 + len2 + && (!C_IS_TYPE_SIGNED(args[i + 2].type) + || args[i + 2].u.val.i64 == -1))) { + yy_error_fmt("%d-th argument of __builtin_shufflevector() is an invalid vector index", i + 3); + } + *ptr = (int8_t)args[i + 2].u.val.i8; + ptr++; + } + + if ((uint32_t)args[0].type->vec.length == len) { + type = (c_type*)args[0].type; + } else { + type = ir_arena_alloc(&rcc->c_arena, sizeof(c_type)); + type->size = IR_VECTOR_SIZE(t); + type->kind = C_TYPE_VECTOR; + type->flags = rcc->active_scope ? 0 : C_TYPE_GLOBAL; + type->attr = c_align2attr(IR_MIN(type->size, 16)); /* 16 byte allgnment */ + type->vec.type = args[0].type->vec.type; + type->vec.length = len; + } + t = c_type2ir(rcc, type); + + c_value_set_rval(val, type, t, + ir_SHUFFLE(t, c_value_ref(rcc, &args[0]), c_value_ref(rcc, &args[1]), ref)); } else { IR_ASSERT(0); } @@ -5119,6 +5406,55 @@ void c_do_builtin_va_arg(rcc_ctx *rcc, c_value *val, const c_type *type) } } +void c_do_builtin_convertvector(rcc_ctx *rcc, c_value *val, const c_type *type) +{ + ir_type t; + ir_op op = IR_NOP; + + if (val->type->kind != C_TYPE_VECTOR) { + yy_error("first argument of __builtin_convertvector() must be a vector"); + } else if (type->kind != C_TYPE_VECTOR) { + yy_error("second argument of __builtin_convertvector() must be a vector type"); + } else if (val->type->vec.length != type->vec.length) { + yy_error("vector and type arguments of __builtin_convertvector() have different number of elements"); + } else if (val->type->vec.type->kind == type->vec.type->kind) { + /* convert to the same type */ + return; + } + + if (C_IS_TYPE_INT(type->vec.type)) { + if (C_IS_TYPE_INT(val->type->vec.type)) { + if (type->vec.type->size < val->type->vec.type->size) { + op = IR_TRUNC; + } else if (type->vec.type->size == val->type->vec.type->size) { + op = IR_BITCAST; + } else if (C_IS_TYPE_SIGNED(val->type->vec.type)) { + op = IR_SEXT; + } else { + op = IR_ZEXT; + } + } else if (C_IS_TYPE_FP(val->type->vec.type)) { + op = IR_FP2INT; + } else { + IR_ASSERT(0); + } + } else if (C_IS_TYPE_FP(type->vec.type)) { + if (C_IS_TYPE_INT(val->type->vec.type)) { + op = IR_INT2FP; + } else if (C_IS_TYPE_FP(val->type->vec.type)) { + op = IR_FP2FP; + } else { + IR_ASSERT(0); + } + } else { + IR_ASSERT(0); + } + + IR_ASSERT(op != IR_NOP); + t = c_type2ir(rcc, type); + c_value_set_rval(val, type, t, ir_fold1(rcc->active_ctx, IR_OPT(op, t), c_value_ref(rcc, val))); +} + static bool c_do_convert_builtin(rcc_ctx *rcc, c_value *func, int32_t num_args, ir_ref *arg_refs) { if (c_value_is_ref(func)) { @@ -5218,7 +5554,14 @@ static ir_ref ir_inline_call(rcc_ctx *rcc, ir_ctx *ctx, ir_ctx *func_ctx, uint32 optx = IR_OPTX(op, IR_OPT_TYPE(optx), proto); } } - xlat[i] = ir_const_ex(ctx, val, IR_OPT_TYPE(optx), optx); + if (op == IR_LONG_CONST) { + xlat[i] = ir_long_const(ctx, insn->type, insn->long_const_size); + memcpy(ir_long_const_ptr(ctx, xlat[i]), insn + 1, insn->long_const_size); + i += IR_ALIGNED_SIZE(insn->long_const_size, sizeof(ir_insn)) / sizeof(ir_insn); + insn += IR_ALIGNED_SIZE(insn->long_const_size, sizeof(ir_insn)) / sizeof(ir_insn); + } else { + xlat[i] = ir_const_ex(ctx, val, IR_OPT_TYPE(optx), optx); + } } xlat[IR_TRUE] = IR_TRUE; xlat[IR_FALSE] = IR_FALSE; @@ -5714,6 +6057,126 @@ void c_do_call(rcc_ctx *rcc, c_value *func, int32_t num_args, c_value *args, c_v if (num_args > C_ALLOCA_PARAMS) ir_mem_free(args); } +static bool c_try_convert_const_fp2fp(rcc_ctx *rcc, const c_type *type, c_value *val) +{ + ir_val v; + + IR_ASSERT(type->kind == C_TYPE_FLOAT && val->type->kind == C_TYPE_DOUBLE); + v.f = (float)val->u.val.d; + v.u32_hi = 0; + if ((double)v.f != val->u.val.d) return 0; + + c_value_set_const(val, type, IR_FLOAT, v); + return 1; +} + +static bool c_try_convert_const_int2fp(rcc_ctx *rcc, const c_type *type, c_value *val) +{ + ir_val v; + + switch (type->kind) { + case C_TYPE_FLOAT: + if (C_IS_TYPE_SIGNED(val->type)) { + v.f = (float)val->u.val.i64; + v.u32_hi = 0; + if ((int64_t)v.f != val->u.val.i64) return 0; + } else { + v.f = (float)val->u.val.u64; + v.u32_hi = 0; + if ((uint64_t)v.f != val->u.val.u64) return 0; + } + c_value_set_const(val, type, IR_FLOAT, v); + return 1; + case C_TYPE_DOUBLE: + if (C_IS_TYPE_SIGNED(val->type)) { + v.d = (double)val->u.val.i64; + if ((int64_t)v.d != val->u.val.i64) return 0; + } else { + v.d = (double)val->u.val.u64; + if ((uint64_t)v.d != val->u.val.u64) return 0; + } + c_value_set_const(val, type, IR_DOUBLE, v); + return 1; + default: + IR_ASSERT(0); + return 0; + } +} + +static bool c_try_convert_const_int2int(rcc_ctx *rcc, const c_type *type, c_value *val) +{ + ir_val v; + + v.u64 = val->u.val.u64; + if (type->size < 8) { + uint32_t shift = (8 - type->size) * 8; + + if (C_IS_TYPE_SIGNED(type)) { + v.i64 = (int64_t)(v.u64 << shift) >> shift; + } else { + v.u64 = (v.u64 << shift) >> shift; + } + } + if (v.u64 != val->u.val.u64) return 0; + c_value_set_const(val, type, c_type2ir(rcc, type), v); + return 1; +} + +static bool c_do_splat(rcc_ctx *rcc, const c_type *type, c_value *val) +{ + ir_type t; + + IR_ASSERT(type->kind == C_TYPE_VECTOR); + + if (C_IS_TYPE_KIND_FP(type->vec.type->kind)) { + if (C_IS_TYPE_KIND_FP(val->type->kind)) { + if (val->type->size > type->vec.type->size) { + if (!c_value_is_const(val) || !c_try_convert_const_fp2fp(rcc, type->vec.type, val)) { + yy_error("cannot convert value to a vector (conversion involves truncation)"); + } + } else if (val->type->size < type->vec.type->size) { + c_do_fp2fp(rcc, type->vec.type, c_type2ir(rcc, type->vec.type), val); + } + } else if (C_IS_TYPE_KIND_INT(val->type->kind)) { + if (val->type->size >= type->vec.type->size) { + if (!c_value_is_const(val) || !c_try_convert_const_int2fp(rcc, type->vec.type, val)) { + yy_error("cannot convert value to a vector (conversion involves truncation)"); + } + } else { + c_do_int2fp(rcc, type->vec.type, c_type2ir(rcc, type->vec.type), val); + } + } else { + return 0; + } + } else { + IR_ASSERT(C_IS_TYPE_KIND_INT(type->vec.type->kind)); + if (C_IS_TYPE_KIND_FP(val->type->kind)) { + yy_error("cannot convert value to a vector"); + } else if (C_IS_TYPE_KIND_INT(val->type->kind)) { + if (val->type->size > type->vec.type->size) { + if (!c_value_is_const(val) || !c_try_convert_const_int2int(rcc, type->vec.type, val)) { + yy_error("cannot convert value to a vector (conversion involves truncation)"); + } + } else if (val->type->size < type->vec.type->size) { + if (C_IS_TYPE_KIND_SIGNED(val->type->kind)) { + c_do_sext(rcc, type->vec.type, c_type2ir(rcc, type->vec.type), val); + } else { + c_do_zext(rcc, type->vec.type, c_type2ir(rcc, type->vec.type), val); + } + } else if (val->type->kind != type->vec.type->kind) { + c_do_bitcast(rcc, type->vec.type, c_type2ir(rcc, type->vec.type), val); + } + } else { + return 0; + } + } + + t = c_type2ir(rcc, type); + c_value_set_rval(val, type, t, ir_SPLAT(t, c_value_ref(rcc, val))); + + return 1; +} + static const c_type *c_common_type(rcc_ctx *rcc, yy_sym sym, c_value *op1, c_value *op2) { const c_type *op1_type = op1->type; @@ -5819,6 +6282,59 @@ static const c_type *c_common_type(rcc_ctx *rcc, yy_sym sym, c_value *op1, c_val } } return NULL; + } else if (t1 == C_TYPE_VECTOR) { + if (C_IS_TYPE_FP(op1->type->vec.type)) { + if (sym == YY__PERCENT || sym == YY__AND || sym == YY__UPARROW || sym == YY__BAR + || sym == YY__LESS_LESS || sym == YY__GREATER_GREATER) { + return NULL; + } + } + if (t2 == C_TYPE_VECTOR) { + if (op1->type->size == op2->type->size) { + if (op1->type->vec.type != op2->type->vec.type) { + if (op2->type->flags & C_TYPE_OPAQUE) { + c_opaque_vector_cast(rcc, op1->type, op2); + } else if (op1->type->flags & C_TYPE_OPAQUE) { + c_opaque_vector_cast(rcc, op2->type, op1); + } + } + if (op1->type->vec.type == op2->type->vec.type) { + if ((sym == YY__LESS || sym == YY__LESS_EQUAL || sym == YY__GREATER || sym == YY__GREATER_EQUAL + || sym == YY__EQUAL_EQUAL || sym == YY__BANG_EQUAL) + && !C_IS_TYPE_SIGNED(op1->type->vec.type)) { + return c_opaque_vector_type(rcc, op1->type); + } + return op1->type; + } + } + } else if (C_IS_TYPE_KIND_SCALAR(t2)) { + if (sym == YY__LESS_LESS || sym == YY__GREATER_GREATER) { + if (!C_IS_TYPE_KIND_INT(t2)) return NULL; + return op1->type; + } else if (c_do_splat(rcc, op1->type, op2)) { + if ((sym == YY__LESS || sym == YY__LESS_EQUAL || sym == YY__GREATER || sym == YY__GREATER_EQUAL + || sym == YY__EQUAL_EQUAL || sym == YY__BANG_EQUAL) + && !C_IS_TYPE_SIGNED(op1->type->vec.type)) { + return c_opaque_vector_type(rcc, op1->type); + } + return op1->type; + } + } + } else if (t2 == C_TYPE_VECTOR && C_IS_TYPE_KIND_SCALAR(t1)) { + if (C_IS_TYPE_FP(op2->type->vec.type)) { + if (sym == YY__PERCENT || sym == YY__AND || sym == YY__UPARROW || sym == YY__BAR + || sym == YY__LESS_LESS || sym == YY__GREATER_GREATER) { + return NULL; + } + } + if (c_do_splat(rcc, op2->type, op1)) { + if ((sym == YY__LESS || sym == YY__LESS_EQUAL || sym == YY__GREATER || sym == YY__GREATER_EQUAL + || sym == YY__EQUAL_EQUAL || sym == YY__BANG_EQUAL) + && !C_IS_TYPE_SIGNED(op2->type->vec.type)) { + return c_opaque_vector_type(rcc, op2->type); + } + return op2->type; + } } else if (t2 == C_TYPE_FUNC) { if (sym == YY__LESS || sym == YY__LESS_EQUAL || sym == YY__GREATER || sym == YY__GREATER_EQUAL || sym == YY__EQUAL_EQUAL || sym == YY__BANG_EQUAL || sym == YY__COLON) { @@ -6268,7 +6784,7 @@ static void c_do_mod(rcc_ctx *rcc, const c_type *type, c_value *op1, c_value *op static void c_do_shl(rcc_ctx *rcc, const c_type *type, c_value *op1, c_value *op2) { - if (c_value_is_const(op1) && c_value_is_const(op2)) { + if (c_value_is_const(op1) && c_value_is_const(op2) && op1->type->kind != C_TYPE_VECTOR) { ir_val val; uint32_t mask = (op2->type->size == 8) ? 63 : 31; @@ -6293,7 +6809,7 @@ static void c_do_shl(rcc_ctx *rcc, const c_type *type, c_value *op1, c_value *op static void c_do_shr(rcc_ctx *rcc, const c_type *type, c_value *op1, c_value *op2) { - if (c_value_is_const(op1) && c_value_is_const(op2)) { + if (c_value_is_const(op1) && c_value_is_const(op2) && op1->type->kind != C_TYPE_VECTOR) { ir_val val; uint32_t mask = (op2->type->size == 8) ? 63 : 31; @@ -6313,7 +6829,13 @@ static void c_do_shr(rcc_ctx *rcc, const c_type *type, c_value *op1, c_value *op } else { ir_type t = c_type2ir(rcc, type); - if (C_IS_TYPE_SIGNED(type)) { + if (type->kind == C_TYPE_VECTOR) { + if (C_IS_TYPE_SIGNED(type->vec.type)) { + c_value_set_rval(op1, type, t, ir_SAR(t, c_value_ref(rcc, op1), c_value_ref(rcc, op2))); + } else { + c_value_set_rval(op1, type, t, ir_SHR(t, c_value_ref(rcc, op1), c_value_ref(rcc, op2))); + } + } else if (C_IS_TYPE_SIGNED(type)) { c_value_set_rval(op1, type, t, ir_SAR(t, c_value_ref(rcc, op1), c_value_ref(rcc, op2))); } else { c_value_set_rval(op1, type, t, ir_SHR(t, c_value_ref(rcc, op1), c_value_ref(rcc, op2))); @@ -6402,6 +6924,13 @@ static void c_do_lt(rcc_ctx *rcc, const c_type *type, c_value *op1, c_value *op2 default: IR_ASSERT(0); return; } c_value_set_const(op1, &c_type_bool, IR_BOOL, val); + } else if (type->kind == C_TYPE_VECTOR) { + ir_type t = c_type2ir(rcc, type); + if (C_IS_TYPE_SIGNED(type->vec.type) || C_IS_TYPE_FP(type->vec.type)) { + c_value_set_rval(op1, type, t, ir_BINARY_OP(IR_LT, t, c_value_ref(rcc, op1), c_value_ref(rcc, op2))); + } else { + c_value_set_rval(op1, type, t, ir_BINARY_OP(IR_ULT, t, c_value_ref(rcc, op1), c_value_ref(rcc, op2))); + } } else { if (C_IS_TYPE_SIGNED(type) || C_IS_TYPE_FP(type)) { c_value_set_rval(op1, &c_type_bool, IR_BOOL, ir_LT(c_value_ref(rcc, op1), c_value_ref(rcc, op2))); @@ -6432,6 +6961,13 @@ static void c_do_gt(rcc_ctx *rcc, const c_type *type, c_value *op1, c_value *op2 default: IR_ASSERT(0); return; } c_value_set_const(op1, &c_type_bool, IR_BOOL, val); + } else if (type->kind == C_TYPE_VECTOR) { + ir_type t = c_type2ir(rcc, type); + if (C_IS_TYPE_SIGNED(type->vec.type) || C_IS_TYPE_FP(type->vec.type)) { + c_value_set_rval(op1, type, t, ir_BINARY_OP(IR_GT, t, c_value_ref(rcc, op1), c_value_ref(rcc, op2))); + } else { + c_value_set_rval(op1, type, t, ir_BINARY_OP(IR_UGT, t, c_value_ref(rcc, op1), c_value_ref(rcc, op2))); + } } else { if (C_IS_TYPE_SIGNED(type) || C_IS_TYPE_FP(type)) { c_value_set_rval(op1, &c_type_bool, IR_BOOL, ir_GT(c_value_ref(rcc, op1), c_value_ref(rcc, op2))); @@ -6462,6 +6998,13 @@ static void c_do_le(rcc_ctx *rcc, const c_type *type, c_value *op1, c_value *op2 default: IR_ASSERT(0); return; } c_value_set_const(op1, &c_type_bool, IR_BOOL, val); + } else if (type->kind == C_TYPE_VECTOR) { + ir_type t = c_type2ir(rcc, type); + if (C_IS_TYPE_SIGNED(type->vec.type) || C_IS_TYPE_FP(type->vec.type)) { + c_value_set_rval(op1, type, t, ir_BINARY_OP(IR_LE, t, c_value_ref(rcc, op1), c_value_ref(rcc, op2))); + } else { + c_value_set_rval(op1, type, t, ir_BINARY_OP(IR_ULE, t, c_value_ref(rcc, op1), c_value_ref(rcc, op2))); + } } else { if (C_IS_TYPE_SIGNED(type) || C_IS_TYPE_FP(type)) { c_value_set_rval(op1, &c_type_bool, IR_BOOL, ir_LE(c_value_ref(rcc, op1), c_value_ref(rcc, op2))); @@ -6492,6 +7035,13 @@ static void c_do_ge(rcc_ctx *rcc, const c_type *type, c_value *op1, c_value *op2 default: IR_ASSERT(0); return; } c_value_set_const(op1, &c_type_bool, IR_BOOL, val); + } else if (type->kind == C_TYPE_VECTOR) { + ir_type t = c_type2ir(rcc, type); + if (C_IS_TYPE_SIGNED(type->vec.type) || C_IS_TYPE_FP(type->vec.type)) { + c_value_set_rval(op1, type, t, ir_BINARY_OP(IR_GE, t, c_value_ref(rcc, op1), c_value_ref(rcc, op2))); + } else { + c_value_set_rval(op1, type, t, ir_BINARY_OP(IR_UGE, t, c_value_ref(rcc, op1), c_value_ref(rcc, op2))); + } } else { if (C_IS_TYPE_SIGNED(type) || C_IS_TYPE_FP(type)) { c_value_set_rval(op1, &c_type_bool, IR_BOOL, ir_GE(c_value_ref(rcc, op1), c_value_ref(rcc, op2))); @@ -6522,6 +7072,9 @@ static void c_do_eq(rcc_ctx *rcc, const c_type *type, c_value *op1, c_value *op2 default: IR_ASSERT(0); return; } c_value_set_const(op1, &c_type_bool, IR_BOOL, val); + } else if (type->kind == C_TYPE_VECTOR) { + ir_type t = c_type2ir(rcc, type); + c_value_set_rval(op1, type, t, ir_BINARY_OP(IR_EQ, t, c_value_ref(rcc, op1), c_value_ref(rcc, op2))); } else { c_value_set_rval(op1, &c_type_bool, IR_BOOL, ir_EQ(c_value_ref(rcc, op1), c_value_ref(rcc, op2))); } @@ -6548,6 +7101,9 @@ static void c_do_ne(rcc_ctx *rcc, const c_type *type, c_value *op1, c_value *op2 default: IR_ASSERT(0); return; } c_value_set_const(op1, &c_type_bool, IR_BOOL, val); + } else if (type->kind == C_TYPE_VECTOR) { + ir_type t = c_type2ir(rcc, type); + c_value_set_rval(op1, type, t, ir_BINARY_OP(IR_NE, t, c_value_ref(rcc, op1), c_value_ref(rcc, op2))); } else { c_value_set_rval(op1, &c_type_bool, IR_BOOL, ir_NE(c_value_ref(rcc, op1), c_value_ref(rcc, op2))); } @@ -6611,7 +7167,7 @@ void c_do_assign_op(rcc_ctx *rcc, yy_sym sym, c_value *op1, c_value *op2) } if (op1->type != op2->type) c_do_check_cvt(rcc, op1->type, op2, -1); if (op1->type->attr & C_ATTR_CONST) yy_error_fmt("%s of read-only location", "assignment"); - if (C_IS_TYPE_SCALAR_OR_PTR(op1->type)) { + if (C_IS_TYPE_SCALAR_OR_PTR(op1->type) || op1->type->kind == C_TYPE_VECTOR) { ir_ref ref = c_do_store(rcc, op1, op2); if (!IR_IS_CONST_REF(ref) || IR_IS_SYM_CONST(rcc->active_ctx->ir_base[ref].op)) { @@ -6673,7 +7229,10 @@ static void c_ir_IF_FALSE(rcc_ctx *rcc, ir_ref ref) ir_ref c_do_bool_and_start(rcc_ctx *rcc, c_value *op1) { - if (op1->type->kind == C_TYPE_VOID || op1->type->kind == C_TYPE_STRUCT || op1->type->kind == C_TYPE_UNION) { + if (op1->type->kind == C_TYPE_VOID + || op1->type->kind == C_TYPE_STRUCT + || op1->type->kind == C_TYPE_UNION + || op1->type->kind == C_TYPE_VECTOR) { yy_error("scalar is required"); } if (c_value_is_const(op1)) { @@ -6690,7 +7249,10 @@ void c_do_bool_and_end(rcc_ctx *rcc, c_value *op1, c_value *op2, ir_ref if_ref) { ir_val val; - if (op2->type->kind == C_TYPE_VOID || op2->type->kind == C_TYPE_STRUCT || op2->type->kind == C_TYPE_UNION) { + if (op2->type->kind == C_TYPE_VOID + || op2->type->kind == C_TYPE_STRUCT + || op2->type->kind == C_TYPE_UNION + || op2->type->kind == C_TYPE_VECTOR) { yy_error("scalar is required"); } if (if_ref) { @@ -6717,7 +7279,10 @@ void c_do_bool_and_end(rcc_ctx *rcc, c_value *op1, c_value *op2, ir_ref if_ref) ir_ref c_do_bool_or_start(rcc_ctx *rcc, c_value *op1) { - if (op1->type->kind == C_TYPE_VOID || op1->type->kind == C_TYPE_STRUCT || op1->type->kind == C_TYPE_UNION) { + if (op1->type->kind == C_TYPE_VOID + || op1->type->kind == C_TYPE_STRUCT + || op1->type->kind == C_TYPE_UNION + || op1->type->kind == C_TYPE_VECTOR) { yy_error("scalar is required"); } if (c_value_is_const(op1)) { @@ -6734,7 +7299,10 @@ void c_do_bool_or_end(rcc_ctx *rcc, c_value *op1, c_value *op2, ir_ref if_ref) { ir_val val; - if (op2->type->kind == C_TYPE_VOID || op2->type->kind == C_TYPE_STRUCT || op2->type->kind == C_TYPE_UNION) { + if (op2->type->kind == C_TYPE_VOID + || op2->type->kind == C_TYPE_STRUCT + || op2->type->kind == C_TYPE_UNION + || op2->type->kind == C_TYPE_VECTOR) { yy_error("scalar is required"); } if (if_ref) { @@ -6858,7 +7426,10 @@ ir_ref c_do_if(rcc_ctx *rcc, c_value *cond) { ir_ref ref; - if (cond->type->kind == C_TYPE_VOID || cond->type->kind == C_TYPE_STRUCT || cond->type->kind == C_TYPE_UNION) { + if (cond->type->kind == C_TYPE_VOID + || cond->type->kind == C_TYPE_STRUCT + || cond->type->kind == C_TYPE_UNION + || cond->type->kind == C_TYPE_VECTOR) { yy_error("scalar is required"); } else if (C_IS_TYPE_FP(cond->type)) { ir_val val; @@ -7271,7 +7842,10 @@ void c_do_loop_check(rcc_ctx *rcc, c_loop *loop, c_value *cond) { ir_ref ref; - if (cond->type->kind == C_TYPE_VOID || cond->type->kind == C_TYPE_STRUCT || cond->type->kind == C_TYPE_UNION) { + if (cond->type->kind == C_TYPE_VOID + || cond->type->kind == C_TYPE_STRUCT + || cond->type->kind == C_TYPE_UNION + || cond->type->kind == C_TYPE_VECTOR) { yy_error("scalar is required"); } else if (C_IS_TYPE_FP(cond->type)) { ir_val val; @@ -7981,7 +8555,19 @@ void c_do_computed_goto(rcc_ctx *rcc, c_value *v) ir_BEGIN(IR_UNUSED); } -static void c_do_init(void *addr, c_value *val) +static void c_do_init_vector(rcc_ctx *rcc, void *addr, c_value *val) +{ + IR_ASSERT(c_value_is_ref(val) && IR_IS_CONST_REF(val->u.ref)); + if (rcc->active_ctx->ir_base[val->u.ref].op == IR_SYM) { + IR_ASSERT(val->u.val.ptr); + memcpy(addr, val->u.val.ptr, val->type->size); + } else { + IR_ASSERT(rcc->active_ctx->ir_base[val->u.ref].op == IR_LONG_CONST); + memcpy(addr, ir_long_const_ptr(rcc->active_ctx, val->u.ref), val->type->size); + } +} + +static void c_do_init(rcc_ctx *rcc, void *addr, c_value *val) { const c_type *type = val->type; c_type_kind kind = type->kind; @@ -8012,6 +8598,7 @@ static void c_do_init(void *addr, c_value *val) case C_TYPE_STRUCT: case C_TYPE_UNION: memcpy(addr, val->u.val.ptr, type->size); break; case C_TYPE_ENUM: kind = type->enumeration.kind; goto repeat; + case C_TYPE_VECTOR: c_do_init_vector(rcc, addr, val); break; default: IR_ASSERT(0); } } @@ -8139,8 +8726,8 @@ void c_do_init_obj(rcc_ctx *rcc, c_sym *obj, c_value *val) if (!c_value_is_const(val) && !c_linker_fix_reloc(rcc, obj, 0, val)) { yy_error("initializer element is not constant"); } - c_do_init(obj->value.u.val.ptr, val); - } else if (C_IS_TYPE_SCALAR_OR_PTR(obj->value.type)) { + c_do_init(rcc, obj->value.u.val.ptr, val); + } else if (C_IS_TYPE_SCALAR_OR_PTR(obj->value.type) || obj->value.type->kind == C_TYPE_VECTOR) { IR_ASSERT(c_value_is_ref(&obj->value)); if (rcc->active_ctx->ir_base[obj->value.u.ref].op == IR_VAR) { ir_VSTORE(obj->value.u.ref, c_value_ref(rcc, val)); @@ -8188,6 +8775,22 @@ void c_do_init_start(rcc_ctx *rcc, c_sym *obj, c_init *init) init->stack[0].type = type; init->stack[0].pos = 0; init->stack[0].last = 0; + + if (type->kind == C_TYPE_VECTOR + && !c_value_is_const(&obj->value) && !(c_value_is_ref(&obj->value) && IR_IS_CONST_REF(obj->value.u.ref))) { + ir_val v; + ir_ref ref; + + v.u64 = 0; + ref = ir_SPLAT(c_type2ir(rcc, type), ir_const(rcc->active_ctx, v, c_type2ir(rcc, type->vec.type))); + + if (rcc->active_ctx->ir_base[obj->value.u.ref].op == IR_VAR) { + ir_VSTORE(obj->value.u.ref, ref); + } else { + IR_ASSERT(rcc->active_ctx->ir_base[obj->value.u.ref].op == IR_ALLOCA); + ir_STORE(obj->value.u.ref, ref); + } + } } void c_do_init_dim(rcc_ctx *rcc, c_sym *obj, c_init *init, c_value *dim) @@ -8288,6 +8891,13 @@ void c_do_init_next(rcc_ctx *rcc, c_sym *obj, c_init *init) yy_warning("excess elements in union initializer"); return; } + } else if (type->kind == C_TYPE_VECTOR) { + pos = init->stack[init->level].pos; + if (++pos < type->vec.length) { + init->stack[init->level].pos = pos; + return; + } + if (init->level == 0) yy_error("excess elements in vector initializer"); } else { if (init->level == 0) yy_error("excess elements in scalar initializer"); } @@ -8402,6 +9012,9 @@ void c_do_init_set(rcc_ctx *rcc, c_sym *obj, c_init *init, c_value *val) // TODO: select best type ??? type = type->record.fields[0].type; if (type->kind != C_TYPE_ARRAY && type->kind != C_TYPE_STRUCT && type->kind != C_TYPE_UNION) break; + } else if (type->kind == C_TYPE_VECTOR) { + type = type->vec.type; + break; } else { break; } @@ -8444,6 +9057,8 @@ void c_do_init_set(rcc_ctx *rcc, c_sym *obj, c_init *init, c_value *val) } else { IR_ASSERT(i == init->level); } + } else if (t->kind == C_TYPE_VECTOR) { + offset += t->vec.type->size * init->stack[i].pos; } else { IR_ASSERT(i == init->level); } @@ -8536,7 +9151,9 @@ void c_do_init_set(rcc_ctx *rcc, c_sym *obj, c_init *init, c_value *val) * We have to remove relocations added previously. */ c_linker_del_reloc(rcc, obj, offset); } - if (!c_value_is_const(val) && !c_linker_fix_reloc(rcc, obj, offset, val)) { + if (!c_value_is_const(val) + && !c_linker_fix_reloc(rcc, obj, offset, val) + && !(IR_IS_CONST_REF(val->u.ref) && val->type->kind == C_TYPE_VECTOR)) { yy_error("initializer element is not constant"); } IR_ASSERT(/*obj->value.u.type == IR_ADDR &&*/ obj->value.u.val.ptr); @@ -8545,7 +9162,7 @@ void c_do_init_set(rcc_ctx *rcc, c_sym *obj, c_init *init, c_value *val) init->size = new_size; } if (!C_IS_BIT_FIELD(bit_field)) { - c_do_init((char*)obj->value.u.val.ptr + offset, val); + c_do_init(rcc, (char*)obj->value.u.val.ptr + offset, val); } else { uint32_t first_bit = C_BIT_FIELD_START(bit_field); uint32_t bits = C_BIT_FIELD_SIZE(bit_field); @@ -8587,16 +9204,44 @@ void c_do_init_set(rcc_ctx *rcc, c_sym *obj, c_init *init, c_value *val) } } else if (rcc->active_ctx->ir_base[obj->value.u.ref].op == IR_VAR) { IR_ASSERT(!C_IS_BIT_FIELD(bit_field)); - ir_VSTORE(obj->value.u.ref, c_value_ref(rcc, val)); + + if (init->stack[init->level].type->kind == C_TYPE_VECTOR) { + const c_type *t = init->stack[init->level].type; + ir_type vt = c_type2ir(rcc, t); + ir_ref ref; + + offset -= t->vec.type->size * init->stack[init->level].pos; + IR_ASSERT(offset == 0); + ref = ir_VLOAD(vt, obj->value.u.ref); + ref = ir_REPLACE(vt, ref, ir_const_u8(rcc->active_ctx, init->stack[init->level].pos), + c_value_ref(rcc, val)); + ir_VSTORE(obj->value.u.ref, ref); + } else { + ir_VSTORE(obj->value.u.ref, c_value_ref(rcc, val)); + } } else if (c_value_is_reg(&obj->value)) { IR_ASSERT(!C_IS_BIT_FIELD(bit_field)); ir_RSTORE(obj->value.u.ref, c_value_ref(rcc, val)); } else { IR_ASSERT(rcc->active_ctx->ir_base[obj->value.u.ref].op == IR_ALLOCA); if (!C_IS_BIT_FIELD(bit_field)) { - ir_STORE( - ir_ADD_A(obj->value.u.ref, ir_const_size_t(rcc->active_ctx, offset)), - c_value_ref(rcc, val)); + if (init->stack[init->level].type->kind == C_TYPE_VECTOR) { + const c_type *t = init->stack[init->level].type; + ir_type vt = c_type2ir(rcc, t); + ir_ref ref; + + offset -= t->vec.type->size * init->stack[init->level].pos; + ref = ir_LOAD(vt, ir_ADD_A(obj->value.u.ref, ir_const_size_t(rcc->active_ctx, offset))); + ref = ir_REPLACE(vt, ref, ir_const_u8(rcc->active_ctx, init->stack[init->level].pos), + c_value_ref(rcc, val)); + ir_STORE( + ir_ADD_A(obj->value.u.ref, ir_const_size_t(rcc->active_ctx, offset)), + ref); + } else { + ir_STORE( + ir_ADD_A(obj->value.u.ref, ir_const_size_t(rcc->active_ctx, offset)), + c_value_ref(rcc, val)); + } } else if (!C_IS_BIT_FIELD_PACKED(bit_field)) { c_do_store_bit_field(rcc, ir_ADD_A(obj->value.u.ref, ir_const_size_t(rcc->active_ctx, offset)), @@ -8627,7 +9272,10 @@ void c_do_init_nested(rcc_ctx *rcc, c_sym *obj, c_init *init, bool b) } } - if (type->kind != C_TYPE_ARRAY && type->kind != C_TYPE_STRUCT && type->kind != C_TYPE_UNION) { + if (type->kind != C_TYPE_ARRAY + && type->kind != C_TYPE_STRUCT + && type->kind != C_TYPE_UNION + && type->kind != C_TYPE_VECTOR) { yy_warning("braces around scalar initializer"); } else if (!b) { init->level++; @@ -8672,7 +9320,9 @@ void c_do_init_expr_start(rcc_ctx *rcc, c_sym *obj, const c_type *type) if (rcc->active_func && !rcc->c_static_data) { ir_ref size = ir_const_size_t(rcc->active_ctx, type->size); ir_ref addr = c_do_alloca(rcc, type->size, c_attr2align(type->attr), 0); - ir_memzero(rcc, addr, size, c_attr2align(type->attr)); + if (type->kind != C_TYPE_VECTOR) { + ir_memzero(rcc, addr, size, c_attr2align(type->attr)); + } c_value_set_rval(&obj->value, type, IR_ADDR, addr); } else { c_dcl d = {.type = type, .flags = C_DCL_DEFINITION, .attr = 0}; @@ -8684,7 +9334,7 @@ void c_do_init_expr_start(rcc_ctx *rcc, c_sym *obj, const c_type *type) obj->tmp_data = 1; addr = ir_mem_calloc(1, type->size); } else { - addr = c_linker_allocate_data(rcc, 0, type->size, c_attr2align(type->attr)); + addr = c_linker_allocate_data(rcc, 0, type->size, c_attr2align(type->attr), type->kind == C_TYPE_ARRAY); } rcc->yy_hash.data[sym_name].sym->value.u.optx = IR_OPT(C_VAL_CONST, IR_ADDR); diff --git a/tests/vector/add-001.test b/tests/vector/add-001.test new file mode 100644 index 0000000..7d73a28 --- /dev/null +++ b/tests/vector/add-001.test @@ -0,0 +1,167 @@ +--TEST-- +ADD.001: 128-bit vectors SSE2 +--TARGET-- +!aarch64 +--ARGS-- +-mno-sse4 -mno-avx2 --run +--CODE-- +#define N 16 +#define I 1 + +int printf(const char *, ...); + +typedef long long i64; +typedef unsigned long long u64; +typedef int i32; +typedef unsigned int u32; +typedef short i16; +typedef unsigned short u16; +typedef char i8; +typedef unsigned char u8; + +typedef double __attribute__((__vector_size__(N))) v_d; +typedef float __attribute__((__vector_size__(N))) v_f; +typedef i64 __attribute__((__vector_size__(N))) v_i64; +typedef u64 __attribute__((__vector_size__(N))) v_u64; +typedef i32 __attribute__((__vector_size__(N))) v_i32; +typedef u32 __attribute__((__vector_size__(N))) v_u32; +typedef i16 __attribute__((__vector_size__(N))) v_i16; +typedef u16 __attribute__((__vector_size__(N))) v_u16; +typedef i8 __attribute__((__vector_size__(N))) v_i8; +typedef u8 __attribute__((__vector_size__(N))) v_u8; + +v_d __attribute__((noinline)) test_v_d(v_d v, double x) +{ + v += x; + return v; +} + +v_f __attribute__((noinline)) test_v_f(v_f v, float x) +{ + v += x; + return v; +} + +v_i64 __attribute__((noinline)) test_v_i64(v_i64 v, i64 x) +{ + v += x; + return v; +} + +v_u64 __attribute__((noinline)) test_v_u64(v_u64 v, u64 x) +{ + v += x; + return v; +} + +v_i32 __attribute__((noinline)) test_v_i32(v_i32 v, i32 x) +{ + v += x; + return v; +} + +v_u32 __attribute__((noinline)) test_v_u32(v_u32 v, u32 x) +{ + v += x; + return v; +} + +v_i16 __attribute__((noinline)) test_v_i16(v_i16 v, i16 x) +{ + v += x; + return v; +} + +v_u16 __attribute__((noinline)) test_v_u16(v_u16 v, u16 x) +{ + v += x; + return v; +} + +v_i8 __attribute__((noinline)) test_v_i8(v_i8 v, i8 x) +{ + v += x; + return v; +} + +v_u8 __attribute__((noinline)) test_v_u8(v_u8 v, u8 x) +{ + v += x; + return v; +} + +int main() +{ + { + v_d x = {}; + x = test_v_d(x, 42.42); + printf("%g\n", x[I]); + } + + { + v_f x = {}; + x = test_v_f(x, 42.42); + printf("%g\n", x[I]); + } + + { + v_i64 x = {}; + x = test_v_i64(x, 42); + printf("%lld\n", x[I]); + } + + { + v_u64 x = {}; + x = test_v_u64(x, 42); + printf("%lld\n", x[I]); + } + + { + v_i32 x = {}; + x = test_v_i32(x, 42); + printf("%d\n", x[I]); + } + + { + v_u32 x = {}; + x = test_v_u32(x, 42); + printf("%d\n", x[I]); + } + + { + v_i16 x = {}; + x = test_v_i16(x, 42); + printf("%d\n", x[I]); + } + + { + v_u16 x = {}; + x = test_v_u16(x, 42); + printf("%d\n", x[I]); + } + + { + v_i8 x = {}; + x = test_v_i8(x, 42); + printf("%d\n", x[I]); + } + + { + v_u8 x = {}; + x = test_v_u8(x, 42); + printf("%d\n", x[I]); + } + + return 0; +} +--EXPECT-- +42.42 +42.42 +42 +42 +42 +42 +42 +42 +42 +42 diff --git a/tests/vector/add-002.test b/tests/vector/add-002.test new file mode 100644 index 0000000..0249a5f --- /dev/null +++ b/tests/vector/add-002.test @@ -0,0 +1,167 @@ +--TEST-- +ADD.002: 128-bit vectors SSE2+SSE4 +--TARGET-- +!aarch64 +--ARGS-- +-mno-avx2 --run +--CODE-- +#define N 16 +#define I 1 + +int printf(const char *, ...); + +typedef long long i64; +typedef unsigned long long u64; +typedef int i32; +typedef unsigned int u32; +typedef short i16; +typedef unsigned short u16; +typedef char i8; +typedef unsigned char u8; + +typedef double __attribute__((__vector_size__(N))) v_d; +typedef float __attribute__((__vector_size__(N))) v_f; +typedef i64 __attribute__((__vector_size__(N))) v_i64; +typedef u64 __attribute__((__vector_size__(N))) v_u64; +typedef i32 __attribute__((__vector_size__(N))) v_i32; +typedef u32 __attribute__((__vector_size__(N))) v_u32; +typedef i16 __attribute__((__vector_size__(N))) v_i16; +typedef u16 __attribute__((__vector_size__(N))) v_u16; +typedef i8 __attribute__((__vector_size__(N))) v_i8; +typedef u8 __attribute__((__vector_size__(N))) v_u8; + +v_d __attribute__((noinline)) test_v_d(v_d v, double x) +{ + v += x; + return v; +} + +v_f __attribute__((noinline)) test_v_f(v_f v, float x) +{ + v += x; + return v; +} + +v_i64 __attribute__((noinline)) test_v_i64(v_i64 v, i64 x) +{ + v += x; + return v; +} + +v_u64 __attribute__((noinline)) test_v_u64(v_u64 v, u64 x) +{ + v += x; + return v; +} + +v_i32 __attribute__((noinline)) test_v_i32(v_i32 v, i32 x) +{ + v += x; + return v; +} + +v_u32 __attribute__((noinline)) test_v_u32(v_u32 v, u32 x) +{ + v += x; + return v; +} + +v_i16 __attribute__((noinline)) test_v_i16(v_i16 v, i16 x) +{ + v += x; + return v; +} + +v_u16 __attribute__((noinline)) test_v_u16(v_u16 v, u16 x) +{ + v += x; + return v; +} + +v_i8 __attribute__((noinline)) test_v_i8(v_i8 v, i8 x) +{ + v += x; + return v; +} + +v_u8 __attribute__((noinline)) test_v_u8(v_u8 v, u8 x) +{ + v += x; + return v; +} + +int main() +{ + { + v_d x = {}; + x = test_v_d(x, 42.42); + printf("%g\n", x[I]); + } + + { + v_f x = {}; + x = test_v_f(x, 42.42); + printf("%g\n", x[I]); + } + + { + v_i64 x = {}; + x = test_v_i64(x, 42); + printf("%lld\n", x[I]); + } + + { + v_u64 x = {}; + x = test_v_u64(x, 42); + printf("%lld\n", x[I]); + } + + { + v_i32 x = {}; + x = test_v_i32(x, 42); + printf("%d\n", x[I]); + } + + { + v_u32 x = {}; + x = test_v_u32(x, 42); + printf("%d\n", x[I]); + } + + { + v_i16 x = {}; + x = test_v_i16(x, 42); + printf("%d\n", x[I]); + } + + { + v_u16 x = {}; + x = test_v_u16(x, 42); + printf("%d\n", x[I]); + } + + { + v_i8 x = {}; + x = test_v_i8(x, 42); + printf("%d\n", x[I]); + } + + { + v_u8 x = {}; + x = test_v_u8(x, 42); + printf("%d\n", x[I]); + } + + return 0; +} +--EXPECT-- +42.42 +42.42 +42 +42 +42 +42 +42 +42 +42 +42 diff --git a/tests/vector/add-003.test b/tests/vector/add-003.test new file mode 100644 index 0000000..0cacb4a --- /dev/null +++ b/tests/vector/add-003.test @@ -0,0 +1,167 @@ +--TEST-- +ADD.003: 128-bit vectors AVX +--TARGET-- +!aarch64 +--ARGS-- +-mavx -mno-avx2 --run +--CODE-- +#define N 16 +#define I 1 + +int printf(const char *, ...); + +typedef long long i64; +typedef unsigned long long u64; +typedef int i32; +typedef unsigned int u32; +typedef short i16; +typedef unsigned short u16; +typedef char i8; +typedef unsigned char u8; + +typedef double __attribute__((__vector_size__(N))) v_d; +typedef float __attribute__((__vector_size__(N))) v_f; +typedef i64 __attribute__((__vector_size__(N))) v_i64; +typedef u64 __attribute__((__vector_size__(N))) v_u64; +typedef i32 __attribute__((__vector_size__(N))) v_i32; +typedef u32 __attribute__((__vector_size__(N))) v_u32; +typedef i16 __attribute__((__vector_size__(N))) v_i16; +typedef u16 __attribute__((__vector_size__(N))) v_u16; +typedef i8 __attribute__((__vector_size__(N))) v_i8; +typedef u8 __attribute__((__vector_size__(N))) v_u8; + +v_d __attribute__((noinline)) test_v_d(v_d v, double x) +{ + v += x; + return v; +} + +v_f __attribute__((noinline)) test_v_f(v_f v, float x) +{ + v += x; + return v; +} + +v_i64 __attribute__((noinline)) test_v_i64(v_i64 v, i64 x) +{ + v += x; + return v; +} + +v_u64 __attribute__((noinline)) test_v_u64(v_u64 v, u64 x) +{ + v += x; + return v; +} + +v_i32 __attribute__((noinline)) test_v_i32(v_i32 v, i32 x) +{ + v += x; + return v; +} + +v_u32 __attribute__((noinline)) test_v_u32(v_u32 v, u32 x) +{ + v += x; + return v; +} + +v_i16 __attribute__((noinline)) test_v_i16(v_i16 v, i16 x) +{ + v += x; + return v; +} + +v_u16 __attribute__((noinline)) test_v_u16(v_u16 v, u16 x) +{ + v += x; + return v; +} + +v_i8 __attribute__((noinline)) test_v_i8(v_i8 v, i8 x) +{ + v += x; + return v; +} + +v_u8 __attribute__((noinline)) test_v_u8(v_u8 v, u8 x) +{ + v += x; + return v; +} + +int main() +{ + { + v_d x = {}; + x = test_v_d(x, 42.42); + printf("%g\n", x[I]); + } + + { + v_f x = {}; + x = test_v_f(x, 42.42); + printf("%g\n", x[I]); + } + + { + v_i64 x = {}; + x = test_v_i64(x, 42); + printf("%lld\n", x[I]); + } + + { + v_u64 x = {}; + x = test_v_u64(x, 42); + printf("%lld\n", x[I]); + } + + { + v_i32 x = {}; + x = test_v_i32(x, 42); + printf("%d\n", x[I]); + } + + { + v_u32 x = {}; + x = test_v_u32(x, 42); + printf("%d\n", x[I]); + } + + { + v_i16 x = {}; + x = test_v_i16(x, 42); + printf("%d\n", x[I]); + } + + { + v_u16 x = {}; + x = test_v_u16(x, 42); + printf("%d\n", x[I]); + } + + { + v_i8 x = {}; + x = test_v_i8(x, 42); + printf("%d\n", x[I]); + } + + { + v_u8 x = {}; + x = test_v_u8(x, 42); + printf("%d\n", x[I]); + } + + return 0; +} +--EXPECT-- +42.42 +42.42 +42 +42 +42 +42 +42 +42 +42 +42 diff --git a/tests/vector/add-004.test b/tests/vector/add-004.test new file mode 100644 index 0000000..dc14bfd --- /dev/null +++ b/tests/vector/add-004.test @@ -0,0 +1,167 @@ +--TEST-- +ADD.004: 128-bit vectors AVX+AVX2 +--TARGET-- +!aarch64 +--ARGS-- +-mavx --run +--CODE-- +#define N 16 +#define I 1 + +int printf(const char *, ...); + +typedef long long i64; +typedef unsigned long long u64; +typedef int i32; +typedef unsigned int u32; +typedef short i16; +typedef unsigned short u16; +typedef char i8; +typedef unsigned char u8; + +typedef double __attribute__((__vector_size__(N))) v_d; +typedef float __attribute__((__vector_size__(N))) v_f; +typedef i64 __attribute__((__vector_size__(N))) v_i64; +typedef u64 __attribute__((__vector_size__(N))) v_u64; +typedef i32 __attribute__((__vector_size__(N))) v_i32; +typedef u32 __attribute__((__vector_size__(N))) v_u32; +typedef i16 __attribute__((__vector_size__(N))) v_i16; +typedef u16 __attribute__((__vector_size__(N))) v_u16; +typedef i8 __attribute__((__vector_size__(N))) v_i8; +typedef u8 __attribute__((__vector_size__(N))) v_u8; + +v_d __attribute__((noinline)) test_v_d(v_d v, double x) +{ + v += x; + return v; +} + +v_f __attribute__((noinline)) test_v_f(v_f v, float x) +{ + v += x; + return v; +} + +v_i64 __attribute__((noinline)) test_v_i64(v_i64 v, i64 x) +{ + v += x; + return v; +} + +v_u64 __attribute__((noinline)) test_v_u64(v_u64 v, u64 x) +{ + v += x; + return v; +} + +v_i32 __attribute__((noinline)) test_v_i32(v_i32 v, i32 x) +{ + v += x; + return v; +} + +v_u32 __attribute__((noinline)) test_v_u32(v_u32 v, u32 x) +{ + v += x; + return v; +} + +v_i16 __attribute__((noinline)) test_v_i16(v_i16 v, i16 x) +{ + v += x; + return v; +} + +v_u16 __attribute__((noinline)) test_v_u16(v_u16 v, u16 x) +{ + v += x; + return v; +} + +v_i8 __attribute__((noinline)) test_v_i8(v_i8 v, i8 x) +{ + v += x; + return v; +} + +v_u8 __attribute__((noinline)) test_v_u8(v_u8 v, u8 x) +{ + v += x; + return v; +} + +int main() +{ + { + v_d x = {}; + x = test_v_d(x, 42.42); + printf("%g\n", x[I]); + } + + { + v_f x = {}; + x = test_v_f(x, 42.42); + printf("%g\n", x[I]); + } + + { + v_i64 x = {}; + x = test_v_i64(x, 42); + printf("%lld\n", x[I]); + } + + { + v_u64 x = {}; + x = test_v_u64(x, 42); + printf("%lld\n", x[I]); + } + + { + v_i32 x = {}; + x = test_v_i32(x, 42); + printf("%d\n", x[I]); + } + + { + v_u32 x = {}; + x = test_v_u32(x, 42); + printf("%d\n", x[I]); + } + + { + v_i16 x = {}; + x = test_v_i16(x, 42); + printf("%d\n", x[I]); + } + + { + v_u16 x = {}; + x = test_v_u16(x, 42); + printf("%d\n", x[I]); + } + + { + v_i8 x = {}; + x = test_v_i8(x, 42); + printf("%d\n", x[I]); + } + + { + v_u8 x = {}; + x = test_v_u8(x, 42); + printf("%d\n", x[I]); + } + + return 0; +} +--EXPECT-- +42.42 +42.42 +42 +42 +42 +42 +42 +42 +42 +42 diff --git a/tests/vector/add-005.test b/tests/vector/add-005.test new file mode 100644 index 0000000..938a5e2 --- /dev/null +++ b/tests/vector/add-005.test @@ -0,0 +1,167 @@ +--TEST-- +ADD.005: 64-bit vectors SSE2 +--TARGET-- +!aarch64 +--ARGS-- +-mno-sse4 -mno-avx2 --run +--CODE-- +#define N 8 +#define I 0 + +int printf(const char *, ...); + +typedef long long i64; +typedef unsigned long long u64; +typedef int i32; +typedef unsigned int u32; +typedef short i16; +typedef unsigned short u16; +typedef char i8; +typedef unsigned char u8; + +typedef double __attribute__((__vector_size__(N))) v_d; +typedef float __attribute__((__vector_size__(N))) v_f; +typedef i64 __attribute__((__vector_size__(N))) v_i64; +typedef u64 __attribute__((__vector_size__(N))) v_u64; +typedef i32 __attribute__((__vector_size__(N))) v_i32; +typedef u32 __attribute__((__vector_size__(N))) v_u32; +typedef i16 __attribute__((__vector_size__(N))) v_i16; +typedef u16 __attribute__((__vector_size__(N))) v_u16; +typedef i8 __attribute__((__vector_size__(N))) v_i8; +typedef u8 __attribute__((__vector_size__(N))) v_u8; + +v_d __attribute__((noinline)) test_v_d(v_d v, double x) +{ + v += x; + return v; +} + +v_f __attribute__((noinline)) test_v_f(v_f v, float x) +{ + v += x; + return v; +} + +v_i64 __attribute__((noinline)) test_v_i64(v_i64 v, i64 x) +{ + v += x; + return v; +} + +v_u64 __attribute__((noinline)) test_v_u64(v_u64 v, u64 x) +{ + v += x; + return v; +} + +v_i32 __attribute__((noinline)) test_v_i32(v_i32 v, i32 x) +{ + v += x; + return v; +} + +v_u32 __attribute__((noinline)) test_v_u32(v_u32 v, u32 x) +{ + v += x; + return v; +} + +v_i16 __attribute__((noinline)) test_v_i16(v_i16 v, i16 x) +{ + v += x; + return v; +} + +v_u16 __attribute__((noinline)) test_v_u16(v_u16 v, u16 x) +{ + v += x; + return v; +} + +v_i8 __attribute__((noinline)) test_v_i8(v_i8 v, i8 x) +{ + v += x; + return v; +} + +v_u8 __attribute__((noinline)) test_v_u8(v_u8 v, u8 x) +{ + v += x; + return v; +} + +int main() +{ + { + v_d x = {}; + x = test_v_d(x, 42.42); + printf("%g\n", x[I]); + } + + { + v_f x = {}; + x = test_v_f(x, 42.42); + printf("%g\n", x[I]); + } + + { + v_i64 x = {}; + x = test_v_i64(x, 42); + printf("%lld\n", x[I]); + } + + { + v_u64 x = {}; + x = test_v_u64(x, 42); + printf("%lld\n", x[I]); + } + + { + v_i32 x = {}; + x = test_v_i32(x, 42); + printf("%d\n", x[I]); + } + + { + v_u32 x = {}; + x = test_v_u32(x, 42); + printf("%d\n", x[I]); + } + + { + v_i16 x = {}; + x = test_v_i16(x, 42); + printf("%d\n", x[I]); + } + + { + v_u16 x = {}; + x = test_v_u16(x, 42); + printf("%d\n", x[I]); + } + + { + v_i8 x = {}; + x = test_v_i8(x, 42); + printf("%d\n", x[I]); + } + + { + v_u8 x = {}; + x = test_v_u8(x, 42); + printf("%d\n", x[I]); + } + + return 0; +} +--EXPECT-- +42.42 +42.42 +42 +42 +42 +42 +42 +42 +42 +42 diff --git a/tests/vector/add-006.test b/tests/vector/add-006.test new file mode 100644 index 0000000..e49c13f --- /dev/null +++ b/tests/vector/add-006.test @@ -0,0 +1,167 @@ +--TEST-- +ADD.006: 64-bit vectors SSE2+SSE4 +--TARGET-- +!aarch64 +--ARGS-- +-mno-avx2 --run +--CODE-- +#define N 8 +#define I 0 + +int printf(const char *, ...); + +typedef long long i64; +typedef unsigned long long u64; +typedef int i32; +typedef unsigned int u32; +typedef short i16; +typedef unsigned short u16; +typedef char i8; +typedef unsigned char u8; + +typedef double __attribute__((__vector_size__(N))) v_d; +typedef float __attribute__((__vector_size__(N))) v_f; +typedef i64 __attribute__((__vector_size__(N))) v_i64; +typedef u64 __attribute__((__vector_size__(N))) v_u64; +typedef i32 __attribute__((__vector_size__(N))) v_i32; +typedef u32 __attribute__((__vector_size__(N))) v_u32; +typedef i16 __attribute__((__vector_size__(N))) v_i16; +typedef u16 __attribute__((__vector_size__(N))) v_u16; +typedef i8 __attribute__((__vector_size__(N))) v_i8; +typedef u8 __attribute__((__vector_size__(N))) v_u8; + +v_d __attribute__((noinline)) test_v_d(v_d v, double x) +{ + v += x; + return v; +} + +v_f __attribute__((noinline)) test_v_f(v_f v, float x) +{ + v += x; + return v; +} + +v_i64 __attribute__((noinline)) test_v_i64(v_i64 v, i64 x) +{ + v += x; + return v; +} + +v_u64 __attribute__((noinline)) test_v_u64(v_u64 v, u64 x) +{ + v += x; + return v; +} + +v_i32 __attribute__((noinline)) test_v_i32(v_i32 v, i32 x) +{ + v += x; + return v; +} + +v_u32 __attribute__((noinline)) test_v_u32(v_u32 v, u32 x) +{ + v += x; + return v; +} + +v_i16 __attribute__((noinline)) test_v_i16(v_i16 v, i16 x) +{ + v += x; + return v; +} + +v_u16 __attribute__((noinline)) test_v_u16(v_u16 v, u16 x) +{ + v += x; + return v; +} + +v_i8 __attribute__((noinline)) test_v_i8(v_i8 v, i8 x) +{ + v += x; + return v; +} + +v_u8 __attribute__((noinline)) test_v_u8(v_u8 v, u8 x) +{ + v += x; + return v; +} + +int main() +{ + { + v_d x = {}; + x = test_v_d(x, 42.42); + printf("%g\n", x[I]); + } + + { + v_f x = {}; + x = test_v_f(x, 42.42); + printf("%g\n", x[I]); + } + + { + v_i64 x = {}; + x = test_v_i64(x, 42); + printf("%lld\n", x[I]); + } + + { + v_u64 x = {}; + x = test_v_u64(x, 42); + printf("%lld\n", x[I]); + } + + { + v_i32 x = {}; + x = test_v_i32(x, 42); + printf("%d\n", x[I]); + } + + { + v_u32 x = {}; + x = test_v_u32(x, 42); + printf("%d\n", x[I]); + } + + { + v_i16 x = {}; + x = test_v_i16(x, 42); + printf("%d\n", x[I]); + } + + { + v_u16 x = {}; + x = test_v_u16(x, 42); + printf("%d\n", x[I]); + } + + { + v_i8 x = {}; + x = test_v_i8(x, 42); + printf("%d\n", x[I]); + } + + { + v_u8 x = {}; + x = test_v_u8(x, 42); + printf("%d\n", x[I]); + } + + return 0; +} +--EXPECT-- +42.42 +42.42 +42 +42 +42 +42 +42 +42 +42 +42 diff --git a/tests/vector/add-007.test b/tests/vector/add-007.test new file mode 100644 index 0000000..b9df0c4 --- /dev/null +++ b/tests/vector/add-007.test @@ -0,0 +1,167 @@ +--TEST-- +ADD.007: 64-bit vectors AVX +--TARGET-- +!aarch64 +--ARGS-- +-mavx -mno-avx2 --run +--CODE-- +#define N 8 +#define I 0 + +int printf(const char *, ...); + +typedef long long i64; +typedef unsigned long long u64; +typedef int i32; +typedef unsigned int u32; +typedef short i16; +typedef unsigned short u16; +typedef char i8; +typedef unsigned char u8; + +typedef double __attribute__((__vector_size__(N))) v_d; +typedef float __attribute__((__vector_size__(N))) v_f; +typedef i64 __attribute__((__vector_size__(N))) v_i64; +typedef u64 __attribute__((__vector_size__(N))) v_u64; +typedef i32 __attribute__((__vector_size__(N))) v_i32; +typedef u32 __attribute__((__vector_size__(N))) v_u32; +typedef i16 __attribute__((__vector_size__(N))) v_i16; +typedef u16 __attribute__((__vector_size__(N))) v_u16; +typedef i8 __attribute__((__vector_size__(N))) v_i8; +typedef u8 __attribute__((__vector_size__(N))) v_u8; + +v_d __attribute__((noinline)) test_v_d(v_d v, double x) +{ + v += x; + return v; +} + +v_f __attribute__((noinline)) test_v_f(v_f v, float x) +{ + v += x; + return v; +} + +v_i64 __attribute__((noinline)) test_v_i64(v_i64 v, i64 x) +{ + v += x; + return v; +} + +v_u64 __attribute__((noinline)) test_v_u64(v_u64 v, u64 x) +{ + v += x; + return v; +} + +v_i32 __attribute__((noinline)) test_v_i32(v_i32 v, i32 x) +{ + v += x; + return v; +} + +v_u32 __attribute__((noinline)) test_v_u32(v_u32 v, u32 x) +{ + v += x; + return v; +} + +v_i16 __attribute__((noinline)) test_v_i16(v_i16 v, i16 x) +{ + v += x; + return v; +} + +v_u16 __attribute__((noinline)) test_v_u16(v_u16 v, u16 x) +{ + v += x; + return v; +} + +v_i8 __attribute__((noinline)) test_v_i8(v_i8 v, i8 x) +{ + v += x; + return v; +} + +v_u8 __attribute__((noinline)) test_v_u8(v_u8 v, u8 x) +{ + v += x; + return v; +} + +int main() +{ + { + v_d x = {}; + x = test_v_d(x, 42.42); + printf("%g\n", x[I]); + } + + { + v_f x = {}; + x = test_v_f(x, 42.42); + printf("%g\n", x[I]); + } + + { + v_i64 x = {}; + x = test_v_i64(x, 42); + printf("%lld\n", x[I]); + } + + { + v_u64 x = {}; + x = test_v_u64(x, 42); + printf("%lld\n", x[I]); + } + + { + v_i32 x = {}; + x = test_v_i32(x, 42); + printf("%d\n", x[I]); + } + + { + v_u32 x = {}; + x = test_v_u32(x, 42); + printf("%d\n", x[I]); + } + + { + v_i16 x = {}; + x = test_v_i16(x, 42); + printf("%d\n", x[I]); + } + + { + v_u16 x = {}; + x = test_v_u16(x, 42); + printf("%d\n", x[I]); + } + + { + v_i8 x = {}; + x = test_v_i8(x, 42); + printf("%d\n", x[I]); + } + + { + v_u8 x = {}; + x = test_v_u8(x, 42); + printf("%d\n", x[I]); + } + + return 0; +} +--EXPECT-- +42.42 +42.42 +42 +42 +42 +42 +42 +42 +42 +42 diff --git a/tests/vector/add-008.test b/tests/vector/add-008.test new file mode 100644 index 0000000..e1766ce --- /dev/null +++ b/tests/vector/add-008.test @@ -0,0 +1,167 @@ +--TEST-- +ADD.008: 64-bit vectors AVX+AVX2 +--TARGET-- +!aarch64 +--ARGS-- +-mavx --run +--CODE-- +#define N 8 +#define I 0 + +int printf(const char *, ...); + +typedef long long i64; +typedef unsigned long long u64; +typedef int i32; +typedef unsigned int u32; +typedef short i16; +typedef unsigned short u16; +typedef char i8; +typedef unsigned char u8; + +typedef double __attribute__((__vector_size__(N))) v_d; +typedef float __attribute__((__vector_size__(N))) v_f; +typedef i64 __attribute__((__vector_size__(N))) v_i64; +typedef u64 __attribute__((__vector_size__(N))) v_u64; +typedef i32 __attribute__((__vector_size__(N))) v_i32; +typedef u32 __attribute__((__vector_size__(N))) v_u32; +typedef i16 __attribute__((__vector_size__(N))) v_i16; +typedef u16 __attribute__((__vector_size__(N))) v_u16; +typedef i8 __attribute__((__vector_size__(N))) v_i8; +typedef u8 __attribute__((__vector_size__(N))) v_u8; + +v_d __attribute__((noinline)) test_v_d(v_d v, double x) +{ + v += x; + return v; +} + +v_f __attribute__((noinline)) test_v_f(v_f v, float x) +{ + v += x; + return v; +} + +v_i64 __attribute__((noinline)) test_v_i64(v_i64 v, i64 x) +{ + v += x; + return v; +} + +v_u64 __attribute__((noinline)) test_v_u64(v_u64 v, u64 x) +{ + v += x; + return v; +} + +v_i32 __attribute__((noinline)) test_v_i32(v_i32 v, i32 x) +{ + v += x; + return v; +} + +v_u32 __attribute__((noinline)) test_v_u32(v_u32 v, u32 x) +{ + v += x; + return v; +} + +v_i16 __attribute__((noinline)) test_v_i16(v_i16 v, i16 x) +{ + v += x; + return v; +} + +v_u16 __attribute__((noinline)) test_v_u16(v_u16 v, u16 x) +{ + v += x; + return v; +} + +v_i8 __attribute__((noinline)) test_v_i8(v_i8 v, i8 x) +{ + v += x; + return v; +} + +v_u8 __attribute__((noinline)) test_v_u8(v_u8 v, u8 x) +{ + v += x; + return v; +} + +int main() +{ + { + v_d x = {}; + x = test_v_d(x, 42.42); + printf("%g\n", x[I]); + } + + { + v_f x = {}; + x = test_v_f(x, 42.42); + printf("%g\n", x[I]); + } + + { + v_i64 x = {}; + x = test_v_i64(x, 42); + printf("%lld\n", x[I]); + } + + { + v_u64 x = {}; + x = test_v_u64(x, 42); + printf("%lld\n", x[I]); + } + + { + v_i32 x = {}; + x = test_v_i32(x, 42); + printf("%d\n", x[I]); + } + + { + v_u32 x = {}; + x = test_v_u32(x, 42); + printf("%d\n", x[I]); + } + + { + v_i16 x = {}; + x = test_v_i16(x, 42); + printf("%d\n", x[I]); + } + + { + v_u16 x = {}; + x = test_v_u16(x, 42); + printf("%d\n", x[I]); + } + + { + v_i8 x = {}; + x = test_v_i8(x, 42); + printf("%d\n", x[I]); + } + + { + v_u8 x = {}; + x = test_v_u8(x, 42); + printf("%d\n", x[I]); + } + + return 0; +} +--EXPECT-- +42.42 +42.42 +42 +42 +42 +42 +42 +42 +42 +42 diff --git a/tests/vector/add-009.test b/tests/vector/add-009.test new file mode 100644 index 0000000..0e45c28 --- /dev/null +++ b/tests/vector/add-009.test @@ -0,0 +1,167 @@ +--TEST-- +ADD.009: 256-bit vectors AVX +--TARGET-- +!aarch64 +--ARGS-- +-mavx -mno-avx2 --run +--CODE-- +#define N 32 +#define I 3 + +int printf(const char *, ...); + +typedef long long i64; +typedef unsigned long long u64; +typedef int i32; +typedef unsigned int u32; +typedef short i16; +typedef unsigned short u16; +typedef char i8; +typedef unsigned char u8; + +typedef double __attribute__((__vector_size__(N))) v_d; +typedef float __attribute__((__vector_size__(N))) v_f; +typedef i64 __attribute__((__vector_size__(N))) v_i64; +typedef u64 __attribute__((__vector_size__(N))) v_u64; +typedef i32 __attribute__((__vector_size__(N))) v_i32; +typedef u32 __attribute__((__vector_size__(N))) v_u32; +typedef i16 __attribute__((__vector_size__(N))) v_i16; +typedef u16 __attribute__((__vector_size__(N))) v_u16; +typedef i8 __attribute__((__vector_size__(N))) v_i8; +typedef u8 __attribute__((__vector_size__(N))) v_u8; + +v_d __attribute__((noinline)) test_v_d(v_d v, double x) +{ + v += x; + return v; +} + +v_f __attribute__((noinline)) test_v_f(v_f v, float x) +{ + v += x; + return v; +} + +v_i64 __attribute__((noinline)) test_v_i64(v_i64 v, i64 x) +{ + v += x; + return v; +} + +v_u64 __attribute__((noinline)) test_v_u64(v_u64 v, u64 x) +{ + v += x; + return v; +} + +v_i32 __attribute__((noinline)) test_v_i32(v_i32 v, i32 x) +{ + v += x; + return v; +} + +v_u32 __attribute__((noinline)) test_v_u32(v_u32 v, u32 x) +{ + v += x; + return v; +} + +v_i16 __attribute__((noinline)) test_v_i16(v_i16 v, i16 x) +{ + v += x; + return v; +} + +v_u16 __attribute__((noinline)) test_v_u16(v_u16 v, u16 x) +{ + v += x; + return v; +} + +v_i8 __attribute__((noinline)) test_v_i8(v_i8 v, i8 x) +{ + v += x; + return v; +} + +v_u8 __attribute__((noinline)) test_v_u8(v_u8 v, u8 x) +{ + v += x; + return v; +} + +int main() +{ + { + v_d x = {}; + x = test_v_d(x, 42.42); + printf("%g\n", x[I]); + } + + { + v_f x = {}; + x = test_v_f(x, 42.42); + printf("%g\n", x[I]); + } + + { + v_i64 x = {}; + x = test_v_i64(x, 42); + printf("%lld\n", x[I]); + } + + { + v_u64 x = {}; + x = test_v_u64(x, 42); + printf("%lld\n", x[I]); + } + + { + v_i32 x = {}; + x = test_v_i32(x, 42); + printf("%d\n", x[I]); + } + + { + v_u32 x = {}; + x = test_v_u32(x, 42); + printf("%d\n", x[I]); + } + + { + v_i16 x = {}; + x = test_v_i16(x, 42); + printf("%d\n", x[I]); + } + + { + v_u16 x = {}; + x = test_v_u16(x, 42); + printf("%d\n", x[I]); + } + + { + v_i8 x = {}; + x = test_v_i8(x, 42); + printf("%d\n", x[I]); + } + + { + v_u8 x = {}; + x = test_v_u8(x, 42); + printf("%d\n", x[I]); + } + + return 0; +} +--EXPECT-- +42.42 +42.42 +42 +42 +42 +42 +42 +42 +42 +42 diff --git a/tests/vector/add-010.test b/tests/vector/add-010.test new file mode 100644 index 0000000..f6a4175 --- /dev/null +++ b/tests/vector/add-010.test @@ -0,0 +1,167 @@ +--TEST-- +ADD.010: 256-bit vectors AVX+AVX2 +--TARGET-- +!aarch64 +--ARGS-- +-mavx --run +--CODE-- +#define N 32 +#define I 3 + +int printf(const char *, ...); + +typedef long long i64; +typedef unsigned long long u64; +typedef int i32; +typedef unsigned int u32; +typedef short i16; +typedef unsigned short u16; +typedef char i8; +typedef unsigned char u8; + +typedef double __attribute__((__vector_size__(N))) v_d; +typedef float __attribute__((__vector_size__(N))) v_f; +typedef i64 __attribute__((__vector_size__(N))) v_i64; +typedef u64 __attribute__((__vector_size__(N))) v_u64; +typedef i32 __attribute__((__vector_size__(N))) v_i32; +typedef u32 __attribute__((__vector_size__(N))) v_u32; +typedef i16 __attribute__((__vector_size__(N))) v_i16; +typedef u16 __attribute__((__vector_size__(N))) v_u16; +typedef i8 __attribute__((__vector_size__(N))) v_i8; +typedef u8 __attribute__((__vector_size__(N))) v_u8; + +v_d __attribute__((noinline)) test_v_d(v_d v, double x) +{ + v += x; + return v; +} + +v_f __attribute__((noinline)) test_v_f(v_f v, float x) +{ + v += x; + return v; +} + +v_i64 __attribute__((noinline)) test_v_i64(v_i64 v, i64 x) +{ + v += x; + return v; +} + +v_u64 __attribute__((noinline)) test_v_u64(v_u64 v, u64 x) +{ + v += x; + return v; +} + +v_i32 __attribute__((noinline)) test_v_i32(v_i32 v, i32 x) +{ + v += x; + return v; +} + +v_u32 __attribute__((noinline)) test_v_u32(v_u32 v, u32 x) +{ + v += x; + return v; +} + +v_i16 __attribute__((noinline)) test_v_i16(v_i16 v, i16 x) +{ + v += x; + return v; +} + +v_u16 __attribute__((noinline)) test_v_u16(v_u16 v, u16 x) +{ + v += x; + return v; +} + +v_i8 __attribute__((noinline)) test_v_i8(v_i8 v, i8 x) +{ + v += x; + return v; +} + +v_u8 __attribute__((noinline)) test_v_u8(v_u8 v, u8 x) +{ + v += x; + return v; +} + +int main() +{ + { + v_d x = {}; + x = test_v_d(x, 42.42); + printf("%g\n", x[I]); + } + + { + v_f x = {}; + x = test_v_f(x, 42.42); + printf("%g\n", x[I]); + } + + { + v_i64 x = {}; + x = test_v_i64(x, 42); + printf("%lld\n", x[I]); + } + + { + v_u64 x = {}; + x = test_v_u64(x, 42); + printf("%lld\n", x[I]); + } + + { + v_i32 x = {}; + x = test_v_i32(x, 42); + printf("%d\n", x[I]); + } + + { + v_u32 x = {}; + x = test_v_u32(x, 42); + printf("%d\n", x[I]); + } + + { + v_i16 x = {}; + x = test_v_i16(x, 42); + printf("%d\n", x[I]); + } + + { + v_u16 x = {}; + x = test_v_u16(x, 42); + printf("%d\n", x[I]); + } + + { + v_i8 x = {}; + x = test_v_i8(x, 42); + printf("%d\n", x[I]); + } + + { + v_u8 x = {}; + x = test_v_u8(x, 42); + printf("%d\n", x[I]); + } + + return 0; +} +--EXPECT-- +42.42 +42.42 +42 +42 +42 +42 +42 +42 +42 +42 diff --git a/tests/vector/convert-fp2fp-001.test b/tests/vector/convert-fp2fp-001.test new file mode 100644 index 0000000..43df1a9 --- /dev/null +++ b/tests/vector/convert-fp2fp-001.test @@ -0,0 +1,41 @@ +--TEST-- +CONVERT.FP2FP.001: 128-bit vectors SSE2 +--TARGET-- +!aarch64 +--ARGS-- +-mno-sse4 -mno-avx2 --run +--CODE-- +int printf(const char *, ...); + +typedef double __attribute__((__vector_size__(16))) v_2d; +typedef float __attribute__((__vector_size__(8))) v_4f; + +v_4f __attribute__((noinline)) test_d_f(v_2d v) +{ + return __builtin_convertvector(v, v_4f); +} + +v_2d __attribute__((noinline)) test_f_d(v_4f v) +{ + return __builtin_convertvector(v, v_2d); +} + +int main() +{ + { + v_2d x = {1.1, 2.2}; + v_4f y = test_d_f(x); + printf("%g %g\n", y[0], y[1]); + } + + { + v_4f x = {1.1f, 2.2f}; + v_2d y = test_f_d(x); + printf("%g %g\n", y[0], y[1]); + } + + return 0; +} +--EXPECT-- +1.1 2.2 +1.1 2.2 diff --git a/tests/vector/convert-fp2fp-002.test b/tests/vector/convert-fp2fp-002.test new file mode 100644 index 0000000..6ecb2f2 --- /dev/null +++ b/tests/vector/convert-fp2fp-002.test @@ -0,0 +1,41 @@ +--TEST-- +CONVERT.FP2FP.001: 256-bit vectors AVX +--TARGET-- +!aarch64 +--ARGS-- +-mavx --run +--CODE-- +int printf(const char *, ...); + +typedef double __attribute__((__vector_size__(32))) v_d; +typedef float __attribute__((__vector_size__(16))) v_f; + +v_f __attribute__((noinline)) test_d_f(v_d v) +{ + return __builtin_convertvector(v, v_f); +} + +v_d __attribute__((noinline)) test_f_d(v_f v) +{ + return __builtin_convertvector(v, v_d); +} + +int main() +{ + { + v_d x = {1.1, 2.2, 3.3, 4.4}; + v_f y = test_d_f(x); + printf("%g %g %g %g\n", y[0], y[1], y[2], y[3]); + } + + { + v_f x = {1.1f, 2.2f, 3.3f, 4.4f}; + v_d y = test_f_d(x); + printf("%g %g %g %g\n", y[0], y[1], y[2], y[3]); + } + + return 0; +} +--EXPECT-- +1.1 2.2 3.3 4.4 +1.1 2.2 3.3 4.4 diff --git a/tests/vector/convert-sext-001.test b/tests/vector/convert-sext-001.test new file mode 100644 index 0000000..0b73d29 --- /dev/null +++ b/tests/vector/convert-sext-001.test @@ -0,0 +1,107 @@ +--TEST-- +CONVERT.SEXT.001: 128-bit vectors SSE2 +--TARGET-- +!aarch64 +--ARGS-- +-mno-sse4 -mno-avx2 --run +--CODE-- +int printf(const char *, ...); + +typedef long long i64; +typedef unsigned long long u64; +typedef int i32; +typedef unsigned int u32; +typedef short i16; +typedef unsigned short u16; +typedef char i8; +typedef unsigned char u8; + +typedef i64 __attribute__((__vector_size__(16))) v_2i64; +typedef i32 __attribute__((__vector_size__(8))) v_2i32; +typedef i16 __attribute__((__vector_size__(4))) v_2i16; +typedef i8 __attribute__((__vector_size__(2))) v_2i8; + +typedef i32 __attribute__((__vector_size__(16))) v_4i32; +typedef i16 __attribute__((__vector_size__(8))) v_4i16; +typedef i8 __attribute__((__vector_size__(4))) v_4i8; + +typedef i16 __attribute__((__vector_size__(16))) v_8i16; +typedef i8 __attribute__((__vector_size__(8))) v_8i8; + +v_2i64 __attribute__((noinline)) test_i32_i64(v_2i32 v) +{ + return __builtin_convertvector(v, v_2i64); +} + +v_2i64 __attribute__((noinline)) test_i16_i64(v_2i16 v) +{ + return __builtin_convertvector(v, v_2i64); +} + +v_2i64 __attribute__((noinline)) test_i8_i64(v_2i8 v) +{ + return __builtin_convertvector(v, v_2i64); +} + +v_4i32 __attribute__((noinline)) test_i16_i32(v_4i16 v) +{ + return __builtin_convertvector(v, v_4i32); +} + +v_4i32 __attribute__((noinline)) test_i8_i32(v_4i8 v) +{ + return __builtin_convertvector(v, v_4i32); +} + +v_8i16 __attribute__((noinline)) test_i8_i16(v_8i8 v) +{ + return __builtin_convertvector(v, v_8i16); +} + +int main() +{ + { + v_8i8 x = {1, 2, 3, 4, 5, 6, 7, -8}; + v_8i16 y = test_i8_i16(x); + printf("%d %d %d %d %d %d %d %d\n", y[0], y[1], y[2], y[3], y[4], y[5], y[6], y[7]); + } + + { + v_4i8 x = {1, 2, 3, -4}; + v_4i32 y = test_i8_i32(x); + printf("%d %d %d %d\n", y[0], y[1], y[2], y[3]); + } + + { + v_4i16 x = {1, 2, 3, -4}; + v_4i32 y = test_i16_i32(x); + printf("%d %d %d %d\n", y[0], y[1], y[2], y[3]); + } + + { + v_2i8 x = {1, -2}; + v_2i64 y = test_i8_i64(x); + printf("%lld %lld\n", y[0], y[1]); + } + + { + v_2i16 x = {1, -2}; + v_2i64 y = test_i16_i64(x); + printf("%lld %lld\n", y[0], y[1]); + } + + { + v_2i32 x = {1, -2}; + v_2i64 y = test_i32_i64(x); + printf("%lld %lld\n", y[0], y[1]); + } + + return 0; +} +--EXPECT-- +1 2 3 4 5 6 7 -8 +1 2 3 -4 +1 2 3 -4 +1 -2 +1 -2 +1 -2 diff --git a/tests/vector/convert-sext-002.test b/tests/vector/convert-sext-002.test new file mode 100644 index 0000000..5fd103f --- /dev/null +++ b/tests/vector/convert-sext-002.test @@ -0,0 +1,109 @@ +--TEST-- +CONVERT.SEXT.002: 256-bit vectors AVX +--TARGET-- +!aarch64 +--ARGS-- +-mavx --run +--CODE-- +int printf(const char *, ...); + +typedef long long i64; +typedef unsigned long long u64; +typedef int i32; +typedef unsigned int u32; +typedef short i16; +typedef unsigned short u16; +typedef char i8; +typedef unsigned char u8; + +typedef i64 __attribute__((__vector_size__(32))) v_4i64; +typedef i32 __attribute__((__vector_size__(16))) v_4i32; +typedef i16 __attribute__((__vector_size__(8))) v_4i16; +typedef i8 __attribute__((__vector_size__(4))) v_4i8; + +typedef i32 __attribute__((__vector_size__(32))) v_8i32; +typedef i16 __attribute__((__vector_size__(16))) v_8i16; +typedef i8 __attribute__((__vector_size__(8))) v_8i8; + +typedef i16 __attribute__((__vector_size__(32))) v_16i16; +typedef i8 __attribute__((__vector_size__(16))) v_16i8; + +v_4i64 __attribute__((noinline)) test_i32_i64(v_4i32 v) +{ + return __builtin_convertvector(v, v_4i64); +} + +v_4i64 __attribute__((noinline)) test_i16_i64(v_4i16 v) +{ + return __builtin_convertvector(v, v_4i64); +} + +v_4i64 __attribute__((noinline)) test_i8_i64(v_4i8 v) +{ + return __builtin_convertvector(v, v_4i64); +} + +v_8i32 __attribute__((noinline)) test_i16_i32(v_8i16 v) +{ + return __builtin_convertvector(v, v_8i32); +} + +v_8i32 __attribute__((noinline)) test_i8_i32(v_8i8 v) +{ + return __builtin_convertvector(v, v_8i32); +} + +v_16i16 __attribute__((noinline)) test_i8_i16(v_16i8 v) +{ + return __builtin_convertvector(v, v_16i16); +} + +int main() +{ + { + v_16i8 x = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, -8}; + v_16i16 y = test_i8_i16(x); + printf("%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d\n", + y[0], y[1], y[2], y[3], y[4], y[5], y[6], y[7], + y[8], y[9], y[10], y[11], y[12], y[13], y[14], y[15]); + } + + { + v_8i8 x = {1, 2, 3, 4, 5, 6, 7, -4}; + v_8i32 y = test_i8_i32(x); + printf("%d %d %d %d %d %d %d %d\n", y[0], y[1], y[2], y[3], y[4], y[5], y[6], y[7]); + } + + { + v_8i16 x = {1, 2, 3, 4, 5, 6, 7, -4}; + v_8i32 y = test_i16_i32(x); + printf("%d %d %d %d %d %d %d %d\n", y[0], y[1], y[2], y[3], y[4], y[5], y[6], y[7]); + } + + { + v_4i8 x = {1, 2, 3, -2}; + v_4i64 y = test_i8_i64(x); + printf("%lld %lld %lld %lld\n", y[0], y[1], y[2], y[3]); + } + + { + v_4i16 x = {1, 2, 3, -2}; + v_4i64 y = test_i16_i64(x); + printf("%lld %lld %lld %lld\n", y[0], y[1], y[2], y[3]); + } + + { + v_4i32 x = {1, 2, 3, -2}; + v_4i64 y = test_i32_i64(x); + printf("%lld %lld %lld %lld\n", y[0], y[1], y[2], y[3]); + } + + return 0; +} +--EXPECT-- +1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 -8 +1 2 3 4 5 6 7 -4 +1 2 3 4 5 6 7 -4 +1 2 3 -2 +1 2 3 -2 +1 2 3 -2 diff --git a/tests/vector/convert-trunc-001.test b/tests/vector/convert-trunc-001.test new file mode 100644 index 0000000..90a39ad --- /dev/null +++ b/tests/vector/convert-trunc-001.test @@ -0,0 +1,107 @@ +--TEST-- +CONVERT.TRUNC.001: 128-bit vectors SSE2 +--TARGET-- +!aarch64 +--ARGS-- +-mno-sse4 -mno-avx2 --run +--CODE-- +int printf(const char *, ...); + +typedef long long i64; +typedef unsigned long long u64; +typedef int i32; +typedef unsigned int u32; +typedef short i16; +typedef unsigned short u16; +typedef char i8; +typedef unsigned char u8; + +typedef i64 __attribute__((__vector_size__(16))) v_2i64; +typedef i32 __attribute__((__vector_size__(8))) v_2i32; +typedef i16 __attribute__((__vector_size__(4))) v_2i16; +typedef i8 __attribute__((__vector_size__(2))) v_2i8; + +typedef i32 __attribute__((__vector_size__(16))) v_4i32; +typedef i16 __attribute__((__vector_size__(8))) v_4i16; +typedef i8 __attribute__((__vector_size__(4))) v_4i8; + +typedef i16 __attribute__((__vector_size__(16))) v_8i16; +typedef i8 __attribute__((__vector_size__(8))) v_8i8; + +v_2i32 __attribute__((noinline)) test_i64_i32(v_2i64 v) +{ + return __builtin_convertvector(v, v_2i32); +} + +v_2i16 __attribute__((noinline)) test_i64_i16(v_2i64 v) +{ + return __builtin_convertvector(v, v_2i16); +} + +v_2i8 __attribute__((noinline)) test_i64_i8(v_2i64 v) +{ + return __builtin_convertvector(v, v_2i8); +} + +v_4i16 __attribute__((noinline)) test_i32_i16(v_4i32 v) +{ + return __builtin_convertvector(v, v_4i16); +} + +v_4i8 __attribute__((noinline)) test_i32_i8(v_4i32 v) +{ + return __builtin_convertvector(v, v_4i8); +} + +v_8i8 __attribute__((noinline)) test_i16_i8(v_8i16 v) +{ + return __builtin_convertvector(v, v_8i8); +} + +int main() +{ + { + v_2i64 x = {1, 2}; + v_2i32 y = test_i64_i32(x); + printf("%d %d\n", y[0], y[1]); + } + + { + v_2i64 x = {1, 2}; + v_2i16 y = test_i64_i16(x); + printf("%d %d\n", y[0], y[1]); + } + + { + v_2i64 x = {1, 2}; + v_2i8 y = test_i64_i8(x); + printf("%d %d\n", y[0], y[1]); + } + + { + v_4i32 x = {1, 2, 3, 4}; + v_4i16 y = test_i32_i16(x); + printf("%d %d %d %d\n", y[0], y[1], y[2], y[3]); + } + + { + v_4i32 x = {1, 2, 3, 4}; + v_4i8 y = test_i32_i8(x); + printf("%d %d %d %d\n", y[0], y[1], y[2], y[3]); + } + + { + v_8i16 x = {1, 2, 3, 4, 5, 6, 7, 8}; + v_8i8 y = test_i16_i8(x); + printf("%d %d %d %d %d %d %d %d\n", y[0], y[1], y[2], y[3], y[4], y[5], y[6], y[7]); + } + + return 0; +} +--EXPECT-- +1 2 +1 2 +1 2 +1 2 3 4 +1 2 3 4 +1 2 3 4 5 6 7 8 diff --git a/tests/vector/convert-trunc-002.test b/tests/vector/convert-trunc-002.test new file mode 100644 index 0000000..69d7df2 --- /dev/null +++ b/tests/vector/convert-trunc-002.test @@ -0,0 +1,107 @@ +--TEST-- +CONVERT.TRUNC.002: 128-bit vectors SSE2+SSE4 +--TARGET-- +!aarch64 +--ARGS-- +-msse4 -mno-avx2 --run +--CODE-- +int printf(const char *, ...); + +typedef long long i64; +typedef unsigned long long u64; +typedef int i32; +typedef unsigned int u32; +typedef short i16; +typedef unsigned short u16; +typedef char i8; +typedef unsigned char u8; + +typedef i64 __attribute__((__vector_size__(16))) v_2i64; +typedef i32 __attribute__((__vector_size__(8))) v_2i32; +typedef i16 __attribute__((__vector_size__(4))) v_2i16; +typedef i8 __attribute__((__vector_size__(2))) v_2i8; + +typedef i32 __attribute__((__vector_size__(16))) v_4i32; +typedef i16 __attribute__((__vector_size__(8))) v_4i16; +typedef i8 __attribute__((__vector_size__(4))) v_4i8; + +typedef i16 __attribute__((__vector_size__(16))) v_8i16; +typedef i8 __attribute__((__vector_size__(8))) v_8i8; + +v_2i32 __attribute__((noinline)) test_i64_i32(v_2i64 v) +{ + return __builtin_convertvector(v, v_2i32); +} + +v_2i16 __attribute__((noinline)) test_i64_i16(v_2i64 v) +{ + return __builtin_convertvector(v, v_2i16); +} + +v_2i8 __attribute__((noinline)) test_i64_i8(v_2i64 v) +{ + return __builtin_convertvector(v, v_2i8); +} + +v_4i16 __attribute__((noinline)) test_i32_i16(v_4i32 v) +{ + return __builtin_convertvector(v, v_4i16); +} + +v_4i8 __attribute__((noinline)) test_i32_i8(v_4i32 v) +{ + return __builtin_convertvector(v, v_4i8); +} + +v_8i8 __attribute__((noinline)) test_i16_i8(v_8i16 v) +{ + return __builtin_convertvector(v, v_8i8); +} + +int main() +{ + { + v_2i64 x = {1, 2}; + v_2i32 y = test_i64_i32(x); + printf("%d %d\n", y[0], y[1]); + } + + { + v_2i64 x = {1, 2}; + v_2i16 y = test_i64_i16(x); + printf("%d %d\n", y[0], y[1]); + } + + { + v_2i64 x = {1, 2}; + v_2i8 y = test_i64_i8(x); + printf("%d %d\n", y[0], y[1]); + } + + { + v_4i32 x = {1, 2, 3, 4}; + v_4i16 y = test_i32_i16(x); + printf("%d %d %d %d\n", y[0], y[1], y[2], y[3]); + } + + { + v_4i32 x = {1, 2, 3, 4}; + v_4i8 y = test_i32_i8(x); + printf("%d %d %d %d\n", y[0], y[1], y[2], y[3]); + } + + { + v_8i16 x = {1, 2, 3, 4, 5, 6, 7, 8}; + v_8i8 y = test_i16_i8(x); + printf("%d %d %d %d %d %d %d %d\n", y[0], y[1], y[2], y[3], y[4], y[5], y[6], y[7]); + } + + return 0; +} +--EXPECT-- +1 2 +1 2 +1 2 +1 2 3 4 +1 2 3 4 +1 2 3 4 5 6 7 8 diff --git a/tests/vector/convert-trunc-003.test b/tests/vector/convert-trunc-003.test new file mode 100644 index 0000000..f167487 --- /dev/null +++ b/tests/vector/convert-trunc-003.test @@ -0,0 +1,109 @@ +--TEST-- +CONVERT.TRUNC.003: 256-bit vectors AVX +--TARGET-- +!aarch64 +--ARGS-- +-mavx --run +--CODE-- +int printf(const char *, ...); + +typedef long long i64; +typedef unsigned long long u64; +typedef int i32; +typedef unsigned int u32; +typedef short i16; +typedef unsigned short u16; +typedef char i8; +typedef unsigned char u8; + +typedef i64 __attribute__((__vector_size__(32))) v_4i64; +typedef i32 __attribute__((__vector_size__(16))) v_4i32; +typedef i16 __attribute__((__vector_size__(8))) v_4i16; +typedef i8 __attribute__((__vector_size__(4))) v_4i8; + +typedef i32 __attribute__((__vector_size__(32))) v_8i32; +typedef i16 __attribute__((__vector_size__(16))) v_8i16; +typedef i8 __attribute__((__vector_size__(8))) v_8i8; + +typedef i16 __attribute__((__vector_size__(32))) v_16i16; +typedef i8 __attribute__((__vector_size__(16))) v_16i8; + +v_4i32 __attribute__((noinline)) test_i64_i32(v_4i64 v) +{ + return __builtin_convertvector(v, v_4i32); +} + +v_4i16 __attribute__((noinline)) test_i64_i16(v_4i64 v) +{ + return __builtin_convertvector(v, v_4i16); +} + +v_4i8 __attribute__((noinline)) test_i64_i8(v_4i64 v) +{ + return __builtin_convertvector(v, v_4i8); +} + +v_8i16 __attribute__((noinline)) test_i32_i16(v_8i32 v) +{ + return __builtin_convertvector(v, v_8i16); +} + +v_8i8 __attribute__((noinline)) test_i32_i8(v_8i32 v) +{ + return __builtin_convertvector(v, v_8i8); +} + +v_16i8 __attribute__((noinline)) test_i16_i8(v_16i16 v) +{ + return __builtin_convertvector(v, v_16i8); +} + +int main() +{ + { + v_4i64 x = {1, 2, 3, 4}; + v_4i32 y = test_i64_i32(x); + printf("%d %d %d %d\n", y[0], y[1], y[2], y[3]); + } + + { + v_4i64 x = {1, 2, 3, 4}; + v_4i16 y = test_i64_i16(x); + printf("%d %d %d %d\n", y[0], y[1], y[2], y[3]); + } + + { + v_4i64 x = {1, 2, 3, 4}; + v_4i8 y = test_i64_i8(x); + printf("%d %d %d %d\n", y[0], y[1], y[2], y[3]); + } + + { + v_8i32 x = {1, 2, 3, 4, 5, 6, 7, 8}; + v_8i16 y = test_i32_i16(x); + printf("%d %d %d %d %d %d %d %d\n", y[0], y[1], y[2], y[3], y[4], y[5], y[6], y[7]); + } + + { + v_8i32 x = {1, 2, 3, 4, 5, 6, 7, 8}; + v_8i8 y = test_i32_i8(x); + printf("%d %d %d %d %d %d %d %d\n", y[0], y[1], y[2], y[3], y[4], y[5], y[6], y[7]); + } + + { + v_16i16 x = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + v_16i8 y = test_i16_i8(x); + printf("%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d\n", + y[0], y[1], y[2], y[3], y[4], y[5], y[6], y[7], + y[8], y[9], y[10], y[11], y[12], y[13], y[14], y[15]); + } + + return 0; +} +--EXPECT-- +1 2 3 4 +1 2 3 4 +1 2 3 4 +1 2 3 4 5 6 7 8 +1 2 3 4 5 6 7 8 +1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 diff --git a/tests/vector/convert-zext-001.test b/tests/vector/convert-zext-001.test new file mode 100644 index 0000000..1e52b7e --- /dev/null +++ b/tests/vector/convert-zext-001.test @@ -0,0 +1,107 @@ +--TEST-- +CONVERT.ZEXT.001: 128-bit vectors SSE2 +--TARGET-- +!aarch64 +--ARGS-- +-mno-sse4 -mno-avx2 --run +--CODE-- +int printf(const char *, ...); + +typedef long long i64; +typedef unsigned long long u64; +typedef int i32; +typedef unsigned int u32; +typedef short i16; +typedef unsigned short u16; +typedef char i8; +typedef unsigned char u8; + +typedef u64 __attribute__((__vector_size__(16))) v_2u64; +typedef u32 __attribute__((__vector_size__(8))) v_2u32; +typedef u16 __attribute__((__vector_size__(4))) v_2u16; +typedef u8 __attribute__((__vector_size__(2))) v_2u8; + +typedef u32 __attribute__((__vector_size__(16))) v_4u32; +typedef u16 __attribute__((__vector_size__(8))) v_4u16; +typedef u8 __attribute__((__vector_size__(4))) v_4u8; + +typedef u16 __attribute__((__vector_size__(16))) v_8u16; +typedef u8 __attribute__((__vector_size__(8))) v_8u8; + +v_2u64 __attribute__((noinline)) test_u32_u64(v_2u32 v) +{ + return __builtin_convertvector(v, v_2u64); +} + +v_2u64 __attribute__((noinline)) test_u16_u64(v_2u16 v) +{ + return __builtin_convertvector(v, v_2u64); +} + +v_2u64 __attribute__((noinline)) test_u8_u64(v_2u8 v) +{ + return __builtin_convertvector(v, v_2u64); +} + +v_4u32 __attribute__((noinline)) test_u16_u32(v_4u16 v) +{ + return __builtin_convertvector(v, v_4u32); +} + +v_4u32 __attribute__((noinline)) test_u8_u32(v_4u8 v) +{ + return __builtin_convertvector(v, v_4u32); +} + +v_8u16 __attribute__((noinline)) test_u8_u16(v_8u8 v) +{ + return __builtin_convertvector(v, v_8u16); +} + +int main() +{ + { + v_8u8 x = {1, 2, 3, 4, 5, 6, 7, -8}; + v_8u16 y = test_u8_u16(x); + printf("%u %u %u %u %u %u %u %u\n", y[0], y[1], y[2], y[3], y[4], y[5], y[6], y[7]); + } + + { + v_4u8 x = {1, 2, 3, -4}; + v_4u32 y = test_u8_u32(x); + printf("%u %u %u %u\n", y[0], y[1], y[2], y[3]); + } + + { + v_4u16 x = {1, 2, 3, -4}; + v_4u32 y = test_u16_u32(x); + printf("%u %u %u %u\n", y[0], y[1], y[2], y[3]); + } + + { + v_2u8 x = {1, -2}; + v_2u64 y = test_u8_u64(x); + printf("%llu %llu\n", y[0], y[1]); + } + + { + v_2u16 x = {1, -2}; + v_2u64 y = test_u16_u64(x); + printf("%llu %llu\n", y[0], y[1]); + } + + { + v_2u32 x = {1, -2}; + v_2u64 y = test_u32_u64(x); + printf("%llu %llu\n", y[0], y[1]); + } + + return 0; +} +--EXPECT-- +1 2 3 4 5 6 7 248 +1 2 3 252 +1 2 3 65532 +1 254 +1 65534 +1 4294967294 diff --git a/tests/vector/convert-zext-002.test b/tests/vector/convert-zext-002.test new file mode 100644 index 0000000..0b5b139 --- /dev/null +++ b/tests/vector/convert-zext-002.test @@ -0,0 +1,109 @@ +--TEST-- +CONVERT.ZEXT.002: 256-bit vectors AVX +--TARGET-- +!aarch64 +--ARGS-- +-mavx --run +--CODE-- +int printf(const char *, ...); + +typedef long long i64; +typedef unsigned long long u64; +typedef int i32; +typedef unsigned int u32; +typedef short i16; +typedef unsigned short u16; +typedef char i8; +typedef unsigned char u8; + +typedef u64 __attribute__((__vector_size__(32))) v_4u64; +typedef u32 __attribute__((__vector_size__(16))) v_4u32; +typedef u16 __attribute__((__vector_size__(8))) v_4u16; +typedef u8 __attribute__((__vector_size__(4))) v_4u8; + +typedef u32 __attribute__((__vector_size__(32))) v_8u32; +typedef u16 __attribute__((__vector_size__(16))) v_8u16; +typedef u8 __attribute__((__vector_size__(8))) v_8u8; + +typedef u16 __attribute__((__vector_size__(32))) v_16u16; +typedef u8 __attribute__((__vector_size__(16))) v_16u8; + +v_4u64 __attribute__((noinline)) test_u32_u64(v_4u32 v) +{ + return __builtin_convertvector(v, v_4u64); +} + +v_4u64 __attribute__((noinline)) test_u16_u64(v_4u16 v) +{ + return __builtin_convertvector(v, v_4u64); +} + +v_4u64 __attribute__((noinline)) test_u8_u64(v_4u8 v) +{ + return __builtin_convertvector(v, v_4u64); +} + +v_8u32 __attribute__((noinline)) test_u16_u32(v_8u16 v) +{ + return __builtin_convertvector(v, v_8u32); +} + +v_8u32 __attribute__((noinline)) test_u8_u32(v_8u8 v) +{ + return __builtin_convertvector(v, v_8u32); +} + +v_16u16 __attribute__((noinline)) test_u8_u16(v_16u8 v) +{ + return __builtin_convertvector(v, v_16u16); +} + +int main() +{ + { + v_16u8 x = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, -8}; + v_16u16 y = test_u8_u16(x); + printf("%u %u %u %u %u %u %u %u %u %u %u %u %u %u %u %u\n", + y[0], y[1], y[2], y[3], y[4], y[5], y[6], y[7], + y[8], y[9], y[10], y[11], y[12], y[13], y[14], y[15]); + } + + { + v_8u8 x = {1, 2, 3, 4, 5, 6, 7, -4}; + v_8u32 y = test_u8_u32(x); + printf("%u %u %u %u %u %u %u %u\n", y[0], y[1], y[2], y[3], y[4], y[5], y[6], y[7]); + } + + { + v_8u16 x = {1, 2, 3, 4, 5, 6, 7, -4}; + v_8u32 y = test_u16_u32(x); + printf("%u %u %u %u %u %u %u %u\n", y[0], y[1], y[2], y[3], y[4], y[5], y[6], y[7]); + } + + { + v_4u8 x = {1, 2, 3, -2}; + v_4u64 y = test_u8_u64(x); + printf("%llu %llu %llu %llu\n", y[0], y[1], y[2], y[3]); + } + + { + v_4u16 x = {1, 2, 3, -2}; + v_4u64 y = test_u16_u64(x); + printf("%llu %llu %llu %llu\n", y[0], y[1], y[2], y[3]); + } + + { + v_4u32 x = {1, 2, 3, -2}; + v_4u64 y = test_u32_u64(x); + printf("%llu %llu %llu %llu\n", y[0], y[1], y[2], y[3]); + } + + return 0; +} +--EXPECT-- +1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 248 +1 2 3 4 5 6 7 252 +1 2 3 4 5 6 7 65532 +1 2 3 254 +1 2 3 65534 +1 2 3 4294967294 diff --git a/tests/vector/div-001.test b/tests/vector/div-001.test new file mode 100644 index 0000000..aab8dfe --- /dev/null +++ b/tests/vector/div-001.test @@ -0,0 +1,167 @@ +--TEST-- +DIV.001: 128-bit vectors SSE2 +--TARGET-- +!aarch64 +--ARGS-- +-mno-sse4 -mno-avx2 --run +--CODE-- +#define N 16 +#define I 1 + +int printf(const char *, ...); + +typedef long long i64; +typedef unsigned long long u64; +typedef int i32; +typedef unsigned int u32; +typedef short i16; +typedef unsigned short u16; +typedef char i8; +typedef unsigned char u8; + +typedef double __attribute__((__vector_size__(N))) v_d; +typedef float __attribute__((__vector_size__(N))) v_f; +typedef i64 __attribute__((__vector_size__(N))) v_i64; +typedef u64 __attribute__((__vector_size__(N))) v_u64; +typedef i32 __attribute__((__vector_size__(N))) v_i32; +typedef u32 __attribute__((__vector_size__(N))) v_u32; +typedef i16 __attribute__((__vector_size__(N))) v_i16; +typedef u16 __attribute__((__vector_size__(N))) v_u16; +typedef i8 __attribute__((__vector_size__(N))) v_i8; +typedef u8 __attribute__((__vector_size__(N))) v_u8; + +v_d __attribute__((noinline)) test_v_d(v_d v, double x) +{ + v = v / x; + return v; +} + +v_f __attribute__((noinline)) test_v_f(v_f v, float x) +{ + v = v / x; + return v; +} + +v_i64 __attribute__((noinline)) test_v_i64(v_i64 v, i64 x) +{ + v = v / x; + return v; +} + +v_u64 __attribute__((noinline)) test_v_u64(v_u64 v, u64 x) +{ + v = v / x; + return v; +} + +v_i32 __attribute__((noinline)) test_v_i32(v_i32 v, i32 x) +{ + v = v / x; + return v; +} + +v_u32 __attribute__((noinline)) test_v_u32(v_u32 v, u32 x) +{ + v = v / x; + return v; +} + +v_i16 __attribute__((noinline)) test_v_i16(v_i16 v, i16 x) +{ + v = v / x; + return v; +} + +v_u16 __attribute__((noinline)) test_v_u16(v_u16 v, u16 x) +{ + v = v / x; + return v; +} + +v_i8 __attribute__((noinline)) test_v_i8(v_i8 v, i8 x) +{ + v = v / x; + return v; +} + +v_u8 __attribute__((noinline)) test_v_u8(v_u8 v, u8 x) +{ + v = v / x; + return v; +} + +int main() +{ + { + v_d x = {42.42, 42.42}; + x = test_v_d(x, 3); + printf("%g\n", x[I]); + } + + { + v_f x = {42.42, 42.42, 42.42, 42.42}; + x = test_v_f(x, 3); + printf("%g\n", x[I]); + } + + { + v_i64 x = {42, 42}; + x = test_v_i64(x, 3); + printf("%lld\n", x[I]); + } + + { + v_u64 x = {42, 42}; + x = test_v_u64(x, 3); + printf("%lld\n", x[I]); + } + + { + v_i32 x = {42, 42, 42, 42}; + x = test_v_i32(x, 3); + printf("%d\n", x[I]); + } + + { + v_u32 x = {42, 42, 42, 42}; + x = test_v_u32(x, 3); + printf("%d\n", x[I]); + } + + { + v_i16 x = {42, 42, 42, 42, 42, 42, 42, 42}; + x = test_v_i16(x, 3); + printf("%d\n", x[I]); + } + + { + v_u16 x = {42, 42, 42, 42, 42, 42, 42, 42}; + x = test_v_u16(x, 3); + printf("%d\n", x[I]); + } + + { + v_i8 x = {42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42}; + x = test_v_i8(x, 3); + printf("%d\n", x[I]); + } + + { + v_u8 x = {42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42}; + x = test_v_u8(x, 3); + printf("%d\n", x[I]); + } + + return 0; +} +--EXPECT-- +14.14 +14.14 +14 +14 +14 +14 +14 +14 +14 +14 diff --git a/tests/vector/eq-001.test b/tests/vector/eq-001.test new file mode 100644 index 0000000..6354d71 --- /dev/null +++ b/tests/vector/eq-001.test @@ -0,0 +1,199 @@ +--TEST-- +EQ.001: 128-bit vectors SSE2 +--TARGET-- +!aarch64 +--ARGS-- +-mno-sse4 -mno-avx2 --run +--CODE-- +#define N 16 +#define I 1 + +int printf(const char *, ...); + +typedef long long i64; +typedef unsigned long long u64; +typedef int i32; +typedef unsigned int u32; +typedef short i16; +typedef unsigned short u16; +typedef char i8; +typedef unsigned char u8; + +typedef double __attribute__((__vector_size__(N))) v_d; +typedef float __attribute__((__vector_size__(N))) v_f; +typedef i64 __attribute__((__vector_size__(N))) v_i64; +typedef u64 __attribute__((__vector_size__(N))) v_u64; +typedef i32 __attribute__((__vector_size__(N))) v_i32; +typedef u32 __attribute__((__vector_size__(N))) v_u32; +typedef i16 __attribute__((__vector_size__(N))) v_i16; +typedef u16 __attribute__((__vector_size__(N))) v_u16; +typedef i8 __attribute__((__vector_size__(N))) v_i8; +typedef u8 __attribute__((__vector_size__(N))) v_u8; + +v_d __attribute__((noinline)) test_v_d(v_d v, double x, double y) +{ + return (v + x == y); +} + +v_f __attribute__((noinline)) test_v_f(v_f v, float x, float y) +{ + return (v + x == y); +} + +v_i64 __attribute__((noinline)) test_v_i64(v_i64 v, i64 x, i64 y) +{ + return (v + x == y); +} + +v_u64 __attribute__((noinline)) test_v_u64(v_u64 v, u64 x, u64 y) +{ + return (v + x == y); +} + +v_i32 __attribute__((noinline)) test_v_i32(v_i32 v, i32 x, i32 y) +{ + return (v + x == y); +} + +v_u32 __attribute__((noinline)) test_v_u32(v_u32 v, u32 x, u32 y) +{ + return (v + x == y); +} + +v_i16 __attribute__((noinline)) test_v_i16(v_i16 v, i16 x, i16 y) +{ + return (v + x == y); +} + +v_u16 __attribute__((noinline)) test_v_u16(v_u16 v, u16 x, u16 y) +{ + return (v + x == y); +} + +v_i8 __attribute__((noinline)) test_v_i8(v_i8 v, i8 x, i8 y) +{ + return (v + x == y); +} + +v_u8 __attribute__((noinline)) test_v_u8(v_u8 v, u8 x, u8 y) +{ + return (v + x == y); +} + +int main() +{ + { + v_d x = {}; + v_i64 y; + y = (v_i64)test_v_d(x, 42.42, 42.42); + printf("%lld\n", y[I]); + x = (v_d){}; + y = (v_i64)test_v_d(x, 42.42, 13.13); + printf("%lld\n", y[I]); + } + + { + v_f x = {}; + v_i32 y; + y = (v_i32)test_v_f(x, 42.42, 42.42); + printf("%d\n", y[I]); + x = (v_f){}; + y = (v_i32)test_v_f(x, 42.42, 13.13); + printf("%d\n", y[I]); + } + + { + v_i64 x = {}; + x = test_v_i64(x, 42, 42); + printf("%lld\n", x[I]); + x = (v_i64){}; + x = test_v_i64(x, 42, 13); + printf("%lld\n", x[I]); + } + + { + v_u64 x = {}; + x = test_v_u64(x, 42, 42); + printf("%lld\n", x[I]); + x = (v_u64){}; + x = test_v_u64(x, 42, 13); + printf("%lld\n", x[I]); + } + + { + v_i32 x = {}; + x = test_v_i32(x, 42, 42); + printf("%d\n", x[I]); + x = (v_i32){}; + x = test_v_i32(x, 42, 13); + printf("%d\n", x[I]); + } + + { + v_u32 x = {}; + x = test_v_u32(x, 42, 42); + printf("%d\n", x[I]); + x = (v_u32){}; + x = test_v_u32(x, 42, 13); + printf("%d\n", x[I]); + } + + { + v_i16 x = {}; + x = test_v_i16(x, 42, 42); + printf("%d\n", x[I]); + x = (v_i16){}; + x = test_v_i16(x, 42, 13); + printf("%d\n", x[I]); + } + + { + v_u16 x = {}; + x = test_v_u16(x, 42, 42); + printf("%d\n", (i16)x[I]); + x = (v_u16){}; + x = test_v_u16(x, 42, 13); + printf("%d\n", (i16)x[I]); + } + + { + v_i8 x = {}; + x = test_v_i8(x, 42, 42); + printf("%d\n", x[I]); + x = (v_i8){}; + x = test_v_i8(x, 42, 13); + printf("%d\n", x[I]); + } + + { + v_u8 x = {}; + x = test_v_u8(x, 42, 42); + printf("%d\n", (i8)x[I]); + x = (v_u8){}; + x = test_v_u8(x, 42, 13); + printf("%d\n", (i8)x[I]); + } + + return 0; +} +--EXPECT-- +-1 +0 +-1 +0 +-1 +0 +-1 +0 +-1 +0 +-1 +0 +-1 +0 +-1 +0 +-1 +0 +-1 +0 diff --git a/tests/vector/eq-002.test b/tests/vector/eq-002.test new file mode 100644 index 0000000..5e31a09 --- /dev/null +++ b/tests/vector/eq-002.test @@ -0,0 +1,199 @@ +--TEST-- +EQ.002: 128-bit vectors SSE2+SSE4 +--TARGET-- +!aarch64 +--ARGS-- +-mno-avx2 --run +--CODE-- +#define N 16 +#define I 1 + +int printf(const char *, ...); + +typedef long long i64; +typedef unsigned long long u64; +typedef int i32; +typedef unsigned int u32; +typedef short i16; +typedef unsigned short u16; +typedef char i8; +typedef unsigned char u8; + +typedef double __attribute__((__vector_size__(N))) v_d; +typedef float __attribute__((__vector_size__(N))) v_f; +typedef i64 __attribute__((__vector_size__(N))) v_i64; +typedef u64 __attribute__((__vector_size__(N))) v_u64; +typedef i32 __attribute__((__vector_size__(N))) v_i32; +typedef u32 __attribute__((__vector_size__(N))) v_u32; +typedef i16 __attribute__((__vector_size__(N))) v_i16; +typedef u16 __attribute__((__vector_size__(N))) v_u16; +typedef i8 __attribute__((__vector_size__(N))) v_i8; +typedef u8 __attribute__((__vector_size__(N))) v_u8; + +v_d __attribute__((noinline)) test_v_d(v_d v, double x, double y) +{ + return (v + x == y); +} + +v_f __attribute__((noinline)) test_v_f(v_f v, float x, float y) +{ + return (v + x == y); +} + +v_i64 __attribute__((noinline)) test_v_i64(v_i64 v, i64 x, i64 y) +{ + return (v + x == y); +} + +v_u64 __attribute__((noinline)) test_v_u64(v_u64 v, u64 x, u64 y) +{ + return (v + x == y); +} + +v_i32 __attribute__((noinline)) test_v_i32(v_i32 v, i32 x, i32 y) +{ + return (v + x == y); +} + +v_u32 __attribute__((noinline)) test_v_u32(v_u32 v, u32 x, u32 y) +{ + return (v + x == y); +} + +v_i16 __attribute__((noinline)) test_v_i16(v_i16 v, i16 x, i16 y) +{ + return (v + x == y); +} + +v_u16 __attribute__((noinline)) test_v_u16(v_u16 v, u16 x, u16 y) +{ + return (v + x == y); +} + +v_i8 __attribute__((noinline)) test_v_i8(v_i8 v, i8 x, i8 y) +{ + return (v + x == y); +} + +v_u8 __attribute__((noinline)) test_v_u8(v_u8 v, u8 x, u8 y) +{ + return (v + x == y); +} + +int main() +{ + { + v_d x = {}; + v_i64 y; + y = (v_i64)test_v_d(x, 42.42, 42.42); + printf("%lld\n", y[I]); + x = (v_d){}; + y = (v_i64)test_v_d(x, 42.42, 13.13); + printf("%lld\n", y[I]); + } + + { + v_f x = {}; + v_i32 y; + y = (v_i32)test_v_f(x, 42.42, 42.42); + printf("%d\n", y[I]); + x = (v_f){}; + y = (v_i32)test_v_f(x, 42.42, 13.13); + printf("%d\n", y[I]); + } + + { + v_i64 x = {}; + x = test_v_i64(x, 42, 42); + printf("%lld\n", x[I]); + x = (v_i64){}; + x = test_v_i64(x, 42, 13); + printf("%lld\n", x[I]); + } + + { + v_u64 x = {}; + x = test_v_u64(x, 42, 42); + printf("%lld\n", x[I]); + x = (v_u64){}; + x = test_v_u64(x, 42, 13); + printf("%lld\n", x[I]); + } + + { + v_i32 x = {}; + x = test_v_i32(x, 42, 42); + printf("%d\n", x[I]); + x = (v_i32){}; + x = test_v_i32(x, 42, 13); + printf("%d\n", x[I]); + } + + { + v_u32 x = {}; + x = test_v_u32(x, 42, 42); + printf("%d\n", x[I]); + x = (v_u32){}; + x = test_v_u32(x, 42, 13); + printf("%d\n", x[I]); + } + + { + v_i16 x = {}; + x = test_v_i16(x, 42, 42); + printf("%d\n", x[I]); + x = (v_i16){}; + x = test_v_i16(x, 42, 13); + printf("%d\n", x[I]); + } + + { + v_u16 x = {}; + x = test_v_u16(x, 42, 42); + printf("%d\n", (i16)x[I]); + x = (v_u16){}; + x = test_v_u16(x, 42, 13); + printf("%d\n", (i16)x[I]); + } + + { + v_i8 x = {}; + x = test_v_i8(x, 42, 42); + printf("%d\n", x[I]); + x = (v_i8){}; + x = test_v_i8(x, 42, 13); + printf("%d\n", x[I]); + } + + { + v_u8 x = {}; + x = test_v_u8(x, 42, 42); + printf("%d\n", (i8)x[I]); + x = (v_u8){}; + x = test_v_u8(x, 42, 13); + printf("%d\n", (i8)x[I]); + } + + return 0; +} +--EXPECT-- +-1 +0 +-1 +0 +-1 +0 +-1 +0 +-1 +0 +-1 +0 +-1 +0 +-1 +0 +-1 +0 +-1 +0 diff --git a/tests/vector/eq-003.test b/tests/vector/eq-003.test new file mode 100644 index 0000000..ad24549 --- /dev/null +++ b/tests/vector/eq-003.test @@ -0,0 +1,199 @@ +--TEST-- +EQ.003: 128-bit vectors AVX +--TARGET-- +!aarch64 +--ARGS-- +-mavx -mno-avx2 --run +--CODE-- +#define N 16 +#define I 1 + +int printf(const char *, ...); + +typedef long long i64; +typedef unsigned long long u64; +typedef int i32; +typedef unsigned int u32; +typedef short i16; +typedef unsigned short u16; +typedef char i8; +typedef unsigned char u8; + +typedef double __attribute__((__vector_size__(N))) v_d; +typedef float __attribute__((__vector_size__(N))) v_f; +typedef i64 __attribute__((__vector_size__(N))) v_i64; +typedef u64 __attribute__((__vector_size__(N))) v_u64; +typedef i32 __attribute__((__vector_size__(N))) v_i32; +typedef u32 __attribute__((__vector_size__(N))) v_u32; +typedef i16 __attribute__((__vector_size__(N))) v_i16; +typedef u16 __attribute__((__vector_size__(N))) v_u16; +typedef i8 __attribute__((__vector_size__(N))) v_i8; +typedef u8 __attribute__((__vector_size__(N))) v_u8; + +v_d __attribute__((noinline)) test_v_d(v_d v, double x, double y) +{ + return (v + x == y); +} + +v_f __attribute__((noinline)) test_v_f(v_f v, float x, float y) +{ + return (v + x == y); +} + +v_i64 __attribute__((noinline)) test_v_i64(v_i64 v, i64 x, i64 y) +{ + return (v + x == y); +} + +v_u64 __attribute__((noinline)) test_v_u64(v_u64 v, u64 x, u64 y) +{ + return (v + x == y); +} + +v_i32 __attribute__((noinline)) test_v_i32(v_i32 v, i32 x, i32 y) +{ + return (v + x == y); +} + +v_u32 __attribute__((noinline)) test_v_u32(v_u32 v, u32 x, u32 y) +{ + return (v + x == y); +} + +v_i16 __attribute__((noinline)) test_v_i16(v_i16 v, i16 x, i16 y) +{ + return (v + x == y); +} + +v_u16 __attribute__((noinline)) test_v_u16(v_u16 v, u16 x, u16 y) +{ + return (v + x == y); +} + +v_i8 __attribute__((noinline)) test_v_i8(v_i8 v, i8 x, i8 y) +{ + return (v + x == y); +} + +v_u8 __attribute__((noinline)) test_v_u8(v_u8 v, u8 x, u8 y) +{ + return (v + x == y); +} + +int main() +{ + { + v_d x = {}; + v_i64 y; + y = (v_i64)test_v_d(x, 42.42, 42.42); + printf("%lld\n", y[I]); + x = (v_d){}; + y = (v_i64)test_v_d(x, 42.42, 13.13); + printf("%lld\n", y[I]); + } + + { + v_f x = {}; + v_i32 y; + y = (v_i32)test_v_f(x, 42.42, 42.42); + printf("%d\n", y[I]); + x = (v_f){}; + y = (v_i32)test_v_f(x, 42.42, 13.13); + printf("%d\n", y[I]); + } + + { + v_i64 x = {}; + x = test_v_i64(x, 42, 42); + printf("%lld\n", x[I]); + x = (v_i64){}; + x = test_v_i64(x, 42, 13); + printf("%lld\n", x[I]); + } + + { + v_u64 x = {}; + x = test_v_u64(x, 42, 42); + printf("%lld\n", x[I]); + x = (v_u64){}; + x = test_v_u64(x, 42, 13); + printf("%lld\n", x[I]); + } + + { + v_i32 x = {}; + x = test_v_i32(x, 42, 42); + printf("%d\n", x[I]); + x = (v_i32){}; + x = test_v_i32(x, 42, 13); + printf("%d\n", x[I]); + } + + { + v_u32 x = {}; + x = test_v_u32(x, 42, 42); + printf("%d\n", x[I]); + x = (v_u32){}; + x = test_v_u32(x, 42, 13); + printf("%d\n", x[I]); + } + + { + v_i16 x = {}; + x = test_v_i16(x, 42, 42); + printf("%d\n", x[I]); + x = (v_i16){}; + x = test_v_i16(x, 42, 13); + printf("%d\n", x[I]); + } + + { + v_u16 x = {}; + x = test_v_u16(x, 42, 42); + printf("%d\n", (i16)x[I]); + x = (v_u16){}; + x = test_v_u16(x, 42, 13); + printf("%d\n", (i16)x[I]); + } + + { + v_i8 x = {}; + x = test_v_i8(x, 42, 42); + printf("%d\n", x[I]); + x = (v_i8){}; + x = test_v_i8(x, 42, 13); + printf("%d\n", x[I]); + } + + { + v_u8 x = {}; + x = test_v_u8(x, 42, 42); + printf("%d\n", (i8)x[I]); + x = (v_u8){}; + x = test_v_u8(x, 42, 13); + printf("%d\n", (i8)x[I]); + } + + return 0; +} +--EXPECT-- +-1 +0 +-1 +0 +-1 +0 +-1 +0 +-1 +0 +-1 +0 +-1 +0 +-1 +0 +-1 +0 +-1 +0 diff --git a/tests/vector/eq-004.test b/tests/vector/eq-004.test new file mode 100644 index 0000000..8bb18ec --- /dev/null +++ b/tests/vector/eq-004.test @@ -0,0 +1,199 @@ +--TEST-- +EQ.004: 64-bit vectors SSE2 +--TARGET-- +!aarch64 +--ARGS-- +-mno-sse4 -mno-avx2 --run +--CODE-- +#define N 8 +#define I 0 + +int printf(const char *, ...); + +typedef long long i64; +typedef unsigned long long u64; +typedef int i32; +typedef unsigned int u32; +typedef short i16; +typedef unsigned short u16; +typedef char i8; +typedef unsigned char u8; + +typedef double __attribute__((__vector_size__(N))) v_d; +typedef float __attribute__((__vector_size__(N))) v_f; +typedef i64 __attribute__((__vector_size__(N))) v_i64; +typedef u64 __attribute__((__vector_size__(N))) v_u64; +typedef i32 __attribute__((__vector_size__(N))) v_i32; +typedef u32 __attribute__((__vector_size__(N))) v_u32; +typedef i16 __attribute__((__vector_size__(N))) v_i16; +typedef u16 __attribute__((__vector_size__(N))) v_u16; +typedef i8 __attribute__((__vector_size__(N))) v_i8; +typedef u8 __attribute__((__vector_size__(N))) v_u8; + +v_d __attribute__((noinline)) test_v_d(v_d v, double x, double y) +{ + return (v + x == y); +} + +v_f __attribute__((noinline)) test_v_f(v_f v, float x, float y) +{ + return (v + x == y); +} + +v_i64 __attribute__((noinline)) test_v_i64(v_i64 v, i64 x, i64 y) +{ + return (v + x == y); +} + +v_u64 __attribute__((noinline)) test_v_u64(v_u64 v, u64 x, u64 y) +{ + return (v + x == y); +} + +v_i32 __attribute__((noinline)) test_v_i32(v_i32 v, i32 x, i32 y) +{ + return (v + x == y); +} + +v_u32 __attribute__((noinline)) test_v_u32(v_u32 v, u32 x, u32 y) +{ + return (v + x == y); +} + +v_i16 __attribute__((noinline)) test_v_i16(v_i16 v, i16 x, i16 y) +{ + return (v + x == y); +} + +v_u16 __attribute__((noinline)) test_v_u16(v_u16 v, u16 x, u16 y) +{ + return (v + x == y); +} + +v_i8 __attribute__((noinline)) test_v_i8(v_i8 v, i8 x, i8 y) +{ + return (v + x == y); +} + +v_u8 __attribute__((noinline)) test_v_u8(v_u8 v, u8 x, u8 y) +{ + return (v + x == y); +} + +int main() +{ + { + v_d x = {}; + v_i64 y; + y = (v_i64)test_v_d(x, 42.42, 42.42); + printf("%lld\n", y[I]); + x = (v_d){}; + y = (v_i64)test_v_d(x, 42.42, 13.13); + printf("%lld\n", y[I]); + } + + { + v_f x = {}; + v_i32 y; + y = (v_i32)test_v_f(x, 42.42, 42.42); + printf("%d\n", y[I]); + x = (v_f){}; + y = (v_i32)test_v_f(x, 42.42, 13.13); + printf("%d\n", y[I]); + } + + { + v_i64 x = {}; + x = test_v_i64(x, 42, 42); + printf("%lld\n", x[I]); + x = (v_i64){}; + x = test_v_i64(x, 42, 13); + printf("%lld\n", x[I]); + } + + { + v_u64 x = {}; + x = test_v_u64(x, 42, 42); + printf("%lld\n", x[I]); + x = (v_u64){}; + x = test_v_u64(x, 42, 13); + printf("%lld\n", x[I]); + } + + { + v_i32 x = {}; + x = test_v_i32(x, 42, 42); + printf("%d\n", x[I]); + x = (v_i32){}; + x = test_v_i32(x, 42, 13); + printf("%d\n", x[I]); + } + + { + v_u32 x = {}; + x = test_v_u32(x, 42, 42); + printf("%d\n", x[I]); + x = (v_u32){}; + x = test_v_u32(x, 42, 13); + printf("%d\n", x[I]); + } + + { + v_i16 x = {}; + x = test_v_i16(x, 42, 42); + printf("%d\n", x[I]); + x = (v_i16){}; + x = test_v_i16(x, 42, 13); + printf("%d\n", x[I]); + } + + { + v_u16 x = {}; + x = test_v_u16(x, 42, 42); + printf("%d\n", (i16)x[I]); + x = (v_u16){}; + x = test_v_u16(x, 42, 13); + printf("%d\n", (i16)x[I]); + } + + { + v_i8 x = {}; + x = test_v_i8(x, 42, 42); + printf("%d\n", x[I]); + x = (v_i8){}; + x = test_v_i8(x, 42, 13); + printf("%d\n", x[I]); + } + + { + v_u8 x = {}; + x = test_v_u8(x, 42, 42); + printf("%d\n", (i8)x[I]); + x = (v_u8){}; + x = test_v_u8(x, 42, 13); + printf("%d\n", (i8)x[I]); + } + + return 0; +} +--EXPECT-- +-1 +0 +-1 +0 +-1 +0 +-1 +0 +-1 +0 +-1 +0 +-1 +0 +-1 +0 +-1 +0 +-1 +0 diff --git a/tests/vector/eq-005.test b/tests/vector/eq-005.test new file mode 100644 index 0000000..65dfdcc --- /dev/null +++ b/tests/vector/eq-005.test @@ -0,0 +1,199 @@ +--TEST-- +EQ.005: 256-bit vectors AVX +--TARGET-- +!aarch64 +--ARGS-- +-mavx -mno-avx2 --run +--CODE-- +#define N 32 +#define I 3 + +int printf(const char *, ...); + +typedef long long i64; +typedef unsigned long long u64; +typedef int i32; +typedef unsigned int u32; +typedef short i16; +typedef unsigned short u16; +typedef char i8; +typedef unsigned char u8; + +typedef double __attribute__((__vector_size__(N))) v_d; +typedef float __attribute__((__vector_size__(N))) v_f; +typedef i64 __attribute__((__vector_size__(N))) v_i64; +typedef u64 __attribute__((__vector_size__(N))) v_u64; +typedef i32 __attribute__((__vector_size__(N))) v_i32; +typedef u32 __attribute__((__vector_size__(N))) v_u32; +typedef i16 __attribute__((__vector_size__(N))) v_i16; +typedef u16 __attribute__((__vector_size__(N))) v_u16; +typedef i8 __attribute__((__vector_size__(N))) v_i8; +typedef u8 __attribute__((__vector_size__(N))) v_u8; + +v_d __attribute__((noinline)) test_v_d(v_d v, double x, double y) +{ + return (v + x == y); +} + +v_f __attribute__((noinline)) test_v_f(v_f v, float x, float y) +{ + return (v + x == y); +} + +v_i64 __attribute__((noinline)) test_v_i64(v_i64 v, i64 x, i64 y) +{ + return (v + x == y); +} + +v_u64 __attribute__((noinline)) test_v_u64(v_u64 v, u64 x, u64 y) +{ + return (v + x == y); +} + +v_i32 __attribute__((noinline)) test_v_i32(v_i32 v, i32 x, i32 y) +{ + return (v + x == y); +} + +v_u32 __attribute__((noinline)) test_v_u32(v_u32 v, u32 x, u32 y) +{ + return (v + x == y); +} + +v_i16 __attribute__((noinline)) test_v_i16(v_i16 v, i16 x, i16 y) +{ + return (v + x == y); +} + +v_u16 __attribute__((noinline)) test_v_u16(v_u16 v, u16 x, u16 y) +{ + return (v + x == y); +} + +v_i8 __attribute__((noinline)) test_v_i8(v_i8 v, i8 x, i8 y) +{ + return (v + x == y); +} + +v_u8 __attribute__((noinline)) test_v_u8(v_u8 v, u8 x, u8 y) +{ + return (v + x == y); +} + +int main() +{ + { + v_d x = {}; + v_i64 y; + y = (v_i64)test_v_d(x, 42.42, 42.42); + printf("%lld\n", y[I]); + x = (v_d){}; + y = (v_i64)test_v_d(x, 42.42, 13.13); + printf("%lld\n", y[I]); + } + + { + v_f x = {}; + v_i32 y; + y = (v_i32)test_v_f(x, 42.42, 42.42); + printf("%d\n", y[I]); + x = (v_f){}; + y = (v_i32)test_v_f(x, 42.42, 13.13); + printf("%d\n", y[I]); + } + + { + v_i64 x = {}; + x = test_v_i64(x, 42, 42); + printf("%lld\n", x[I]); + x = (v_i64){}; + x = test_v_i64(x, 42, 13); + printf("%lld\n", x[I]); + } + + { + v_u64 x = {}; + x = test_v_u64(x, 42, 42); + printf("%lld\n", x[I]); + x = (v_u64){}; + x = test_v_u64(x, 42, 13); + printf("%lld\n", x[I]); + } + + { + v_i32 x = {}; + x = test_v_i32(x, 42, 42); + printf("%d\n", x[I]); + x = (v_i32){}; + x = test_v_i32(x, 42, 13); + printf("%d\n", x[I]); + } + + { + v_u32 x = {}; + x = test_v_u32(x, 42, 42); + printf("%d\n", x[I]); + x = (v_u32){}; + x = test_v_u32(x, 42, 13); + printf("%d\n", x[I]); + } + + { + v_i16 x = {}; + x = test_v_i16(x, 42, 42); + printf("%d\n", x[I]); + x = (v_i16){}; + x = test_v_i16(x, 42, 13); + printf("%d\n", x[I]); + } + + { + v_u16 x = {}; + x = test_v_u16(x, 42, 42); + printf("%d\n", (i16)x[I]); + x = (v_u16){}; + x = test_v_u16(x, 42, 13); + printf("%d\n", (i16)x[I]); + } + + { + v_i8 x = {}; + x = test_v_i8(x, 42, 42); + printf("%d\n", x[I]); + x = (v_i8){}; + x = test_v_i8(x, 42, 13); + printf("%d\n", x[I]); + } + + { + v_u8 x = {}; + x = test_v_u8(x, 42, 42); + printf("%d\n", (i8)x[I]); + x = (v_u8){}; + x = test_v_u8(x, 42, 13); + printf("%d\n", (i8)x[I]); + } + + return 0; +} +--EXPECT-- +-1 +0 +-1 +0 +-1 +0 +-1 +0 +-1 +0 +-1 +0 +-1 +0 +-1 +0 +-1 +0 +-1 +0 diff --git a/tests/vector/eq-006.test b/tests/vector/eq-006.test new file mode 100644 index 0000000..71e7a1b --- /dev/null +++ b/tests/vector/eq-006.test @@ -0,0 +1,199 @@ +--TEST-- +EQ.006: 128-bit vectors SSE +--TARGET-- +!aarch64 +--ARGS-- +-mno-sse4 -mno-avx2 --run +--CODE-- +#define N 16 +#define I 1 + +int printf(const char *, ...); + +typedef long long i64; +typedef unsigned long long u64; +typedef int i32; +typedef unsigned int u32; +typedef short i16; +typedef unsigned short u16; +typedef char i8; +typedef unsigned char u8; + +typedef double __attribute__((__vector_size__(N))) v_d; +typedef float __attribute__((__vector_size__(N))) v_f; +typedef i64 __attribute__((__vector_size__(N))) v_i64; +typedef u64 __attribute__((__vector_size__(N))) v_u64; +typedef i32 __attribute__((__vector_size__(N))) v_i32; +typedef u32 __attribute__((__vector_size__(N))) v_u32; +typedef i16 __attribute__((__vector_size__(N))) v_i16; +typedef u16 __attribute__((__vector_size__(N))) v_u16; +typedef i8 __attribute__((__vector_size__(N))) v_i8; +typedef u8 __attribute__((__vector_size__(N))) v_u8; + +v_d __attribute__((noinline)) test_v_d(v_d v, double x) +{ + return (v + x == 42.42); +} + +v_f __attribute__((noinline)) test_v_f(v_f v, float x) +{ + return (v + x == 42.42f); +} + +v_i64 __attribute__((noinline)) test_v_i64(v_i64 v, i64 x) +{ + return (v + x == 42); +} + +v_u64 __attribute__((noinline)) test_v_u64(v_u64 v, u64 x) +{ + return (v + x == 42); +} + +v_i32 __attribute__((noinline)) test_v_i32(v_i32 v, i32 x) +{ + return (v + x == 42); +} + +v_u32 __attribute__((noinline)) test_v_u32(v_u32 v, u32 x) +{ + return (v + x == 42); +} + +v_i16 __attribute__((noinline)) test_v_i16(v_i16 v, i16 x) +{ + return (v + x == 42); +} + +v_u16 __attribute__((noinline)) test_v_u16(v_u16 v, u16 x) +{ + return (v + x == 42); +} + +v_i8 __attribute__((noinline)) test_v_i8(v_i8 v, i8 x) +{ + return (v + x == 42); +} + +v_u8 __attribute__((noinline)) test_v_u8(v_u8 v, u8 x) +{ + return (v + x == 42); +} + +int main() +{ + { + v_d x = {}; + v_i64 y; + y = (v_i64)test_v_d(x, 42.42); + printf("%lld\n", y[I]); + x = (v_d){}; + y = (v_i64)test_v_d(x, 13.13); + printf("%lld\n", y[I]); + } + + { + v_f x = {}; + v_i32 y; + y = (v_i32)test_v_f(x, 42.42); + printf("%d\n", y[I]); + x = (v_f){}; + y = (v_i32)test_v_f(x, 13.13); + printf("%d\n", y[I]); + } + + { + v_i64 x = {}; + x = test_v_i64(x, 42); + printf("%lld\n", x[I]); + x = (v_i64){}; + x = test_v_i64(x, 13); + printf("%lld\n", x[I]); + } + + { + v_u64 x = {}; + x = test_v_u64(x, 42); + printf("%lld\n", x[I]); + x = (v_u64){}; + x = test_v_u64(x, 13); + printf("%lld\n", x[I]); + } + + { + v_i32 x = {}; + x = test_v_i32(x, 42); + printf("%d\n", x[I]); + x = (v_i32){}; + x = test_v_i32(x, 13); + printf("%d\n", x[I]); + } + + { + v_u32 x = {}; + x = test_v_u32(x, 42); + printf("%d\n", x[I]); + x = (v_u32){}; + x = test_v_u32(x, 13); + printf("%d\n", x[I]); + } + + { + v_i16 x = {}; + x = test_v_i16(x, 42); + printf("%d\n", x[I]); + x = (v_i16){}; + x = test_v_i16(x, 13); + printf("%d\n", x[I]); + } + + { + v_u16 x = {}; + x = test_v_u16(x, 42); + printf("%d\n", (i16)x[I]); + x = (v_u16){}; + x = test_v_u16(x, 13); + printf("%d\n", (i16)x[I]); + } + + { + v_i8 x = {}; + x = test_v_i8(x, 42); + printf("%d\n", x[I]); + x = (v_i8){}; + x = test_v_i8(x, 13); + printf("%d\n", x[I]); + } + + { + v_u8 x = {}; + x = test_v_u8(x, 42); + printf("%d\n", (i8)x[I]); + x = (v_u8){}; + x = test_v_u8(x, 13); + printf("%d\n", (i8)x[I]); + } + + return 0; +} +--EXPECT-- +-1 +0 +-1 +0 +-1 +0 +-1 +0 +-1 +0 +-1 +0 +-1 +0 +-1 +0 +-1 +0 +-1 +0 diff --git a/tests/vector/ge-001.test b/tests/vector/ge-001.test new file mode 100644 index 0000000..cd7524a --- /dev/null +++ b/tests/vector/ge-001.test @@ -0,0 +1,239 @@ +--TEST-- +GE.001: 128-bit vectors SSE2 +--TARGET-- +!aarch64 +--ARGS-- +-mno-sse4 -mno-avx2 --run +--CODE-- +#define N 16 +#define I 1 + +int printf(const char *, ...); + +typedef long long i64; +typedef unsigned long long u64; +typedef int i32; +typedef unsigned int u32; +typedef short i16; +typedef unsigned short u16; +typedef char i8; +typedef unsigned char u8; + +typedef double __attribute__((__vector_size__(N))) v_d; +typedef float __attribute__((__vector_size__(N))) v_f; +typedef i64 __attribute__((__vector_size__(N))) v_i64; +typedef u64 __attribute__((__vector_size__(N))) v_u64; +typedef i32 __attribute__((__vector_size__(N))) v_i32; +typedef u32 __attribute__((__vector_size__(N))) v_u32; +typedef i16 __attribute__((__vector_size__(N))) v_i16; +typedef u16 __attribute__((__vector_size__(N))) v_u16; +typedef i8 __attribute__((__vector_size__(N))) v_i8; +typedef u8 __attribute__((__vector_size__(N))) v_u8; + +v_d __attribute__((noinline)) test_v_d(v_d v, double x, double y) +{ + return (v + x >= y); +} + +v_f __attribute__((noinline)) test_v_f(v_f v, float x, float y) +{ + return (v + x >= y); +} + +v_i64 __attribute__((noinline)) test_v_i64(v_i64 v, i64 x, i64 y) +{ + return (v + x >= y); +} + +v_u64 __attribute__((noinline)) test_v_u64(v_u64 v, u64 x, u64 y) +{ + return (v + x >= y); +} + +v_i32 __attribute__((noinline)) test_v_i32(v_i32 v, i32 x, i32 y) +{ + return (v + x >= y); +} + +v_u32 __attribute__((noinline)) test_v_u32(v_u32 v, u32 x, u32 y) +{ + return (v + x >= y); +} + +v_i16 __attribute__((noinline)) test_v_i16(v_i16 v, i16 x, i16 y) +{ + return (v + x >= y); +} + +v_u16 __attribute__((noinline)) test_v_u16(v_u16 v, u16 x, u16 y) +{ + return (v + x >= y); +} + +v_i8 __attribute__((noinline)) test_v_i8(v_i8 v, i8 x, i8 y) +{ + return (v + x >= y); +} + +v_u8 __attribute__((noinline)) test_v_u8(v_u8 v, u8 x, u8 y) +{ + return (v + x >= y); +} + +int main() +{ + { + v_d x = {}; + v_i64 y; + y = (v_i64)test_v_d(x, 42.42, 42.42); + printf("%lld\n", y[I]); + x = (v_d){}; + y = (v_i64)test_v_d(x, 42.42, 13.13); + printf("%lld\n", y[I]); + x = (v_d){}; + y = (v_i64)test_v_d(x, 42.42, 55.55); + printf("%lld\n", y[I]); + } + + { + v_f x = {}; + v_i32 y; + y = (v_i32)test_v_f(x, 42.42, 42.42); + printf("%d\n", y[I]); + x = (v_f){}; + y = (v_i32)test_v_f(x, 42.42, 13.13); + printf("%d\n", y[I]); + x = (v_f){}; + y = (v_i32)test_v_f(x, 42.42, 55.55); + printf("%d\n", y[I]); + } + + { + v_i64 x = {}; + x = test_v_i64(x, 42, 42); + printf("%lld\n", x[I]); + x = (v_i64){}; + x = test_v_i64(x, 42, 13); + printf("%lld\n", x[I]); + x = (v_i64){}; + x = test_v_i64(x, 42, 55); + printf("%lld\n", x[I]); + } + + { + v_u64 x = {}; + x = test_v_u64(x, 42, 42); + printf("%lld\n", x[I]); + x = (v_u64){}; + x = test_v_u64(x, 42, 13); + printf("%lld\n", x[I]); + x = (v_u64){}; + x = test_v_u64(x, 42, 55); + printf("%lld\n", x[I]); + } + + { + v_i32 x = {}; + x = test_v_i32(x, 42, 42); + printf("%d\n", x[I]); + x = (v_i32){}; + x = test_v_i32(x, 42, 13); + printf("%d\n", x[I]); + x = (v_i32){}; + x = test_v_i32(x, 42, 55); + printf("%d\n", x[I]); + } + + { + v_u32 x = {}; + x = test_v_u32(x, 42, 42); + printf("%d\n", x[I]); + x = (v_u32){}; + x = test_v_u32(x, 42, 13); + printf("%d\n", x[I]); + x = (v_u32){}; + x = test_v_u32(x, 42, 55); + printf("%d\n", x[I]); + } + + { + v_i16 x = {}; + x = test_v_i16(x, 42, 42); + printf("%d\n", x[I]); + x = (v_i16){}; + x = test_v_i16(x, 42, 13); + printf("%d\n", x[I]); + x = (v_i16){}; + x = test_v_i16(x, 42, 55); + printf("%d\n", x[I]); + } + + { + v_u16 x = {}; + x = test_v_u16(x, 42, 42); + printf("%d\n", (i16)x[I]); + x = (v_u16){}; + x = test_v_u16(x, 42, 13); + printf("%d\n", (i16)x[I]); + x = (v_u16){}; + x = test_v_u16(x, 42, 55); + printf("%d\n", (i16)x[I]); + } + + { + v_i8 x = {}; + x = test_v_i8(x, 42, 42); + printf("%d\n", x[I]); + x = (v_i8){}; + x = test_v_i8(x, 42, 13); + printf("%d\n", x[I]); + x = (v_i8){}; + x = test_v_i8(x, 42, 55); + printf("%d\n", x[I]); + } + + { + v_u8 x = {}; + x = test_v_u8(x, 42, 42); + printf("%d\n", (i8)x[I]); + x = (v_u8){}; + x = test_v_u8(x, 42, 13); + printf("%d\n", (i8)x[I]); + x = (v_u8){}; + x = test_v_u8(x, 42, 55); + printf("%d\n", (i8)x[I]); + } + + return 0; +} +--EXPECT-- +-1 +-1 +0 +-1 +-1 +0 +-1 +-1 +0 +-1 +-1 +0 +-1 +-1 +0 +-1 +-1 +0 +-1 +-1 +0 +-1 +-1 +0 +-1 +-1 +0 +-1 +-1 +0 diff --git a/tests/vector/ge-002.test b/tests/vector/ge-002.test new file mode 100644 index 0000000..233f121 --- /dev/null +++ b/tests/vector/ge-002.test @@ -0,0 +1,239 @@ +--TEST-- +GE.002: 128-bit vectors SSE2+SSE4 +--TARGET-- +!aarch64 +--ARGS-- +-mno-avx2 --run +--CODE-- +#define N 16 +#define I 1 + +int printf(const char *, ...); + +typedef long long i64; +typedef unsigned long long u64; +typedef int i32; +typedef unsigned int u32; +typedef short i16; +typedef unsigned short u16; +typedef char i8; +typedef unsigned char u8; + +typedef double __attribute__((__vector_size__(N))) v_d; +typedef float __attribute__((__vector_size__(N))) v_f; +typedef i64 __attribute__((__vector_size__(N))) v_i64; +typedef u64 __attribute__((__vector_size__(N))) v_u64; +typedef i32 __attribute__((__vector_size__(N))) v_i32; +typedef u32 __attribute__((__vector_size__(N))) v_u32; +typedef i16 __attribute__((__vector_size__(N))) v_i16; +typedef u16 __attribute__((__vector_size__(N))) v_u16; +typedef i8 __attribute__((__vector_size__(N))) v_i8; +typedef u8 __attribute__((__vector_size__(N))) v_u8; + +v_d __attribute__((noinline)) test_v_d(v_d v, double x, double y) +{ + return (v + x >= y); +} + +v_f __attribute__((noinline)) test_v_f(v_f v, float x, float y) +{ + return (v + x >= y); +} + +v_i64 __attribute__((noinline)) test_v_i64(v_i64 v, i64 x, i64 y) +{ + return (v + x >= y); +} + +v_u64 __attribute__((noinline)) test_v_u64(v_u64 v, u64 x, u64 y) +{ + return (v + x >= y); +} + +v_i32 __attribute__((noinline)) test_v_i32(v_i32 v, i32 x, i32 y) +{ + return (v + x >= y); +} + +v_u32 __attribute__((noinline)) test_v_u32(v_u32 v, u32 x, u32 y) +{ + return (v + x >= y); +} + +v_i16 __attribute__((noinline)) test_v_i16(v_i16 v, i16 x, i16 y) +{ + return (v + x >= y); +} + +v_u16 __attribute__((noinline)) test_v_u16(v_u16 v, u16 x, u16 y) +{ + return (v + x >= y); +} + +v_i8 __attribute__((noinline)) test_v_i8(v_i8 v, i8 x, i8 y) +{ + return (v + x >= y); +} + +v_u8 __attribute__((noinline)) test_v_u8(v_u8 v, u8 x, u8 y) +{ + return (v + x >= y); +} + +int main() +{ + { + v_d x = {}; + v_i64 y; + y = (v_i64)test_v_d(x, 42.42, 42.42); + printf("%lld\n", y[I]); + x = (v_d){}; + y = (v_i64)test_v_d(x, 42.42, 13.13); + printf("%lld\n", y[I]); + x = (v_d){}; + y = (v_i64)test_v_d(x, 42.42, 55.55); + printf("%lld\n", y[I]); + } + + { + v_f x = {}; + v_i32 y; + y = (v_i32)test_v_f(x, 42.42, 42.42); + printf("%d\n", y[I]); + x = (v_f){}; + y = (v_i32)test_v_f(x, 42.42, 13.13); + printf("%d\n", y[I]); + x = (v_f){}; + y = (v_i32)test_v_f(x, 42.42, 55.55); + printf("%d\n", y[I]); + } + + { + v_i64 x = {}; + x = test_v_i64(x, 42, 42); + printf("%lld\n", x[I]); + x = (v_i64){}; + x = test_v_i64(x, 42, 13); + printf("%lld\n", x[I]); + x = (v_i64){}; + x = test_v_i64(x, 42, 55); + printf("%lld\n", x[I]); + } + + { + v_u64 x = {}; + x = test_v_u64(x, 42, 42); + printf("%lld\n", x[I]); + x = (v_u64){}; + x = test_v_u64(x, 42, 13); + printf("%lld\n", x[I]); + x = (v_u64){}; + x = test_v_u64(x, 42, 55); + printf("%lld\n", x[I]); + } + + { + v_i32 x = {}; + x = test_v_i32(x, 42, 42); + printf("%d\n", x[I]); + x = (v_i32){}; + x = test_v_i32(x, 42, 13); + printf("%d\n", x[I]); + x = (v_i32){}; + x = test_v_i32(x, 42, 55); + printf("%d\n", x[I]); + } + + { + v_u32 x = {}; + x = test_v_u32(x, 42, 42); + printf("%d\n", x[I]); + x = (v_u32){}; + x = test_v_u32(x, 42, 13); + printf("%d\n", x[I]); + x = (v_u32){}; + x = test_v_u32(x, 42, 55); + printf("%d\n", x[I]); + } + + { + v_i16 x = {}; + x = test_v_i16(x, 42, 42); + printf("%d\n", x[I]); + x = (v_i16){}; + x = test_v_i16(x, 42, 13); + printf("%d\n", x[I]); + x = (v_i16){}; + x = test_v_i16(x, 42, 55); + printf("%d\n", x[I]); + } + + { + v_u16 x = {}; + x = test_v_u16(x, 42, 42); + printf("%d\n", (i16)x[I]); + x = (v_u16){}; + x = test_v_u16(x, 42, 13); + printf("%d\n", (i16)x[I]); + x = (v_u16){}; + x = test_v_u16(x, 42, 55); + printf("%d\n", (i16)x[I]); + } + + { + v_i8 x = {}; + x = test_v_i8(x, 42, 42); + printf("%d\n", x[I]); + x = (v_i8){}; + x = test_v_i8(x, 42, 13); + printf("%d\n", x[I]); + x = (v_i8){}; + x = test_v_i8(x, 42, 55); + printf("%d\n", x[I]); + } + + { + v_u8 x = {}; + x = test_v_u8(x, 42, 42); + printf("%d\n", (i8)x[I]); + x = (v_u8){}; + x = test_v_u8(x, 42, 13); + printf("%d\n", (i8)x[I]); + x = (v_u8){}; + x = test_v_u8(x, 42, 55); + printf("%d\n", (i8)x[I]); + } + + return 0; +} +--EXPECT-- +-1 +-1 +0 +-1 +-1 +0 +-1 +-1 +0 +-1 +-1 +0 +-1 +-1 +0 +-1 +-1 +0 +-1 +-1 +0 +-1 +-1 +0 +-1 +-1 +0 +-1 +-1 +0 diff --git a/tests/vector/ge-003.test b/tests/vector/ge-003.test new file mode 100644 index 0000000..b235997 --- /dev/null +++ b/tests/vector/ge-003.test @@ -0,0 +1,239 @@ +--TEST-- +GE.003: 128-bit vectors AVX +--TARGET-- +!aarch64 +--ARGS-- +-mavx -mno-avx2 --run +--CODE-- +#define N 16 +#define I 1 + +int printf(const char *, ...); + +typedef long long i64; +typedef unsigned long long u64; +typedef int i32; +typedef unsigned int u32; +typedef short i16; +typedef unsigned short u16; +typedef char i8; +typedef unsigned char u8; + +typedef double __attribute__((__vector_size__(N))) v_d; +typedef float __attribute__((__vector_size__(N))) v_f; +typedef i64 __attribute__((__vector_size__(N))) v_i64; +typedef u64 __attribute__((__vector_size__(N))) v_u64; +typedef i32 __attribute__((__vector_size__(N))) v_i32; +typedef u32 __attribute__((__vector_size__(N))) v_u32; +typedef i16 __attribute__((__vector_size__(N))) v_i16; +typedef u16 __attribute__((__vector_size__(N))) v_u16; +typedef i8 __attribute__((__vector_size__(N))) v_i8; +typedef u8 __attribute__((__vector_size__(N))) v_u8; + +v_d __attribute__((noinline)) test_v_d(v_d v, double x, double y) +{ + return (v + x >= y); +} + +v_f __attribute__((noinline)) test_v_f(v_f v, float x, float y) +{ + return (v + x >= y); +} + +v_i64 __attribute__((noinline)) test_v_i64(v_i64 v, i64 x, i64 y) +{ + return (v + x >= y); +} + +v_u64 __attribute__((noinline)) test_v_u64(v_u64 v, u64 x, u64 y) +{ + return (v + x >= y); +} + +v_i32 __attribute__((noinline)) test_v_i32(v_i32 v, i32 x, i32 y) +{ + return (v + x >= y); +} + +v_u32 __attribute__((noinline)) test_v_u32(v_u32 v, u32 x, u32 y) +{ + return (v + x >= y); +} + +v_i16 __attribute__((noinline)) test_v_i16(v_i16 v, i16 x, i16 y) +{ + return (v + x >= y); +} + +v_u16 __attribute__((noinline)) test_v_u16(v_u16 v, u16 x, u16 y) +{ + return (v + x >= y); +} + +v_i8 __attribute__((noinline)) test_v_i8(v_i8 v, i8 x, i8 y) +{ + return (v + x >= y); +} + +v_u8 __attribute__((noinline)) test_v_u8(v_u8 v, u8 x, u8 y) +{ + return (v + x >= y); +} + +int main() +{ + { + v_d x = {}; + v_i64 y; + y = (v_i64)test_v_d(x, 42.42, 42.42); + printf("%lld\n", y[I]); + x = (v_d){}; + y = (v_i64)test_v_d(x, 42.42, 13.13); + printf("%lld\n", y[I]); + x = (v_d){}; + y = (v_i64)test_v_d(x, 42.42, 55.55); + printf("%lld\n", y[I]); + } + + { + v_f x = {}; + v_i32 y; + y = (v_i32)test_v_f(x, 42.42, 42.42); + printf("%d\n", y[I]); + x = (v_f){}; + y = (v_i32)test_v_f(x, 42.42, 13.13); + printf("%d\n", y[I]); + x = (v_f){}; + y = (v_i32)test_v_f(x, 42.42, 55.55); + printf("%d\n", y[I]); + } + + { + v_i64 x = {}; + x = test_v_i64(x, 42, 42); + printf("%lld\n", x[I]); + x = (v_i64){}; + x = test_v_i64(x, 42, 13); + printf("%lld\n", x[I]); + x = (v_i64){}; + x = test_v_i64(x, 42, 55); + printf("%lld\n", x[I]); + } + + { + v_u64 x = {}; + x = test_v_u64(x, 42, 42); + printf("%lld\n", x[I]); + x = (v_u64){}; + x = test_v_u64(x, 42, 13); + printf("%lld\n", x[I]); + x = (v_u64){}; + x = test_v_u64(x, 42, 55); + printf("%lld\n", x[I]); + } + + { + v_i32 x = {}; + x = test_v_i32(x, 42, 42); + printf("%d\n", x[I]); + x = (v_i32){}; + x = test_v_i32(x, 42, 13); + printf("%d\n", x[I]); + x = (v_i32){}; + x = test_v_i32(x, 42, 55); + printf("%d\n", x[I]); + } + + { + v_u32 x = {}; + x = test_v_u32(x, 42, 42); + printf("%d\n", x[I]); + x = (v_u32){}; + x = test_v_u32(x, 42, 13); + printf("%d\n", x[I]); + x = (v_u32){}; + x = test_v_u32(x, 42, 55); + printf("%d\n", x[I]); + } + + { + v_i16 x = {}; + x = test_v_i16(x, 42, 42); + printf("%d\n", x[I]); + x = (v_i16){}; + x = test_v_i16(x, 42, 13); + printf("%d\n", x[I]); + x = (v_i16){}; + x = test_v_i16(x, 42, 55); + printf("%d\n", x[I]); + } + + { + v_u16 x = {}; + x = test_v_u16(x, 42, 42); + printf("%d\n", (i16)x[I]); + x = (v_u16){}; + x = test_v_u16(x, 42, 13); + printf("%d\n", (i16)x[I]); + x = (v_u16){}; + x = test_v_u16(x, 42, 55); + printf("%d\n", (i16)x[I]); + } + + { + v_i8 x = {}; + x = test_v_i8(x, 42, 42); + printf("%d\n", x[I]); + x = (v_i8){}; + x = test_v_i8(x, 42, 13); + printf("%d\n", x[I]); + x = (v_i8){}; + x = test_v_i8(x, 42, 55); + printf("%d\n", x[I]); + } + + { + v_u8 x = {}; + x = test_v_u8(x, 42, 42); + printf("%d\n", (i8)x[I]); + x = (v_u8){}; + x = test_v_u8(x, 42, 13); + printf("%d\n", (i8)x[I]); + x = (v_u8){}; + x = test_v_u8(x, 42, 55); + printf("%d\n", (i8)x[I]); + } + + return 0; +} +--EXPECT-- +-1 +-1 +0 +-1 +-1 +0 +-1 +-1 +0 +-1 +-1 +0 +-1 +-1 +0 +-1 +-1 +0 +-1 +-1 +0 +-1 +-1 +0 +-1 +-1 +0 +-1 +-1 +0 diff --git a/tests/vector/ge-004.test b/tests/vector/ge-004.test new file mode 100644 index 0000000..7c20c10 --- /dev/null +++ b/tests/vector/ge-004.test @@ -0,0 +1,239 @@ +--TEST-- +GE.004: 128-bit vectors AVX+AVX2 +--TARGET-- +!aarch64 +--ARGS-- +-mavx --run +--CODE-- +#define N 16 +#define I 1 + +int printf(const char *, ...); + +typedef long long i64; +typedef unsigned long long u64; +typedef int i32; +typedef unsigned int u32; +typedef short i16; +typedef unsigned short u16; +typedef char i8; +typedef unsigned char u8; + +typedef double __attribute__((__vector_size__(N))) v_d; +typedef float __attribute__((__vector_size__(N))) v_f; +typedef i64 __attribute__((__vector_size__(N))) v_i64; +typedef u64 __attribute__((__vector_size__(N))) v_u64; +typedef i32 __attribute__((__vector_size__(N))) v_i32; +typedef u32 __attribute__((__vector_size__(N))) v_u32; +typedef i16 __attribute__((__vector_size__(N))) v_i16; +typedef u16 __attribute__((__vector_size__(N))) v_u16; +typedef i8 __attribute__((__vector_size__(N))) v_i8; +typedef u8 __attribute__((__vector_size__(N))) v_u8; + +v_d __attribute__((noinline)) test_v_d(v_d v, double x, double y) +{ + return (v + x >= y); +} + +v_f __attribute__((noinline)) test_v_f(v_f v, float x, float y) +{ + return (v + x >= y); +} + +v_i64 __attribute__((noinline)) test_v_i64(v_i64 v, i64 x, i64 y) +{ + return (v + x >= y); +} + +v_u64 __attribute__((noinline)) test_v_u64(v_u64 v, u64 x, u64 y) +{ + return (v + x >= y); +} + +v_i32 __attribute__((noinline)) test_v_i32(v_i32 v, i32 x, i32 y) +{ + return (v + x >= y); +} + +v_u32 __attribute__((noinline)) test_v_u32(v_u32 v, u32 x, u32 y) +{ + return (v + x >= y); +} + +v_i16 __attribute__((noinline)) test_v_i16(v_i16 v, i16 x, i16 y) +{ + return (v + x >= y); +} + +v_u16 __attribute__((noinline)) test_v_u16(v_u16 v, u16 x, u16 y) +{ + return (v + x >= y); +} + +v_i8 __attribute__((noinline)) test_v_i8(v_i8 v, i8 x, i8 y) +{ + return (v + x >= y); +} + +v_u8 __attribute__((noinline)) test_v_u8(v_u8 v, u8 x, u8 y) +{ + return (v + x >= y); +} + +int main() +{ + { + v_d x = {}; + v_i64 y; + y = (v_i64)test_v_d(x, 42.42, 42.42); + printf("%lld\n", y[I]); + x = (v_d){}; + y = (v_i64)test_v_d(x, 42.42, 13.13); + printf("%lld\n", y[I]); + x = (v_d){}; + y = (v_i64)test_v_d(x, 42.42, 55.55); + printf("%lld\n", y[I]); + } + + { + v_f x = {}; + v_i32 y; + y = (v_i32)test_v_f(x, 42.42, 42.42); + printf("%d\n", y[I]); + x = (v_f){}; + y = (v_i32)test_v_f(x, 42.42, 13.13); + printf("%d\n", y[I]); + x = (v_f){}; + y = (v_i32)test_v_f(x, 42.42, 55.55); + printf("%d\n", y[I]); + } + + { + v_i64 x = {}; + x = test_v_i64(x, 42, 42); + printf("%lld\n", x[I]); + x = (v_i64){}; + x = test_v_i64(x, 42, 13); + printf("%lld\n", x[I]); + x = (v_i64){}; + x = test_v_i64(x, 42, 55); + printf("%lld\n", x[I]); + } + + { + v_u64 x = {}; + x = test_v_u64(x, 42, 42); + printf("%lld\n", x[I]); + x = (v_u64){}; + x = test_v_u64(x, 42, 13); + printf("%lld\n", x[I]); + x = (v_u64){}; + x = test_v_u64(x, 42, 55); + printf("%lld\n", x[I]); + } + + { + v_i32 x = {}; + x = test_v_i32(x, 42, 42); + printf("%d\n", x[I]); + x = (v_i32){}; + x = test_v_i32(x, 42, 13); + printf("%d\n", x[I]); + x = (v_i32){}; + x = test_v_i32(x, 42, 55); + printf("%d\n", x[I]); + } + + { + v_u32 x = {}; + x = test_v_u32(x, 42, 42); + printf("%d\n", x[I]); + x = (v_u32){}; + x = test_v_u32(x, 42, 13); + printf("%d\n", x[I]); + x = (v_u32){}; + x = test_v_u32(x, 42, 55); + printf("%d\n", x[I]); + } + + { + v_i16 x = {}; + x = test_v_i16(x, 42, 42); + printf("%d\n", x[I]); + x = (v_i16){}; + x = test_v_i16(x, 42, 13); + printf("%d\n", x[I]); + x = (v_i16){}; + x = test_v_i16(x, 42, 55); + printf("%d\n", x[I]); + } + + { + v_u16 x = {}; + x = test_v_u16(x, 42, 42); + printf("%d\n", (i16)x[I]); + x = (v_u16){}; + x = test_v_u16(x, 42, 13); + printf("%d\n", (i16)x[I]); + x = (v_u16){}; + x = test_v_u16(x, 42, 55); + printf("%d\n", (i16)x[I]); + } + + { + v_i8 x = {}; + x = test_v_i8(x, 42, 42); + printf("%d\n", x[I]); + x = (v_i8){}; + x = test_v_i8(x, 42, 13); + printf("%d\n", x[I]); + x = (v_i8){}; + x = test_v_i8(x, 42, 55); + printf("%d\n", x[I]); + } + + { + v_u8 x = {}; + x = test_v_u8(x, 42, 42); + printf("%d\n", (i8)x[I]); + x = (v_u8){}; + x = test_v_u8(x, 42, 13); + printf("%d\n", (i8)x[I]); + x = (v_u8){}; + x = test_v_u8(x, 42, 55); + printf("%d\n", (i8)x[I]); + } + + return 0; +} +--EXPECT-- +-1 +-1 +0 +-1 +-1 +0 +-1 +-1 +0 +-1 +-1 +0 +-1 +-1 +0 +-1 +-1 +0 +-1 +-1 +0 +-1 +-1 +0 +-1 +-1 +0 +-1 +-1 +0 diff --git a/tests/vector/ge-005.test b/tests/vector/ge-005.test new file mode 100644 index 0000000..444014e --- /dev/null +++ b/tests/vector/ge-005.test @@ -0,0 +1,239 @@ +--TEST-- +GE.005: 64-bit vectors SSE2 +--TARGET-- +!aarch64 +--ARGS-- +-mno-sse4 -mno-avx2 --run +--CODE-- +#define N 8 +#define I 0 + +int printf(const char *, ...); + +typedef long long i64; +typedef unsigned long long u64; +typedef int i32; +typedef unsigned int u32; +typedef short i16; +typedef unsigned short u16; +typedef char i8; +typedef unsigned char u8; + +typedef double __attribute__((__vector_size__(N))) v_d; +typedef float __attribute__((__vector_size__(N))) v_f; +typedef i64 __attribute__((__vector_size__(N))) v_i64; +typedef u64 __attribute__((__vector_size__(N))) v_u64; +typedef i32 __attribute__((__vector_size__(N))) v_i32; +typedef u32 __attribute__((__vector_size__(N))) v_u32; +typedef i16 __attribute__((__vector_size__(N))) v_i16; +typedef u16 __attribute__((__vector_size__(N))) v_u16; +typedef i8 __attribute__((__vector_size__(N))) v_i8; +typedef u8 __attribute__((__vector_size__(N))) v_u8; + +v_d __attribute__((noinline)) test_v_d(v_d v, double x, double y) +{ + return (v + x >= y); +} + +v_f __attribute__((noinline)) test_v_f(v_f v, float x, float y) +{ + return (v + x >= y); +} + +v_i64 __attribute__((noinline)) test_v_i64(v_i64 v, i64 x, i64 y) +{ + return (v + x >= y); +} + +v_u64 __attribute__((noinline)) test_v_u64(v_u64 v, u64 x, u64 y) +{ + return (v + x >= y); +} + +v_i32 __attribute__((noinline)) test_v_i32(v_i32 v, i32 x, i32 y) +{ + return (v + x >= y); +} + +v_u32 __attribute__((noinline)) test_v_u32(v_u32 v, u32 x, u32 y) +{ + return (v + x >= y); +} + +v_i16 __attribute__((noinline)) test_v_i16(v_i16 v, i16 x, i16 y) +{ + return (v + x >= y); +} + +v_u16 __attribute__((noinline)) test_v_u16(v_u16 v, u16 x, u16 y) +{ + return (v + x >= y); +} + +v_i8 __attribute__((noinline)) test_v_i8(v_i8 v, i8 x, i8 y) +{ + return (v + x >= y); +} + +v_u8 __attribute__((noinline)) test_v_u8(v_u8 v, u8 x, u8 y) +{ + return (v + x >= y); +} + +int main() +{ + { + v_d x = {}; + v_i64 y; + y = (v_i64)test_v_d(x, 42.42, 42.42); + printf("%lld\n", y[I]); + x = (v_d){}; + y = (v_i64)test_v_d(x, 42.42, 13.13); + printf("%lld\n", y[I]); + x = (v_d){}; + y = (v_i64)test_v_d(x, 42.42, 55.55); + printf("%lld\n", y[I]); + } + + { + v_f x = {}; + v_i32 y; + y = (v_i32)test_v_f(x, 42.42, 42.42); + printf("%d\n", y[I]); + x = (v_f){}; + y = (v_i32)test_v_f(x, 42.42, 13.13); + printf("%d\n", y[I]); + x = (v_f){}; + y = (v_i32)test_v_f(x, 42.42, 55.55); + printf("%d\n", y[I]); + } + + { + v_i64 x = {}; + x = test_v_i64(x, 42, 42); + printf("%lld\n", x[I]); + x = (v_i64){}; + x = test_v_i64(x, 42, 13); + printf("%lld\n", x[I]); + x = (v_i64){}; + x = test_v_i64(x, 42, 55); + printf("%lld\n", x[I]); + } + + { + v_u64 x = {}; + x = test_v_u64(x, 42, 42); + printf("%lld\n", x[I]); + x = (v_u64){}; + x = test_v_u64(x, 42, 13); + printf("%lld\n", x[I]); + x = (v_u64){}; + x = test_v_u64(x, 42, 55); + printf("%lld\n", x[I]); + } + + { + v_i32 x = {}; + x = test_v_i32(x, 42, 42); + printf("%d\n", x[I]); + x = (v_i32){}; + x = test_v_i32(x, 42, 13); + printf("%d\n", x[I]); + x = (v_i32){}; + x = test_v_i32(x, 42, 55); + printf("%d\n", x[I]); + } + + { + v_u32 x = {}; + x = test_v_u32(x, 42, 42); + printf("%d\n", x[I]); + x = (v_u32){}; + x = test_v_u32(x, 42, 13); + printf("%d\n", x[I]); + x = (v_u32){}; + x = test_v_u32(x, 42, 55); + printf("%d\n", x[I]); + } + + { + v_i16 x = {}; + x = test_v_i16(x, 42, 42); + printf("%d\n", x[I]); + x = (v_i16){}; + x = test_v_i16(x, 42, 13); + printf("%d\n", x[I]); + x = (v_i16){}; + x = test_v_i16(x, 42, 55); + printf("%d\n", x[I]); + } + + { + v_u16 x = {}; + x = test_v_u16(x, 42, 42); + printf("%d\n", (i16)x[I]); + x = (v_u16){}; + x = test_v_u16(x, 42, 13); + printf("%d\n", (i16)x[I]); + x = (v_u16){}; + x = test_v_u16(x, 42, 55); + printf("%d\n", (i16)x[I]); + } + + { + v_i8 x = {}; + x = test_v_i8(x, 42, 42); + printf("%d\n", x[I]); + x = (v_i8){}; + x = test_v_i8(x, 42, 13); + printf("%d\n", x[I]); + x = (v_i8){}; + x = test_v_i8(x, 42, 55); + printf("%d\n", x[I]); + } + + { + v_u8 x = {}; + x = test_v_u8(x, 42, 42); + printf("%d\n", (i8)x[I]); + x = (v_u8){}; + x = test_v_u8(x, 42, 13); + printf("%d\n", (i8)x[I]); + x = (v_u8){}; + x = test_v_u8(x, 42, 55); + printf("%d\n", (i8)x[I]); + } + + return 0; +} +--EXPECT-- +-1 +-1 +0 +-1 +-1 +0 +-1 +-1 +0 +-1 +-1 +0 +-1 +-1 +0 +-1 +-1 +0 +-1 +-1 +0 +-1 +-1 +0 +-1 +-1 +0 +-1 +-1 +0 diff --git a/tests/vector/ge-006.test b/tests/vector/ge-006.test new file mode 100644 index 0000000..497c7d8 --- /dev/null +++ b/tests/vector/ge-006.test @@ -0,0 +1,239 @@ +--TEST-- +GE.006: 64-bit vectors AVX +--TARGET-- +!aarch64 +--ARGS-- +-mavx -mno-avx2 --run +--CODE-- +#define N 8 +#define I 0 + +int printf(const char *, ...); + +typedef long long i64; +typedef unsigned long long u64; +typedef int i32; +typedef unsigned int u32; +typedef short i16; +typedef unsigned short u16; +typedef char i8; +typedef unsigned char u8; + +typedef double __attribute__((__vector_size__(N))) v_d; +typedef float __attribute__((__vector_size__(N))) v_f; +typedef i64 __attribute__((__vector_size__(N))) v_i64; +typedef u64 __attribute__((__vector_size__(N))) v_u64; +typedef i32 __attribute__((__vector_size__(N))) v_i32; +typedef u32 __attribute__((__vector_size__(N))) v_u32; +typedef i16 __attribute__((__vector_size__(N))) v_i16; +typedef u16 __attribute__((__vector_size__(N))) v_u16; +typedef i8 __attribute__((__vector_size__(N))) v_i8; +typedef u8 __attribute__((__vector_size__(N))) v_u8; + +v_d __attribute__((noinline)) test_v_d(v_d v, double x, double y) +{ + return (v + x >= y); +} + +v_f __attribute__((noinline)) test_v_f(v_f v, float x, float y) +{ + return (v + x >= y); +} + +v_i64 __attribute__((noinline)) test_v_i64(v_i64 v, i64 x, i64 y) +{ + return (v + x >= y); +} + +v_u64 __attribute__((noinline)) test_v_u64(v_u64 v, u64 x, u64 y) +{ + return (v + x >= y); +} + +v_i32 __attribute__((noinline)) test_v_i32(v_i32 v, i32 x, i32 y) +{ + return (v + x >= y); +} + +v_u32 __attribute__((noinline)) test_v_u32(v_u32 v, u32 x, u32 y) +{ + return (v + x >= y); +} + +v_i16 __attribute__((noinline)) test_v_i16(v_i16 v, i16 x, i16 y) +{ + return (v + x >= y); +} + +v_u16 __attribute__((noinline)) test_v_u16(v_u16 v, u16 x, u16 y) +{ + return (v + x >= y); +} + +v_i8 __attribute__((noinline)) test_v_i8(v_i8 v, i8 x, i8 y) +{ + return (v + x >= y); +} + +v_u8 __attribute__((noinline)) test_v_u8(v_u8 v, u8 x, u8 y) +{ + return (v + x >= y); +} + +int main() +{ + { + v_d x = {}; + v_i64 y; + y = (v_i64)test_v_d(x, 42.42, 42.42); + printf("%lld\n", y[I]); + x = (v_d){}; + y = (v_i64)test_v_d(x, 42.42, 13.13); + printf("%lld\n", y[I]); + x = (v_d){}; + y = (v_i64)test_v_d(x, 42.42, 55.55); + printf("%lld\n", y[I]); + } + + { + v_f x = {}; + v_i32 y; + y = (v_i32)test_v_f(x, 42.42, 42.42); + printf("%d\n", y[I]); + x = (v_f){}; + y = (v_i32)test_v_f(x, 42.42, 13.13); + printf("%d\n", y[I]); + x = (v_f){}; + y = (v_i32)test_v_f(x, 42.42, 55.55); + printf("%d\n", y[I]); + } + + { + v_i64 x = {}; + x = test_v_i64(x, 42, 42); + printf("%lld\n", x[I]); + x = (v_i64){}; + x = test_v_i64(x, 42, 13); + printf("%lld\n", x[I]); + x = (v_i64){}; + x = test_v_i64(x, 42, 55); + printf("%lld\n", x[I]); + } + + { + v_u64 x = {}; + x = test_v_u64(x, 42, 42); + printf("%lld\n", x[I]); + x = (v_u64){}; + x = test_v_u64(x, 42, 13); + printf("%lld\n", x[I]); + x = (v_u64){}; + x = test_v_u64(x, 42, 55); + printf("%lld\n", x[I]); + } + + { + v_i32 x = {}; + x = test_v_i32(x, 42, 42); + printf("%d\n", x[I]); + x = (v_i32){}; + x = test_v_i32(x, 42, 13); + printf("%d\n", x[I]); + x = (v_i32){}; + x = test_v_i32(x, 42, 55); + printf("%d\n", x[I]); + } + + { + v_u32 x = {}; + x = test_v_u32(x, 42, 42); + printf("%d\n", x[I]); + x = (v_u32){}; + x = test_v_u32(x, 42, 13); + printf("%d\n", x[I]); + x = (v_u32){}; + x = test_v_u32(x, 42, 55); + printf("%d\n", x[I]); + } + + { + v_i16 x = {}; + x = test_v_i16(x, 42, 42); + printf("%d\n", x[I]); + x = (v_i16){}; + x = test_v_i16(x, 42, 13); + printf("%d\n", x[I]); + x = (v_i16){}; + x = test_v_i16(x, 42, 55); + printf("%d\n", x[I]); + } + + { + v_u16 x = {}; + x = test_v_u16(x, 42, 42); + printf("%d\n", (i16)x[I]); + x = (v_u16){}; + x = test_v_u16(x, 42, 13); + printf("%d\n", (i16)x[I]); + x = (v_u16){}; + x = test_v_u16(x, 42, 55); + printf("%d\n", (i16)x[I]); + } + + { + v_i8 x = {}; + x = test_v_i8(x, 42, 42); + printf("%d\n", x[I]); + x = (v_i8){}; + x = test_v_i8(x, 42, 13); + printf("%d\n", x[I]); + x = (v_i8){}; + x = test_v_i8(x, 42, 55); + printf("%d\n", x[I]); + } + + { + v_u8 x = {}; + x = test_v_u8(x, 42, 42); + printf("%d\n", (i8)x[I]); + x = (v_u8){}; + x = test_v_u8(x, 42, 13); + printf("%d\n", (i8)x[I]); + x = (v_u8){}; + x = test_v_u8(x, 42, 55); + printf("%d\n", (i8)x[I]); + } + + return 0; +} +--EXPECT-- +-1 +-1 +0 +-1 +-1 +0 +-1 +-1 +0 +-1 +-1 +0 +-1 +-1 +0 +-1 +-1 +0 +-1 +-1 +0 +-1 +-1 +0 +-1 +-1 +0 +-1 +-1 +0 diff --git a/tests/vector/ge-007.test b/tests/vector/ge-007.test new file mode 100644 index 0000000..789715f --- /dev/null +++ b/tests/vector/ge-007.test @@ -0,0 +1,239 @@ +--TEST-- +GE.007: 256-bit vectors AVX +--TARGET-- +!aarch64 +--ARGS-- +-mavx -mno-avx2 --run +--CODE-- +#define N 32 +#define I 3 + +int printf(const char *, ...); + +typedef long long i64; +typedef unsigned long long u64; +typedef int i32; +typedef unsigned int u32; +typedef short i16; +typedef unsigned short u16; +typedef char i8; +typedef unsigned char u8; + +typedef double __attribute__((__vector_size__(N))) v_d; +typedef float __attribute__((__vector_size__(N))) v_f; +typedef i64 __attribute__((__vector_size__(N))) v_i64; +typedef u64 __attribute__((__vector_size__(N))) v_u64; +typedef i32 __attribute__((__vector_size__(N))) v_i32; +typedef u32 __attribute__((__vector_size__(N))) v_u32; +typedef i16 __attribute__((__vector_size__(N))) v_i16; +typedef u16 __attribute__((__vector_size__(N))) v_u16; +typedef i8 __attribute__((__vector_size__(N))) v_i8; +typedef u8 __attribute__((__vector_size__(N))) v_u8; + +v_d __attribute__((noinline)) test_v_d(v_d v, double x, double y) +{ + return (v + x >= y); +} + +v_f __attribute__((noinline)) test_v_f(v_f v, float x, float y) +{ + return (v + x >= y); +} + +v_i64 __attribute__((noinline)) test_v_i64(v_i64 v, i64 x, i64 y) +{ + return (v + x >= y); +} + +v_u64 __attribute__((noinline)) test_v_u64(v_u64 v, u64 x, u64 y) +{ + return (v + x >= y); +} + +v_i32 __attribute__((noinline)) test_v_i32(v_i32 v, i32 x, i32 y) +{ + return (v + x >= y); +} + +v_u32 __attribute__((noinline)) test_v_u32(v_u32 v, u32 x, u32 y) +{ + return (v + x >= y); +} + +v_i16 __attribute__((noinline)) test_v_i16(v_i16 v, i16 x, i16 y) +{ + return (v + x >= y); +} + +v_u16 __attribute__((noinline)) test_v_u16(v_u16 v, u16 x, u16 y) +{ + return (v + x >= y); +} + +v_i8 __attribute__((noinline)) test_v_i8(v_i8 v, i8 x, i8 y) +{ + return (v + x >= y); +} + +v_u8 __attribute__((noinline)) test_v_u8(v_u8 v, u8 x, u8 y) +{ + return (v + x >= y); +} + +int main() +{ + { + v_d x = {}; + v_i64 y; + y = (v_i64)test_v_d(x, 42.42, 42.42); + printf("%lld\n", y[I]); + x = (v_d){}; + y = (v_i64)test_v_d(x, 42.42, 13.13); + printf("%lld\n", y[I]); + x = (v_d){}; + y = (v_i64)test_v_d(x, 42.42, 55.55); + printf("%lld\n", y[I]); + } + + { + v_f x = {}; + v_i32 y; + y = (v_i32)test_v_f(x, 42.42, 42.42); + printf("%d\n", y[I]); + x = (v_f){}; + y = (v_i32)test_v_f(x, 42.42, 13.13); + printf("%d\n", y[I]); + x = (v_f){}; + y = (v_i32)test_v_f(x, 42.42, 55.55); + printf("%d\n", y[I]); + } + + { + v_i64 x = {}; + x = test_v_i64(x, 42, 42); + printf("%lld\n", x[I]); + x = (v_i64){}; + x = test_v_i64(x, 42, 13); + printf("%lld\n", x[I]); + x = (v_i64){}; + x = test_v_i64(x, 42, 55); + printf("%lld\n", x[I]); + } + + { + v_u64 x = {}; + x = test_v_u64(x, 42, 42); + printf("%lld\n", x[I]); + x = (v_u64){}; + x = test_v_u64(x, 42, 13); + printf("%lld\n", x[I]); + x = (v_u64){}; + x = test_v_u64(x, 42, 55); + printf("%lld\n", x[I]); + } + + { + v_i32 x = {}; + x = test_v_i32(x, 42, 42); + printf("%d\n", x[I]); + x = (v_i32){}; + x = test_v_i32(x, 42, 13); + printf("%d\n", x[I]); + x = (v_i32){}; + x = test_v_i32(x, 42, 55); + printf("%d\n", x[I]); + } + + { + v_u32 x = {}; + x = test_v_u32(x, 42, 42); + printf("%d\n", x[I]); + x = (v_u32){}; + x = test_v_u32(x, 42, 13); + printf("%d\n", x[I]); + x = (v_u32){}; + x = test_v_u32(x, 42, 55); + printf("%d\n", x[I]); + } + + { + v_i16 x = {}; + x = test_v_i16(x, 42, 42); + printf("%d\n", x[I]); + x = (v_i16){}; + x = test_v_i16(x, 42, 13); + printf("%d\n", x[I]); + x = (v_i16){}; + x = test_v_i16(x, 42, 55); + printf("%d\n", x[I]); + } + + { + v_u16 x = {}; + x = test_v_u16(x, 42, 42); + printf("%d\n", (i16)x[I]); + x = (v_u16){}; + x = test_v_u16(x, 42, 13); + printf("%d\n", (i16)x[I]); + x = (v_u16){}; + x = test_v_u16(x, 42, 55); + printf("%d\n", (i16)x[I]); + } + + { + v_i8 x = {}; + x = test_v_i8(x, 42, 42); + printf("%d\n", x[I]); + x = (v_i8){}; + x = test_v_i8(x, 42, 13); + printf("%d\n", x[I]); + x = (v_i8){}; + x = test_v_i8(x, 42, 55); + printf("%d\n", x[I]); + } + + { + v_u8 x = {}; + x = test_v_u8(x, 42, 42); + printf("%d\n", (i8)x[I]); + x = (v_u8){}; + x = test_v_u8(x, 42, 13); + printf("%d\n", (i8)x[I]); + x = (v_u8){}; + x = test_v_u8(x, 42, 55); + printf("%d\n", (i8)x[I]); + } + + return 0; +} +--EXPECT-- +-1 +-1 +0 +-1 +-1 +0 +-1 +-1 +0 +-1 +-1 +0 +-1 +-1 +0 +-1 +-1 +0 +-1 +-1 +0 +-1 +-1 +0 +-1 +-1 +0 +-1 +-1 +0 diff --git a/tests/vector/ge-008.test b/tests/vector/ge-008.test new file mode 100644 index 0000000..0932487 --- /dev/null +++ b/tests/vector/ge-008.test @@ -0,0 +1,239 @@ +--TEST-- +GE.008: 256-bit vectors AVX+AVX2 +--TARGET-- +!aarch64 +--ARGS-- +-mavx --run +--CODE-- +#define N 32 +#define I 3 + +int printf(const char *, ...); + +typedef long long i64; +typedef unsigned long long u64; +typedef int i32; +typedef unsigned int u32; +typedef short i16; +typedef unsigned short u16; +typedef char i8; +typedef unsigned char u8; + +typedef double __attribute__((__vector_size__(N))) v_d; +typedef float __attribute__((__vector_size__(N))) v_f; +typedef i64 __attribute__((__vector_size__(N))) v_i64; +typedef u64 __attribute__((__vector_size__(N))) v_u64; +typedef i32 __attribute__((__vector_size__(N))) v_i32; +typedef u32 __attribute__((__vector_size__(N))) v_u32; +typedef i16 __attribute__((__vector_size__(N))) v_i16; +typedef u16 __attribute__((__vector_size__(N))) v_u16; +typedef i8 __attribute__((__vector_size__(N))) v_i8; +typedef u8 __attribute__((__vector_size__(N))) v_u8; + +v_d __attribute__((noinline)) test_v_d(v_d v, double x, double y) +{ + return (v + x >= y); +} + +v_f __attribute__((noinline)) test_v_f(v_f v, float x, float y) +{ + return (v + x >= y); +} + +v_i64 __attribute__((noinline)) test_v_i64(v_i64 v, i64 x, i64 y) +{ + return (v + x >= y); +} + +v_u64 __attribute__((noinline)) test_v_u64(v_u64 v, u64 x, u64 y) +{ + return (v + x >= y); +} + +v_i32 __attribute__((noinline)) test_v_i32(v_i32 v, i32 x, i32 y) +{ + return (v + x >= y); +} + +v_u32 __attribute__((noinline)) test_v_u32(v_u32 v, u32 x, u32 y) +{ + return (v + x >= y); +} + +v_i16 __attribute__((noinline)) test_v_i16(v_i16 v, i16 x, i16 y) +{ + return (v + x >= y); +} + +v_u16 __attribute__((noinline)) test_v_u16(v_u16 v, u16 x, u16 y) +{ + return (v + x >= y); +} + +v_i8 __attribute__((noinline)) test_v_i8(v_i8 v, i8 x, i8 y) +{ + return (v + x >= y); +} + +v_u8 __attribute__((noinline)) test_v_u8(v_u8 v, u8 x, u8 y) +{ + return (v + x >= y); +} + +int main() +{ + { + v_d x = {}; + v_i64 y; + y = (v_i64)test_v_d(x, 42.42, 42.42); + printf("%lld\n", y[I]); + x = (v_d){}; + y = (v_i64)test_v_d(x, 42.42, 13.13); + printf("%lld\n", y[I]); + x = (v_d){}; + y = (v_i64)test_v_d(x, 42.42, 55.55); + printf("%lld\n", y[I]); + } + + { + v_f x = {}; + v_i32 y; + y = (v_i32)test_v_f(x, 42.42, 42.42); + printf("%d\n", y[I]); + x = (v_f){}; + y = (v_i32)test_v_f(x, 42.42, 13.13); + printf("%d\n", y[I]); + x = (v_f){}; + y = (v_i32)test_v_f(x, 42.42, 55.55); + printf("%d\n", y[I]); + } + + { + v_i64 x = {}; + x = test_v_i64(x, 42, 42); + printf("%lld\n", x[I]); + x = (v_i64){}; + x = test_v_i64(x, 42, 13); + printf("%lld\n", x[I]); + x = (v_i64){}; + x = test_v_i64(x, 42, 55); + printf("%lld\n", x[I]); + } + + { + v_u64 x = {}; + x = test_v_u64(x, 42, 42); + printf("%lld\n", x[I]); + x = (v_u64){}; + x = test_v_u64(x, 42, 13); + printf("%lld\n", x[I]); + x = (v_u64){}; + x = test_v_u64(x, 42, 55); + printf("%lld\n", x[I]); + } + + { + v_i32 x = {}; + x = test_v_i32(x, 42, 42); + printf("%d\n", x[I]); + x = (v_i32){}; + x = test_v_i32(x, 42, 13); + printf("%d\n", x[I]); + x = (v_i32){}; + x = test_v_i32(x, 42, 55); + printf("%d\n", x[I]); + } + + { + v_u32 x = {}; + x = test_v_u32(x, 42, 42); + printf("%d\n", x[I]); + x = (v_u32){}; + x = test_v_u32(x, 42, 13); + printf("%d\n", x[I]); + x = (v_u32){}; + x = test_v_u32(x, 42, 55); + printf("%d\n", x[I]); + } + + { + v_i16 x = {}; + x = test_v_i16(x, 42, 42); + printf("%d\n", x[I]); + x = (v_i16){}; + x = test_v_i16(x, 42, 13); + printf("%d\n", x[I]); + x = (v_i16){}; + x = test_v_i16(x, 42, 55); + printf("%d\n", x[I]); + } + + { + v_u16 x = {}; + x = test_v_u16(x, 42, 42); + printf("%d\n", (i16)x[I]); + x = (v_u16){}; + x = test_v_u16(x, 42, 13); + printf("%d\n", (i16)x[I]); + x = (v_u16){}; + x = test_v_u16(x, 42, 55); + printf("%d\n", (i16)x[I]); + } + + { + v_i8 x = {}; + x = test_v_i8(x, 42, 42); + printf("%d\n", x[I]); + x = (v_i8){}; + x = test_v_i8(x, 42, 13); + printf("%d\n", x[I]); + x = (v_i8){}; + x = test_v_i8(x, 42, 55); + printf("%d\n", x[I]); + } + + { + v_u8 x = {}; + x = test_v_u8(x, 42, 42); + printf("%d\n", (i8)x[I]); + x = (v_u8){}; + x = test_v_u8(x, 42, 13); + printf("%d\n", (i8)x[I]); + x = (v_u8){}; + x = test_v_u8(x, 42, 55); + printf("%d\n", (i8)x[I]); + } + + return 0; +} +--EXPECT-- +-1 +-1 +0 +-1 +-1 +0 +-1 +-1 +0 +-1 +-1 +0 +-1 +-1 +0 +-1 +-1 +0 +-1 +-1 +0 +-1 +-1 +0 +-1 +-1 +0 +-1 +-1 +0 diff --git a/tests/vector/gt-001.test b/tests/vector/gt-001.test new file mode 100644 index 0000000..49a794f --- /dev/null +++ b/tests/vector/gt-001.test @@ -0,0 +1,239 @@ +--TEST-- +GT.001: 128-bit vectors SSE2 +--TARGET-- +!aarch64 +--ARGS-- +-mno-sse4 -mno-avx2 --run +--CODE-- +#define N 16 +#define I 1 + +int printf(const char *, ...); + +typedef long long i64; +typedef unsigned long long u64; +typedef int i32; +typedef unsigned int u32; +typedef short i16; +typedef unsigned short u16; +typedef char i8; +typedef unsigned char u8; + +typedef double __attribute__((__vector_size__(N))) v_d; +typedef float __attribute__((__vector_size__(N))) v_f; +typedef i64 __attribute__((__vector_size__(N))) v_i64; +typedef u64 __attribute__((__vector_size__(N))) v_u64; +typedef i32 __attribute__((__vector_size__(N))) v_i32; +typedef u32 __attribute__((__vector_size__(N))) v_u32; +typedef i16 __attribute__((__vector_size__(N))) v_i16; +typedef u16 __attribute__((__vector_size__(N))) v_u16; +typedef i8 __attribute__((__vector_size__(N))) v_i8; +typedef u8 __attribute__((__vector_size__(N))) v_u8; + +v_d __attribute__((noinline)) test_v_d(v_d v, double x, double y) +{ + return (v + x > y); +} + +v_f __attribute__((noinline)) test_v_f(v_f v, float x, float y) +{ + return (v + x > y); +} + +v_i64 __attribute__((noinline)) test_v_i64(v_i64 v, i64 x, i64 y) +{ + return (v + x > y); +} + +v_u64 __attribute__((noinline)) test_v_u64(v_u64 v, u64 x, u64 y) +{ + return (v + x > y); +} + +v_i32 __attribute__((noinline)) test_v_i32(v_i32 v, i32 x, i32 y) +{ + return (v + x > y); +} + +v_u32 __attribute__((noinline)) test_v_u32(v_u32 v, u32 x, u32 y) +{ + return (v + x > y); +} + +v_i16 __attribute__((noinline)) test_v_i16(v_i16 v, i16 x, i16 y) +{ + return (v + x > y); +} + +v_u16 __attribute__((noinline)) test_v_u16(v_u16 v, u16 x, u16 y) +{ + return (v + x > y); +} + +v_i8 __attribute__((noinline)) test_v_i8(v_i8 v, i8 x, i8 y) +{ + return (v + x > y); +} + +v_u8 __attribute__((noinline)) test_v_u8(v_u8 v, u8 x, u8 y) +{ + return (v + x > y); +} + +int main() +{ + { + v_d x = {}; + v_i64 y; + y = (v_i64)test_v_d(x, 42.42, 42.42); + printf("%lld\n", y[I]); + x = (v_d){}; + y = (v_i64)test_v_d(x, 42.42, 13.13); + printf("%lld\n", y[I]); + x = (v_d){}; + y = (v_i64)test_v_d(x, 42.42, 55.55); + printf("%lld\n", y[I]); + } + + { + v_f x = {}; + v_i32 y; + y = (v_i32)test_v_f(x, 42.42, 42.42); + printf("%d\n", y[I]); + x = (v_f){}; + y = (v_i32)test_v_f(x, 42.42, 13.13); + printf("%d\n", y[I]); + x = (v_f){}; + y = (v_i32)test_v_f(x, 42.42, 55.55); + printf("%d\n", y[I]); + } + + { + v_i64 x = {}; + x = test_v_i64(x, 42, 42); + printf("%lld\n", x[I]); + x = (v_i64){}; + x = test_v_i64(x, 42, 13); + printf("%lld\n", x[I]); + x = (v_i64){}; + x = test_v_i64(x, 42, 55); + printf("%lld\n", x[I]); + } + + { + v_u64 x = {}; + x = test_v_u64(x, 42, 42); + printf("%lld\n", x[I]); + x = (v_u64){}; + x = test_v_u64(x, 42, 13); + printf("%lld\n", x[I]); + x = (v_u64){}; + x = test_v_u64(x, 42, 55); + printf("%lld\n", x[I]); + } + + { + v_i32 x = {}; + x = test_v_i32(x, 42, 42); + printf("%d\n", x[I]); + x = (v_i32){}; + x = test_v_i32(x, 42, 13); + printf("%d\n", x[I]); + x = (v_i32){}; + x = test_v_i32(x, 42, 55); + printf("%d\n", x[I]); + } + + { + v_u32 x = {}; + x = test_v_u32(x, 42, 42); + printf("%d\n", x[I]); + x = (v_u32){}; + x = test_v_u32(x, 42, 13); + printf("%d\n", x[I]); + x = (v_u32){}; + x = test_v_u32(x, 42, 55); + printf("%d\n", x[I]); + } + + { + v_i16 x = {}; + x = test_v_i16(x, 42, 42); + printf("%d\n", x[I]); + x = (v_i16){}; + x = test_v_i16(x, 42, 13); + printf("%d\n", x[I]); + x = (v_i16){}; + x = test_v_i16(x, 42, 55); + printf("%d\n", x[I]); + } + + { + v_u16 x = {}; + x = test_v_u16(x, 42, 42); + printf("%d\n", (i16)x[I]); + x = (v_u16){}; + x = test_v_u16(x, 42, 13); + printf("%d\n", (i16)x[I]); + x = (v_u16){}; + x = test_v_u16(x, 42, 55); + printf("%d\n", (i16)x[I]); + } + + { + v_i8 x = {}; + x = test_v_i8(x, 42, 42); + printf("%d\n", x[I]); + x = (v_i8){}; + x = test_v_i8(x, 42, 13); + printf("%d\n", x[I]); + x = (v_i8){}; + x = test_v_i8(x, 42, 55); + printf("%d\n", x[I]); + } + + { + v_u8 x = {}; + x = test_v_u8(x, 42, 42); + printf("%d\n", (i8)x[I]); + x = (v_u8){}; + x = test_v_u8(x, 42, 13); + printf("%d\n", (i8)x[I]); + x = (v_u8){}; + x = test_v_u8(x, 42, 55); + printf("%d\n", (i8)x[I]); + } + + return 0; +} +--EXPECT-- +0 +-1 +0 +0 +-1 +0 +0 +-1 +0 +0 +-1 +0 +0 +-1 +0 +0 +-1 +0 +0 +-1 +0 +0 +-1 +0 +0 +-1 +0 +0 +-1 +0 diff --git a/tests/vector/gt-002.test b/tests/vector/gt-002.test new file mode 100644 index 0000000..07bbe13 --- /dev/null +++ b/tests/vector/gt-002.test @@ -0,0 +1,239 @@ +--TEST-- +GT.002: 128-bit vectors SSE2+SSE4 +--TARGET-- +!aarch64 +--ARGS-- +-mno-avx2 --run +--CODE-- +#define N 16 +#define I 1 + +int printf(const char *, ...); + +typedef long long i64; +typedef unsigned long long u64; +typedef int i32; +typedef unsigned int u32; +typedef short i16; +typedef unsigned short u16; +typedef char i8; +typedef unsigned char u8; + +typedef double __attribute__((__vector_size__(N))) v_d; +typedef float __attribute__((__vector_size__(N))) v_f; +typedef i64 __attribute__((__vector_size__(N))) v_i64; +typedef u64 __attribute__((__vector_size__(N))) v_u64; +typedef i32 __attribute__((__vector_size__(N))) v_i32; +typedef u32 __attribute__((__vector_size__(N))) v_u32; +typedef i16 __attribute__((__vector_size__(N))) v_i16; +typedef u16 __attribute__((__vector_size__(N))) v_u16; +typedef i8 __attribute__((__vector_size__(N))) v_i8; +typedef u8 __attribute__((__vector_size__(N))) v_u8; + +v_d __attribute__((noinline)) test_v_d(v_d v, double x, double y) +{ + return (v + x > y); +} + +v_f __attribute__((noinline)) test_v_f(v_f v, float x, float y) +{ + return (v + x > y); +} + +v_i64 __attribute__((noinline)) test_v_i64(v_i64 v, i64 x, i64 y) +{ + return (v + x > y); +} + +v_u64 __attribute__((noinline)) test_v_u64(v_u64 v, u64 x, u64 y) +{ + return (v + x > y); +} + +v_i32 __attribute__((noinline)) test_v_i32(v_i32 v, i32 x, i32 y) +{ + return (v + x > y); +} + +v_u32 __attribute__((noinline)) test_v_u32(v_u32 v, u32 x, u32 y) +{ + return (v + x > y); +} + +v_i16 __attribute__((noinline)) test_v_i16(v_i16 v, i16 x, i16 y) +{ + return (v + x > y); +} + +v_u16 __attribute__((noinline)) test_v_u16(v_u16 v, u16 x, u16 y) +{ + return (v + x > y); +} + +v_i8 __attribute__((noinline)) test_v_i8(v_i8 v, i8 x, i8 y) +{ + return (v + x > y); +} + +v_u8 __attribute__((noinline)) test_v_u8(v_u8 v, u8 x, u8 y) +{ + return (v + x > y); +} + +int main() +{ + { + v_d x = {}; + v_i64 y; + y = (v_i64)test_v_d(x, 42.42, 42.42); + printf("%lld\n", y[I]); + x = (v_d){}; + y = (v_i64)test_v_d(x, 42.42, 13.13); + printf("%lld\n", y[I]); + x = (v_d){}; + y = (v_i64)test_v_d(x, 42.42, 55.55); + printf("%lld\n", y[I]); + } + + { + v_f x = {}; + v_i32 y; + y = (v_i32)test_v_f(x, 42.42, 42.42); + printf("%d\n", y[I]); + x = (v_f){}; + y = (v_i32)test_v_f(x, 42.42, 13.13); + printf("%d\n", y[I]); + x = (v_f){}; + y = (v_i32)test_v_f(x, 42.42, 55.55); + printf("%d\n", y[I]); + } + + { + v_i64 x = {}; + x = test_v_i64(x, 42, 42); + printf("%lld\n", x[I]); + x = (v_i64){}; + x = test_v_i64(x, 42, 13); + printf("%lld\n", x[I]); + x = (v_i64){}; + x = test_v_i64(x, 42, 55); + printf("%lld\n", x[I]); + } + + { + v_u64 x = {}; + x = test_v_u64(x, 42, 42); + printf("%lld\n", x[I]); + x = (v_u64){}; + x = test_v_u64(x, 42, 13); + printf("%lld\n", x[I]); + x = (v_u64){}; + x = test_v_u64(x, 42, 55); + printf("%lld\n", x[I]); + } + + { + v_i32 x = {}; + x = test_v_i32(x, 42, 42); + printf("%d\n", x[I]); + x = (v_i32){}; + x = test_v_i32(x, 42, 13); + printf("%d\n", x[I]); + x = (v_i32){}; + x = test_v_i32(x, 42, 55); + printf("%d\n", x[I]); + } + + { + v_u32 x = {}; + x = test_v_u32(x, 42, 42); + printf("%d\n", x[I]); + x = (v_u32){}; + x = test_v_u32(x, 42, 13); + printf("%d\n", x[I]); + x = (v_u32){}; + x = test_v_u32(x, 42, 55); + printf("%d\n", x[I]); + } + + { + v_i16 x = {}; + x = test_v_i16(x, 42, 42); + printf("%d\n", x[I]); + x = (v_i16){}; + x = test_v_i16(x, 42, 13); + printf("%d\n", x[I]); + x = (v_i16){}; + x = test_v_i16(x, 42, 55); + printf("%d\n", x[I]); + } + + { + v_u16 x = {}; + x = test_v_u16(x, 42, 42); + printf("%d\n", (i16)x[I]); + x = (v_u16){}; + x = test_v_u16(x, 42, 13); + printf("%d\n", (i16)x[I]); + x = (v_u16){}; + x = test_v_u16(x, 42, 55); + printf("%d\n", (i16)x[I]); + } + + { + v_i8 x = {}; + x = test_v_i8(x, 42, 42); + printf("%d\n", x[I]); + x = (v_i8){}; + x = test_v_i8(x, 42, 13); + printf("%d\n", x[I]); + x = (v_i8){}; + x = test_v_i8(x, 42, 55); + printf("%d\n", x[I]); + } + + { + v_u8 x = {}; + x = test_v_u8(x, 42, 42); + printf("%d\n", (i8)x[I]); + x = (v_u8){}; + x = test_v_u8(x, 42, 13); + printf("%d\n", (i8)x[I]); + x = (v_u8){}; + x = test_v_u8(x, 42, 55); + printf("%d\n", (i8)x[I]); + } + + return 0; +} +--EXPECT-- +0 +-1 +0 +0 +-1 +0 +0 +-1 +0 +0 +-1 +0 +0 +-1 +0 +0 +-1 +0 +0 +-1 +0 +0 +-1 +0 +0 +-1 +0 +0 +-1 +0 diff --git a/tests/vector/gt-003.test b/tests/vector/gt-003.test new file mode 100644 index 0000000..7d3145d --- /dev/null +++ b/tests/vector/gt-003.test @@ -0,0 +1,239 @@ +--TEST-- +GT.003: 128-bit vectors AVX +--TARGET-- +!aarch64 +--ARGS-- +-mavx -mno-avx2 --run +--CODE-- +#define N 16 +#define I 1 + +int printf(const char *, ...); + +typedef long long i64; +typedef unsigned long long u64; +typedef int i32; +typedef unsigned int u32; +typedef short i16; +typedef unsigned short u16; +typedef char i8; +typedef unsigned char u8; + +typedef double __attribute__((__vector_size__(N))) v_d; +typedef float __attribute__((__vector_size__(N))) v_f; +typedef i64 __attribute__((__vector_size__(N))) v_i64; +typedef u64 __attribute__((__vector_size__(N))) v_u64; +typedef i32 __attribute__((__vector_size__(N))) v_i32; +typedef u32 __attribute__((__vector_size__(N))) v_u32; +typedef i16 __attribute__((__vector_size__(N))) v_i16; +typedef u16 __attribute__((__vector_size__(N))) v_u16; +typedef i8 __attribute__((__vector_size__(N))) v_i8; +typedef u8 __attribute__((__vector_size__(N))) v_u8; + +v_d __attribute__((noinline)) test_v_d(v_d v, double x, double y) +{ + return (v + x > y); +} + +v_f __attribute__((noinline)) test_v_f(v_f v, float x, float y) +{ + return (v + x > y); +} + +v_i64 __attribute__((noinline)) test_v_i64(v_i64 v, i64 x, i64 y) +{ + return (v + x > y); +} + +v_u64 __attribute__((noinline)) test_v_u64(v_u64 v, u64 x, u64 y) +{ + return (v + x > y); +} + +v_i32 __attribute__((noinline)) test_v_i32(v_i32 v, i32 x, i32 y) +{ + return (v + x > y); +} + +v_u32 __attribute__((noinline)) test_v_u32(v_u32 v, u32 x, u32 y) +{ + return (v + x > y); +} + +v_i16 __attribute__((noinline)) test_v_i16(v_i16 v, i16 x, i16 y) +{ + return (v + x > y); +} + +v_u16 __attribute__((noinline)) test_v_u16(v_u16 v, u16 x, u16 y) +{ + return (v + x > y); +} + +v_i8 __attribute__((noinline)) test_v_i8(v_i8 v, i8 x, i8 y) +{ + return (v + x > y); +} + +v_u8 __attribute__((noinline)) test_v_u8(v_u8 v, u8 x, u8 y) +{ + return (v + x > y); +} + +int main() +{ + { + v_d x = {}; + v_i64 y; + y = (v_i64)test_v_d(x, 42.42, 42.42); + printf("%lld\n", y[I]); + x = (v_d){}; + y = (v_i64)test_v_d(x, 42.42, 13.13); + printf("%lld\n", y[I]); + x = (v_d){}; + y = (v_i64)test_v_d(x, 42.42, 55.55); + printf("%lld\n", y[I]); + } + + { + v_f x = {}; + v_i32 y; + y = (v_i32)test_v_f(x, 42.42, 42.42); + printf("%d\n", y[I]); + x = (v_f){}; + y = (v_i32)test_v_f(x, 42.42, 13.13); + printf("%d\n", y[I]); + x = (v_f){}; + y = (v_i32)test_v_f(x, 42.42, 55.55); + printf("%d\n", y[I]); + } + + { + v_i64 x = {}; + x = test_v_i64(x, 42, 42); + printf("%lld\n", x[I]); + x = (v_i64){}; + x = test_v_i64(x, 42, 13); + printf("%lld\n", x[I]); + x = (v_i64){}; + x = test_v_i64(x, 42, 55); + printf("%lld\n", x[I]); + } + + { + v_u64 x = {}; + x = test_v_u64(x, 42, 42); + printf("%lld\n", x[I]); + x = (v_u64){}; + x = test_v_u64(x, 42, 13); + printf("%lld\n", x[I]); + x = (v_u64){}; + x = test_v_u64(x, 42, 55); + printf("%lld\n", x[I]); + } + + { + v_i32 x = {}; + x = test_v_i32(x, 42, 42); + printf("%d\n", x[I]); + x = (v_i32){}; + x = test_v_i32(x, 42, 13); + printf("%d\n", x[I]); + x = (v_i32){}; + x = test_v_i32(x, 42, 55); + printf("%d\n", x[I]); + } + + { + v_u32 x = {}; + x = test_v_u32(x, 42, 42); + printf("%d\n", x[I]); + x = (v_u32){}; + x = test_v_u32(x, 42, 13); + printf("%d\n", x[I]); + x = (v_u32){}; + x = test_v_u32(x, 42, 55); + printf("%d\n", x[I]); + } + + { + v_i16 x = {}; + x = test_v_i16(x, 42, 42); + printf("%d\n", x[I]); + x = (v_i16){}; + x = test_v_i16(x, 42, 13); + printf("%d\n", x[I]); + x = (v_i16){}; + x = test_v_i16(x, 42, 55); + printf("%d\n", x[I]); + } + + { + v_u16 x = {}; + x = test_v_u16(x, 42, 42); + printf("%d\n", (i16)x[I]); + x = (v_u16){}; + x = test_v_u16(x, 42, 13); + printf("%d\n", (i16)x[I]); + x = (v_u16){}; + x = test_v_u16(x, 42, 55); + printf("%d\n", (i16)x[I]); + } + + { + v_i8 x = {}; + x = test_v_i8(x, 42, 42); + printf("%d\n", x[I]); + x = (v_i8){}; + x = test_v_i8(x, 42, 13); + printf("%d\n", x[I]); + x = (v_i8){}; + x = test_v_i8(x, 42, 55); + printf("%d\n", x[I]); + } + + { + v_u8 x = {}; + x = test_v_u8(x, 42, 42); + printf("%d\n", (i8)x[I]); + x = (v_u8){}; + x = test_v_u8(x, 42, 13); + printf("%d\n", (i8)x[I]); + x = (v_u8){}; + x = test_v_u8(x, 42, 55); + printf("%d\n", (i8)x[I]); + } + + return 0; +} +--EXPECT-- +0 +-1 +0 +0 +-1 +0 +0 +-1 +0 +0 +-1 +0 +0 +-1 +0 +0 +-1 +0 +0 +-1 +0 +0 +-1 +0 +0 +-1 +0 +0 +-1 +0 diff --git a/tests/vector/gt-004.test b/tests/vector/gt-004.test new file mode 100644 index 0000000..b4c1910 --- /dev/null +++ b/tests/vector/gt-004.test @@ -0,0 +1,239 @@ +--TEST-- +GT.004: 128-bit vectors AVX+AVX2 +--TARGET-- +!aarch64 +--ARGS-- +-mavx --run +--CODE-- +#define N 16 +#define I 1 + +int printf(const char *, ...); + +typedef long long i64; +typedef unsigned long long u64; +typedef int i32; +typedef unsigned int u32; +typedef short i16; +typedef unsigned short u16; +typedef char i8; +typedef unsigned char u8; + +typedef double __attribute__((__vector_size__(N))) v_d; +typedef float __attribute__((__vector_size__(N))) v_f; +typedef i64 __attribute__((__vector_size__(N))) v_i64; +typedef u64 __attribute__((__vector_size__(N))) v_u64; +typedef i32 __attribute__((__vector_size__(N))) v_i32; +typedef u32 __attribute__((__vector_size__(N))) v_u32; +typedef i16 __attribute__((__vector_size__(N))) v_i16; +typedef u16 __attribute__((__vector_size__(N))) v_u16; +typedef i8 __attribute__((__vector_size__(N))) v_i8; +typedef u8 __attribute__((__vector_size__(N))) v_u8; + +v_d __attribute__((noinline)) test_v_d(v_d v, double x, double y) +{ + return (v + x > y); +} + +v_f __attribute__((noinline)) test_v_f(v_f v, float x, float y) +{ + return (v + x > y); +} + +v_i64 __attribute__((noinline)) test_v_i64(v_i64 v, i64 x, i64 y) +{ + return (v + x > y); +} + +v_u64 __attribute__((noinline)) test_v_u64(v_u64 v, u64 x, u64 y) +{ + return (v + x > y); +} + +v_i32 __attribute__((noinline)) test_v_i32(v_i32 v, i32 x, i32 y) +{ + return (v + x > y); +} + +v_u32 __attribute__((noinline)) test_v_u32(v_u32 v, u32 x, u32 y) +{ + return (v + x > y); +} + +v_i16 __attribute__((noinline)) test_v_i16(v_i16 v, i16 x, i16 y) +{ + return (v + x > y); +} + +v_u16 __attribute__((noinline)) test_v_u16(v_u16 v, u16 x, u16 y) +{ + return (v + x > y); +} + +v_i8 __attribute__((noinline)) test_v_i8(v_i8 v, i8 x, i8 y) +{ + return (v + x > y); +} + +v_u8 __attribute__((noinline)) test_v_u8(v_u8 v, u8 x, u8 y) +{ + return (v + x > y); +} + +int main() +{ + { + v_d x = {}; + v_i64 y; + y = (v_i64)test_v_d(x, 42.42, 42.42); + printf("%lld\n", y[I]); + x = (v_d){}; + y = (v_i64)test_v_d(x, 42.42, 13.13); + printf("%lld\n", y[I]); + x = (v_d){}; + y = (v_i64)test_v_d(x, 42.42, 55.55); + printf("%lld\n", y[I]); + } + + { + v_f x = {}; + v_i32 y; + y = (v_i32)test_v_f(x, 42.42, 42.42); + printf("%d\n", y[I]); + x = (v_f){}; + y = (v_i32)test_v_f(x, 42.42, 13.13); + printf("%d\n", y[I]); + x = (v_f){}; + y = (v_i32)test_v_f(x, 42.42, 55.55); + printf("%d\n", y[I]); + } + + { + v_i64 x = {}; + x = test_v_i64(x, 42, 42); + printf("%lld\n", x[I]); + x = (v_i64){}; + x = test_v_i64(x, 42, 13); + printf("%lld\n", x[I]); + x = (v_i64){}; + x = test_v_i64(x, 42, 55); + printf("%lld\n", x[I]); + } + + { + v_u64 x = {}; + x = test_v_u64(x, 42, 42); + printf("%lld\n", x[I]); + x = (v_u64){}; + x = test_v_u64(x, 42, 13); + printf("%lld\n", x[I]); + x = (v_u64){}; + x = test_v_u64(x, 42, 55); + printf("%lld\n", x[I]); + } + + { + v_i32 x = {}; + x = test_v_i32(x, 42, 42); + printf("%d\n", x[I]); + x = (v_i32){}; + x = test_v_i32(x, 42, 13); + printf("%d\n", x[I]); + x = (v_i32){}; + x = test_v_i32(x, 42, 55); + printf("%d\n", x[I]); + } + + { + v_u32 x = {}; + x = test_v_u32(x, 42, 42); + printf("%d\n", x[I]); + x = (v_u32){}; + x = test_v_u32(x, 42, 13); + printf("%d\n", x[I]); + x = (v_u32){}; + x = test_v_u32(x, 42, 55); + printf("%d\n", x[I]); + } + + { + v_i16 x = {}; + x = test_v_i16(x, 42, 42); + printf("%d\n", x[I]); + x = (v_i16){}; + x = test_v_i16(x, 42, 13); + printf("%d\n", x[I]); + x = (v_i16){}; + x = test_v_i16(x, 42, 55); + printf("%d\n", x[I]); + } + + { + v_u16 x = {}; + x = test_v_u16(x, 42, 42); + printf("%d\n", (i16)x[I]); + x = (v_u16){}; + x = test_v_u16(x, 42, 13); + printf("%d\n", (i16)x[I]); + x = (v_u16){}; + x = test_v_u16(x, 42, 55); + printf("%d\n", (i16)x[I]); + } + + { + v_i8 x = {}; + x = test_v_i8(x, 42, 42); + printf("%d\n", x[I]); + x = (v_i8){}; + x = test_v_i8(x, 42, 13); + printf("%d\n", x[I]); + x = (v_i8){}; + x = test_v_i8(x, 42, 55); + printf("%d\n", x[I]); + } + + { + v_u8 x = {}; + x = test_v_u8(x, 42, 42); + printf("%d\n", (i8)x[I]); + x = (v_u8){}; + x = test_v_u8(x, 42, 13); + printf("%d\n", (i8)x[I]); + x = (v_u8){}; + x = test_v_u8(x, 42, 55); + printf("%d\n", (i8)x[I]); + } + + return 0; +} +--EXPECT-- +0 +-1 +0 +0 +-1 +0 +0 +-1 +0 +0 +-1 +0 +0 +-1 +0 +0 +-1 +0 +0 +-1 +0 +0 +-1 +0 +0 +-1 +0 +0 +-1 +0 diff --git a/tests/vector/gt-005.test b/tests/vector/gt-005.test new file mode 100644 index 0000000..e2053f7 --- /dev/null +++ b/tests/vector/gt-005.test @@ -0,0 +1,239 @@ +--TEST-- +GT.005: 64-bit vectors SSE2 +--TARGET-- +!aarch64 +--ARGS-- +-mno-sse4 -mno-avx2 --run +--CODE-- +#define N 8 +#define I 0 + +int printf(const char *, ...); + +typedef long long i64; +typedef unsigned long long u64; +typedef int i32; +typedef unsigned int u32; +typedef short i16; +typedef unsigned short u16; +typedef char i8; +typedef unsigned char u8; + +typedef double __attribute__((__vector_size__(N))) v_d; +typedef float __attribute__((__vector_size__(N))) v_f; +typedef i64 __attribute__((__vector_size__(N))) v_i64; +typedef u64 __attribute__((__vector_size__(N))) v_u64; +typedef i32 __attribute__((__vector_size__(N))) v_i32; +typedef u32 __attribute__((__vector_size__(N))) v_u32; +typedef i16 __attribute__((__vector_size__(N))) v_i16; +typedef u16 __attribute__((__vector_size__(N))) v_u16; +typedef i8 __attribute__((__vector_size__(N))) v_i8; +typedef u8 __attribute__((__vector_size__(N))) v_u8; + +v_d __attribute__((noinline)) test_v_d(v_d v, double x, double y) +{ + return (v + x > y); +} + +v_f __attribute__((noinline)) test_v_f(v_f v, float x, float y) +{ + return (v + x > y); +} + +v_i64 __attribute__((noinline)) test_v_i64(v_i64 v, i64 x, i64 y) +{ + return (v + x > y); +} + +v_u64 __attribute__((noinline)) test_v_u64(v_u64 v, u64 x, u64 y) +{ + return (v + x > y); +} + +v_i32 __attribute__((noinline)) test_v_i32(v_i32 v, i32 x, i32 y) +{ + return (v + x > y); +} + +v_u32 __attribute__((noinline)) test_v_u32(v_u32 v, u32 x, u32 y) +{ + return (v + x > y); +} + +v_i16 __attribute__((noinline)) test_v_i16(v_i16 v, i16 x, i16 y) +{ + return (v + x > y); +} + +v_u16 __attribute__((noinline)) test_v_u16(v_u16 v, u16 x, u16 y) +{ + return (v + x > y); +} + +v_i8 __attribute__((noinline)) test_v_i8(v_i8 v, i8 x, i8 y) +{ + return (v + x > y); +} + +v_u8 __attribute__((noinline)) test_v_u8(v_u8 v, u8 x, u8 y) +{ + return (v + x > y); +} + +int main() +{ + { + v_d x = {}; + v_i64 y; + y = (v_i64)test_v_d(x, 42.42, 42.42); + printf("%lld\n", y[I]); + x = (v_d){}; + y = (v_i64)test_v_d(x, 42.42, 13.13); + printf("%lld\n", y[I]); + x = (v_d){}; + y = (v_i64)test_v_d(x, 42.42, 55.55); + printf("%lld\n", y[I]); + } + + { + v_f x = {}; + v_i32 y; + y = (v_i32)test_v_f(x, 42.42, 42.42); + printf("%d\n", y[I]); + x = (v_f){}; + y = (v_i32)test_v_f(x, 42.42, 13.13); + printf("%d\n", y[I]); + x = (v_f){}; + y = (v_i32)test_v_f(x, 42.42, 55.55); + printf("%d\n", y[I]); + } + + { + v_i64 x = {}; + x = test_v_i64(x, 42, 42); + printf("%lld\n", x[I]); + x = (v_i64){}; + x = test_v_i64(x, 42, 13); + printf("%lld\n", x[I]); + x = (v_i64){}; + x = test_v_i64(x, 42, 55); + printf("%lld\n", x[I]); + } + + { + v_u64 x = {}; + x = test_v_u64(x, 42, 42); + printf("%lld\n", x[I]); + x = (v_u64){}; + x = test_v_u64(x, 42, 13); + printf("%lld\n", x[I]); + x = (v_u64){}; + x = test_v_u64(x, 42, 55); + printf("%lld\n", x[I]); + } + + { + v_i32 x = {}; + x = test_v_i32(x, 42, 42); + printf("%d\n", x[I]); + x = (v_i32){}; + x = test_v_i32(x, 42, 13); + printf("%d\n", x[I]); + x = (v_i32){}; + x = test_v_i32(x, 42, 55); + printf("%d\n", x[I]); + } + + { + v_u32 x = {}; + x = test_v_u32(x, 42, 42); + printf("%d\n", x[I]); + x = (v_u32){}; + x = test_v_u32(x, 42, 13); + printf("%d\n", x[I]); + x = (v_u32){}; + x = test_v_u32(x, 42, 55); + printf("%d\n", x[I]); + } + + { + v_i16 x = {}; + x = test_v_i16(x, 42, 42); + printf("%d\n", x[I]); + x = (v_i16){}; + x = test_v_i16(x, 42, 13); + printf("%d\n", x[I]); + x = (v_i16){}; + x = test_v_i16(x, 42, 55); + printf("%d\n", x[I]); + } + + { + v_u16 x = {}; + x = test_v_u16(x, 42, 42); + printf("%d\n", (i16)x[I]); + x = (v_u16){}; + x = test_v_u16(x, 42, 13); + printf("%d\n", (i16)x[I]); + x = (v_u16){}; + x = test_v_u16(x, 42, 55); + printf("%d\n", (i16)x[I]); + } + + { + v_i8 x = {}; + x = test_v_i8(x, 42, 42); + printf("%d\n", x[I]); + x = (v_i8){}; + x = test_v_i8(x, 42, 13); + printf("%d\n", x[I]); + x = (v_i8){}; + x = test_v_i8(x, 42, 55); + printf("%d\n", x[I]); + } + + { + v_u8 x = {}; + x = test_v_u8(x, 42, 42); + printf("%d\n", (i8)x[I]); + x = (v_u8){}; + x = test_v_u8(x, 42, 13); + printf("%d\n", (i8)x[I]); + x = (v_u8){}; + x = test_v_u8(x, 42, 55); + printf("%d\n", (i8)x[I]); + } + + return 0; +} +--EXPECT-- +0 +-1 +0 +0 +-1 +0 +0 +-1 +0 +0 +-1 +0 +0 +-1 +0 +0 +-1 +0 +0 +-1 +0 +0 +-1 +0 +0 +-1 +0 +0 +-1 +0 diff --git a/tests/vector/gt-006.test b/tests/vector/gt-006.test new file mode 100644 index 0000000..902962c --- /dev/null +++ b/tests/vector/gt-006.test @@ -0,0 +1,239 @@ +--TEST-- +GT.006: 64-bit vectors AVX +--TARGET-- +!aarch64 +--ARGS-- +-mavx -mno-avx2 --run +--CODE-- +#define N 8 +#define I 0 + +int printf(const char *, ...); + +typedef long long i64; +typedef unsigned long long u64; +typedef int i32; +typedef unsigned int u32; +typedef short i16; +typedef unsigned short u16; +typedef char i8; +typedef unsigned char u8; + +typedef double __attribute__((__vector_size__(N))) v_d; +typedef float __attribute__((__vector_size__(N))) v_f; +typedef i64 __attribute__((__vector_size__(N))) v_i64; +typedef u64 __attribute__((__vector_size__(N))) v_u64; +typedef i32 __attribute__((__vector_size__(N))) v_i32; +typedef u32 __attribute__((__vector_size__(N))) v_u32; +typedef i16 __attribute__((__vector_size__(N))) v_i16; +typedef u16 __attribute__((__vector_size__(N))) v_u16; +typedef i8 __attribute__((__vector_size__(N))) v_i8; +typedef u8 __attribute__((__vector_size__(N))) v_u8; + +v_d __attribute__((noinline)) test_v_d(v_d v, double x, double y) +{ + return (v + x > y); +} + +v_f __attribute__((noinline)) test_v_f(v_f v, float x, float y) +{ + return (v + x > y); +} + +v_i64 __attribute__((noinline)) test_v_i64(v_i64 v, i64 x, i64 y) +{ + return (v + x > y); +} + +v_u64 __attribute__((noinline)) test_v_u64(v_u64 v, u64 x, u64 y) +{ + return (v + x > y); +} + +v_i32 __attribute__((noinline)) test_v_i32(v_i32 v, i32 x, i32 y) +{ + return (v + x > y); +} + +v_u32 __attribute__((noinline)) test_v_u32(v_u32 v, u32 x, u32 y) +{ + return (v + x > y); +} + +v_i16 __attribute__((noinline)) test_v_i16(v_i16 v, i16 x, i16 y) +{ + return (v + x > y); +} + +v_u16 __attribute__((noinline)) test_v_u16(v_u16 v, u16 x, u16 y) +{ + return (v + x > y); +} + +v_i8 __attribute__((noinline)) test_v_i8(v_i8 v, i8 x, i8 y) +{ + return (v + x > y); +} + +v_u8 __attribute__((noinline)) test_v_u8(v_u8 v, u8 x, u8 y) +{ + return (v + x > y); +} + +int main() +{ + { + v_d x = {}; + v_i64 y; + y = (v_i64)test_v_d(x, 42.42, 42.42); + printf("%lld\n", y[I]); + x = (v_d){}; + y = (v_i64)test_v_d(x, 42.42, 13.13); + printf("%lld\n", y[I]); + x = (v_d){}; + y = (v_i64)test_v_d(x, 42.42, 55.55); + printf("%lld\n", y[I]); + } + + { + v_f x = {}; + v_i32 y; + y = (v_i32)test_v_f(x, 42.42, 42.42); + printf("%d\n", y[I]); + x = (v_f){}; + y = (v_i32)test_v_f(x, 42.42, 13.13); + printf("%d\n", y[I]); + x = (v_f){}; + y = (v_i32)test_v_f(x, 42.42, 55.55); + printf("%d\n", y[I]); + } + + { + v_i64 x = {}; + x = test_v_i64(x, 42, 42); + printf("%lld\n", x[I]); + x = (v_i64){}; + x = test_v_i64(x, 42, 13); + printf("%lld\n", x[I]); + x = (v_i64){}; + x = test_v_i64(x, 42, 55); + printf("%lld\n", x[I]); + } + + { + v_u64 x = {}; + x = test_v_u64(x, 42, 42); + printf("%lld\n", x[I]); + x = (v_u64){}; + x = test_v_u64(x, 42, 13); + printf("%lld\n", x[I]); + x = (v_u64){}; + x = test_v_u64(x, 42, 55); + printf("%lld\n", x[I]); + } + + { + v_i32 x = {}; + x = test_v_i32(x, 42, 42); + printf("%d\n", x[I]); + x = (v_i32){}; + x = test_v_i32(x, 42, 13); + printf("%d\n", x[I]); + x = (v_i32){}; + x = test_v_i32(x, 42, 55); + printf("%d\n", x[I]); + } + + { + v_u32 x = {}; + x = test_v_u32(x, 42, 42); + printf("%d\n", x[I]); + x = (v_u32){}; + x = test_v_u32(x, 42, 13); + printf("%d\n", x[I]); + x = (v_u32){}; + x = test_v_u32(x, 42, 55); + printf("%d\n", x[I]); + } + + { + v_i16 x = {}; + x = test_v_i16(x, 42, 42); + printf("%d\n", x[I]); + x = (v_i16){}; + x = test_v_i16(x, 42, 13); + printf("%d\n", x[I]); + x = (v_i16){}; + x = test_v_i16(x, 42, 55); + printf("%d\n", x[I]); + } + + { + v_u16 x = {}; + x = test_v_u16(x, 42, 42); + printf("%d\n", (i16)x[I]); + x = (v_u16){}; + x = test_v_u16(x, 42, 13); + printf("%d\n", (i16)x[I]); + x = (v_u16){}; + x = test_v_u16(x, 42, 55); + printf("%d\n", (i16)x[I]); + } + + { + v_i8 x = {}; + x = test_v_i8(x, 42, 42); + printf("%d\n", x[I]); + x = (v_i8){}; + x = test_v_i8(x, 42, 13); + printf("%d\n", x[I]); + x = (v_i8){}; + x = test_v_i8(x, 42, 55); + printf("%d\n", x[I]); + } + + { + v_u8 x = {}; + x = test_v_u8(x, 42, 42); + printf("%d\n", (i8)x[I]); + x = (v_u8){}; + x = test_v_u8(x, 42, 13); + printf("%d\n", (i8)x[I]); + x = (v_u8){}; + x = test_v_u8(x, 42, 55); + printf("%d\n", (i8)x[I]); + } + + return 0; +} +--EXPECT-- +0 +-1 +0 +0 +-1 +0 +0 +-1 +0 +0 +-1 +0 +0 +-1 +0 +0 +-1 +0 +0 +-1 +0 +0 +-1 +0 +0 +-1 +0 +0 +-1 +0 diff --git a/tests/vector/gt-007.test b/tests/vector/gt-007.test new file mode 100644 index 0000000..fbf441b --- /dev/null +++ b/tests/vector/gt-007.test @@ -0,0 +1,239 @@ +--TEST-- +GT.007: 256-bit vectors AVX +--TARGET-- +!aarch64 +--ARGS-- +-mavx -mno-avx2 --run +--CODE-- +#define N 32 +#define I 3 + +int printf(const char *, ...); + +typedef long long i64; +typedef unsigned long long u64; +typedef int i32; +typedef unsigned int u32; +typedef short i16; +typedef unsigned short u16; +typedef char i8; +typedef unsigned char u8; + +typedef double __attribute__((__vector_size__(N))) v_d; +typedef float __attribute__((__vector_size__(N))) v_f; +typedef i64 __attribute__((__vector_size__(N))) v_i64; +typedef u64 __attribute__((__vector_size__(N))) v_u64; +typedef i32 __attribute__((__vector_size__(N))) v_i32; +typedef u32 __attribute__((__vector_size__(N))) v_u32; +typedef i16 __attribute__((__vector_size__(N))) v_i16; +typedef u16 __attribute__((__vector_size__(N))) v_u16; +typedef i8 __attribute__((__vector_size__(N))) v_i8; +typedef u8 __attribute__((__vector_size__(N))) v_u8; + +v_d __attribute__((noinline)) test_v_d(v_d v, double x, double y) +{ + return (v + x > y); +} + +v_f __attribute__((noinline)) test_v_f(v_f v, float x, float y) +{ + return (v + x > y); +} + +v_i64 __attribute__((noinline)) test_v_i64(v_i64 v, i64 x, i64 y) +{ + return (v + x > y); +} + +v_u64 __attribute__((noinline)) test_v_u64(v_u64 v, u64 x, u64 y) +{ + return (v + x > y); +} + +v_i32 __attribute__((noinline)) test_v_i32(v_i32 v, i32 x, i32 y) +{ + return (v + x > y); +} + +v_u32 __attribute__((noinline)) test_v_u32(v_u32 v, u32 x, u32 y) +{ + return (v + x > y); +} + +v_i16 __attribute__((noinline)) test_v_i16(v_i16 v, i16 x, i16 y) +{ + return (v + x > y); +} + +v_u16 __attribute__((noinline)) test_v_u16(v_u16 v, u16 x, u16 y) +{ + return (v + x > y); +} + +v_i8 __attribute__((noinline)) test_v_i8(v_i8 v, i8 x, i8 y) +{ + return (v + x > y); +} + +v_u8 __attribute__((noinline)) test_v_u8(v_u8 v, u8 x, u8 y) +{ + return (v + x > y); +} + +int main() +{ + { + v_d x = {}; + v_i64 y; + y = (v_i64)test_v_d(x, 42.42, 42.42); + printf("%lld\n", y[I]); + x = (v_d){}; + y = (v_i64)test_v_d(x, 42.42, 13.13); + printf("%lld\n", y[I]); + x = (v_d){}; + y = (v_i64)test_v_d(x, 42.42, 55.55); + printf("%lld\n", y[I]); + } + + { + v_f x = {}; + v_i32 y; + y = (v_i32)test_v_f(x, 42.42, 42.42); + printf("%d\n", y[I]); + x = (v_f){}; + y = (v_i32)test_v_f(x, 42.42, 13.13); + printf("%d\n", y[I]); + x = (v_f){}; + y = (v_i32)test_v_f(x, 42.42, 55.55); + printf("%d\n", y[I]); + } + + { + v_i64 x = {}; + x = test_v_i64(x, 42, 42); + printf("%lld\n", x[I]); + x = (v_i64){}; + x = test_v_i64(x, 42, 13); + printf("%lld\n", x[I]); + x = (v_i64){}; + x = test_v_i64(x, 42, 55); + printf("%lld\n", x[I]); + } + + { + v_u64 x = {}; + x = test_v_u64(x, 42, 42); + printf("%lld\n", x[I]); + x = (v_u64){}; + x = test_v_u64(x, 42, 13); + printf("%lld\n", x[I]); + x = (v_u64){}; + x = test_v_u64(x, 42, 55); + printf("%lld\n", x[I]); + } + + { + v_i32 x = {}; + x = test_v_i32(x, 42, 42); + printf("%d\n", x[I]); + x = (v_i32){}; + x = test_v_i32(x, 42, 13); + printf("%d\n", x[I]); + x = (v_i32){}; + x = test_v_i32(x, 42, 55); + printf("%d\n", x[I]); + } + + { + v_u32 x = {}; + x = test_v_u32(x, 42, 42); + printf("%d\n", x[I]); + x = (v_u32){}; + x = test_v_u32(x, 42, 13); + printf("%d\n", x[I]); + x = (v_u32){}; + x = test_v_u32(x, 42, 55); + printf("%d\n", x[I]); + } + + { + v_i16 x = {}; + x = test_v_i16(x, 42, 42); + printf("%d\n", x[I]); + x = (v_i16){}; + x = test_v_i16(x, 42, 13); + printf("%d\n", x[I]); + x = (v_i16){}; + x = test_v_i16(x, 42, 55); + printf("%d\n", x[I]); + } + + { + v_u16 x = {}; + x = test_v_u16(x, 42, 42); + printf("%d\n", (i16)x[I]); + x = (v_u16){}; + x = test_v_u16(x, 42, 13); + printf("%d\n", (i16)x[I]); + x = (v_u16){}; + x = test_v_u16(x, 42, 55); + printf("%d\n", (i16)x[I]); + } + + { + v_i8 x = {}; + x = test_v_i8(x, 42, 42); + printf("%d\n", x[I]); + x = (v_i8){}; + x = test_v_i8(x, 42, 13); + printf("%d\n", x[I]); + x = (v_i8){}; + x = test_v_i8(x, 42, 55); + printf("%d\n", x[I]); + } + + { + v_u8 x = {}; + x = test_v_u8(x, 42, 42); + printf("%d\n", (i8)x[I]); + x = (v_u8){}; + x = test_v_u8(x, 42, 13); + printf("%d\n", (i8)x[I]); + x = (v_u8){}; + x = test_v_u8(x, 42, 55); + printf("%d\n", (i8)x[I]); + } + + return 0; +} +--EXPECT-- +0 +-1 +0 +0 +-1 +0 +0 +-1 +0 +0 +-1 +0 +0 +-1 +0 +0 +-1 +0 +0 +-1 +0 +0 +-1 +0 +0 +-1 +0 +0 +-1 +0 diff --git a/tests/vector/gt-008.test b/tests/vector/gt-008.test new file mode 100644 index 0000000..3cd1534 --- /dev/null +++ b/tests/vector/gt-008.test @@ -0,0 +1,239 @@ +--TEST-- +GT.008: 256-bit vectors AVX+AVX2 +--TARGET-- +!aarch64 +--ARGS-- +-mavx --run +--CODE-- +#define N 32 +#define I 3 + +int printf(const char *, ...); + +typedef long long i64; +typedef unsigned long long u64; +typedef int i32; +typedef unsigned int u32; +typedef short i16; +typedef unsigned short u16; +typedef char i8; +typedef unsigned char u8; + +typedef double __attribute__((__vector_size__(N))) v_d; +typedef float __attribute__((__vector_size__(N))) v_f; +typedef i64 __attribute__((__vector_size__(N))) v_i64; +typedef u64 __attribute__((__vector_size__(N))) v_u64; +typedef i32 __attribute__((__vector_size__(N))) v_i32; +typedef u32 __attribute__((__vector_size__(N))) v_u32; +typedef i16 __attribute__((__vector_size__(N))) v_i16; +typedef u16 __attribute__((__vector_size__(N))) v_u16; +typedef i8 __attribute__((__vector_size__(N))) v_i8; +typedef u8 __attribute__((__vector_size__(N))) v_u8; + +v_d __attribute__((noinline)) test_v_d(v_d v, double x, double y) +{ + return (v + x > y); +} + +v_f __attribute__((noinline)) test_v_f(v_f v, float x, float y) +{ + return (v + x > y); +} + +v_i64 __attribute__((noinline)) test_v_i64(v_i64 v, i64 x, i64 y) +{ + return (v + x > y); +} + +v_u64 __attribute__((noinline)) test_v_u64(v_u64 v, u64 x, u64 y) +{ + return (v + x > y); +} + +v_i32 __attribute__((noinline)) test_v_i32(v_i32 v, i32 x, i32 y) +{ + return (v + x > y); +} + +v_u32 __attribute__((noinline)) test_v_u32(v_u32 v, u32 x, u32 y) +{ + return (v + x > y); +} + +v_i16 __attribute__((noinline)) test_v_i16(v_i16 v, i16 x, i16 y) +{ + return (v + x > y); +} + +v_u16 __attribute__((noinline)) test_v_u16(v_u16 v, u16 x, u16 y) +{ + return (v + x > y); +} + +v_i8 __attribute__((noinline)) test_v_i8(v_i8 v, i8 x, i8 y) +{ + return (v + x > y); +} + +v_u8 __attribute__((noinline)) test_v_u8(v_u8 v, u8 x, u8 y) +{ + return (v + x > y); +} + +int main() +{ + { + v_d x = {}; + v_i64 y; + y = (v_i64)test_v_d(x, 42.42, 42.42); + printf("%lld\n", y[I]); + x = (v_d){}; + y = (v_i64)test_v_d(x, 42.42, 13.13); + printf("%lld\n", y[I]); + x = (v_d){}; + y = (v_i64)test_v_d(x, 42.42, 55.55); + printf("%lld\n", y[I]); + } + + { + v_f x = {}; + v_i32 y; + y = (v_i32)test_v_f(x, 42.42, 42.42); + printf("%d\n", y[I]); + x = (v_f){}; + y = (v_i32)test_v_f(x, 42.42, 13.13); + printf("%d\n", y[I]); + x = (v_f){}; + y = (v_i32)test_v_f(x, 42.42, 55.55); + printf("%d\n", y[I]); + } + + { + v_i64 x = {}; + x = test_v_i64(x, 42, 42); + printf("%lld\n", x[I]); + x = (v_i64){}; + x = test_v_i64(x, 42, 13); + printf("%lld\n", x[I]); + x = (v_i64){}; + x = test_v_i64(x, 42, 55); + printf("%lld\n", x[I]); + } + + { + v_u64 x = {}; + x = test_v_u64(x, 42, 42); + printf("%lld\n", x[I]); + x = (v_u64){}; + x = test_v_u64(x, 42, 13); + printf("%lld\n", x[I]); + x = (v_u64){}; + x = test_v_u64(x, 42, 55); + printf("%lld\n", x[I]); + } + + { + v_i32 x = {}; + x = test_v_i32(x, 42, 42); + printf("%d\n", x[I]); + x = (v_i32){}; + x = test_v_i32(x, 42, 13); + printf("%d\n", x[I]); + x = (v_i32){}; + x = test_v_i32(x, 42, 55); + printf("%d\n", x[I]); + } + + { + v_u32 x = {}; + x = test_v_u32(x, 42, 42); + printf("%d\n", x[I]); + x = (v_u32){}; + x = test_v_u32(x, 42, 13); + printf("%d\n", x[I]); + x = (v_u32){}; + x = test_v_u32(x, 42, 55); + printf("%d\n", x[I]); + } + + { + v_i16 x = {}; + x = test_v_i16(x, 42, 42); + printf("%d\n", x[I]); + x = (v_i16){}; + x = test_v_i16(x, 42, 13); + printf("%d\n", x[I]); + x = (v_i16){}; + x = test_v_i16(x, 42, 55); + printf("%d\n", x[I]); + } + + { + v_u16 x = {}; + x = test_v_u16(x, 42, 42); + printf("%d\n", (i16)x[I]); + x = (v_u16){}; + x = test_v_u16(x, 42, 13); + printf("%d\n", (i16)x[I]); + x = (v_u16){}; + x = test_v_u16(x, 42, 55); + printf("%d\n", (i16)x[I]); + } + + { + v_i8 x = {}; + x = test_v_i8(x, 42, 42); + printf("%d\n", x[I]); + x = (v_i8){}; + x = test_v_i8(x, 42, 13); + printf("%d\n", x[I]); + x = (v_i8){}; + x = test_v_i8(x, 42, 55); + printf("%d\n", x[I]); + } + + { + v_u8 x = {}; + x = test_v_u8(x, 42, 42); + printf("%d\n", (i8)x[I]); + x = (v_u8){}; + x = test_v_u8(x, 42, 13); + printf("%d\n", (i8)x[I]); + x = (v_u8){}; + x = test_v_u8(x, 42, 55); + printf("%d\n", (i8)x[I]); + } + + return 0; +} +--EXPECT-- +0 +-1 +0 +0 +-1 +0 +0 +-1 +0 +0 +-1 +0 +0 +-1 +0 +0 +-1 +0 +0 +-1 +0 +0 +-1 +0 +0 +-1 +0 +0 +-1 +0 diff --git a/tests/vector/le-001.test b/tests/vector/le-001.test new file mode 100644 index 0000000..6d0b42f --- /dev/null +++ b/tests/vector/le-001.test @@ -0,0 +1,239 @@ +--TEST-- +LE.001: 128-bit vectors SSE2 +--TARGET-- +!aarch64 +--ARGS-- +-mno-sse4 -mno-avx2 --run +--CODE-- +#define N 16 +#define I 1 + +int printf(const char *, ...); + +typedef long long i64; +typedef unsigned long long u64; +typedef int i32; +typedef unsigned int u32; +typedef short i16; +typedef unsigned short u16; +typedef char i8; +typedef unsigned char u8; + +typedef double __attribute__((__vector_size__(N))) v_d; +typedef float __attribute__((__vector_size__(N))) v_f; +typedef i64 __attribute__((__vector_size__(N))) v_i64; +typedef u64 __attribute__((__vector_size__(N))) v_u64; +typedef i32 __attribute__((__vector_size__(N))) v_i32; +typedef u32 __attribute__((__vector_size__(N))) v_u32; +typedef i16 __attribute__((__vector_size__(N))) v_i16; +typedef u16 __attribute__((__vector_size__(N))) v_u16; +typedef i8 __attribute__((__vector_size__(N))) v_i8; +typedef u8 __attribute__((__vector_size__(N))) v_u8; + +v_d __attribute__((noinline)) test_v_d(v_d v, double x, double y) +{ + return (v + x <= y); +} + +v_f __attribute__((noinline)) test_v_f(v_f v, float x, float y) +{ + return (v + x <= y); +} + +v_i64 __attribute__((noinline)) test_v_i64(v_i64 v, i64 x, i64 y) +{ + return (v + x <= y); +} + +v_u64 __attribute__((noinline)) test_v_u64(v_u64 v, u64 x, u64 y) +{ + return (v + x <= y); +} + +v_i32 __attribute__((noinline)) test_v_i32(v_i32 v, i32 x, i32 y) +{ + return (v + x <= y); +} + +v_u32 __attribute__((noinline)) test_v_u32(v_u32 v, u32 x, u32 y) +{ + return (v + x <= y); +} + +v_i16 __attribute__((noinline)) test_v_i16(v_i16 v, i16 x, i16 y) +{ + return (v + x <= y); +} + +v_u16 __attribute__((noinline)) test_v_u16(v_u16 v, u16 x, u16 y) +{ + return (v + x <= y); +} + +v_i8 __attribute__((noinline)) test_v_i8(v_i8 v, i8 x, i8 y) +{ + return (v + x <= y); +} + +v_u8 __attribute__((noinline)) test_v_u8(v_u8 v, u8 x, u8 y) +{ + return (v + x <= y); +} + +int main() +{ + { + v_d x = {}; + v_i64 y; + y = (v_i64)test_v_d(x, 42.42, 42.42); + printf("%lld\n", y[I]); + x = (v_d){}; + y = (v_i64)test_v_d(x, 42.42, 13.13); + printf("%lld\n", y[I]); + x = (v_d){}; + y = (v_i64)test_v_d(x, 42.42, 55.55); + printf("%lld\n", y[I]); + } + + { + v_f x = {}; + v_i32 y; + y = (v_i32)test_v_f(x, 42.42, 42.42); + printf("%d\n", y[I]); + x = (v_f){}; + y = (v_i32)test_v_f(x, 42.42, 13.13); + printf("%d\n", y[I]); + x = (v_f){}; + y = (v_i32)test_v_f(x, 42.42, 55.55); + printf("%d\n", y[I]); + } + + { + v_i64 x = {}; + x = test_v_i64(x, 42, 42); + printf("%lld\n", x[I]); + x = (v_i64){}; + x = test_v_i64(x, 42, 13); + printf("%lld\n", x[I]); + x = (v_i64){}; + x = test_v_i64(x, 42, 55); + printf("%lld\n", x[I]); + } + + { + v_u64 x = {}; + x = test_v_u64(x, 42, 42); + printf("%lld\n", x[I]); + x = (v_u64){}; + x = test_v_u64(x, 42, 13); + printf("%lld\n", x[I]); + x = (v_u64){}; + x = test_v_u64(x, 42, 55); + printf("%lld\n", x[I]); + } + + { + v_i32 x = {}; + x = test_v_i32(x, 42, 42); + printf("%d\n", x[I]); + x = (v_i32){}; + x = test_v_i32(x, 42, 13); + printf("%d\n", x[I]); + x = (v_i32){}; + x = test_v_i32(x, 42, 55); + printf("%d\n", x[I]); + } + + { + v_u32 x = {}; + x = test_v_u32(x, 42, 42); + printf("%d\n", x[I]); + x = (v_u32){}; + x = test_v_u32(x, 42, 13); + printf("%d\n", x[I]); + x = (v_u32){}; + x = test_v_u32(x, 42, 55); + printf("%d\n", x[I]); + } + + { + v_i16 x = {}; + x = test_v_i16(x, 42, 42); + printf("%d\n", x[I]); + x = (v_i16){}; + x = test_v_i16(x, 42, 13); + printf("%d\n", x[I]); + x = (v_i16){}; + x = test_v_i16(x, 42, 55); + printf("%d\n", x[I]); + } + + { + v_u16 x = {}; + x = test_v_u16(x, 42, 42); + printf("%d\n", (i16)x[I]); + x = (v_u16){}; + x = test_v_u16(x, 42, 13); + printf("%d\n", (i16)x[I]); + x = (v_u16){}; + x = test_v_u16(x, 42, 55); + printf("%d\n", (i16)x[I]); + } + + { + v_i8 x = {}; + x = test_v_i8(x, 42, 42); + printf("%d\n", x[I]); + x = (v_i8){}; + x = test_v_i8(x, 42, 13); + printf("%d\n", x[I]); + x = (v_i8){}; + x = test_v_i8(x, 42, 55); + printf("%d\n", x[I]); + } + + { + v_u8 x = {}; + x = test_v_u8(x, 42, 42); + printf("%d\n", (i8)x[I]); + x = (v_u8){}; + x = test_v_u8(x, 42, 13); + printf("%d\n", (i8)x[I]); + x = (v_u8){}; + x = test_v_u8(x, 42, 55); + printf("%d\n", (i8)x[I]); + } + + return 0; +} +--EXPECT-- +-1 +0 +-1 +-1 +0 +-1 +-1 +0 +-1 +-1 +0 +-1 +-1 +0 +-1 +-1 +0 +-1 +-1 +0 +-1 +-1 +0 +-1 +-1 +0 +-1 +-1 +0 +-1 diff --git a/tests/vector/le-002.test b/tests/vector/le-002.test new file mode 100644 index 0000000..b8f9808 --- /dev/null +++ b/tests/vector/le-002.test @@ -0,0 +1,239 @@ +--TEST-- +LE.002: 128-bit vectors SSE2+SSE4 +--TARGET-- +!aarch64 +--ARGS-- +-mno-avx2 --run +--CODE-- +#define N 16 +#define I 1 + +int printf(const char *, ...); + +typedef long long i64; +typedef unsigned long long u64; +typedef int i32; +typedef unsigned int u32; +typedef short i16; +typedef unsigned short u16; +typedef char i8; +typedef unsigned char u8; + +typedef double __attribute__((__vector_size__(N))) v_d; +typedef float __attribute__((__vector_size__(N))) v_f; +typedef i64 __attribute__((__vector_size__(N))) v_i64; +typedef u64 __attribute__((__vector_size__(N))) v_u64; +typedef i32 __attribute__((__vector_size__(N))) v_i32; +typedef u32 __attribute__((__vector_size__(N))) v_u32; +typedef i16 __attribute__((__vector_size__(N))) v_i16; +typedef u16 __attribute__((__vector_size__(N))) v_u16; +typedef i8 __attribute__((__vector_size__(N))) v_i8; +typedef u8 __attribute__((__vector_size__(N))) v_u8; + +v_d __attribute__((noinline)) test_v_d(v_d v, double x, double y) +{ + return (v + x <= y); +} + +v_f __attribute__((noinline)) test_v_f(v_f v, float x, float y) +{ + return (v + x <= y); +} + +v_i64 __attribute__((noinline)) test_v_i64(v_i64 v, i64 x, i64 y) +{ + return (v + x <= y); +} + +v_u64 __attribute__((noinline)) test_v_u64(v_u64 v, u64 x, u64 y) +{ + return (v + x <= y); +} + +v_i32 __attribute__((noinline)) test_v_i32(v_i32 v, i32 x, i32 y) +{ + return (v + x <= y); +} + +v_u32 __attribute__((noinline)) test_v_u32(v_u32 v, u32 x, u32 y) +{ + return (v + x <= y); +} + +v_i16 __attribute__((noinline)) test_v_i16(v_i16 v, i16 x, i16 y) +{ + return (v + x <= y); +} + +v_u16 __attribute__((noinline)) test_v_u16(v_u16 v, u16 x, u16 y) +{ + return (v + x <= y); +} + +v_i8 __attribute__((noinline)) test_v_i8(v_i8 v, i8 x, i8 y) +{ + return (v + x <= y); +} + +v_u8 __attribute__((noinline)) test_v_u8(v_u8 v, u8 x, u8 y) +{ + return (v + x <= y); +} + +int main() +{ + { + v_d x = {}; + v_i64 y; + y = (v_i64)test_v_d(x, 42.42, 42.42); + printf("%lld\n", y[I]); + x = (v_d){}; + y = (v_i64)test_v_d(x, 42.42, 13.13); + printf("%lld\n", y[I]); + x = (v_d){}; + y = (v_i64)test_v_d(x, 42.42, 55.55); + printf("%lld\n", y[I]); + } + + { + v_f x = {}; + v_i32 y; + y = (v_i32)test_v_f(x, 42.42, 42.42); + printf("%d\n", y[I]); + x = (v_f){}; + y = (v_i32)test_v_f(x, 42.42, 13.13); + printf("%d\n", y[I]); + x = (v_f){}; + y = (v_i32)test_v_f(x, 42.42, 55.55); + printf("%d\n", y[I]); + } + + { + v_i64 x = {}; + x = test_v_i64(x, 42, 42); + printf("%lld\n", x[I]); + x = (v_i64){}; + x = test_v_i64(x, 42, 13); + printf("%lld\n", x[I]); + x = (v_i64){}; + x = test_v_i64(x, 42, 55); + printf("%lld\n", x[I]); + } + + { + v_u64 x = {}; + x = test_v_u64(x, 42, 42); + printf("%lld\n", x[I]); + x = (v_u64){}; + x = test_v_u64(x, 42, 13); + printf("%lld\n", x[I]); + x = (v_u64){}; + x = test_v_u64(x, 42, 55); + printf("%lld\n", x[I]); + } + + { + v_i32 x = {}; + x = test_v_i32(x, 42, 42); + printf("%d\n", x[I]); + x = (v_i32){}; + x = test_v_i32(x, 42, 13); + printf("%d\n", x[I]); + x = (v_i32){}; + x = test_v_i32(x, 42, 55); + printf("%d\n", x[I]); + } + + { + v_u32 x = {}; + x = test_v_u32(x, 42, 42); + printf("%d\n", x[I]); + x = (v_u32){}; + x = test_v_u32(x, 42, 13); + printf("%d\n", x[I]); + x = (v_u32){}; + x = test_v_u32(x, 42, 55); + printf("%d\n", x[I]); + } + + { + v_i16 x = {}; + x = test_v_i16(x, 42, 42); + printf("%d\n", x[I]); + x = (v_i16){}; + x = test_v_i16(x, 42, 13); + printf("%d\n", x[I]); + x = (v_i16){}; + x = test_v_i16(x, 42, 55); + printf("%d\n", x[I]); + } + + { + v_u16 x = {}; + x = test_v_u16(x, 42, 42); + printf("%d\n", (i16)x[I]); + x = (v_u16){}; + x = test_v_u16(x, 42, 13); + printf("%d\n", (i16)x[I]); + x = (v_u16){}; + x = test_v_u16(x, 42, 55); + printf("%d\n", (i16)x[I]); + } + + { + v_i8 x = {}; + x = test_v_i8(x, 42, 42); + printf("%d\n", x[I]); + x = (v_i8){}; + x = test_v_i8(x, 42, 13); + printf("%d\n", x[I]); + x = (v_i8){}; + x = test_v_i8(x, 42, 55); + printf("%d\n", x[I]); + } + + { + v_u8 x = {}; + x = test_v_u8(x, 42, 42); + printf("%d\n", (i8)x[I]); + x = (v_u8){}; + x = test_v_u8(x, 42, 13); + printf("%d\n", (i8)x[I]); + x = (v_u8){}; + x = test_v_u8(x, 42, 55); + printf("%d\n", (i8)x[I]); + } + + return 0; +} +--EXPECT-- +-1 +0 +-1 +-1 +0 +-1 +-1 +0 +-1 +-1 +0 +-1 +-1 +0 +-1 +-1 +0 +-1 +-1 +0 +-1 +-1 +0 +-1 +-1 +0 +-1 +-1 +0 +-1 diff --git a/tests/vector/le-003.test b/tests/vector/le-003.test new file mode 100644 index 0000000..3297813 --- /dev/null +++ b/tests/vector/le-003.test @@ -0,0 +1,239 @@ +--TEST-- +LE.003: 128-bit vectors AVX +--TARGET-- +!aarch64 +--ARGS-- +-mavx -mno-avx2 --run +--CODE-- +#define N 16 +#define I 1 + +int printf(const char *, ...); + +typedef long long i64; +typedef unsigned long long u64; +typedef int i32; +typedef unsigned int u32; +typedef short i16; +typedef unsigned short u16; +typedef char i8; +typedef unsigned char u8; + +typedef double __attribute__((__vector_size__(N))) v_d; +typedef float __attribute__((__vector_size__(N))) v_f; +typedef i64 __attribute__((__vector_size__(N))) v_i64; +typedef u64 __attribute__((__vector_size__(N))) v_u64; +typedef i32 __attribute__((__vector_size__(N))) v_i32; +typedef u32 __attribute__((__vector_size__(N))) v_u32; +typedef i16 __attribute__((__vector_size__(N))) v_i16; +typedef u16 __attribute__((__vector_size__(N))) v_u16; +typedef i8 __attribute__((__vector_size__(N))) v_i8; +typedef u8 __attribute__((__vector_size__(N))) v_u8; + +v_d __attribute__((noinline)) test_v_d(v_d v, double x, double y) +{ + return (v + x <= y); +} + +v_f __attribute__((noinline)) test_v_f(v_f v, float x, float y) +{ + return (v + x <= y); +} + +v_i64 __attribute__((noinline)) test_v_i64(v_i64 v, i64 x, i64 y) +{ + return (v + x <= y); +} + +v_u64 __attribute__((noinline)) test_v_u64(v_u64 v, u64 x, u64 y) +{ + return (v + x <= y); +} + +v_i32 __attribute__((noinline)) test_v_i32(v_i32 v, i32 x, i32 y) +{ + return (v + x <= y); +} + +v_u32 __attribute__((noinline)) test_v_u32(v_u32 v, u32 x, u32 y) +{ + return (v + x <= y); +} + +v_i16 __attribute__((noinline)) test_v_i16(v_i16 v, i16 x, i16 y) +{ + return (v + x <= y); +} + +v_u16 __attribute__((noinline)) test_v_u16(v_u16 v, u16 x, u16 y) +{ + return (v + x <= y); +} + +v_i8 __attribute__((noinline)) test_v_i8(v_i8 v, i8 x, i8 y) +{ + return (v + x <= y); +} + +v_u8 __attribute__((noinline)) test_v_u8(v_u8 v, u8 x, u8 y) +{ + return (v + x <= y); +} + +int main() +{ + { + v_d x = {}; + v_i64 y; + y = (v_i64)test_v_d(x, 42.42, 42.42); + printf("%lld\n", y[I]); + x = (v_d){}; + y = (v_i64)test_v_d(x, 42.42, 13.13); + printf("%lld\n", y[I]); + x = (v_d){}; + y = (v_i64)test_v_d(x, 42.42, 55.55); + printf("%lld\n", y[I]); + } + + { + v_f x = {}; + v_i32 y; + y = (v_i32)test_v_f(x, 42.42, 42.42); + printf("%d\n", y[I]); + x = (v_f){}; + y = (v_i32)test_v_f(x, 42.42, 13.13); + printf("%d\n", y[I]); + x = (v_f){}; + y = (v_i32)test_v_f(x, 42.42, 55.55); + printf("%d\n", y[I]); + } + + { + v_i64 x = {}; + x = test_v_i64(x, 42, 42); + printf("%lld\n", x[I]); + x = (v_i64){}; + x = test_v_i64(x, 42, 13); + printf("%lld\n", x[I]); + x = (v_i64){}; + x = test_v_i64(x, 42, 55); + printf("%lld\n", x[I]); + } + + { + v_u64 x = {}; + x = test_v_u64(x, 42, 42); + printf("%lld\n", x[I]); + x = (v_u64){}; + x = test_v_u64(x, 42, 13); + printf("%lld\n", x[I]); + x = (v_u64){}; + x = test_v_u64(x, 42, 55); + printf("%lld\n", x[I]); + } + + { + v_i32 x = {}; + x = test_v_i32(x, 42, 42); + printf("%d\n", x[I]); + x = (v_i32){}; + x = test_v_i32(x, 42, 13); + printf("%d\n", x[I]); + x = (v_i32){}; + x = test_v_i32(x, 42, 55); + printf("%d\n", x[I]); + } + + { + v_u32 x = {}; + x = test_v_u32(x, 42, 42); + printf("%d\n", x[I]); + x = (v_u32){}; + x = test_v_u32(x, 42, 13); + printf("%d\n", x[I]); + x = (v_u32){}; + x = test_v_u32(x, 42, 55); + printf("%d\n", x[I]); + } + + { + v_i16 x = {}; + x = test_v_i16(x, 42, 42); + printf("%d\n", x[I]); + x = (v_i16){}; + x = test_v_i16(x, 42, 13); + printf("%d\n", x[I]); + x = (v_i16){}; + x = test_v_i16(x, 42, 55); + printf("%d\n", x[I]); + } + + { + v_u16 x = {}; + x = test_v_u16(x, 42, 42); + printf("%d\n", (i16)x[I]); + x = (v_u16){}; + x = test_v_u16(x, 42, 13); + printf("%d\n", (i16)x[I]); + x = (v_u16){}; + x = test_v_u16(x, 42, 55); + printf("%d\n", (i16)x[I]); + } + + { + v_i8 x = {}; + x = test_v_i8(x, 42, 42); + printf("%d\n", x[I]); + x = (v_i8){}; + x = test_v_i8(x, 42, 13); + printf("%d\n", x[I]); + x = (v_i8){}; + x = test_v_i8(x, 42, 55); + printf("%d\n", x[I]); + } + + { + v_u8 x = {}; + x = test_v_u8(x, 42, 42); + printf("%d\n", (i8)x[I]); + x = (v_u8){}; + x = test_v_u8(x, 42, 13); + printf("%d\n", (i8)x[I]); + x = (v_u8){}; + x = test_v_u8(x, 42, 55); + printf("%d\n", (i8)x[I]); + } + + return 0; +} +--EXPECT-- +-1 +0 +-1 +-1 +0 +-1 +-1 +0 +-1 +-1 +0 +-1 +-1 +0 +-1 +-1 +0 +-1 +-1 +0 +-1 +-1 +0 +-1 +-1 +0 +-1 +-1 +0 +-1 diff --git a/tests/vector/le-004.test b/tests/vector/le-004.test new file mode 100644 index 0000000..fda6fc6 --- /dev/null +++ b/tests/vector/le-004.test @@ -0,0 +1,239 @@ +--TEST-- +LE.004: 128-bit vectors AVX+AVX2 +--TARGET-- +!aarch64 +--ARGS-- +-mavx --run +--CODE-- +#define N 16 +#define I 1 + +int printf(const char *, ...); + +typedef long long i64; +typedef unsigned long long u64; +typedef int i32; +typedef unsigned int u32; +typedef short i16; +typedef unsigned short u16; +typedef char i8; +typedef unsigned char u8; + +typedef double __attribute__((__vector_size__(N))) v_d; +typedef float __attribute__((__vector_size__(N))) v_f; +typedef i64 __attribute__((__vector_size__(N))) v_i64; +typedef u64 __attribute__((__vector_size__(N))) v_u64; +typedef i32 __attribute__((__vector_size__(N))) v_i32; +typedef u32 __attribute__((__vector_size__(N))) v_u32; +typedef i16 __attribute__((__vector_size__(N))) v_i16; +typedef u16 __attribute__((__vector_size__(N))) v_u16; +typedef i8 __attribute__((__vector_size__(N))) v_i8; +typedef u8 __attribute__((__vector_size__(N))) v_u8; + +v_d __attribute__((noinline)) test_v_d(v_d v, double x, double y) +{ + return (v + x <= y); +} + +v_f __attribute__((noinline)) test_v_f(v_f v, float x, float y) +{ + return (v + x <= y); +} + +v_i64 __attribute__((noinline)) test_v_i64(v_i64 v, i64 x, i64 y) +{ + return (v + x <= y); +} + +v_u64 __attribute__((noinline)) test_v_u64(v_u64 v, u64 x, u64 y) +{ + return (v + x <= y); +} + +v_i32 __attribute__((noinline)) test_v_i32(v_i32 v, i32 x, i32 y) +{ + return (v + x <= y); +} + +v_u32 __attribute__((noinline)) test_v_u32(v_u32 v, u32 x, u32 y) +{ + return (v + x <= y); +} + +v_i16 __attribute__((noinline)) test_v_i16(v_i16 v, i16 x, i16 y) +{ + return (v + x <= y); +} + +v_u16 __attribute__((noinline)) test_v_u16(v_u16 v, u16 x, u16 y) +{ + return (v + x <= y); +} + +v_i8 __attribute__((noinline)) test_v_i8(v_i8 v, i8 x, i8 y) +{ + return (v + x <= y); +} + +v_u8 __attribute__((noinline)) test_v_u8(v_u8 v, u8 x, u8 y) +{ + return (v + x <= y); +} + +int main() +{ + { + v_d x = {}; + v_i64 y; + y = (v_i64)test_v_d(x, 42.42, 42.42); + printf("%lld\n", y[I]); + x = (v_d){}; + y = (v_i64)test_v_d(x, 42.42, 13.13); + printf("%lld\n", y[I]); + x = (v_d){}; + y = (v_i64)test_v_d(x, 42.42, 55.55); + printf("%lld\n", y[I]); + } + + { + v_f x = {}; + v_i32 y; + y = (v_i32)test_v_f(x, 42.42, 42.42); + printf("%d\n", y[I]); + x = (v_f){}; + y = (v_i32)test_v_f(x, 42.42, 13.13); + printf("%d\n", y[I]); + x = (v_f){}; + y = (v_i32)test_v_f(x, 42.42, 55.55); + printf("%d\n", y[I]); + } + + { + v_i64 x = {}; + x = test_v_i64(x, 42, 42); + printf("%lld\n", x[I]); + x = (v_i64){}; + x = test_v_i64(x, 42, 13); + printf("%lld\n", x[I]); + x = (v_i64){}; + x = test_v_i64(x, 42, 55); + printf("%lld\n", x[I]); + } + + { + v_u64 x = {}; + x = test_v_u64(x, 42, 42); + printf("%lld\n", x[I]); + x = (v_u64){}; + x = test_v_u64(x, 42, 13); + printf("%lld\n", x[I]); + x = (v_u64){}; + x = test_v_u64(x, 42, 55); + printf("%lld\n", x[I]); + } + + { + v_i32 x = {}; + x = test_v_i32(x, 42, 42); + printf("%d\n", x[I]); + x = (v_i32){}; + x = test_v_i32(x, 42, 13); + printf("%d\n", x[I]); + x = (v_i32){}; + x = test_v_i32(x, 42, 55); + printf("%d\n", x[I]); + } + + { + v_u32 x = {}; + x = test_v_u32(x, 42, 42); + printf("%d\n", x[I]); + x = (v_u32){}; + x = test_v_u32(x, 42, 13); + printf("%d\n", x[I]); + x = (v_u32){}; + x = test_v_u32(x, 42, 55); + printf("%d\n", x[I]); + } + + { + v_i16 x = {}; + x = test_v_i16(x, 42, 42); + printf("%d\n", x[I]); + x = (v_i16){}; + x = test_v_i16(x, 42, 13); + printf("%d\n", x[I]); + x = (v_i16){}; + x = test_v_i16(x, 42, 55); + printf("%d\n", x[I]); + } + + { + v_u16 x = {}; + x = test_v_u16(x, 42, 42); + printf("%d\n", (i16)x[I]); + x = (v_u16){}; + x = test_v_u16(x, 42, 13); + printf("%d\n", (i16)x[I]); + x = (v_u16){}; + x = test_v_u16(x, 42, 55); + printf("%d\n", (i16)x[I]); + } + + { + v_i8 x = {}; + x = test_v_i8(x, 42, 42); + printf("%d\n", x[I]); + x = (v_i8){}; + x = test_v_i8(x, 42, 13); + printf("%d\n", x[I]); + x = (v_i8){}; + x = test_v_i8(x, 42, 55); + printf("%d\n", x[I]); + } + + { + v_u8 x = {}; + x = test_v_u8(x, 42, 42); + printf("%d\n", (i8)x[I]); + x = (v_u8){}; + x = test_v_u8(x, 42, 13); + printf("%d\n", (i8)x[I]); + x = (v_u8){}; + x = test_v_u8(x, 42, 55); + printf("%d\n", (i8)x[I]); + } + + return 0; +} +--EXPECT-- +-1 +0 +-1 +-1 +0 +-1 +-1 +0 +-1 +-1 +0 +-1 +-1 +0 +-1 +-1 +0 +-1 +-1 +0 +-1 +-1 +0 +-1 +-1 +0 +-1 +-1 +0 +-1 diff --git a/tests/vector/le-005.test b/tests/vector/le-005.test new file mode 100644 index 0000000..523ca6d --- /dev/null +++ b/tests/vector/le-005.test @@ -0,0 +1,239 @@ +--TEST-- +LE.005: 64-bit vectors SSE2 +--TARGET-- +!aarch64 +--ARGS-- +-mno-sse4 -mno-avx2 --run +--CODE-- +#define N 8 +#define I 0 + +int printf(const char *, ...); + +typedef long long i64; +typedef unsigned long long u64; +typedef int i32; +typedef unsigned int u32; +typedef short i16; +typedef unsigned short u16; +typedef char i8; +typedef unsigned char u8; + +typedef double __attribute__((__vector_size__(N))) v_d; +typedef float __attribute__((__vector_size__(N))) v_f; +typedef i64 __attribute__((__vector_size__(N))) v_i64; +typedef u64 __attribute__((__vector_size__(N))) v_u64; +typedef i32 __attribute__((__vector_size__(N))) v_i32; +typedef u32 __attribute__((__vector_size__(N))) v_u32; +typedef i16 __attribute__((__vector_size__(N))) v_i16; +typedef u16 __attribute__((__vector_size__(N))) v_u16; +typedef i8 __attribute__((__vector_size__(N))) v_i8; +typedef u8 __attribute__((__vector_size__(N))) v_u8; + +v_d __attribute__((noinline)) test_v_d(v_d v, double x, double y) +{ + return (v + x <= y); +} + +v_f __attribute__((noinline)) test_v_f(v_f v, float x, float y) +{ + return (v + x <= y); +} + +v_i64 __attribute__((noinline)) test_v_i64(v_i64 v, i64 x, i64 y) +{ + return (v + x <= y); +} + +v_u64 __attribute__((noinline)) test_v_u64(v_u64 v, u64 x, u64 y) +{ + return (v + x <= y); +} + +v_i32 __attribute__((noinline)) test_v_i32(v_i32 v, i32 x, i32 y) +{ + return (v + x <= y); +} + +v_u32 __attribute__((noinline)) test_v_u32(v_u32 v, u32 x, u32 y) +{ + return (v + x <= y); +} + +v_i16 __attribute__((noinline)) test_v_i16(v_i16 v, i16 x, i16 y) +{ + return (v + x <= y); +} + +v_u16 __attribute__((noinline)) test_v_u16(v_u16 v, u16 x, u16 y) +{ + return (v + x <= y); +} + +v_i8 __attribute__((noinline)) test_v_i8(v_i8 v, i8 x, i8 y) +{ + return (v + x <= y); +} + +v_u8 __attribute__((noinline)) test_v_u8(v_u8 v, u8 x, u8 y) +{ + return (v + x <= y); +} + +int main() +{ + { + v_d x = {}; + v_i64 y; + y = (v_i64)test_v_d(x, 42.42, 42.42); + printf("%lld\n", y[I]); + x = (v_d){}; + y = (v_i64)test_v_d(x, 42.42, 13.13); + printf("%lld\n", y[I]); + x = (v_d){}; + y = (v_i64)test_v_d(x, 42.42, 55.55); + printf("%lld\n", y[I]); + } + + { + v_f x = {}; + v_i32 y; + y = (v_i32)test_v_f(x, 42.42, 42.42); + printf("%d\n", y[I]); + x = (v_f){}; + y = (v_i32)test_v_f(x, 42.42, 13.13); + printf("%d\n", y[I]); + x = (v_f){}; + y = (v_i32)test_v_f(x, 42.42, 55.55); + printf("%d\n", y[I]); + } + + { + v_i64 x = {}; + x = test_v_i64(x, 42, 42); + printf("%lld\n", x[I]); + x = (v_i64){}; + x = test_v_i64(x, 42, 13); + printf("%lld\n", x[I]); + x = (v_i64){}; + x = test_v_i64(x, 42, 55); + printf("%lld\n", x[I]); + } + + { + v_u64 x = {}; + x = test_v_u64(x, 42, 42); + printf("%lld\n", x[I]); + x = (v_u64){}; + x = test_v_u64(x, 42, 13); + printf("%lld\n", x[I]); + x = (v_u64){}; + x = test_v_u64(x, 42, 55); + printf("%lld\n", x[I]); + } + + { + v_i32 x = {}; + x = test_v_i32(x, 42, 42); + printf("%d\n", x[I]); + x = (v_i32){}; + x = test_v_i32(x, 42, 13); + printf("%d\n", x[I]); + x = (v_i32){}; + x = test_v_i32(x, 42, 55); + printf("%d\n", x[I]); + } + + { + v_u32 x = {}; + x = test_v_u32(x, 42, 42); + printf("%d\n", x[I]); + x = (v_u32){}; + x = test_v_u32(x, 42, 13); + printf("%d\n", x[I]); + x = (v_u32){}; + x = test_v_u32(x, 42, 55); + printf("%d\n", x[I]); + } + + { + v_i16 x = {}; + x = test_v_i16(x, 42, 42); + printf("%d\n", x[I]); + x = (v_i16){}; + x = test_v_i16(x, 42, 13); + printf("%d\n", x[I]); + x = (v_i16){}; + x = test_v_i16(x, 42, 55); + printf("%d\n", x[I]); + } + + { + v_u16 x = {}; + x = test_v_u16(x, 42, 42); + printf("%d\n", (i16)x[I]); + x = (v_u16){}; + x = test_v_u16(x, 42, 13); + printf("%d\n", (i16)x[I]); + x = (v_u16){}; + x = test_v_u16(x, 42, 55); + printf("%d\n", (i16)x[I]); + } + + { + v_i8 x = {}; + x = test_v_i8(x, 42, 42); + printf("%d\n", x[I]); + x = (v_i8){}; + x = test_v_i8(x, 42, 13); + printf("%d\n", x[I]); + x = (v_i8){}; + x = test_v_i8(x, 42, 55); + printf("%d\n", x[I]); + } + + { + v_u8 x = {}; + x = test_v_u8(x, 42, 42); + printf("%d\n", (i8)x[I]); + x = (v_u8){}; + x = test_v_u8(x, 42, 13); + printf("%d\n", (i8)x[I]); + x = (v_u8){}; + x = test_v_u8(x, 42, 55); + printf("%d\n", (i8)x[I]); + } + + return 0; +} +--EXPECT-- +-1 +0 +-1 +-1 +0 +-1 +-1 +0 +-1 +-1 +0 +-1 +-1 +0 +-1 +-1 +0 +-1 +-1 +0 +-1 +-1 +0 +-1 +-1 +0 +-1 +-1 +0 +-1 diff --git a/tests/vector/le-006.test b/tests/vector/le-006.test new file mode 100644 index 0000000..41da71a --- /dev/null +++ b/tests/vector/le-006.test @@ -0,0 +1,239 @@ +--TEST-- +LE.006: 64-bit vectors AVX +--TARGET-- +!aarch64 +--ARGS-- +-mavx -mno-avx2 --run +--CODE-- +#define N 8 +#define I 0 + +int printf(const char *, ...); + +typedef long long i64; +typedef unsigned long long u64; +typedef int i32; +typedef unsigned int u32; +typedef short i16; +typedef unsigned short u16; +typedef char i8; +typedef unsigned char u8; + +typedef double __attribute__((__vector_size__(N))) v_d; +typedef float __attribute__((__vector_size__(N))) v_f; +typedef i64 __attribute__((__vector_size__(N))) v_i64; +typedef u64 __attribute__((__vector_size__(N))) v_u64; +typedef i32 __attribute__((__vector_size__(N))) v_i32; +typedef u32 __attribute__((__vector_size__(N))) v_u32; +typedef i16 __attribute__((__vector_size__(N))) v_i16; +typedef u16 __attribute__((__vector_size__(N))) v_u16; +typedef i8 __attribute__((__vector_size__(N))) v_i8; +typedef u8 __attribute__((__vector_size__(N))) v_u8; + +v_d __attribute__((noinline)) test_v_d(v_d v, double x, double y) +{ + return (v + x <= y); +} + +v_f __attribute__((noinline)) test_v_f(v_f v, float x, float y) +{ + return (v + x <= y); +} + +v_i64 __attribute__((noinline)) test_v_i64(v_i64 v, i64 x, i64 y) +{ + return (v + x <= y); +} + +v_u64 __attribute__((noinline)) test_v_u64(v_u64 v, u64 x, u64 y) +{ + return (v + x <= y); +} + +v_i32 __attribute__((noinline)) test_v_i32(v_i32 v, i32 x, i32 y) +{ + return (v + x <= y); +} + +v_u32 __attribute__((noinline)) test_v_u32(v_u32 v, u32 x, u32 y) +{ + return (v + x <= y); +} + +v_i16 __attribute__((noinline)) test_v_i16(v_i16 v, i16 x, i16 y) +{ + return (v + x <= y); +} + +v_u16 __attribute__((noinline)) test_v_u16(v_u16 v, u16 x, u16 y) +{ + return (v + x <= y); +} + +v_i8 __attribute__((noinline)) test_v_i8(v_i8 v, i8 x, i8 y) +{ + return (v + x <= y); +} + +v_u8 __attribute__((noinline)) test_v_u8(v_u8 v, u8 x, u8 y) +{ + return (v + x <= y); +} + +int main() +{ + { + v_d x = {}; + v_i64 y; + y = (v_i64)test_v_d(x, 42.42, 42.42); + printf("%lld\n", y[I]); + x = (v_d){}; + y = (v_i64)test_v_d(x, 42.42, 13.13); + printf("%lld\n", y[I]); + x = (v_d){}; + y = (v_i64)test_v_d(x, 42.42, 55.55); + printf("%lld\n", y[I]); + } + + { + v_f x = {}; + v_i32 y; + y = (v_i32)test_v_f(x, 42.42, 42.42); + printf("%d\n", y[I]); + x = (v_f){}; + y = (v_i32)test_v_f(x, 42.42, 13.13); + printf("%d\n", y[I]); + x = (v_f){}; + y = (v_i32)test_v_f(x, 42.42, 55.55); + printf("%d\n", y[I]); + } + + { + v_i64 x = {}; + x = test_v_i64(x, 42, 42); + printf("%lld\n", x[I]); + x = (v_i64){}; + x = test_v_i64(x, 42, 13); + printf("%lld\n", x[I]); + x = (v_i64){}; + x = test_v_i64(x, 42, 55); + printf("%lld\n", x[I]); + } + + { + v_u64 x = {}; + x = test_v_u64(x, 42, 42); + printf("%lld\n", x[I]); + x = (v_u64){}; + x = test_v_u64(x, 42, 13); + printf("%lld\n", x[I]); + x = (v_u64){}; + x = test_v_u64(x, 42, 55); + printf("%lld\n", x[I]); + } + + { + v_i32 x = {}; + x = test_v_i32(x, 42, 42); + printf("%d\n", x[I]); + x = (v_i32){}; + x = test_v_i32(x, 42, 13); + printf("%d\n", x[I]); + x = (v_i32){}; + x = test_v_i32(x, 42, 55); + printf("%d\n", x[I]); + } + + { + v_u32 x = {}; + x = test_v_u32(x, 42, 42); + printf("%d\n", x[I]); + x = (v_u32){}; + x = test_v_u32(x, 42, 13); + printf("%d\n", x[I]); + x = (v_u32){}; + x = test_v_u32(x, 42, 55); + printf("%d\n", x[I]); + } + + { + v_i16 x = {}; + x = test_v_i16(x, 42, 42); + printf("%d\n", x[I]); + x = (v_i16){}; + x = test_v_i16(x, 42, 13); + printf("%d\n", x[I]); + x = (v_i16){}; + x = test_v_i16(x, 42, 55); + printf("%d\n", x[I]); + } + + { + v_u16 x = {}; + x = test_v_u16(x, 42, 42); + printf("%d\n", (i16)x[I]); + x = (v_u16){}; + x = test_v_u16(x, 42, 13); + printf("%d\n", (i16)x[I]); + x = (v_u16){}; + x = test_v_u16(x, 42, 55); + printf("%d\n", (i16)x[I]); + } + + { + v_i8 x = {}; + x = test_v_i8(x, 42, 42); + printf("%d\n", x[I]); + x = (v_i8){}; + x = test_v_i8(x, 42, 13); + printf("%d\n", x[I]); + x = (v_i8){}; + x = test_v_i8(x, 42, 55); + printf("%d\n", x[I]); + } + + { + v_u8 x = {}; + x = test_v_u8(x, 42, 42); + printf("%d\n", (i8)x[I]); + x = (v_u8){}; + x = test_v_u8(x, 42, 13); + printf("%d\n", (i8)x[I]); + x = (v_u8){}; + x = test_v_u8(x, 42, 55); + printf("%d\n", (i8)x[I]); + } + + return 0; +} +--EXPECT-- +-1 +0 +-1 +-1 +0 +-1 +-1 +0 +-1 +-1 +0 +-1 +-1 +0 +-1 +-1 +0 +-1 +-1 +0 +-1 +-1 +0 +-1 +-1 +0 +-1 +-1 +0 +-1 diff --git a/tests/vector/le-007.test b/tests/vector/le-007.test new file mode 100644 index 0000000..079e009 --- /dev/null +++ b/tests/vector/le-007.test @@ -0,0 +1,239 @@ +--TEST-- +LE.007: 256-bit vectors AVX +--TARGET-- +!aarch64 +--ARGS-- +-mavx -mno-avx2 --run +--CODE-- +#define N 32 +#define I 3 + +int printf(const char *, ...); + +typedef long long i64; +typedef unsigned long long u64; +typedef int i32; +typedef unsigned int u32; +typedef short i16; +typedef unsigned short u16; +typedef char i8; +typedef unsigned char u8; + +typedef double __attribute__((__vector_size__(N))) v_d; +typedef float __attribute__((__vector_size__(N))) v_f; +typedef i64 __attribute__((__vector_size__(N))) v_i64; +typedef u64 __attribute__((__vector_size__(N))) v_u64; +typedef i32 __attribute__((__vector_size__(N))) v_i32; +typedef u32 __attribute__((__vector_size__(N))) v_u32; +typedef i16 __attribute__((__vector_size__(N))) v_i16; +typedef u16 __attribute__((__vector_size__(N))) v_u16; +typedef i8 __attribute__((__vector_size__(N))) v_i8; +typedef u8 __attribute__((__vector_size__(N))) v_u8; + +v_d __attribute__((noinline)) test_v_d(v_d v, double x, double y) +{ + return (v + x <= y); +} + +v_f __attribute__((noinline)) test_v_f(v_f v, float x, float y) +{ + return (v + x <= y); +} + +v_i64 __attribute__((noinline)) test_v_i64(v_i64 v, i64 x, i64 y) +{ + return (v + x <= y); +} + +v_u64 __attribute__((noinline)) test_v_u64(v_u64 v, u64 x, u64 y) +{ + return (v + x <= y); +} + +v_i32 __attribute__((noinline)) test_v_i32(v_i32 v, i32 x, i32 y) +{ + return (v + x <= y); +} + +v_u32 __attribute__((noinline)) test_v_u32(v_u32 v, u32 x, u32 y) +{ + return (v + x <= y); +} + +v_i16 __attribute__((noinline)) test_v_i16(v_i16 v, i16 x, i16 y) +{ + return (v + x <= y); +} + +v_u16 __attribute__((noinline)) test_v_u16(v_u16 v, u16 x, u16 y) +{ + return (v + x <= y); +} + +v_i8 __attribute__((noinline)) test_v_i8(v_i8 v, i8 x, i8 y) +{ + return (v + x <= y); +} + +v_u8 __attribute__((noinline)) test_v_u8(v_u8 v, u8 x, u8 y) +{ + return (v + x <= y); +} + +int main() +{ + { + v_d x = {}; + v_i64 y; + y = (v_i64)test_v_d(x, 42.42, 42.42); + printf("%lld\n", y[I]); + x = (v_d){}; + y = (v_i64)test_v_d(x, 42.42, 13.13); + printf("%lld\n", y[I]); + x = (v_d){}; + y = (v_i64)test_v_d(x, 42.42, 55.55); + printf("%lld\n", y[I]); + } + + { + v_f x = {}; + v_i32 y; + y = (v_i32)test_v_f(x, 42.42, 42.42); + printf("%d\n", y[I]); + x = (v_f){}; + y = (v_i32)test_v_f(x, 42.42, 13.13); + printf("%d\n", y[I]); + x = (v_f){}; + y = (v_i32)test_v_f(x, 42.42, 55.55); + printf("%d\n", y[I]); + } + + { + v_i64 x = {}; + x = test_v_i64(x, 42, 42); + printf("%lld\n", x[I]); + x = (v_i64){}; + x = test_v_i64(x, 42, 13); + printf("%lld\n", x[I]); + x = (v_i64){}; + x = test_v_i64(x, 42, 55); + printf("%lld\n", x[I]); + } + + { + v_u64 x = {}; + x = test_v_u64(x, 42, 42); + printf("%lld\n", x[I]); + x = (v_u64){}; + x = test_v_u64(x, 42, 13); + printf("%lld\n", x[I]); + x = (v_u64){}; + x = test_v_u64(x, 42, 55); + printf("%lld\n", x[I]); + } + + { + v_i32 x = {}; + x = test_v_i32(x, 42, 42); + printf("%d\n", x[I]); + x = (v_i32){}; + x = test_v_i32(x, 42, 13); + printf("%d\n", x[I]); + x = (v_i32){}; + x = test_v_i32(x, 42, 55); + printf("%d\n", x[I]); + } + + { + v_u32 x = {}; + x = test_v_u32(x, 42, 42); + printf("%d\n", x[I]); + x = (v_u32){}; + x = test_v_u32(x, 42, 13); + printf("%d\n", x[I]); + x = (v_u32){}; + x = test_v_u32(x, 42, 55); + printf("%d\n", x[I]); + } + + { + v_i16 x = {}; + x = test_v_i16(x, 42, 42); + printf("%d\n", x[I]); + x = (v_i16){}; + x = test_v_i16(x, 42, 13); + printf("%d\n", x[I]); + x = (v_i16){}; + x = test_v_i16(x, 42, 55); + printf("%d\n", x[I]); + } + + { + v_u16 x = {}; + x = test_v_u16(x, 42, 42); + printf("%d\n", (i16)x[I]); + x = (v_u16){}; + x = test_v_u16(x, 42, 13); + printf("%d\n", (i16)x[I]); + x = (v_u16){}; + x = test_v_u16(x, 42, 55); + printf("%d\n", (i16)x[I]); + } + + { + v_i8 x = {}; + x = test_v_i8(x, 42, 42); + printf("%d\n", x[I]); + x = (v_i8){}; + x = test_v_i8(x, 42, 13); + printf("%d\n", x[I]); + x = (v_i8){}; + x = test_v_i8(x, 42, 55); + printf("%d\n", x[I]); + } + + { + v_u8 x = {}; + x = test_v_u8(x, 42, 42); + printf("%d\n", (i8)x[I]); + x = (v_u8){}; + x = test_v_u8(x, 42, 13); + printf("%d\n", (i8)x[I]); + x = (v_u8){}; + x = test_v_u8(x, 42, 55); + printf("%d\n", (i8)x[I]); + } + + return 0; +} +--EXPECT-- +-1 +0 +-1 +-1 +0 +-1 +-1 +0 +-1 +-1 +0 +-1 +-1 +0 +-1 +-1 +0 +-1 +-1 +0 +-1 +-1 +0 +-1 +-1 +0 +-1 +-1 +0 +-1 diff --git a/tests/vector/le-008.test b/tests/vector/le-008.test new file mode 100644 index 0000000..b95c938 --- /dev/null +++ b/tests/vector/le-008.test @@ -0,0 +1,239 @@ +--TEST-- +LE.008: 256-bit vectors AVX+AVX2 +--TARGET-- +!aarch64 +--ARGS-- +-mavx --run +--CODE-- +#define N 32 +#define I 3 + +int printf(const char *, ...); + +typedef long long i64; +typedef unsigned long long u64; +typedef int i32; +typedef unsigned int u32; +typedef short i16; +typedef unsigned short u16; +typedef char i8; +typedef unsigned char u8; + +typedef double __attribute__((__vector_size__(N))) v_d; +typedef float __attribute__((__vector_size__(N))) v_f; +typedef i64 __attribute__((__vector_size__(N))) v_i64; +typedef u64 __attribute__((__vector_size__(N))) v_u64; +typedef i32 __attribute__((__vector_size__(N))) v_i32; +typedef u32 __attribute__((__vector_size__(N))) v_u32; +typedef i16 __attribute__((__vector_size__(N))) v_i16; +typedef u16 __attribute__((__vector_size__(N))) v_u16; +typedef i8 __attribute__((__vector_size__(N))) v_i8; +typedef u8 __attribute__((__vector_size__(N))) v_u8; + +v_d __attribute__((noinline)) test_v_d(v_d v, double x, double y) +{ + return (v + x <= y); +} + +v_f __attribute__((noinline)) test_v_f(v_f v, float x, float y) +{ + return (v + x <= y); +} + +v_i64 __attribute__((noinline)) test_v_i64(v_i64 v, i64 x, i64 y) +{ + return (v + x <= y); +} + +v_u64 __attribute__((noinline)) test_v_u64(v_u64 v, u64 x, u64 y) +{ + return (v + x <= y); +} + +v_i32 __attribute__((noinline)) test_v_i32(v_i32 v, i32 x, i32 y) +{ + return (v + x <= y); +} + +v_u32 __attribute__((noinline)) test_v_u32(v_u32 v, u32 x, u32 y) +{ + return (v + x <= y); +} + +v_i16 __attribute__((noinline)) test_v_i16(v_i16 v, i16 x, i16 y) +{ + return (v + x <= y); +} + +v_u16 __attribute__((noinline)) test_v_u16(v_u16 v, u16 x, u16 y) +{ + return (v + x <= y); +} + +v_i8 __attribute__((noinline)) test_v_i8(v_i8 v, i8 x, i8 y) +{ + return (v + x <= y); +} + +v_u8 __attribute__((noinline)) test_v_u8(v_u8 v, u8 x, u8 y) +{ + return (v + x <= y); +} + +int main() +{ + { + v_d x = {}; + v_i64 y; + y = (v_i64)test_v_d(x, 42.42, 42.42); + printf("%lld\n", y[I]); + x = (v_d){}; + y = (v_i64)test_v_d(x, 42.42, 13.13); + printf("%lld\n", y[I]); + x = (v_d){}; + y = (v_i64)test_v_d(x, 42.42, 55.55); + printf("%lld\n", y[I]); + } + + { + v_f x = {}; + v_i32 y; + y = (v_i32)test_v_f(x, 42.42, 42.42); + printf("%d\n", y[I]); + x = (v_f){}; + y = (v_i32)test_v_f(x, 42.42, 13.13); + printf("%d\n", y[I]); + x = (v_f){}; + y = (v_i32)test_v_f(x, 42.42, 55.55); + printf("%d\n", y[I]); + } + + { + v_i64 x = {}; + x = test_v_i64(x, 42, 42); + printf("%lld\n", x[I]); + x = (v_i64){}; + x = test_v_i64(x, 42, 13); + printf("%lld\n", x[I]); + x = (v_i64){}; + x = test_v_i64(x, 42, 55); + printf("%lld\n", x[I]); + } + + { + v_u64 x = {}; + x = test_v_u64(x, 42, 42); + printf("%lld\n", x[I]); + x = (v_u64){}; + x = test_v_u64(x, 42, 13); + printf("%lld\n", x[I]); + x = (v_u64){}; + x = test_v_u64(x, 42, 55); + printf("%lld\n", x[I]); + } + + { + v_i32 x = {}; + x = test_v_i32(x, 42, 42); + printf("%d\n", x[I]); + x = (v_i32){}; + x = test_v_i32(x, 42, 13); + printf("%d\n", x[I]); + x = (v_i32){}; + x = test_v_i32(x, 42, 55); + printf("%d\n", x[I]); + } + + { + v_u32 x = {}; + x = test_v_u32(x, 42, 42); + printf("%d\n", x[I]); + x = (v_u32){}; + x = test_v_u32(x, 42, 13); + printf("%d\n", x[I]); + x = (v_u32){}; + x = test_v_u32(x, 42, 55); + printf("%d\n", x[I]); + } + + { + v_i16 x = {}; + x = test_v_i16(x, 42, 42); + printf("%d\n", x[I]); + x = (v_i16){}; + x = test_v_i16(x, 42, 13); + printf("%d\n", x[I]); + x = (v_i16){}; + x = test_v_i16(x, 42, 55); + printf("%d\n", x[I]); + } + + { + v_u16 x = {}; + x = test_v_u16(x, 42, 42); + printf("%d\n", (i16)x[I]); + x = (v_u16){}; + x = test_v_u16(x, 42, 13); + printf("%d\n", (i16)x[I]); + x = (v_u16){}; + x = test_v_u16(x, 42, 55); + printf("%d\n", (i16)x[I]); + } + + { + v_i8 x = {}; + x = test_v_i8(x, 42, 42); + printf("%d\n", x[I]); + x = (v_i8){}; + x = test_v_i8(x, 42, 13); + printf("%d\n", x[I]); + x = (v_i8){}; + x = test_v_i8(x, 42, 55); + printf("%d\n", x[I]); + } + + { + v_u8 x = {}; + x = test_v_u8(x, 42, 42); + printf("%d\n", (i8)x[I]); + x = (v_u8){}; + x = test_v_u8(x, 42, 13); + printf("%d\n", (i8)x[I]); + x = (v_u8){}; + x = test_v_u8(x, 42, 55); + printf("%d\n", (i8)x[I]); + } + + return 0; +} +--EXPECT-- +-1 +0 +-1 +-1 +0 +-1 +-1 +0 +-1 +-1 +0 +-1 +-1 +0 +-1 +-1 +0 +-1 +-1 +0 +-1 +-1 +0 +-1 +-1 +0 +-1 +-1 +0 +-1 diff --git a/tests/vector/lt-001.test b/tests/vector/lt-001.test new file mode 100644 index 0000000..18b0183 --- /dev/null +++ b/tests/vector/lt-001.test @@ -0,0 +1,239 @@ +--TEST-- +LT.001: 128-bit vectors SSE2 +--TARGET-- +!aarch64 +--ARGS-- +-mno-sse4 -mno-avx2 --run +--CODE-- +#define N 16 +#define I 1 + +int printf(const char *, ...); + +typedef long long i64; +typedef unsigned long long u64; +typedef int i32; +typedef unsigned int u32; +typedef short i16; +typedef unsigned short u16; +typedef char i8; +typedef unsigned char u8; + +typedef double __attribute__((__vector_size__(N))) v_d; +typedef float __attribute__((__vector_size__(N))) v_f; +typedef i64 __attribute__((__vector_size__(N))) v_i64; +typedef u64 __attribute__((__vector_size__(N))) v_u64; +typedef i32 __attribute__((__vector_size__(N))) v_i32; +typedef u32 __attribute__((__vector_size__(N))) v_u32; +typedef i16 __attribute__((__vector_size__(N))) v_i16; +typedef u16 __attribute__((__vector_size__(N))) v_u16; +typedef i8 __attribute__((__vector_size__(N))) v_i8; +typedef u8 __attribute__((__vector_size__(N))) v_u8; + +v_d __attribute__((noinline)) test_v_d(v_d v, double x, double y) +{ + return (v + x < y); +} + +v_f __attribute__((noinline)) test_v_f(v_f v, float x, float y) +{ + return (v + x < y); +} + +v_i64 __attribute__((noinline)) test_v_i64(v_i64 v, i64 x, i64 y) +{ + return (v + x < y); +} + +v_u64 __attribute__((noinline)) test_v_u64(v_u64 v, u64 x, u64 y) +{ + return (v + x < y); +} + +v_i32 __attribute__((noinline)) test_v_i32(v_i32 v, i32 x, i32 y) +{ + return (v + x < y); +} + +v_u32 __attribute__((noinline)) test_v_u32(v_u32 v, u32 x, u32 y) +{ + return (v + x < y); +} + +v_i16 __attribute__((noinline)) test_v_i16(v_i16 v, i16 x, i16 y) +{ + return (v + x < y); +} + +v_u16 __attribute__((noinline)) test_v_u16(v_u16 v, u16 x, u16 y) +{ + return (v + x < y); +} + +v_i8 __attribute__((noinline)) test_v_i8(v_i8 v, i8 x, i8 y) +{ + return (v + x < y); +} + +v_u8 __attribute__((noinline)) test_v_u8(v_u8 v, u8 x, u8 y) +{ + return (v + x < y); +} + +int main() +{ + { + v_d x = {}; + v_i64 y; + y = (v_i64)test_v_d(x, 42.42, 42.42); + printf("%lld\n", y[I]); + x = (v_d){}; + y = (v_i64)test_v_d(x, 42.42, 13.13); + printf("%lld\n", y[I]); + x = (v_d){}; + y = (v_i64)test_v_d(x, 42.42, 55.55); + printf("%lld\n", y[I]); + } + + { + v_f x = {}; + v_i32 y; + y = (v_i32)test_v_f(x, 42.42, 42.42); + printf("%d\n", y[I]); + x = (v_f){}; + y = (v_i32)test_v_f(x, 42.42, 13.13); + printf("%d\n", y[I]); + x = (v_f){}; + y = (v_i32)test_v_f(x, 42.42, 55.55); + printf("%d\n", y[I]); + } + + { + v_i64 x = {}; + x = test_v_i64(x, 42, 42); + printf("%lld\n", x[I]); + x = (v_i64){}; + x = test_v_i64(x, 42, 13); + printf("%lld\n", x[I]); + x = (v_i64){}; + x = test_v_i64(x, 42, 55); + printf("%lld\n", x[I]); + } + + { + v_u64 x = {}; + x = test_v_u64(x, 42, 42); + printf("%lld\n", x[I]); + x = (v_u64){}; + x = test_v_u64(x, 42, 13); + printf("%lld\n", x[I]); + x = (v_u64){}; + x = test_v_u64(x, 42, 55); + printf("%lld\n", x[I]); + } + + { + v_i32 x = {}; + x = test_v_i32(x, 42, 42); + printf("%d\n", x[I]); + x = (v_i32){}; + x = test_v_i32(x, 42, 13); + printf("%d\n", x[I]); + x = (v_i32){}; + x = test_v_i32(x, 42, 55); + printf("%d\n", x[I]); + } + + { + v_u32 x = {}; + x = test_v_u32(x, 42, 42); + printf("%d\n", x[I]); + x = (v_u32){}; + x = test_v_u32(x, 42, 13); + printf("%d\n", x[I]); + x = (v_u32){}; + x = test_v_u32(x, 42, 55); + printf("%d\n", x[I]); + } + + { + v_i16 x = {}; + x = test_v_i16(x, 42, 42); + printf("%d\n", x[I]); + x = (v_i16){}; + x = test_v_i16(x, 42, 13); + printf("%d\n", x[I]); + x = (v_i16){}; + x = test_v_i16(x, 42, 55); + printf("%d\n", x[I]); + } + + { + v_u16 x = {}; + x = test_v_u16(x, 42, 42); + printf("%d\n", (i16)x[I]); + x = (v_u16){}; + x = test_v_u16(x, 42, 13); + printf("%d\n", (i16)x[I]); + x = (v_u16){}; + x = test_v_u16(x, 42, 55); + printf("%d\n", (i16)x[I]); + } + + { + v_i8 x = {}; + x = test_v_i8(x, 42, 42); + printf("%d\n", x[I]); + x = (v_i8){}; + x = test_v_i8(x, 42, 13); + printf("%d\n", x[I]); + x = (v_i8){}; + x = test_v_i8(x, 42, 55); + printf("%d\n", x[I]); + } + + { + v_u8 x = {}; + x = test_v_u8(x, 42, 42); + printf("%d\n", (i8)x[I]); + x = (v_u8){}; + x = test_v_u8(x, 42, 13); + printf("%d\n", (i8)x[I]); + x = (v_u8){}; + x = test_v_u8(x, 42, 55); + printf("%d\n", (i8)x[I]); + } + + return 0; +} +--EXPECT-- +0 +0 +-1 +0 +0 +-1 +0 +0 +-1 +0 +0 +-1 +0 +0 +-1 +0 +0 +-1 +0 +0 +-1 +0 +0 +-1 +0 +0 +-1 +0 +0 +-1 diff --git a/tests/vector/lt-002.test b/tests/vector/lt-002.test new file mode 100644 index 0000000..ab709c1 --- /dev/null +++ b/tests/vector/lt-002.test @@ -0,0 +1,239 @@ +--TEST-- +LT.002: 128-bit vectors SSE2+SSE4 +--TARGET-- +!aarch64 +--ARGS-- +-mno-avx2 --run +--CODE-- +#define N 16 +#define I 1 + +int printf(const char *, ...); + +typedef long long i64; +typedef unsigned long long u64; +typedef int i32; +typedef unsigned int u32; +typedef short i16; +typedef unsigned short u16; +typedef char i8; +typedef unsigned char u8; + +typedef double __attribute__((__vector_size__(N))) v_d; +typedef float __attribute__((__vector_size__(N))) v_f; +typedef i64 __attribute__((__vector_size__(N))) v_i64; +typedef u64 __attribute__((__vector_size__(N))) v_u64; +typedef i32 __attribute__((__vector_size__(N))) v_i32; +typedef u32 __attribute__((__vector_size__(N))) v_u32; +typedef i16 __attribute__((__vector_size__(N))) v_i16; +typedef u16 __attribute__((__vector_size__(N))) v_u16; +typedef i8 __attribute__((__vector_size__(N))) v_i8; +typedef u8 __attribute__((__vector_size__(N))) v_u8; + +v_d __attribute__((noinline)) test_v_d(v_d v, double x, double y) +{ + return (v + x < y); +} + +v_f __attribute__((noinline)) test_v_f(v_f v, float x, float y) +{ + return (v + x < y); +} + +v_i64 __attribute__((noinline)) test_v_i64(v_i64 v, i64 x, i64 y) +{ + return (v + x < y); +} + +v_u64 __attribute__((noinline)) test_v_u64(v_u64 v, u64 x, u64 y) +{ + return (v + x < y); +} + +v_i32 __attribute__((noinline)) test_v_i32(v_i32 v, i32 x, i32 y) +{ + return (v + x < y); +} + +v_u32 __attribute__((noinline)) test_v_u32(v_u32 v, u32 x, u32 y) +{ + return (v + x < y); +} + +v_i16 __attribute__((noinline)) test_v_i16(v_i16 v, i16 x, i16 y) +{ + return (v + x < y); +} + +v_u16 __attribute__((noinline)) test_v_u16(v_u16 v, u16 x, u16 y) +{ + return (v + x < y); +} + +v_i8 __attribute__((noinline)) test_v_i8(v_i8 v, i8 x, i8 y) +{ + return (v + x < y); +} + +v_u8 __attribute__((noinline)) test_v_u8(v_u8 v, u8 x, u8 y) +{ + return (v + x < y); +} + +int main() +{ + { + v_d x = {}; + v_i64 y; + y = (v_i64)test_v_d(x, 42.42, 42.42); + printf("%lld\n", y[I]); + x = (v_d){}; + y = (v_i64)test_v_d(x, 42.42, 13.13); + printf("%lld\n", y[I]); + x = (v_d){}; + y = (v_i64)test_v_d(x, 42.42, 55.55); + printf("%lld\n", y[I]); + } + + { + v_f x = {}; + v_i32 y; + y = (v_i32)test_v_f(x, 42.42, 42.42); + printf("%d\n", y[I]); + x = (v_f){}; + y = (v_i32)test_v_f(x, 42.42, 13.13); + printf("%d\n", y[I]); + x = (v_f){}; + y = (v_i32)test_v_f(x, 42.42, 55.55); + printf("%d\n", y[I]); + } + + { + v_i64 x = {}; + x = test_v_i64(x, 42, 42); + printf("%lld\n", x[I]); + x = (v_i64){}; + x = test_v_i64(x, 42, 13); + printf("%lld\n", x[I]); + x = (v_i64){}; + x = test_v_i64(x, 42, 55); + printf("%lld\n", x[I]); + } + + { + v_u64 x = {}; + x = test_v_u64(x, 42, 42); + printf("%lld\n", x[I]); + x = (v_u64){}; + x = test_v_u64(x, 42, 13); + printf("%lld\n", x[I]); + x = (v_u64){}; + x = test_v_u64(x, 42, 55); + printf("%lld\n", x[I]); + } + + { + v_i32 x = {}; + x = test_v_i32(x, 42, 42); + printf("%d\n", x[I]); + x = (v_i32){}; + x = test_v_i32(x, 42, 13); + printf("%d\n", x[I]); + x = (v_i32){}; + x = test_v_i32(x, 42, 55); + printf("%d\n", x[I]); + } + + { + v_u32 x = {}; + x = test_v_u32(x, 42, 42); + printf("%d\n", x[I]); + x = (v_u32){}; + x = test_v_u32(x, 42, 13); + printf("%d\n", x[I]); + x = (v_u32){}; + x = test_v_u32(x, 42, 55); + printf("%d\n", x[I]); + } + + { + v_i16 x = {}; + x = test_v_i16(x, 42, 42); + printf("%d\n", x[I]); + x = (v_i16){}; + x = test_v_i16(x, 42, 13); + printf("%d\n", x[I]); + x = (v_i16){}; + x = test_v_i16(x, 42, 55); + printf("%d\n", x[I]); + } + + { + v_u16 x = {}; + x = test_v_u16(x, 42, 42); + printf("%d\n", (i16)x[I]); + x = (v_u16){}; + x = test_v_u16(x, 42, 13); + printf("%d\n", (i16)x[I]); + x = (v_u16){}; + x = test_v_u16(x, 42, 55); + printf("%d\n", (i16)x[I]); + } + + { + v_i8 x = {}; + x = test_v_i8(x, 42, 42); + printf("%d\n", x[I]); + x = (v_i8){}; + x = test_v_i8(x, 42, 13); + printf("%d\n", x[I]); + x = (v_i8){}; + x = test_v_i8(x, 42, 55); + printf("%d\n", x[I]); + } + + { + v_u8 x = {}; + x = test_v_u8(x, 42, 42); + printf("%d\n", (i8)x[I]); + x = (v_u8){}; + x = test_v_u8(x, 42, 13); + printf("%d\n", (i8)x[I]); + x = (v_u8){}; + x = test_v_u8(x, 42, 55); + printf("%d\n", (i8)x[I]); + } + + return 0; +} +--EXPECT-- +0 +0 +-1 +0 +0 +-1 +0 +0 +-1 +0 +0 +-1 +0 +0 +-1 +0 +0 +-1 +0 +0 +-1 +0 +0 +-1 +0 +0 +-1 +0 +0 +-1 diff --git a/tests/vector/lt-003.test b/tests/vector/lt-003.test new file mode 100644 index 0000000..af15526 --- /dev/null +++ b/tests/vector/lt-003.test @@ -0,0 +1,239 @@ +--TEST-- +LT.003: 128-bit vectors AVX +--TARGET-- +!aarch64 +--ARGS-- +-mavx -mno-avx2 --run +--CODE-- +#define N 16 +#define I 1 + +int printf(const char *, ...); + +typedef long long i64; +typedef unsigned long long u64; +typedef int i32; +typedef unsigned int u32; +typedef short i16; +typedef unsigned short u16; +typedef char i8; +typedef unsigned char u8; + +typedef double __attribute__((__vector_size__(N))) v_d; +typedef float __attribute__((__vector_size__(N))) v_f; +typedef i64 __attribute__((__vector_size__(N))) v_i64; +typedef u64 __attribute__((__vector_size__(N))) v_u64; +typedef i32 __attribute__((__vector_size__(N))) v_i32; +typedef u32 __attribute__((__vector_size__(N))) v_u32; +typedef i16 __attribute__((__vector_size__(N))) v_i16; +typedef u16 __attribute__((__vector_size__(N))) v_u16; +typedef i8 __attribute__((__vector_size__(N))) v_i8; +typedef u8 __attribute__((__vector_size__(N))) v_u8; + +v_d __attribute__((noinline)) test_v_d(v_d v, double x, double y) +{ + return (v + x < y); +} + +v_f __attribute__((noinline)) test_v_f(v_f v, float x, float y) +{ + return (v + x < y); +} + +v_i64 __attribute__((noinline)) test_v_i64(v_i64 v, i64 x, i64 y) +{ + return (v + x < y); +} + +v_u64 __attribute__((noinline)) test_v_u64(v_u64 v, u64 x, u64 y) +{ + return (v + x < y); +} + +v_i32 __attribute__((noinline)) test_v_i32(v_i32 v, i32 x, i32 y) +{ + return (v + x < y); +} + +v_u32 __attribute__((noinline)) test_v_u32(v_u32 v, u32 x, u32 y) +{ + return (v + x < y); +} + +v_i16 __attribute__((noinline)) test_v_i16(v_i16 v, i16 x, i16 y) +{ + return (v + x < y); +} + +v_u16 __attribute__((noinline)) test_v_u16(v_u16 v, u16 x, u16 y) +{ + return (v + x < y); +} + +v_i8 __attribute__((noinline)) test_v_i8(v_i8 v, i8 x, i8 y) +{ + return (v + x < y); +} + +v_u8 __attribute__((noinline)) test_v_u8(v_u8 v, u8 x, u8 y) +{ + return (v + x < y); +} + +int main() +{ + { + v_d x = {}; + v_i64 y; + y = (v_i64)test_v_d(x, 42.42, 42.42); + printf("%lld\n", y[I]); + x = (v_d){}; + y = (v_i64)test_v_d(x, 42.42, 13.13); + printf("%lld\n", y[I]); + x = (v_d){}; + y = (v_i64)test_v_d(x, 42.42, 55.55); + printf("%lld\n", y[I]); + } + + { + v_f x = {}; + v_i32 y; + y = (v_i32)test_v_f(x, 42.42, 42.42); + printf("%d\n", y[I]); + x = (v_f){}; + y = (v_i32)test_v_f(x, 42.42, 13.13); + printf("%d\n", y[I]); + x = (v_f){}; + y = (v_i32)test_v_f(x, 42.42, 55.55); + printf("%d\n", y[I]); + } + + { + v_i64 x = {}; + x = test_v_i64(x, 42, 42); + printf("%lld\n", x[I]); + x = (v_i64){}; + x = test_v_i64(x, 42, 13); + printf("%lld\n", x[I]); + x = (v_i64){}; + x = test_v_i64(x, 42, 55); + printf("%lld\n", x[I]); + } + + { + v_u64 x = {}; + x = test_v_u64(x, 42, 42); + printf("%lld\n", x[I]); + x = (v_u64){}; + x = test_v_u64(x, 42, 13); + printf("%lld\n", x[I]); + x = (v_u64){}; + x = test_v_u64(x, 42, 55); + printf("%lld\n", x[I]); + } + + { + v_i32 x = {}; + x = test_v_i32(x, 42, 42); + printf("%d\n", x[I]); + x = (v_i32){}; + x = test_v_i32(x, 42, 13); + printf("%d\n", x[I]); + x = (v_i32){}; + x = test_v_i32(x, 42, 55); + printf("%d\n", x[I]); + } + + { + v_u32 x = {}; + x = test_v_u32(x, 42, 42); + printf("%d\n", x[I]); + x = (v_u32){}; + x = test_v_u32(x, 42, 13); + printf("%d\n", x[I]); + x = (v_u32){}; + x = test_v_u32(x, 42, 55); + printf("%d\n", x[I]); + } + + { + v_i16 x = {}; + x = test_v_i16(x, 42, 42); + printf("%d\n", x[I]); + x = (v_i16){}; + x = test_v_i16(x, 42, 13); + printf("%d\n", x[I]); + x = (v_i16){}; + x = test_v_i16(x, 42, 55); + printf("%d\n", x[I]); + } + + { + v_u16 x = {}; + x = test_v_u16(x, 42, 42); + printf("%d\n", (i16)x[I]); + x = (v_u16){}; + x = test_v_u16(x, 42, 13); + printf("%d\n", (i16)x[I]); + x = (v_u16){}; + x = test_v_u16(x, 42, 55); + printf("%d\n", (i16)x[I]); + } + + { + v_i8 x = {}; + x = test_v_i8(x, 42, 42); + printf("%d\n", x[I]); + x = (v_i8){}; + x = test_v_i8(x, 42, 13); + printf("%d\n", x[I]); + x = (v_i8){}; + x = test_v_i8(x, 42, 55); + printf("%d\n", x[I]); + } + + { + v_u8 x = {}; + x = test_v_u8(x, 42, 42); + printf("%d\n", (i8)x[I]); + x = (v_u8){}; + x = test_v_u8(x, 42, 13); + printf("%d\n", (i8)x[I]); + x = (v_u8){}; + x = test_v_u8(x, 42, 55); + printf("%d\n", (i8)x[I]); + } + + return 0; +} +--EXPECT-- +0 +0 +-1 +0 +0 +-1 +0 +0 +-1 +0 +0 +-1 +0 +0 +-1 +0 +0 +-1 +0 +0 +-1 +0 +0 +-1 +0 +0 +-1 +0 +0 +-1 diff --git a/tests/vector/lt-004.test b/tests/vector/lt-004.test new file mode 100644 index 0000000..850dc87 --- /dev/null +++ b/tests/vector/lt-004.test @@ -0,0 +1,239 @@ +--TEST-- +LT.004: 128-bit vectors AVX+AVX2 +--TARGET-- +!aarch64 +--ARGS-- +-mavx --run +--CODE-- +#define N 16 +#define I 1 + +int printf(const char *, ...); + +typedef long long i64; +typedef unsigned long long u64; +typedef int i32; +typedef unsigned int u32; +typedef short i16; +typedef unsigned short u16; +typedef char i8; +typedef unsigned char u8; + +typedef double __attribute__((__vector_size__(N))) v_d; +typedef float __attribute__((__vector_size__(N))) v_f; +typedef i64 __attribute__((__vector_size__(N))) v_i64; +typedef u64 __attribute__((__vector_size__(N))) v_u64; +typedef i32 __attribute__((__vector_size__(N))) v_i32; +typedef u32 __attribute__((__vector_size__(N))) v_u32; +typedef i16 __attribute__((__vector_size__(N))) v_i16; +typedef u16 __attribute__((__vector_size__(N))) v_u16; +typedef i8 __attribute__((__vector_size__(N))) v_i8; +typedef u8 __attribute__((__vector_size__(N))) v_u8; + +v_d __attribute__((noinline)) test_v_d(v_d v, double x, double y) +{ + return (v + x < y); +} + +v_f __attribute__((noinline)) test_v_f(v_f v, float x, float y) +{ + return (v + x < y); +} + +v_i64 __attribute__((noinline)) test_v_i64(v_i64 v, i64 x, i64 y) +{ + return (v + x < y); +} + +v_u64 __attribute__((noinline)) test_v_u64(v_u64 v, u64 x, u64 y) +{ + return (v + x < y); +} + +v_i32 __attribute__((noinline)) test_v_i32(v_i32 v, i32 x, i32 y) +{ + return (v + x < y); +} + +v_u32 __attribute__((noinline)) test_v_u32(v_u32 v, u32 x, u32 y) +{ + return (v + x < y); +} + +v_i16 __attribute__((noinline)) test_v_i16(v_i16 v, i16 x, i16 y) +{ + return (v + x < y); +} + +v_u16 __attribute__((noinline)) test_v_u16(v_u16 v, u16 x, u16 y) +{ + return (v + x < y); +} + +v_i8 __attribute__((noinline)) test_v_i8(v_i8 v, i8 x, i8 y) +{ + return (v + x < y); +} + +v_u8 __attribute__((noinline)) test_v_u8(v_u8 v, u8 x, u8 y) +{ + return (v + x < y); +} + +int main() +{ + { + v_d x = {}; + v_i64 y; + y = (v_i64)test_v_d(x, 42.42, 42.42); + printf("%lld\n", y[I]); + x = (v_d){}; + y = (v_i64)test_v_d(x, 42.42, 13.13); + printf("%lld\n", y[I]); + x = (v_d){}; + y = (v_i64)test_v_d(x, 42.42, 55.55); + printf("%lld\n", y[I]); + } + + { + v_f x = {}; + v_i32 y; + y = (v_i32)test_v_f(x, 42.42, 42.42); + printf("%d\n", y[I]); + x = (v_f){}; + y = (v_i32)test_v_f(x, 42.42, 13.13); + printf("%d\n", y[I]); + x = (v_f){}; + y = (v_i32)test_v_f(x, 42.42, 55.55); + printf("%d\n", y[I]); + } + + { + v_i64 x = {}; + x = test_v_i64(x, 42, 42); + printf("%lld\n", x[I]); + x = (v_i64){}; + x = test_v_i64(x, 42, 13); + printf("%lld\n", x[I]); + x = (v_i64){}; + x = test_v_i64(x, 42, 55); + printf("%lld\n", x[I]); + } + + { + v_u64 x = {}; + x = test_v_u64(x, 42, 42); + printf("%lld\n", x[I]); + x = (v_u64){}; + x = test_v_u64(x, 42, 13); + printf("%lld\n", x[I]); + x = (v_u64){}; + x = test_v_u64(x, 42, 55); + printf("%lld\n", x[I]); + } + + { + v_i32 x = {}; + x = test_v_i32(x, 42, 42); + printf("%d\n", x[I]); + x = (v_i32){}; + x = test_v_i32(x, 42, 13); + printf("%d\n", x[I]); + x = (v_i32){}; + x = test_v_i32(x, 42, 55); + printf("%d\n", x[I]); + } + + { + v_u32 x = {}; + x = test_v_u32(x, 42, 42); + printf("%d\n", x[I]); + x = (v_u32){}; + x = test_v_u32(x, 42, 13); + printf("%d\n", x[I]); + x = (v_u32){}; + x = test_v_u32(x, 42, 55); + printf("%d\n", x[I]); + } + + { + v_i16 x = {}; + x = test_v_i16(x, 42, 42); + printf("%d\n", x[I]); + x = (v_i16){}; + x = test_v_i16(x, 42, 13); + printf("%d\n", x[I]); + x = (v_i16){}; + x = test_v_i16(x, 42, 55); + printf("%d\n", x[I]); + } + + { + v_u16 x = {}; + x = test_v_u16(x, 42, 42); + printf("%d\n", (i16)x[I]); + x = (v_u16){}; + x = test_v_u16(x, 42, 13); + printf("%d\n", (i16)x[I]); + x = (v_u16){}; + x = test_v_u16(x, 42, 55); + printf("%d\n", (i16)x[I]); + } + + { + v_i8 x = {}; + x = test_v_i8(x, 42, 42); + printf("%d\n", x[I]); + x = (v_i8){}; + x = test_v_i8(x, 42, 13); + printf("%d\n", x[I]); + x = (v_i8){}; + x = test_v_i8(x, 42, 55); + printf("%d\n", x[I]); + } + + { + v_u8 x = {}; + x = test_v_u8(x, 42, 42); + printf("%d\n", (i8)x[I]); + x = (v_u8){}; + x = test_v_u8(x, 42, 13); + printf("%d\n", (i8)x[I]); + x = (v_u8){}; + x = test_v_u8(x, 42, 55); + printf("%d\n", (i8)x[I]); + } + + return 0; +} +--EXPECT-- +0 +0 +-1 +0 +0 +-1 +0 +0 +-1 +0 +0 +-1 +0 +0 +-1 +0 +0 +-1 +0 +0 +-1 +0 +0 +-1 +0 +0 +-1 +0 +0 +-1 diff --git a/tests/vector/lt-005.test b/tests/vector/lt-005.test new file mode 100644 index 0000000..8c92a2d --- /dev/null +++ b/tests/vector/lt-005.test @@ -0,0 +1,239 @@ +--TEST-- +LT.005: 64-bit vectors SSE2 +--TARGET-- +!aarch64 +--ARGS-- +-mno-sse4 -mno-avx2 --run +--CODE-- +#define N 8 +#define I 0 + +int printf(const char *, ...); + +typedef long long i64; +typedef unsigned long long u64; +typedef int i32; +typedef unsigned int u32; +typedef short i16; +typedef unsigned short u16; +typedef char i8; +typedef unsigned char u8; + +typedef double __attribute__((__vector_size__(N))) v_d; +typedef float __attribute__((__vector_size__(N))) v_f; +typedef i64 __attribute__((__vector_size__(N))) v_i64; +typedef u64 __attribute__((__vector_size__(N))) v_u64; +typedef i32 __attribute__((__vector_size__(N))) v_i32; +typedef u32 __attribute__((__vector_size__(N))) v_u32; +typedef i16 __attribute__((__vector_size__(N))) v_i16; +typedef u16 __attribute__((__vector_size__(N))) v_u16; +typedef i8 __attribute__((__vector_size__(N))) v_i8; +typedef u8 __attribute__((__vector_size__(N))) v_u8; + +v_d __attribute__((noinline)) test_v_d(v_d v, double x, double y) +{ + return (v + x < y); +} + +v_f __attribute__((noinline)) test_v_f(v_f v, float x, float y) +{ + return (v + x < y); +} + +v_i64 __attribute__((noinline)) test_v_i64(v_i64 v, i64 x, i64 y) +{ + return (v + x < y); +} + +v_u64 __attribute__((noinline)) test_v_u64(v_u64 v, u64 x, u64 y) +{ + return (v + x < y); +} + +v_i32 __attribute__((noinline)) test_v_i32(v_i32 v, i32 x, i32 y) +{ + return (v + x < y); +} + +v_u32 __attribute__((noinline)) test_v_u32(v_u32 v, u32 x, u32 y) +{ + return (v + x < y); +} + +v_i16 __attribute__((noinline)) test_v_i16(v_i16 v, i16 x, i16 y) +{ + return (v + x < y); +} + +v_u16 __attribute__((noinline)) test_v_u16(v_u16 v, u16 x, u16 y) +{ + return (v + x < y); +} + +v_i8 __attribute__((noinline)) test_v_i8(v_i8 v, i8 x, i8 y) +{ + return (v + x < y); +} + +v_u8 __attribute__((noinline)) test_v_u8(v_u8 v, u8 x, u8 y) +{ + return (v + x < y); +} + +int main() +{ + { + v_d x = {}; + v_i64 y; + y = (v_i64)test_v_d(x, 42.42, 42.42); + printf("%lld\n", y[I]); + x = (v_d){}; + y = (v_i64)test_v_d(x, 42.42, 13.13); + printf("%lld\n", y[I]); + x = (v_d){}; + y = (v_i64)test_v_d(x, 42.42, 55.55); + printf("%lld\n", y[I]); + } + + { + v_f x = {}; + v_i32 y; + y = (v_i32)test_v_f(x, 42.42, 42.42); + printf("%d\n", y[I]); + x = (v_f){}; + y = (v_i32)test_v_f(x, 42.42, 13.13); + printf("%d\n", y[I]); + x = (v_f){}; + y = (v_i32)test_v_f(x, 42.42, 55.55); + printf("%d\n", y[I]); + } + + { + v_i64 x = {}; + x = test_v_i64(x, 42, 42); + printf("%lld\n", x[I]); + x = (v_i64){}; + x = test_v_i64(x, 42, 13); + printf("%lld\n", x[I]); + x = (v_i64){}; + x = test_v_i64(x, 42, 55); + printf("%lld\n", x[I]); + } + + { + v_u64 x = {}; + x = test_v_u64(x, 42, 42); + printf("%lld\n", x[I]); + x = (v_u64){}; + x = test_v_u64(x, 42, 13); + printf("%lld\n", x[I]); + x = (v_u64){}; + x = test_v_u64(x, 42, 55); + printf("%lld\n", x[I]); + } + + { + v_i32 x = {}; + x = test_v_i32(x, 42, 42); + printf("%d\n", x[I]); + x = (v_i32){}; + x = test_v_i32(x, 42, 13); + printf("%d\n", x[I]); + x = (v_i32){}; + x = test_v_i32(x, 42, 55); + printf("%d\n", x[I]); + } + + { + v_u32 x = {}; + x = test_v_u32(x, 42, 42); + printf("%d\n", x[I]); + x = (v_u32){}; + x = test_v_u32(x, 42, 13); + printf("%d\n", x[I]); + x = (v_u32){}; + x = test_v_u32(x, 42, 55); + printf("%d\n", x[I]); + } + + { + v_i16 x = {}; + x = test_v_i16(x, 42, 42); + printf("%d\n", x[I]); + x = (v_i16){}; + x = test_v_i16(x, 42, 13); + printf("%d\n", x[I]); + x = (v_i16){}; + x = test_v_i16(x, 42, 55); + printf("%d\n", x[I]); + } + + { + v_u16 x = {}; + x = test_v_u16(x, 42, 42); + printf("%d\n", (i16)x[I]); + x = (v_u16){}; + x = test_v_u16(x, 42, 13); + printf("%d\n", (i16)x[I]); + x = (v_u16){}; + x = test_v_u16(x, 42, 55); + printf("%d\n", (i16)x[I]); + } + + { + v_i8 x = {}; + x = test_v_i8(x, 42, 42); + printf("%d\n", x[I]); + x = (v_i8){}; + x = test_v_i8(x, 42, 13); + printf("%d\n", x[I]); + x = (v_i8){}; + x = test_v_i8(x, 42, 55); + printf("%d\n", x[I]); + } + + { + v_u8 x = {}; + x = test_v_u8(x, 42, 42); + printf("%d\n", (i8)x[I]); + x = (v_u8){}; + x = test_v_u8(x, 42, 13); + printf("%d\n", (i8)x[I]); + x = (v_u8){}; + x = test_v_u8(x, 42, 55); + printf("%d\n", (i8)x[I]); + } + + return 0; +} +--EXPECT-- +0 +0 +-1 +0 +0 +-1 +0 +0 +-1 +0 +0 +-1 +0 +0 +-1 +0 +0 +-1 +0 +0 +-1 +0 +0 +-1 +0 +0 +-1 +0 +0 +-1 diff --git a/tests/vector/lt-006.test b/tests/vector/lt-006.test new file mode 100644 index 0000000..6ed265a --- /dev/null +++ b/tests/vector/lt-006.test @@ -0,0 +1,239 @@ +--TEST-- +LT.006: 64-bit vectors AVX +--TARGET-- +!aarch64 +--ARGS-- +-mavx -mno-avx2 --run +--CODE-- +#define N 8 +#define I 0 + +int printf(const char *, ...); + +typedef long long i64; +typedef unsigned long long u64; +typedef int i32; +typedef unsigned int u32; +typedef short i16; +typedef unsigned short u16; +typedef char i8; +typedef unsigned char u8; + +typedef double __attribute__((__vector_size__(N))) v_d; +typedef float __attribute__((__vector_size__(N))) v_f; +typedef i64 __attribute__((__vector_size__(N))) v_i64; +typedef u64 __attribute__((__vector_size__(N))) v_u64; +typedef i32 __attribute__((__vector_size__(N))) v_i32; +typedef u32 __attribute__((__vector_size__(N))) v_u32; +typedef i16 __attribute__((__vector_size__(N))) v_i16; +typedef u16 __attribute__((__vector_size__(N))) v_u16; +typedef i8 __attribute__((__vector_size__(N))) v_i8; +typedef u8 __attribute__((__vector_size__(N))) v_u8; + +v_d __attribute__((noinline)) test_v_d(v_d v, double x, double y) +{ + return (v + x < y); +} + +v_f __attribute__((noinline)) test_v_f(v_f v, float x, float y) +{ + return (v + x < y); +} + +v_i64 __attribute__((noinline)) test_v_i64(v_i64 v, i64 x, i64 y) +{ + return (v + x < y); +} + +v_u64 __attribute__((noinline)) test_v_u64(v_u64 v, u64 x, u64 y) +{ + return (v + x < y); +} + +v_i32 __attribute__((noinline)) test_v_i32(v_i32 v, i32 x, i32 y) +{ + return (v + x < y); +} + +v_u32 __attribute__((noinline)) test_v_u32(v_u32 v, u32 x, u32 y) +{ + return (v + x < y); +} + +v_i16 __attribute__((noinline)) test_v_i16(v_i16 v, i16 x, i16 y) +{ + return (v + x < y); +} + +v_u16 __attribute__((noinline)) test_v_u16(v_u16 v, u16 x, u16 y) +{ + return (v + x < y); +} + +v_i8 __attribute__((noinline)) test_v_i8(v_i8 v, i8 x, i8 y) +{ + return (v + x < y); +} + +v_u8 __attribute__((noinline)) test_v_u8(v_u8 v, u8 x, u8 y) +{ + return (v + x < y); +} + +int main() +{ + { + v_d x = {}; + v_i64 y; + y = (v_i64)test_v_d(x, 42.42, 42.42); + printf("%lld\n", y[I]); + x = (v_d){}; + y = (v_i64)test_v_d(x, 42.42, 13.13); + printf("%lld\n", y[I]); + x = (v_d){}; + y = (v_i64)test_v_d(x, 42.42, 55.55); + printf("%lld\n", y[I]); + } + + { + v_f x = {}; + v_i32 y; + y = (v_i32)test_v_f(x, 42.42, 42.42); + printf("%d\n", y[I]); + x = (v_f){}; + y = (v_i32)test_v_f(x, 42.42, 13.13); + printf("%d\n", y[I]); + x = (v_f){}; + y = (v_i32)test_v_f(x, 42.42, 55.55); + printf("%d\n", y[I]); + } + + { + v_i64 x = {}; + x = test_v_i64(x, 42, 42); + printf("%lld\n", x[I]); + x = (v_i64){}; + x = test_v_i64(x, 42, 13); + printf("%lld\n", x[I]); + x = (v_i64){}; + x = test_v_i64(x, 42, 55); + printf("%lld\n", x[I]); + } + + { + v_u64 x = {}; + x = test_v_u64(x, 42, 42); + printf("%lld\n", x[I]); + x = (v_u64){}; + x = test_v_u64(x, 42, 13); + printf("%lld\n", x[I]); + x = (v_u64){}; + x = test_v_u64(x, 42, 55); + printf("%lld\n", x[I]); + } + + { + v_i32 x = {}; + x = test_v_i32(x, 42, 42); + printf("%d\n", x[I]); + x = (v_i32){}; + x = test_v_i32(x, 42, 13); + printf("%d\n", x[I]); + x = (v_i32){}; + x = test_v_i32(x, 42, 55); + printf("%d\n", x[I]); + } + + { + v_u32 x = {}; + x = test_v_u32(x, 42, 42); + printf("%d\n", x[I]); + x = (v_u32){}; + x = test_v_u32(x, 42, 13); + printf("%d\n", x[I]); + x = (v_u32){}; + x = test_v_u32(x, 42, 55); + printf("%d\n", x[I]); + } + + { + v_i16 x = {}; + x = test_v_i16(x, 42, 42); + printf("%d\n", x[I]); + x = (v_i16){}; + x = test_v_i16(x, 42, 13); + printf("%d\n", x[I]); + x = (v_i16){}; + x = test_v_i16(x, 42, 55); + printf("%d\n", x[I]); + } + + { + v_u16 x = {}; + x = test_v_u16(x, 42, 42); + printf("%d\n", (i16)x[I]); + x = (v_u16){}; + x = test_v_u16(x, 42, 13); + printf("%d\n", (i16)x[I]); + x = (v_u16){}; + x = test_v_u16(x, 42, 55); + printf("%d\n", (i16)x[I]); + } + + { + v_i8 x = {}; + x = test_v_i8(x, 42, 42); + printf("%d\n", x[I]); + x = (v_i8){}; + x = test_v_i8(x, 42, 13); + printf("%d\n", x[I]); + x = (v_i8){}; + x = test_v_i8(x, 42, 55); + printf("%d\n", x[I]); + } + + { + v_u8 x = {}; + x = test_v_u8(x, 42, 42); + printf("%d\n", (i8)x[I]); + x = (v_u8){}; + x = test_v_u8(x, 42, 13); + printf("%d\n", (i8)x[I]); + x = (v_u8){}; + x = test_v_u8(x, 42, 55); + printf("%d\n", (i8)x[I]); + } + + return 0; +} +--EXPECT-- +0 +0 +-1 +0 +0 +-1 +0 +0 +-1 +0 +0 +-1 +0 +0 +-1 +0 +0 +-1 +0 +0 +-1 +0 +0 +-1 +0 +0 +-1 +0 +0 +-1 diff --git a/tests/vector/lt-007.test b/tests/vector/lt-007.test new file mode 100644 index 0000000..1c6391b --- /dev/null +++ b/tests/vector/lt-007.test @@ -0,0 +1,239 @@ +--TEST-- +LT.007: 256-bit vectors AVX +--TARGET-- +!aarch64 +--ARGS-- +-mavx -mno-avx2 --run +--CODE-- +#define N 32 +#define I 3 + +int printf(const char *, ...); + +typedef long long i64; +typedef unsigned long long u64; +typedef int i32; +typedef unsigned int u32; +typedef short i16; +typedef unsigned short u16; +typedef char i8; +typedef unsigned char u8; + +typedef double __attribute__((__vector_size__(N))) v_d; +typedef float __attribute__((__vector_size__(N))) v_f; +typedef i64 __attribute__((__vector_size__(N))) v_i64; +typedef u64 __attribute__((__vector_size__(N))) v_u64; +typedef i32 __attribute__((__vector_size__(N))) v_i32; +typedef u32 __attribute__((__vector_size__(N))) v_u32; +typedef i16 __attribute__((__vector_size__(N))) v_i16; +typedef u16 __attribute__((__vector_size__(N))) v_u16; +typedef i8 __attribute__((__vector_size__(N))) v_i8; +typedef u8 __attribute__((__vector_size__(N))) v_u8; + +v_d __attribute__((noinline)) test_v_d(v_d v, double x, double y) +{ + return (v + x < y); +} + +v_f __attribute__((noinline)) test_v_f(v_f v, float x, float y) +{ + return (v + x < y); +} + +v_i64 __attribute__((noinline)) test_v_i64(v_i64 v, i64 x, i64 y) +{ + return (v + x < y); +} + +v_u64 __attribute__((noinline)) test_v_u64(v_u64 v, u64 x, u64 y) +{ + return (v + x < y); +} + +v_i32 __attribute__((noinline)) test_v_i32(v_i32 v, i32 x, i32 y) +{ + return (v + x < y); +} + +v_u32 __attribute__((noinline)) test_v_u32(v_u32 v, u32 x, u32 y) +{ + return (v + x < y); +} + +v_i16 __attribute__((noinline)) test_v_i16(v_i16 v, i16 x, i16 y) +{ + return (v + x < y); +} + +v_u16 __attribute__((noinline)) test_v_u16(v_u16 v, u16 x, u16 y) +{ + return (v + x < y); +} + +v_i8 __attribute__((noinline)) test_v_i8(v_i8 v, i8 x, i8 y) +{ + return (v + x < y); +} + +v_u8 __attribute__((noinline)) test_v_u8(v_u8 v, u8 x, u8 y) +{ + return (v + x < y); +} + +int main() +{ + { + v_d x = {}; + v_i64 y; + y = (v_i64)test_v_d(x, 42.42, 42.42); + printf("%lld\n", y[I]); + x = (v_d){}; + y = (v_i64)test_v_d(x, 42.42, 13.13); + printf("%lld\n", y[I]); + x = (v_d){}; + y = (v_i64)test_v_d(x, 42.42, 55.55); + printf("%lld\n", y[I]); + } + + { + v_f x = {}; + v_i32 y; + y = (v_i32)test_v_f(x, 42.42, 42.42); + printf("%d\n", y[I]); + x = (v_f){}; + y = (v_i32)test_v_f(x, 42.42, 13.13); + printf("%d\n", y[I]); + x = (v_f){}; + y = (v_i32)test_v_f(x, 42.42, 55.55); + printf("%d\n", y[I]); + } + + { + v_i64 x = {}; + x = test_v_i64(x, 42, 42); + printf("%lld\n", x[I]); + x = (v_i64){}; + x = test_v_i64(x, 42, 13); + printf("%lld\n", x[I]); + x = (v_i64){}; + x = test_v_i64(x, 42, 55); + printf("%lld\n", x[I]); + } + + { + v_u64 x = {}; + x = test_v_u64(x, 42, 42); + printf("%lld\n", x[I]); + x = (v_u64){}; + x = test_v_u64(x, 42, 13); + printf("%lld\n", x[I]); + x = (v_u64){}; + x = test_v_u64(x, 42, 55); + printf("%lld\n", x[I]); + } + + { + v_i32 x = {}; + x = test_v_i32(x, 42, 42); + printf("%d\n", x[I]); + x = (v_i32){}; + x = test_v_i32(x, 42, 13); + printf("%d\n", x[I]); + x = (v_i32){}; + x = test_v_i32(x, 42, 55); + printf("%d\n", x[I]); + } + + { + v_u32 x = {}; + x = test_v_u32(x, 42, 42); + printf("%d\n", x[I]); + x = (v_u32){}; + x = test_v_u32(x, 42, 13); + printf("%d\n", x[I]); + x = (v_u32){}; + x = test_v_u32(x, 42, 55); + printf("%d\n", x[I]); + } + + { + v_i16 x = {}; + x = test_v_i16(x, 42, 42); + printf("%d\n", x[I]); + x = (v_i16){}; + x = test_v_i16(x, 42, 13); + printf("%d\n", x[I]); + x = (v_i16){}; + x = test_v_i16(x, 42, 55); + printf("%d\n", x[I]); + } + + { + v_u16 x = {}; + x = test_v_u16(x, 42, 42); + printf("%d\n", (i16)x[I]); + x = (v_u16){}; + x = test_v_u16(x, 42, 13); + printf("%d\n", (i16)x[I]); + x = (v_u16){}; + x = test_v_u16(x, 42, 55); + printf("%d\n", (i16)x[I]); + } + + { + v_i8 x = {}; + x = test_v_i8(x, 42, 42); + printf("%d\n", x[I]); + x = (v_i8){}; + x = test_v_i8(x, 42, 13); + printf("%d\n", x[I]); + x = (v_i8){}; + x = test_v_i8(x, 42, 55); + printf("%d\n", x[I]); + } + + { + v_u8 x = {}; + x = test_v_u8(x, 42, 42); + printf("%d\n", (i8)x[I]); + x = (v_u8){}; + x = test_v_u8(x, 42, 13); + printf("%d\n", (i8)x[I]); + x = (v_u8){}; + x = test_v_u8(x, 42, 55); + printf("%d\n", (i8)x[I]); + } + + return 0; +} +--EXPECT-- +0 +0 +-1 +0 +0 +-1 +0 +0 +-1 +0 +0 +-1 +0 +0 +-1 +0 +0 +-1 +0 +0 +-1 +0 +0 +-1 +0 +0 +-1 +0 +0 +-1 diff --git a/tests/vector/lt-008.test b/tests/vector/lt-008.test new file mode 100644 index 0000000..1e109f0 --- /dev/null +++ b/tests/vector/lt-008.test @@ -0,0 +1,239 @@ +--TEST-- +LT.008: 256-bit vectors AVX+AVX2 +--TARGET-- +!aarch64 +--ARGS-- +-mavx --run +--CODE-- +#define N 32 +#define I 3 + +int printf(const char *, ...); + +typedef long long i64; +typedef unsigned long long u64; +typedef int i32; +typedef unsigned int u32; +typedef short i16; +typedef unsigned short u16; +typedef char i8; +typedef unsigned char u8; + +typedef double __attribute__((__vector_size__(N))) v_d; +typedef float __attribute__((__vector_size__(N))) v_f; +typedef i64 __attribute__((__vector_size__(N))) v_i64; +typedef u64 __attribute__((__vector_size__(N))) v_u64; +typedef i32 __attribute__((__vector_size__(N))) v_i32; +typedef u32 __attribute__((__vector_size__(N))) v_u32; +typedef i16 __attribute__((__vector_size__(N))) v_i16; +typedef u16 __attribute__((__vector_size__(N))) v_u16; +typedef i8 __attribute__((__vector_size__(N))) v_i8; +typedef u8 __attribute__((__vector_size__(N))) v_u8; + +v_d __attribute__((noinline)) test_v_d(v_d v, double x, double y) +{ + return (v + x < y); +} + +v_f __attribute__((noinline)) test_v_f(v_f v, float x, float y) +{ + return (v + x < y); +} + +v_i64 __attribute__((noinline)) test_v_i64(v_i64 v, i64 x, i64 y) +{ + return (v + x < y); +} + +v_u64 __attribute__((noinline)) test_v_u64(v_u64 v, u64 x, u64 y) +{ + return (v + x < y); +} + +v_i32 __attribute__((noinline)) test_v_i32(v_i32 v, i32 x, i32 y) +{ + return (v + x < y); +} + +v_u32 __attribute__((noinline)) test_v_u32(v_u32 v, u32 x, u32 y) +{ + return (v + x < y); +} + +v_i16 __attribute__((noinline)) test_v_i16(v_i16 v, i16 x, i16 y) +{ + return (v + x < y); +} + +v_u16 __attribute__((noinline)) test_v_u16(v_u16 v, u16 x, u16 y) +{ + return (v + x < y); +} + +v_i8 __attribute__((noinline)) test_v_i8(v_i8 v, i8 x, i8 y) +{ + return (v + x < y); +} + +v_u8 __attribute__((noinline)) test_v_u8(v_u8 v, u8 x, u8 y) +{ + return (v + x < y); +} + +int main() +{ + { + v_d x = {}; + v_i64 y; + y = (v_i64)test_v_d(x, 42.42, 42.42); + printf("%lld\n", y[I]); + x = (v_d){}; + y = (v_i64)test_v_d(x, 42.42, 13.13); + printf("%lld\n", y[I]); + x = (v_d){}; + y = (v_i64)test_v_d(x, 42.42, 55.55); + printf("%lld\n", y[I]); + } + + { + v_f x = {}; + v_i32 y; + y = (v_i32)test_v_f(x, 42.42, 42.42); + printf("%d\n", y[I]); + x = (v_f){}; + y = (v_i32)test_v_f(x, 42.42, 13.13); + printf("%d\n", y[I]); + x = (v_f){}; + y = (v_i32)test_v_f(x, 42.42, 55.55); + printf("%d\n", y[I]); + } + + { + v_i64 x = {}; + x = test_v_i64(x, 42, 42); + printf("%lld\n", x[I]); + x = (v_i64){}; + x = test_v_i64(x, 42, 13); + printf("%lld\n", x[I]); + x = (v_i64){}; + x = test_v_i64(x, 42, 55); + printf("%lld\n", x[I]); + } + + { + v_u64 x = {}; + x = test_v_u64(x, 42, 42); + printf("%lld\n", x[I]); + x = (v_u64){}; + x = test_v_u64(x, 42, 13); + printf("%lld\n", x[I]); + x = (v_u64){}; + x = test_v_u64(x, 42, 55); + printf("%lld\n", x[I]); + } + + { + v_i32 x = {}; + x = test_v_i32(x, 42, 42); + printf("%d\n", x[I]); + x = (v_i32){}; + x = test_v_i32(x, 42, 13); + printf("%d\n", x[I]); + x = (v_i32){}; + x = test_v_i32(x, 42, 55); + printf("%d\n", x[I]); + } + + { + v_u32 x = {}; + x = test_v_u32(x, 42, 42); + printf("%d\n", x[I]); + x = (v_u32){}; + x = test_v_u32(x, 42, 13); + printf("%d\n", x[I]); + x = (v_u32){}; + x = test_v_u32(x, 42, 55); + printf("%d\n", x[I]); + } + + { + v_i16 x = {}; + x = test_v_i16(x, 42, 42); + printf("%d\n", x[I]); + x = (v_i16){}; + x = test_v_i16(x, 42, 13); + printf("%d\n", x[I]); + x = (v_i16){}; + x = test_v_i16(x, 42, 55); + printf("%d\n", x[I]); + } + + { + v_u16 x = {}; + x = test_v_u16(x, 42, 42); + printf("%d\n", (i16)x[I]); + x = (v_u16){}; + x = test_v_u16(x, 42, 13); + printf("%d\n", (i16)x[I]); + x = (v_u16){}; + x = test_v_u16(x, 42, 55); + printf("%d\n", (i16)x[I]); + } + + { + v_i8 x = {}; + x = test_v_i8(x, 42, 42); + printf("%d\n", x[I]); + x = (v_i8){}; + x = test_v_i8(x, 42, 13); + printf("%d\n", x[I]); + x = (v_i8){}; + x = test_v_i8(x, 42, 55); + printf("%d\n", x[I]); + } + + { + v_u8 x = {}; + x = test_v_u8(x, 42, 42); + printf("%d\n", (i8)x[I]); + x = (v_u8){}; + x = test_v_u8(x, 42, 13); + printf("%d\n", (i8)x[I]); + x = (v_u8){}; + x = test_v_u8(x, 42, 55); + printf("%d\n", (i8)x[I]); + } + + return 0; +} +--EXPECT-- +0 +0 +-1 +0 +0 +-1 +0 +0 +-1 +0 +0 +-1 +0 +0 +-1 +0 +0 +-1 +0 +0 +-1 +0 +0 +-1 +0 +0 +-1 +0 +0 +-1 diff --git a/tests/vector/mod-001.test b/tests/vector/mod-001.test new file mode 100644 index 0000000..aed5016 --- /dev/null +++ b/tests/vector/mod-001.test @@ -0,0 +1,141 @@ +--TEST-- +MOD.001: 128-bit vectors SSE2 +--TARGET-- +!aarch64 +--ARGS-- +-mno-sse4 -mno-avx2 --run +--CODE-- +#define N 16 +#define I 1 + +int printf(const char *, ...); + +typedef long long i64; +typedef unsigned long long u64; +typedef int i32; +typedef unsigned int u32; +typedef short i16; +typedef unsigned short u16; +typedef char i8; +typedef unsigned char u8; + +typedef double __attribute__((__vector_size__(N))) v_d; +typedef float __attribute__((__vector_size__(N))) v_f; +typedef i64 __attribute__((__vector_size__(N))) v_i64; +typedef u64 __attribute__((__vector_size__(N))) v_u64; +typedef i32 __attribute__((__vector_size__(N))) v_i32; +typedef u32 __attribute__((__vector_size__(N))) v_u32; +typedef i16 __attribute__((__vector_size__(N))) v_i16; +typedef u16 __attribute__((__vector_size__(N))) v_u16; +typedef i8 __attribute__((__vector_size__(N))) v_i8; +typedef u8 __attribute__((__vector_size__(N))) v_u8; + +v_i64 __attribute__((noinline)) test_v_i64(v_i64 v, i64 x) +{ + v = v % x; + return v; +} + +v_u64 __attribute__((noinline)) test_v_u64(v_u64 v, u64 x) +{ + v = v % x; + return v; +} + +v_i32 __attribute__((noinline)) test_v_i32(v_i32 v, i32 x) +{ + v = v % x; + return v; +} + +v_u32 __attribute__((noinline)) test_v_u32(v_u32 v, u32 x) +{ + v = v % x; + return v; +} + +v_i16 __attribute__((noinline)) test_v_i16(v_i16 v, i16 x) +{ + v = v % x; + return v; +} + +v_u16 __attribute__((noinline)) test_v_u16(v_u16 v, u16 x) +{ + v = v % x; + return v; +} + +v_i8 __attribute__((noinline)) test_v_i8(v_i8 v, i8 x) +{ + v = v % x; + return v; +} + +v_u8 __attribute__((noinline)) test_v_u8(v_u8 v, u8 x) +{ + v = v % x; + return v; +} + +int main() +{ + { + v_i64 x = {42, 42}; + x = test_v_i64(x, 13); + printf("%lld\n", x[I]); + } + + { + v_u64 x = {42, 42}; + x = test_v_u64(x, 13); + printf("%lld\n", x[I]); + } + + { + v_i32 x = {42, 42, 42, 42}; + x = test_v_i32(x, 13); + printf("%d\n", x[I]); + } + + { + v_u32 x = {42, 42, 42, 42}; + x = test_v_u32(x, 13); + printf("%d\n", x[I]); + } + + { + v_i16 x = {42, 42, 42, 42, 42, 42, 42, 42}; + x = test_v_i16(x, 13); + printf("%d\n", x[I]); + } + + { + v_u16 x = {42, 42, 42, 42, 42, 42, 42, 42}; + x = test_v_u16(x, 13); + printf("%d\n", x[I]); + } + + { + v_i8 x = {42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42}; + x = test_v_i8(x, 13); + printf("%d\n", x[I]); + } + + { + v_u8 x = {42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42}; + x = test_v_u8(x, 13); + printf("%d\n", x[I]); + } + + return 0; +} +--EXPECT-- +3 +3 +3 +3 +3 +3 +3 +3 diff --git a/tests/vector/mul-001.test b/tests/vector/mul-001.test new file mode 100644 index 0000000..bf13ee2 --- /dev/null +++ b/tests/vector/mul-001.test @@ -0,0 +1,167 @@ +--TEST-- +MUL.001: 128-bit vectors SSE2 +--TARGET-- +!aarch64 +--ARGS-- +-mno-sse4 -mno-avx2 --run +--CODE-- +#define N 16 +#define I 1 + +int printf(const char *, ...); + +typedef long long i64; +typedef unsigned long long u64; +typedef int i32; +typedef unsigned int u32; +typedef short i16; +typedef unsigned short u16; +typedef char i8; +typedef unsigned char u8; + +typedef double __attribute__((__vector_size__(N))) v_d; +typedef float __attribute__((__vector_size__(N))) v_f; +typedef i64 __attribute__((__vector_size__(N))) v_i64; +typedef u64 __attribute__((__vector_size__(N))) v_u64; +typedef i32 __attribute__((__vector_size__(N))) v_i32; +typedef u32 __attribute__((__vector_size__(N))) v_u32; +typedef i16 __attribute__((__vector_size__(N))) v_i16; +typedef u16 __attribute__((__vector_size__(N))) v_u16; +typedef i8 __attribute__((__vector_size__(N))) v_i8; +typedef u8 __attribute__((__vector_size__(N))) v_u8; + +v_d __attribute__((noinline)) test_v_d(v_d v, double x) +{ + v = v * x; + return v; +} + +v_f __attribute__((noinline)) test_v_f(v_f v, float x) +{ + v = v * x; + return v; +} + +v_i64 __attribute__((noinline)) test_v_i64(v_i64 v, i64 x) +{ + v = v * x; + return v; +} + +v_u64 __attribute__((noinline)) test_v_u64(v_u64 v, u64 x) +{ + v = v * x; + return v; +} + +v_i32 __attribute__((noinline)) test_v_i32(v_i32 v, i32 x) +{ + v = v * x; + return v; +} + +v_u32 __attribute__((noinline)) test_v_u32(v_u32 v, u32 x) +{ + v = v * x; + return v; +} + +v_i16 __attribute__((noinline)) test_v_i16(v_i16 v, i16 x) +{ + v = v * x; + return v; +} + +v_u16 __attribute__((noinline)) test_v_u16(v_u16 v, u16 x) +{ + v = v * x; + return v; +} + +v_i8 __attribute__((noinline)) test_v_i8(v_i8 v, i8 x) +{ + v = v * x; + return v; +} + +v_u8 __attribute__((noinline)) test_v_u8(v_u8 v, u8 x) +{ + v = v * x; + return v; +} + +int main() +{ + { + v_d x = {42.42, 42.42}; + x = test_v_d(x, 3); + printf("%g\n", x[I]); + } + + { + v_f x = {42.42, 42.42, 42.42, 42.42}; + x = test_v_f(x, 3); + printf("%g\n", x[I]); + } + + { + v_i64 x = {42, 42}; + x = test_v_i64(x, 3); + printf("%lld\n", x[I]); + } + + { + v_u64 x = {42, 42}; + x = test_v_u64(x, 3); + printf("%lld\n", x[I]); + } + + { + v_i32 x = {42, 42, 42, 42}; + x = test_v_i32(x, 3); + printf("%d\n", x[I]); + } + + { + v_u32 x = {42, 42, 42, 42}; + x = test_v_u32(x, 3); + printf("%d\n", x[I]); + } + + { + v_i16 x = {42, 42, 42, 42, 42, 42, 42, 42}; + x = test_v_i16(x, 3); + printf("%d\n", x[I]); + } + + { + v_u16 x = {42, 42, 42, 42, 42, 42, 42, 42}; + x = test_v_u16(x, 3); + printf("%d\n", x[I]); + } + + { + v_i8 x = {42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42}; + x = test_v_i8(x, 3); + printf("%d\n", x[I]); + } + + { + v_u8 x = {42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42}; + x = test_v_u8(x, 3); + printf("%d\n", x[I]); + } + + return 0; +} +--EXPECT-- +127.26 +127.26 +126 +126 +126 +126 +126 +126 +126 +126 diff --git a/tests/vector/ne-001.test b/tests/vector/ne-001.test new file mode 100644 index 0000000..e7ac9d6 --- /dev/null +++ b/tests/vector/ne-001.test @@ -0,0 +1,199 @@ +--TEST-- +NE.001: 128-bit vectors SSE2 +--TARGET-- +!aarch64 +--ARGS-- +-mno-sse4 -mno-avx2 --run +--CODE-- +#define N 16 +#define I 1 + +int printf(const char *, ...); + +typedef long long i64; +typedef unsigned long long u64; +typedef int i32; +typedef unsigned int u32; +typedef short i16; +typedef unsigned short u16; +typedef char i8; +typedef unsigned char u8; + +typedef double __attribute__((__vector_size__(N))) v_d; +typedef float __attribute__((__vector_size__(N))) v_f; +typedef i64 __attribute__((__vector_size__(N))) v_i64; +typedef u64 __attribute__((__vector_size__(N))) v_u64; +typedef i32 __attribute__((__vector_size__(N))) v_i32; +typedef u32 __attribute__((__vector_size__(N))) v_u32; +typedef i16 __attribute__((__vector_size__(N))) v_i16; +typedef u16 __attribute__((__vector_size__(N))) v_u16; +typedef i8 __attribute__((__vector_size__(N))) v_i8; +typedef u8 __attribute__((__vector_size__(N))) v_u8; + +v_d __attribute__((noinline)) test_v_d(v_d v, double x, double y) +{ + return (v + x != y); +} + +v_f __attribute__((noinline)) test_v_f(v_f v, float x, float y) +{ + return (v + x != y); +} + +v_i64 __attribute__((noinline)) test_v_i64(v_i64 v, i64 x, i64 y) +{ + return (v + x != y); +} + +v_u64 __attribute__((noinline)) test_v_u64(v_u64 v, u64 x, u64 y) +{ + return (v + x != y); +} + +v_i32 __attribute__((noinline)) test_v_i32(v_i32 v, i32 x, i32 y) +{ + return (v + x != y); +} + +v_u32 __attribute__((noinline)) test_v_u32(v_u32 v, u32 x, u32 y) +{ + return (v + x != y); +} + +v_i16 __attribute__((noinline)) test_v_i16(v_i16 v, i16 x, i16 y) +{ + return (v + x != y); +} + +v_u16 __attribute__((noinline)) test_v_u16(v_u16 v, u16 x, u16 y) +{ + return (v + x != y); +} + +v_i8 __attribute__((noinline)) test_v_i8(v_i8 v, i8 x, i8 y) +{ + return (v + x != y); +} + +v_u8 __attribute__((noinline)) test_v_u8(v_u8 v, u8 x, u8 y) +{ + return (v + x != y); +} + +int main() +{ + { + v_d x = {}; + v_i64 y; + y = (v_i64)test_v_d(x, 42.42, 42.42); + printf("%lld\n", y[I]); + x = (v_d){}; + y = (v_i64)test_v_d(x, 42.42, 13.13); + printf("%lld\n", y[I]); + } + + { + v_f x = {}; + v_i32 y; + y = (v_i32)test_v_f(x, 42.42, 42.42); + printf("%d\n", y[I]); + x = (v_f){}; + y = (v_i32)test_v_f(x, 42.42, 13.13); + printf("%d\n", y[I]); + } + + { + v_i64 x = {}; + x = test_v_i64(x, 42, 42); + printf("%lld\n", x[I]); + x = (v_i64){}; + x = test_v_i64(x, 42, 13); + printf("%lld\n", x[I]); + } + + { + v_u64 x = {}; + x = test_v_u64(x, 42, 42); + printf("%lld\n", x[I]); + x = (v_u64){}; + x = test_v_u64(x, 42, 13); + printf("%lld\n", x[I]); + } + + { + v_i32 x = {}; + x = test_v_i32(x, 42, 42); + printf("%d\n", x[I]); + x = (v_i32){}; + x = test_v_i32(x, 42, 13); + printf("%d\n", x[I]); + } + + { + v_u32 x = {}; + x = test_v_u32(x, 42, 42); + printf("%d\n", x[I]); + x = (v_u32){}; + x = test_v_u32(x, 42, 13); + printf("%d\n", x[I]); + } + + { + v_i16 x = {}; + x = test_v_i16(x, 42, 42); + printf("%d\n", x[I]); + x = (v_i16){}; + x = test_v_i16(x, 42, 13); + printf("%d\n", x[I]); + } + + { + v_u16 x = {}; + x = test_v_u16(x, 42, 42); + printf("%d\n", (i16)x[I]); + x = (v_u16){}; + x = test_v_u16(x, 42, 13); + printf("%d\n", (i16)x[I]); + } + + { + v_i8 x = {}; + x = test_v_i8(x, 42, 42); + printf("%d\n", x[I]); + x = (v_i8){}; + x = test_v_i8(x, 42, 13); + printf("%d\n", x[I]); + } + + { + v_u8 x = {}; + x = test_v_u8(x, 42, 42); + printf("%d\n", (i8)x[I]); + x = (v_u8){}; + x = test_v_u8(x, 42, 13); + printf("%d\n", (i8)x[I]); + } + + return 0; +} +--EXPECT-- +0 +-1 +0 +-1 +0 +-1 +0 +-1 +0 +-1 +0 +-1 +0 +-1 +0 +-1 +0 +-1 +0 +-1 diff --git a/tests/vector/ne-002.test b/tests/vector/ne-002.test new file mode 100644 index 0000000..4e12b10 --- /dev/null +++ b/tests/vector/ne-002.test @@ -0,0 +1,199 @@ +--TEST-- +NE.002: 128-bit vectors SSE2+SSE4 +--TARGET-- +!aarch64 +--ARGS-- +-mno-avx2 --run +--CODE-- +#define N 16 +#define I 1 + +int printf(const char *, ...); + +typedef long long i64; +typedef unsigned long long u64; +typedef int i32; +typedef unsigned int u32; +typedef short i16; +typedef unsigned short u16; +typedef char i8; +typedef unsigned char u8; + +typedef double __attribute__((__vector_size__(N))) v_d; +typedef float __attribute__((__vector_size__(N))) v_f; +typedef i64 __attribute__((__vector_size__(N))) v_i64; +typedef u64 __attribute__((__vector_size__(N))) v_u64; +typedef i32 __attribute__((__vector_size__(N))) v_i32; +typedef u32 __attribute__((__vector_size__(N))) v_u32; +typedef i16 __attribute__((__vector_size__(N))) v_i16; +typedef u16 __attribute__((__vector_size__(N))) v_u16; +typedef i8 __attribute__((__vector_size__(N))) v_i8; +typedef u8 __attribute__((__vector_size__(N))) v_u8; + +v_d __attribute__((noinline)) test_v_d(v_d v, double x, double y) +{ + return (v + x != y); +} + +v_f __attribute__((noinline)) test_v_f(v_f v, float x, float y) +{ + return (v + x != y); +} + +v_i64 __attribute__((noinline)) test_v_i64(v_i64 v, i64 x, i64 y) +{ + return (v + x != y); +} + +v_u64 __attribute__((noinline)) test_v_u64(v_u64 v, u64 x, u64 y) +{ + return (v + x != y); +} + +v_i32 __attribute__((noinline)) test_v_i32(v_i32 v, i32 x, i32 y) +{ + return (v + x != y); +} + +v_u32 __attribute__((noinline)) test_v_u32(v_u32 v, u32 x, u32 y) +{ + return (v + x != y); +} + +v_i16 __attribute__((noinline)) test_v_i16(v_i16 v, i16 x, i16 y) +{ + return (v + x != y); +} + +v_u16 __attribute__((noinline)) test_v_u16(v_u16 v, u16 x, u16 y) +{ + return (v + x != y); +} + +v_i8 __attribute__((noinline)) test_v_i8(v_i8 v, i8 x, i8 y) +{ + return (v + x != y); +} + +v_u8 __attribute__((noinline)) test_v_u8(v_u8 v, u8 x, u8 y) +{ + return (v + x != y); +} + +int main() +{ + { + v_d x = {}; + v_i64 y; + y = (v_i64)test_v_d(x, 42.42, 42.42); + printf("%lld\n", y[I]); + x = (v_d){}; + y = (v_i64)test_v_d(x, 42.42, 13.13); + printf("%lld\n", y[I]); + } + + { + v_f x = {}; + v_i32 y; + y = (v_i32)test_v_f(x, 42.42, 42.42); + printf("%d\n", y[I]); + x = (v_f){}; + y = (v_i32)test_v_f(x, 42.42, 13.13); + printf("%d\n", y[I]); + } + + { + v_i64 x = {}; + x = test_v_i64(x, 42, 42); + printf("%lld\n", x[I]); + x = (v_i64){}; + x = test_v_i64(x, 42, 13); + printf("%lld\n", x[I]); + } + + { + v_u64 x = {}; + x = test_v_u64(x, 42, 42); + printf("%lld\n", x[I]); + x = (v_u64){}; + x = test_v_u64(x, 42, 13); + printf("%lld\n", x[I]); + } + + { + v_i32 x = {}; + x = test_v_i32(x, 42, 42); + printf("%d\n", x[I]); + x = (v_i32){}; + x = test_v_i32(x, 42, 13); + printf("%d\n", x[I]); + } + + { + v_u32 x = {}; + x = test_v_u32(x, 42, 42); + printf("%d\n", x[I]); + x = (v_u32){}; + x = test_v_u32(x, 42, 13); + printf("%d\n", x[I]); + } + + { + v_i16 x = {}; + x = test_v_i16(x, 42, 42); + printf("%d\n", x[I]); + x = (v_i16){}; + x = test_v_i16(x, 42, 13); + printf("%d\n", x[I]); + } + + { + v_u16 x = {}; + x = test_v_u16(x, 42, 42); + printf("%d\n", (i16)x[I]); + x = (v_u16){}; + x = test_v_u16(x, 42, 13); + printf("%d\n", (i16)x[I]); + } + + { + v_i8 x = {}; + x = test_v_i8(x, 42, 42); + printf("%d\n", x[I]); + x = (v_i8){}; + x = test_v_i8(x, 42, 13); + printf("%d\n", x[I]); + } + + { + v_u8 x = {}; + x = test_v_u8(x, 42, 42); + printf("%d\n", (i8)x[I]); + x = (v_u8){}; + x = test_v_u8(x, 42, 13); + printf("%d\n", (i8)x[I]); + } + + return 0; +} +--EXPECT-- +0 +-1 +0 +-1 +0 +-1 +0 +-1 +0 +-1 +0 +-1 +0 +-1 +0 +-1 +0 +-1 +0 +-1 diff --git a/tests/vector/ne-003.test b/tests/vector/ne-003.test new file mode 100644 index 0000000..c96d3af --- /dev/null +++ b/tests/vector/ne-003.test @@ -0,0 +1,199 @@ +--TEST-- +NE.003: 128-bit vectors AVX +--TARGET-- +!aarch64 +--ARGS-- +-mavx -mno-avx2 --run +--CODE-- +#define N 16 +#define I 1 + +int printf(const char *, ...); + +typedef long long i64; +typedef unsigned long long u64; +typedef int i32; +typedef unsigned int u32; +typedef short i16; +typedef unsigned short u16; +typedef char i8; +typedef unsigned char u8; + +typedef double __attribute__((__vector_size__(N))) v_d; +typedef float __attribute__((__vector_size__(N))) v_f; +typedef i64 __attribute__((__vector_size__(N))) v_i64; +typedef u64 __attribute__((__vector_size__(N))) v_u64; +typedef i32 __attribute__((__vector_size__(N))) v_i32; +typedef u32 __attribute__((__vector_size__(N))) v_u32; +typedef i16 __attribute__((__vector_size__(N))) v_i16; +typedef u16 __attribute__((__vector_size__(N))) v_u16; +typedef i8 __attribute__((__vector_size__(N))) v_i8; +typedef u8 __attribute__((__vector_size__(N))) v_u8; + +v_d __attribute__((noinline)) test_v_d(v_d v, double x, double y) +{ + return (v + x != y); +} + +v_f __attribute__((noinline)) test_v_f(v_f v, float x, float y) +{ + return (v + x != y); +} + +v_i64 __attribute__((noinline)) test_v_i64(v_i64 v, i64 x, i64 y) +{ + return (v + x != y); +} + +v_u64 __attribute__((noinline)) test_v_u64(v_u64 v, u64 x, u64 y) +{ + return (v + x != y); +} + +v_i32 __attribute__((noinline)) test_v_i32(v_i32 v, i32 x, i32 y) +{ + return (v + x != y); +} + +v_u32 __attribute__((noinline)) test_v_u32(v_u32 v, u32 x, u32 y) +{ + return (v + x != y); +} + +v_i16 __attribute__((noinline)) test_v_i16(v_i16 v, i16 x, i16 y) +{ + return (v + x != y); +} + +v_u16 __attribute__((noinline)) test_v_u16(v_u16 v, u16 x, u16 y) +{ + return (v + x != y); +} + +v_i8 __attribute__((noinline)) test_v_i8(v_i8 v, i8 x, i8 y) +{ + return (v + x != y); +} + +v_u8 __attribute__((noinline)) test_v_u8(v_u8 v, u8 x, u8 y) +{ + return (v + x != y); +} + +int main() +{ + { + v_d x = {}; + v_i64 y; + y = (v_i64)test_v_d(x, 42.42, 42.42); + printf("%lld\n", y[I]); + x = (v_d){}; + y = (v_i64)test_v_d(x, 42.42, 13.13); + printf("%lld\n", y[I]); + } + + { + v_f x = {}; + v_i32 y; + y = (v_i32)test_v_f(x, 42.42, 42.42); + printf("%d\n", y[I]); + x = (v_f){}; + y = (v_i32)test_v_f(x, 42.42, 13.13); + printf("%d\n", y[I]); + } + + { + v_i64 x = {}; + x = test_v_i64(x, 42, 42); + printf("%lld\n", x[I]); + x = (v_i64){}; + x = test_v_i64(x, 42, 13); + printf("%lld\n", x[I]); + } + + { + v_u64 x = {}; + x = test_v_u64(x, 42, 42); + printf("%lld\n", x[I]); + x = (v_u64){}; + x = test_v_u64(x, 42, 13); + printf("%lld\n", x[I]); + } + + { + v_i32 x = {}; + x = test_v_i32(x, 42, 42); + printf("%d\n", x[I]); + x = (v_i32){}; + x = test_v_i32(x, 42, 13); + printf("%d\n", x[I]); + } + + { + v_u32 x = {}; + x = test_v_u32(x, 42, 42); + printf("%d\n", x[I]); + x = (v_u32){}; + x = test_v_u32(x, 42, 13); + printf("%d\n", x[I]); + } + + { + v_i16 x = {}; + x = test_v_i16(x, 42, 42); + printf("%d\n", x[I]); + x = (v_i16){}; + x = test_v_i16(x, 42, 13); + printf("%d\n", x[I]); + } + + { + v_u16 x = {}; + x = test_v_u16(x, 42, 42); + printf("%d\n", (i16)x[I]); + x = (v_u16){}; + x = test_v_u16(x, 42, 13); + printf("%d\n", (i16)x[I]); + } + + { + v_i8 x = {}; + x = test_v_i8(x, 42, 42); + printf("%d\n", x[I]); + x = (v_i8){}; + x = test_v_i8(x, 42, 13); + printf("%d\n", x[I]); + } + + { + v_u8 x = {}; + x = test_v_u8(x, 42, 42); + printf("%d\n", (i8)x[I]); + x = (v_u8){}; + x = test_v_u8(x, 42, 13); + printf("%d\n", (i8)x[I]); + } + + return 0; +} +--EXPECT-- +0 +-1 +0 +-1 +0 +-1 +0 +-1 +0 +-1 +0 +-1 +0 +-1 +0 +-1 +0 +-1 +0 +-1 diff --git a/tests/vector/ne-004.test b/tests/vector/ne-004.test new file mode 100644 index 0000000..806daf8 --- /dev/null +++ b/tests/vector/ne-004.test @@ -0,0 +1,199 @@ +--TEST-- +NE.004: 64-bit vectors SSE2 +--TARGET-- +!aarch64 +--ARGS-- +-mno-sse4 -mno-avx2 --run +--CODE-- +#define N 8 +#define I 0 + +int printf(const char *, ...); + +typedef long long i64; +typedef unsigned long long u64; +typedef int i32; +typedef unsigned int u32; +typedef short i16; +typedef unsigned short u16; +typedef char i8; +typedef unsigned char u8; + +typedef double __attribute__((__vector_size__(N))) v_d; +typedef float __attribute__((__vector_size__(N))) v_f; +typedef i64 __attribute__((__vector_size__(N))) v_i64; +typedef u64 __attribute__((__vector_size__(N))) v_u64; +typedef i32 __attribute__((__vector_size__(N))) v_i32; +typedef u32 __attribute__((__vector_size__(N))) v_u32; +typedef i16 __attribute__((__vector_size__(N))) v_i16; +typedef u16 __attribute__((__vector_size__(N))) v_u16; +typedef i8 __attribute__((__vector_size__(N))) v_i8; +typedef u8 __attribute__((__vector_size__(N))) v_u8; + +v_d __attribute__((noinline)) test_v_d(v_d v, double x, double y) +{ + return (v + x != y); +} + +v_f __attribute__((noinline)) test_v_f(v_f v, float x, float y) +{ + return (v + x != y); +} + +v_i64 __attribute__((noinline)) test_v_i64(v_i64 v, i64 x, i64 y) +{ + return (v + x != y); +} + +v_u64 __attribute__((noinline)) test_v_u64(v_u64 v, u64 x, u64 y) +{ + return (v + x != y); +} + +v_i32 __attribute__((noinline)) test_v_i32(v_i32 v, i32 x, i32 y) +{ + return (v + x != y); +} + +v_u32 __attribute__((noinline)) test_v_u32(v_u32 v, u32 x, u32 y) +{ + return (v + x != y); +} + +v_i16 __attribute__((noinline)) test_v_i16(v_i16 v, i16 x, i16 y) +{ + return (v + x != y); +} + +v_u16 __attribute__((noinline)) test_v_u16(v_u16 v, u16 x, u16 y) +{ + return (v + x != y); +} + +v_i8 __attribute__((noinline)) test_v_i8(v_i8 v, i8 x, i8 y) +{ + return (v + x != y); +} + +v_u8 __attribute__((noinline)) test_v_u8(v_u8 v, u8 x, u8 y) +{ + return (v + x != y); +} + +int main() +{ + { + v_d x = {}; + v_i64 y; + y = (v_i64)test_v_d(x, 42.42, 42.42); + printf("%lld\n", y[I]); + x = (v_d){}; + y = (v_i64)test_v_d(x, 42.42, 13.13); + printf("%lld\n", y[I]); + } + + { + v_f x = {}; + v_i32 y; + y = (v_i32)test_v_f(x, 42.42, 42.42); + printf("%d\n", y[I]); + x = (v_f){}; + y = (v_i32)test_v_f(x, 42.42, 13.13); + printf("%d\n", y[I]); + } + + { + v_i64 x = {}; + x = test_v_i64(x, 42, 42); + printf("%lld\n", x[I]); + x = (v_i64){}; + x = test_v_i64(x, 42, 13); + printf("%lld\n", x[I]); + } + + { + v_u64 x = {}; + x = test_v_u64(x, 42, 42); + printf("%lld\n", x[I]); + x = (v_u64){}; + x = test_v_u64(x, 42, 13); + printf("%lld\n", x[I]); + } + + { + v_i32 x = {}; + x = test_v_i32(x, 42, 42); + printf("%d\n", x[I]); + x = (v_i32){}; + x = test_v_i32(x, 42, 13); + printf("%d\n", x[I]); + } + + { + v_u32 x = {}; + x = test_v_u32(x, 42, 42); + printf("%d\n", x[I]); + x = (v_u32){}; + x = test_v_u32(x, 42, 13); + printf("%d\n", x[I]); + } + + { + v_i16 x = {}; + x = test_v_i16(x, 42, 42); + printf("%d\n", x[I]); + x = (v_i16){}; + x = test_v_i16(x, 42, 13); + printf("%d\n", x[I]); + } + + { + v_u16 x = {}; + x = test_v_u16(x, 42, 42); + printf("%d\n", (i16)x[I]); + x = (v_u16){}; + x = test_v_u16(x, 42, 13); + printf("%d\n", (i16)x[I]); + } + + { + v_i8 x = {}; + x = test_v_i8(x, 42, 42); + printf("%d\n", x[I]); + x = (v_i8){}; + x = test_v_i8(x, 42, 13); + printf("%d\n", x[I]); + } + + { + v_u8 x = {}; + x = test_v_u8(x, 42, 42); + printf("%d\n", (i8)x[I]); + x = (v_u8){}; + x = test_v_u8(x, 42, 13); + printf("%d\n", (i8)x[I]); + } + + return 0; +} +--EXPECT-- +0 +-1 +0 +-1 +0 +-1 +0 +-1 +0 +-1 +0 +-1 +0 +-1 +0 +-1 +0 +-1 +0 +-1 diff --git a/tests/vector/ne-005.test b/tests/vector/ne-005.test new file mode 100644 index 0000000..7408108 --- /dev/null +++ b/tests/vector/ne-005.test @@ -0,0 +1,199 @@ +--TEST-- +NE.005: 256-bit vectors AVX +--TARGET-- +!aarch64 +--ARGS-- +-mavx -mno-avx2 --run +--CODE-- +#define N 32 +#define I 3 + +int printf(const char *, ...); + +typedef long long i64; +typedef unsigned long long u64; +typedef int i32; +typedef unsigned int u32; +typedef short i16; +typedef unsigned short u16; +typedef char i8; +typedef unsigned char u8; + +typedef double __attribute__((__vector_size__(N))) v_d; +typedef float __attribute__((__vector_size__(N))) v_f; +typedef i64 __attribute__((__vector_size__(N))) v_i64; +typedef u64 __attribute__((__vector_size__(N))) v_u64; +typedef i32 __attribute__((__vector_size__(N))) v_i32; +typedef u32 __attribute__((__vector_size__(N))) v_u32; +typedef i16 __attribute__((__vector_size__(N))) v_i16; +typedef u16 __attribute__((__vector_size__(N))) v_u16; +typedef i8 __attribute__((__vector_size__(N))) v_i8; +typedef u8 __attribute__((__vector_size__(N))) v_u8; + +v_d __attribute__((noinline)) test_v_d(v_d v, double x, double y) +{ + return (v + x != y); +} + +v_f __attribute__((noinline)) test_v_f(v_f v, float x, float y) +{ + return (v + x != y); +} + +v_i64 __attribute__((noinline)) test_v_i64(v_i64 v, i64 x, i64 y) +{ + return (v + x != y); +} + +v_u64 __attribute__((noinline)) test_v_u64(v_u64 v, u64 x, u64 y) +{ + return (v + x != y); +} + +v_i32 __attribute__((noinline)) test_v_i32(v_i32 v, i32 x, i32 y) +{ + return (v + x != y); +} + +v_u32 __attribute__((noinline)) test_v_u32(v_u32 v, u32 x, u32 y) +{ + return (v + x != y); +} + +v_i16 __attribute__((noinline)) test_v_i16(v_i16 v, i16 x, i16 y) +{ + return (v + x != y); +} + +v_u16 __attribute__((noinline)) test_v_u16(v_u16 v, u16 x, u16 y) +{ + return (v + x != y); +} + +v_i8 __attribute__((noinline)) test_v_i8(v_i8 v, i8 x, i8 y) +{ + return (v + x != y); +} + +v_u8 __attribute__((noinline)) test_v_u8(v_u8 v, u8 x, u8 y) +{ + return (v + x != y); +} + +int main() +{ + { + v_d x = {}; + v_i64 y; + y = (v_i64)test_v_d(x, 42.42, 42.42); + printf("%lld\n", y[I]); + x = (v_d){}; + y = (v_i64)test_v_d(x, 42.42, 13.13); + printf("%lld\n", y[I]); + } + + { + v_f x = {}; + v_i32 y; + y = (v_i32)test_v_f(x, 42.42, 42.42); + printf("%d\n", y[I]); + x = (v_f){}; + y = (v_i32)test_v_f(x, 42.42, 13.13); + printf("%d\n", y[I]); + } + + { + v_i64 x = {}; + x = test_v_i64(x, 42, 42); + printf("%lld\n", x[I]); + x = (v_i64){}; + x = test_v_i64(x, 42, 13); + printf("%lld\n", x[I]); + } + + { + v_u64 x = {}; + x = test_v_u64(x, 42, 42); + printf("%lld\n", x[I]); + x = (v_u64){}; + x = test_v_u64(x, 42, 13); + printf("%lld\n", x[I]); + } + + { + v_i32 x = {}; + x = test_v_i32(x, 42, 42); + printf("%d\n", x[I]); + x = (v_i32){}; + x = test_v_i32(x, 42, 13); + printf("%d\n", x[I]); + } + + { + v_u32 x = {}; + x = test_v_u32(x, 42, 42); + printf("%d\n", x[I]); + x = (v_u32){}; + x = test_v_u32(x, 42, 13); + printf("%d\n", x[I]); + } + + { + v_i16 x = {}; + x = test_v_i16(x, 42, 42); + printf("%d\n", x[I]); + x = (v_i16){}; + x = test_v_i16(x, 42, 13); + printf("%d\n", x[I]); + } + + { + v_u16 x = {}; + x = test_v_u16(x, 42, 42); + printf("%d\n", (i16)x[I]); + x = (v_u16){}; + x = test_v_u16(x, 42, 13); + printf("%d\n", (i16)x[I]); + } + + { + v_i8 x = {}; + x = test_v_i8(x, 42, 42); + printf("%d\n", x[I]); + x = (v_i8){}; + x = test_v_i8(x, 42, 13); + printf("%d\n", x[I]); + } + + { + v_u8 x = {}; + x = test_v_u8(x, 42, 42); + printf("%d\n", (i8)x[I]); + x = (v_u8){}; + x = test_v_u8(x, 42, 13); + printf("%d\n", (i8)x[I]); + } + + return 0; +} +--EXPECT-- +0 +-1 +0 +-1 +0 +-1 +0 +-1 +0 +-1 +0 +-1 +0 +-1 +0 +-1 +0 +-1 +0 +-1 diff --git a/tests/vector/ne-006.test b/tests/vector/ne-006.test new file mode 100644 index 0000000..6804ac2 --- /dev/null +++ b/tests/vector/ne-006.test @@ -0,0 +1,199 @@ +--TEST-- +NE.006: 128-bit vectors SSE +--TARGET-- +!aarch64 +--ARGS-- +-mno-sse4 -mno-avx2 --run +--CODE-- +#define N 16 +#define I 1 + +int printf(const char *, ...); + +typedef long long i64; +typedef unsigned long long u64; +typedef int i32; +typedef unsigned int u32; +typedef short i16; +typedef unsigned short u16; +typedef char i8; +typedef unsigned char u8; + +typedef double __attribute__((__vector_size__(N))) v_d; +typedef float __attribute__((__vector_size__(N))) v_f; +typedef i64 __attribute__((__vector_size__(N))) v_i64; +typedef u64 __attribute__((__vector_size__(N))) v_u64; +typedef i32 __attribute__((__vector_size__(N))) v_i32; +typedef u32 __attribute__((__vector_size__(N))) v_u32; +typedef i16 __attribute__((__vector_size__(N))) v_i16; +typedef u16 __attribute__((__vector_size__(N))) v_u16; +typedef i8 __attribute__((__vector_size__(N))) v_i8; +typedef u8 __attribute__((__vector_size__(N))) v_u8; + +v_d __attribute__((noinline)) test_v_d(v_d v, double x) +{ + return (v + x != 42.42); +} + +v_f __attribute__((noinline)) test_v_f(v_f v, float x) +{ + return (v + x != 42.42f); +} + +v_i64 __attribute__((noinline)) test_v_i64(v_i64 v, i64 x) +{ + return (v + x != 42); +} + +v_u64 __attribute__((noinline)) test_v_u64(v_u64 v, u64 x) +{ + return (v + x != 42); +} + +v_i32 __attribute__((noinline)) test_v_i32(v_i32 v, i32 x) +{ + return (v + x != 42); +} + +v_u32 __attribute__((noinline)) test_v_u32(v_u32 v, u32 x) +{ + return (v + x != 42); +} + +v_i16 __attribute__((noinline)) test_v_i16(v_i16 v, i16 x) +{ + return (v + x != 42); +} + +v_u16 __attribute__((noinline)) test_v_u16(v_u16 v, u16 x) +{ + return (v + x != 42); +} + +v_i8 __attribute__((noinline)) test_v_i8(v_i8 v, i8 x) +{ + return (v + x != 42); +} + +v_u8 __attribute__((noinline)) test_v_u8(v_u8 v, u8 x) +{ + return (v + x != 42); +} + +int main() +{ + { + v_d x = {}; + v_i64 y; + y = (v_i64)test_v_d(x, 42.42); + printf("%lld\n", y[I]); + x = (v_d){}; + y = (v_i64)test_v_d(x, 13.13); + printf("%lld\n", y[I]); + } + + { + v_f x = {}; + v_i32 y; + y = (v_i32)test_v_f(x, 42.42); + printf("%d\n", y[I]); + x = (v_f){}; + y = (v_i32)test_v_f(x, 13.13); + printf("%d\n", y[I]); + } + + { + v_i64 x = {}; + x = test_v_i64(x, 42); + printf("%lld\n", x[I]); + x = (v_i64){}; + x = test_v_i64(x, 13); + printf("%lld\n", x[I]); + } + + { + v_u64 x = {}; + x = test_v_u64(x, 42); + printf("%lld\n", x[I]); + x = (v_u64){}; + x = test_v_u64(x, 13); + printf("%lld\n", x[I]); + } + + { + v_i32 x = {}; + x = test_v_i32(x, 42); + printf("%d\n", x[I]); + x = (v_i32){}; + x = test_v_i32(x, 13); + printf("%d\n", x[I]); + } + + { + v_u32 x = {}; + x = test_v_u32(x, 42); + printf("%d\n", x[I]); + x = (v_u32){}; + x = test_v_u32(x, 13); + printf("%d\n", x[I]); + } + + { + v_i16 x = {}; + x = test_v_i16(x, 42); + printf("%d\n", x[I]); + x = (v_i16){}; + x = test_v_i16(x, 13); + printf("%d\n", x[I]); + } + + { + v_u16 x = {}; + x = test_v_u16(x, 42); + printf("%d\n", (i16)x[I]); + x = (v_u16){}; + x = test_v_u16(x, 13); + printf("%d\n", (i16)x[I]); + } + + { + v_i8 x = {}; + x = test_v_i8(x, 42); + printf("%d\n", x[I]); + x = (v_i8){}; + x = test_v_i8(x, 13); + printf("%d\n", x[I]); + } + + { + v_u8 x = {}; + x = test_v_u8(x, 42); + printf("%d\n", (i8)x[I]); + x = (v_u8){}; + x = test_v_u8(x, 13); + printf("%d\n", (i8)x[I]); + } + + return 0; +} +--EXPECT-- +0 +-1 +0 +-1 +0 +-1 +0 +-1 +0 +-1 +0 +-1 +0 +-1 +0 +-1 +0 +-1 +0 +-1 diff --git a/tests/vector/neg-001.test b/tests/vector/neg-001.test new file mode 100644 index 0000000..378f663 --- /dev/null +++ b/tests/vector/neg-001.test @@ -0,0 +1,167 @@ +--TEST-- +NEG.001: 128-bit vectors SSE2 +--TARGET-- +!aarch64 +--ARGS-- +-mno-sse4 -mno-avx2 --run +--CODE-- +#define N 16 +#define I 1 + +int printf(const char *, ...); + +typedef long long i64; +typedef unsigned long long u64; +typedef int i32; +typedef unsigned int u32; +typedef short i16; +typedef unsigned short u16; +typedef char i8; +typedef unsigned char u8; + +typedef double __attribute__((__vector_size__(N))) v_d; +typedef float __attribute__((__vector_size__(N))) v_f; +typedef i64 __attribute__((__vector_size__(N))) v_i64; +typedef u64 __attribute__((__vector_size__(N))) v_u64; +typedef i32 __attribute__((__vector_size__(N))) v_i32; +typedef u32 __attribute__((__vector_size__(N))) v_u32; +typedef i16 __attribute__((__vector_size__(N))) v_i16; +typedef u16 __attribute__((__vector_size__(N))) v_u16; +typedef i8 __attribute__((__vector_size__(N))) v_i8; +typedef u8 __attribute__((__vector_size__(N))) v_u8; + +v_d __attribute__((noinline)) test_v_d(v_d v, double x) +{ + v[I] = x; + return -v; +} + +v_f __attribute__((noinline)) test_v_f(v_f v, float x) +{ + v[I] = x; + return -v; +} + +v_i64 __attribute__((noinline)) test_v_i64(v_i64 v, i64 x) +{ + v[I] = x; + return -v; +} + +v_u64 __attribute__((noinline)) test_v_u64(v_u64 v, u64 x) +{ + v[I] = x; + return -v; +} + +v_i32 __attribute__((noinline)) test_v_i32(v_i32 v, i32 x) +{ + v[I] = x; + return -v; +} + +v_u32 __attribute__((noinline)) test_v_u32(v_u32 v, u32 x) +{ + v[I] = x; + return -v; +} + +v_i16 __attribute__((noinline)) test_v_i16(v_i16 v, i16 x) +{ + v[I] = x; + return -v; +} + +v_u16 __attribute__((noinline)) test_v_u16(v_u16 v, u16 x) +{ + v[I] = x; + return -v; +} + +v_i8 __attribute__((noinline)) test_v_i8(v_i8 v, i8 x) +{ + v[I] = x; + return -v; +} + +v_u8 __attribute__((noinline)) test_v_u8(v_u8 v, u8 x) +{ + v[I] = x; + return -v; +} + +int main() +{ + { + v_d x = {}; + x = test_v_d(x, 42.42); + printf("%g\n", -x[I]); + } + + { + v_f x = {}; + x = test_v_f(x, 42.42); + printf("%g\n", -x[I]); + } + + { + v_i64 x = {}; + x = test_v_i64(x, 42); + printf("%lld\n", -x[I]); + } + + { + v_u64 x = {}; + x = test_v_u64(x, 42); + printf("%lld\n", -x[I]); + } + + { + v_i32 x = {}; + x = test_v_i32(x, 42); + printf("%d\n", -x[I]); + } + + { + v_u32 x = {}; + x = test_v_u32(x, 42); + printf("%d\n", -x[I]); + } + + { + v_i16 x = {}; + x = test_v_i16(x, 42); + printf("%d\n", -x[I]); + } + + { + v_u16 x = {}; + x = test_v_u16(x, 42); + printf("%d\n", -(i16)x[I]); + } + + { + v_i8 x = {}; + x = test_v_i8(x, 42); + printf("%d\n", -x[I]); + } + + { + v_u8 x = {}; + x = test_v_u8(x, 42); + printf("%d\n", -(i8)x[I]); + } + + return 0; +} +--EXPECT-- +42.42 +42.42 +42 +42 +42 +42 +42 +42 +42 +42 diff --git a/tests/vector/neg-002.test b/tests/vector/neg-002.test new file mode 100644 index 0000000..89a790c --- /dev/null +++ b/tests/vector/neg-002.test @@ -0,0 +1,167 @@ +--TEST-- +NEG.002: 128-bit vectors SSE2+SSE4 +--TARGET-- +!aarch64 +--ARGS-- +-mno-avx2 --run +--CODE-- +#define N 16 +#define I 1 + +int printf(const char *, ...); + +typedef long long i64; +typedef unsigned long long u64; +typedef int i32; +typedef unsigned int u32; +typedef short i16; +typedef unsigned short u16; +typedef char i8; +typedef unsigned char u8; + +typedef double __attribute__((__vector_size__(N))) v_d; +typedef float __attribute__((__vector_size__(N))) v_f; +typedef i64 __attribute__((__vector_size__(N))) v_i64; +typedef u64 __attribute__((__vector_size__(N))) v_u64; +typedef i32 __attribute__((__vector_size__(N))) v_i32; +typedef u32 __attribute__((__vector_size__(N))) v_u32; +typedef i16 __attribute__((__vector_size__(N))) v_i16; +typedef u16 __attribute__((__vector_size__(N))) v_u16; +typedef i8 __attribute__((__vector_size__(N))) v_i8; +typedef u8 __attribute__((__vector_size__(N))) v_u8; + +v_d __attribute__((noinline)) test_v_d(v_d v, double x) +{ + v[I] = x; + return -v; +} + +v_f __attribute__((noinline)) test_v_f(v_f v, float x) +{ + v[I] = x; + return -v; +} + +v_i64 __attribute__((noinline)) test_v_i64(v_i64 v, i64 x) +{ + v[I] = x; + return -v; +} + +v_u64 __attribute__((noinline)) test_v_u64(v_u64 v, u64 x) +{ + v[I] = x; + return -v; +} + +v_i32 __attribute__((noinline)) test_v_i32(v_i32 v, i32 x) +{ + v[I] = x; + return -v; +} + +v_u32 __attribute__((noinline)) test_v_u32(v_u32 v, u32 x) +{ + v[I] = x; + return -v; +} + +v_i16 __attribute__((noinline)) test_v_i16(v_i16 v, i16 x) +{ + v[I] = x; + return -v; +} + +v_u16 __attribute__((noinline)) test_v_u16(v_u16 v, u16 x) +{ + v[I] = x; + return -v; +} + +v_i8 __attribute__((noinline)) test_v_i8(v_i8 v, i8 x) +{ + v[I] = x; + return -v; +} + +v_u8 __attribute__((noinline)) test_v_u8(v_u8 v, u8 x) +{ + v[I] = x; + return -v; +} + +int main() +{ + { + v_d x = {}; + x = test_v_d(x, 42.42); + printf("%g\n", -x[I]); + } + + { + v_f x = {}; + x = test_v_f(x, 42.42); + printf("%g\n", -x[I]); + } + + { + v_i64 x = {}; + x = test_v_i64(x, 42); + printf("%lld\n", -x[I]); + } + + { + v_u64 x = {}; + x = test_v_u64(x, 42); + printf("%lld\n", -x[I]); + } + + { + v_i32 x = {}; + x = test_v_i32(x, 42); + printf("%d\n", -x[I]); + } + + { + v_u32 x = {}; + x = test_v_u32(x, 42); + printf("%d\n", -x[I]); + } + + { + v_i16 x = {}; + x = test_v_i16(x, 42); + printf("%d\n", -x[I]); + } + + { + v_u16 x = {}; + x = test_v_u16(x, 42); + printf("%d\n", -(i16)x[I]); + } + + { + v_i8 x = {}; + x = test_v_i8(x, 42); + printf("%d\n", -x[I]); + } + + { + v_u8 x = {}; + x = test_v_u8(x, 42); + printf("%d\n", -(i8)x[I]); + } + + return 0; +} +--EXPECT-- +42.42 +42.42 +42 +42 +42 +42 +42 +42 +42 +42 diff --git a/tests/vector/neg-003.test b/tests/vector/neg-003.test new file mode 100644 index 0000000..101ae42 --- /dev/null +++ b/tests/vector/neg-003.test @@ -0,0 +1,167 @@ +--TEST-- +NEG.003: 128-bit vectors AVX +--TARGET-- +!aarch64 +--ARGS-- +-mavx -mno-avx2 --run +--CODE-- +#define N 16 +#define I 1 + +int printf(const char *, ...); + +typedef long long i64; +typedef unsigned long long u64; +typedef int i32; +typedef unsigned int u32; +typedef short i16; +typedef unsigned short u16; +typedef char i8; +typedef unsigned char u8; + +typedef double __attribute__((__vector_size__(N))) v_d; +typedef float __attribute__((__vector_size__(N))) v_f; +typedef i64 __attribute__((__vector_size__(N))) v_i64; +typedef u64 __attribute__((__vector_size__(N))) v_u64; +typedef i32 __attribute__((__vector_size__(N))) v_i32; +typedef u32 __attribute__((__vector_size__(N))) v_u32; +typedef i16 __attribute__((__vector_size__(N))) v_i16; +typedef u16 __attribute__((__vector_size__(N))) v_u16; +typedef i8 __attribute__((__vector_size__(N))) v_i8; +typedef u8 __attribute__((__vector_size__(N))) v_u8; + +v_d __attribute__((noinline)) test_v_d(v_d v, double x) +{ + v[I] = x; + return -v; +} + +v_f __attribute__((noinline)) test_v_f(v_f v, float x) +{ + v[I] = x; + return -v; +} + +v_i64 __attribute__((noinline)) test_v_i64(v_i64 v, i64 x) +{ + v[I] = x; + return -v; +} + +v_u64 __attribute__((noinline)) test_v_u64(v_u64 v, u64 x) +{ + v[I] = x; + return -v; +} + +v_i32 __attribute__((noinline)) test_v_i32(v_i32 v, i32 x) +{ + v[I] = x; + return -v; +} + +v_u32 __attribute__((noinline)) test_v_u32(v_u32 v, u32 x) +{ + v[I] = x; + return -v; +} + +v_i16 __attribute__((noinline)) test_v_i16(v_i16 v, i16 x) +{ + v[I] = x; + return -v; +} + +v_u16 __attribute__((noinline)) test_v_u16(v_u16 v, u16 x) +{ + v[I] = x; + return -v; +} + +v_i8 __attribute__((noinline)) test_v_i8(v_i8 v, i8 x) +{ + v[I] = x; + return -v; +} + +v_u8 __attribute__((noinline)) test_v_u8(v_u8 v, u8 x) +{ + v[I] = x; + return -v; +} + +int main() +{ + { + v_d x = {}; + x = test_v_d(x, 42.42); + printf("%g\n", -x[I]); + } + + { + v_f x = {}; + x = test_v_f(x, 42.42); + printf("%g\n", -x[I]); + } + + { + v_i64 x = {}; + x = test_v_i64(x, 42); + printf("%lld\n", -x[I]); + } + + { + v_u64 x = {}; + x = test_v_u64(x, 42); + printf("%lld\n", -x[I]); + } + + { + v_i32 x = {}; + x = test_v_i32(x, 42); + printf("%d\n", -x[I]); + } + + { + v_u32 x = {}; + x = test_v_u32(x, 42); + printf("%d\n", -x[I]); + } + + { + v_i16 x = {}; + x = test_v_i16(x, 42); + printf("%d\n", -x[I]); + } + + { + v_u16 x = {}; + x = test_v_u16(x, 42); + printf("%d\n", -(i16)x[I]); + } + + { + v_i8 x = {}; + x = test_v_i8(x, 42); + printf("%d\n", -x[I]); + } + + { + v_u8 x = {}; + x = test_v_u8(x, 42); + printf("%d\n", -(i8)x[I]); + } + + return 0; +} +--EXPECT-- +42.42 +42.42 +42 +42 +42 +42 +42 +42 +42 +42 diff --git a/tests/vector/neg-004.test b/tests/vector/neg-004.test new file mode 100644 index 0000000..842e16f --- /dev/null +++ b/tests/vector/neg-004.test @@ -0,0 +1,167 @@ +--TEST-- +NEG.004: 128-bit vectors AVX+AVX2 +--TARGET-- +!aarch64 +--ARGS-- +-mavx -mno-avx2 --run +--CODE-- +#define N 16 +#define I 1 + +int printf(const char *, ...); + +typedef long long i64; +typedef unsigned long long u64; +typedef int i32; +typedef unsigned int u32; +typedef short i16; +typedef unsigned short u16; +typedef char i8; +typedef unsigned char u8; + +typedef double __attribute__((__vector_size__(N))) v_d; +typedef float __attribute__((__vector_size__(N))) v_f; +typedef i64 __attribute__((__vector_size__(N))) v_i64; +typedef u64 __attribute__((__vector_size__(N))) v_u64; +typedef i32 __attribute__((__vector_size__(N))) v_i32; +typedef u32 __attribute__((__vector_size__(N))) v_u32; +typedef i16 __attribute__((__vector_size__(N))) v_i16; +typedef u16 __attribute__((__vector_size__(N))) v_u16; +typedef i8 __attribute__((__vector_size__(N))) v_i8; +typedef u8 __attribute__((__vector_size__(N))) v_u8; + +v_d __attribute__((noinline)) test_v_d(v_d v, double x) +{ + v[I] = x; + return -v; +} + +v_f __attribute__((noinline)) test_v_f(v_f v, float x) +{ + v[I] = x; + return -v; +} + +v_i64 __attribute__((noinline)) test_v_i64(v_i64 v, i64 x) +{ + v[I] = x; + return -v; +} + +v_u64 __attribute__((noinline)) test_v_u64(v_u64 v, u64 x) +{ + v[I] = x; + return -v; +} + +v_i32 __attribute__((noinline)) test_v_i32(v_i32 v, i32 x) +{ + v[I] = x; + return -v; +} + +v_u32 __attribute__((noinline)) test_v_u32(v_u32 v, u32 x) +{ + v[I] = x; + return -v; +} + +v_i16 __attribute__((noinline)) test_v_i16(v_i16 v, i16 x) +{ + v[I] = x; + return -v; +} + +v_u16 __attribute__((noinline)) test_v_u16(v_u16 v, u16 x) +{ + v[I] = x; + return -v; +} + +v_i8 __attribute__((noinline)) test_v_i8(v_i8 v, i8 x) +{ + v[I] = x; + return -v; +} + +v_u8 __attribute__((noinline)) test_v_u8(v_u8 v, u8 x) +{ + v[I] = x; + return -v; +} + +int main() +{ + { + v_d x = {}; + x = test_v_d(x, 42.42); + printf("%g\n", -x[I]); + } + + { + v_f x = {}; + x = test_v_f(x, 42.42); + printf("%g\n", -x[I]); + } + + { + v_i64 x = {}; + x = test_v_i64(x, 42); + printf("%lld\n", -x[I]); + } + + { + v_u64 x = {}; + x = test_v_u64(x, 42); + printf("%lld\n", -x[I]); + } + + { + v_i32 x = {}; + x = test_v_i32(x, 42); + printf("%d\n", -x[I]); + } + + { + v_u32 x = {}; + x = test_v_u32(x, 42); + printf("%d\n", -x[I]); + } + + { + v_i16 x = {}; + x = test_v_i16(x, 42); + printf("%d\n", -x[I]); + } + + { + v_u16 x = {}; + x = test_v_u16(x, 42); + printf("%d\n", -(i16)x[I]); + } + + { + v_i8 x = {}; + x = test_v_i8(x, 42); + printf("%d\n", -x[I]); + } + + { + v_u8 x = {}; + x = test_v_u8(x, 42); + printf("%d\n", -(i8)x[I]); + } + + return 0; +} +--EXPECT-- +42.42 +42.42 +42 +42 +42 +42 +42 +42 +42 +42 diff --git a/tests/vector/neg-005.test b/tests/vector/neg-005.test new file mode 100644 index 0000000..effe8b2 --- /dev/null +++ b/tests/vector/neg-005.test @@ -0,0 +1,167 @@ +--TEST-- +NEG.005: 64-bit vectors SSE2 +--TARGET-- +!aarch64 +--ARGS-- +-mno-sse4 -mno-avx2 --run +--CODE-- +#define N 8 +#define I 0 + +int printf(const char *, ...); + +typedef long long i64; +typedef unsigned long long u64; +typedef int i32; +typedef unsigned int u32; +typedef short i16; +typedef unsigned short u16; +typedef char i8; +typedef unsigned char u8; + +typedef double __attribute__((__vector_size__(N))) v_d; +typedef float __attribute__((__vector_size__(N))) v_f; +typedef i64 __attribute__((__vector_size__(N))) v_i64; +typedef u64 __attribute__((__vector_size__(N))) v_u64; +typedef i32 __attribute__((__vector_size__(N))) v_i32; +typedef u32 __attribute__((__vector_size__(N))) v_u32; +typedef i16 __attribute__((__vector_size__(N))) v_i16; +typedef u16 __attribute__((__vector_size__(N))) v_u16; +typedef i8 __attribute__((__vector_size__(N))) v_i8; +typedef u8 __attribute__((__vector_size__(N))) v_u8; + +v_d __attribute__((noinline)) test_v_d(v_d v, double x) +{ + v[I] = x; + return -v; +} + +v_f __attribute__((noinline)) test_v_f(v_f v, float x) +{ + v[I] = x; + return -v; +} + +v_i64 __attribute__((noinline)) test_v_i64(v_i64 v, i64 x) +{ + v[I] = x; + return -v; +} + +v_u64 __attribute__((noinline)) test_v_u64(v_u64 v, u64 x) +{ + v[I] = x; + return -v; +} + +v_i32 __attribute__((noinline)) test_v_i32(v_i32 v, i32 x) +{ + v[I] = x; + return -v; +} + +v_u32 __attribute__((noinline)) test_v_u32(v_u32 v, u32 x) +{ + v[I] = x; + return -v; +} + +v_i16 __attribute__((noinline)) test_v_i16(v_i16 v, i16 x) +{ + v[I] = x; + return -v; +} + +v_u16 __attribute__((noinline)) test_v_u16(v_u16 v, u16 x) +{ + v[I] = x; + return -v; +} + +v_i8 __attribute__((noinline)) test_v_i8(v_i8 v, i8 x) +{ + v[I] = x; + return -v; +} + +v_u8 __attribute__((noinline)) test_v_u8(v_u8 v, u8 x) +{ + v[I] = x; + return -v; +} + +int main() +{ + { + v_d x = {}; + x = test_v_d(x, 42.42); + printf("%g\n", -x[I]); + } + + { + v_f x = {}; + x = test_v_f(x, 42.42); + printf("%g\n", -x[I]); + } + + { + v_i64 x = {}; + x = test_v_i64(x, 42); + printf("%lld\n", -x[I]); + } + + { + v_u64 x = {}; + x = test_v_u64(x, 42); + printf("%lld\n", -x[I]); + } + + { + v_i32 x = {}; + x = test_v_i32(x, 42); + printf("%d\n", -x[I]); + } + + { + v_u32 x = {}; + x = test_v_u32(x, 42); + printf("%d\n", -x[I]); + } + + { + v_i16 x = {}; + x = test_v_i16(x, 42); + printf("%d\n", -x[I]); + } + + { + v_u16 x = {}; + x = test_v_u16(x, 42); + printf("%d\n", -(i16)x[I]); + } + + { + v_i8 x = {}; + x = test_v_i8(x, 42); + printf("%d\n", -x[I]); + } + + { + v_u8 x = {}; + x = test_v_u8(x, 42); + printf("%d\n", -(i8)x[I]); + } + + return 0; +} +--EXPECT-- +42.42 +42.42 +42 +42 +42 +42 +42 +42 +42 +42 diff --git a/tests/vector/neg-006.test b/tests/vector/neg-006.test new file mode 100644 index 0000000..acf2dc5 --- /dev/null +++ b/tests/vector/neg-006.test @@ -0,0 +1,167 @@ +--TEST-- +NEG.006: 256-bit vectors AVX +--TARGET-- +!aarch64 +--ARGS-- +-mavx -mno-avx2 --run +--CODE-- +#define N 32 +#define I 3 + +int printf(const char *, ...); + +typedef long long i64; +typedef unsigned long long u64; +typedef int i32; +typedef unsigned int u32; +typedef short i16; +typedef unsigned short u16; +typedef char i8; +typedef unsigned char u8; + +typedef double __attribute__((__vector_size__(N))) v_d; +typedef float __attribute__((__vector_size__(N))) v_f; +typedef i64 __attribute__((__vector_size__(N))) v_i64; +typedef u64 __attribute__((__vector_size__(N))) v_u64; +typedef i32 __attribute__((__vector_size__(N))) v_i32; +typedef u32 __attribute__((__vector_size__(N))) v_u32; +typedef i16 __attribute__((__vector_size__(N))) v_i16; +typedef u16 __attribute__((__vector_size__(N))) v_u16; +typedef i8 __attribute__((__vector_size__(N))) v_i8; +typedef u8 __attribute__((__vector_size__(N))) v_u8; + +v_d __attribute__((noinline)) test_v_d(v_d v, double x) +{ + v[I] = x; + return -v; +} + +v_f __attribute__((noinline)) test_v_f(v_f v, float x) +{ + v[I] = x; + return -v; +} + +v_i64 __attribute__((noinline)) test_v_i64(v_i64 v, i64 x) +{ + v[I] = x; + return -v; +} + +v_u64 __attribute__((noinline)) test_v_u64(v_u64 v, u64 x) +{ + v[I] = x; + return -v; +} + +v_i32 __attribute__((noinline)) test_v_i32(v_i32 v, i32 x) +{ + v[I] = x; + return -v; +} + +v_u32 __attribute__((noinline)) test_v_u32(v_u32 v, u32 x) +{ + v[I] = x; + return -v; +} + +v_i16 __attribute__((noinline)) test_v_i16(v_i16 v, i16 x) +{ + v[I] = x; + return -v; +} + +v_u16 __attribute__((noinline)) test_v_u16(v_u16 v, u16 x) +{ + v[I] = x; + return -v; +} + +v_i8 __attribute__((noinline)) test_v_i8(v_i8 v, i8 x) +{ + v[I] = x; + return -v; +} + +v_u8 __attribute__((noinline)) test_v_u8(v_u8 v, u8 x) +{ + v[I] = x; + return -v; +} + +int main() +{ + { + v_d x = {}; + x = test_v_d(x, 42.42); + printf("%g\n", -x[I]); + } + + { + v_f x = {}; + x = test_v_f(x, 42.42); + printf("%g\n", -x[I]); + } + + { + v_i64 x = {}; + x = test_v_i64(x, 42); + printf("%lld\n", -x[I]); + } + + { + v_u64 x = {}; + x = test_v_u64(x, 42); + printf("%lld\n", -x[I]); + } + + { + v_i32 x = {}; + x = test_v_i32(x, 42); + printf("%d\n", -x[I]); + } + + { + v_u32 x = {}; + x = test_v_u32(x, 42); + printf("%d\n", -x[I]); + } + + { + v_i16 x = {}; + x = test_v_i16(x, 42); + printf("%d\n", -x[I]); + } + + { + v_u16 x = {}; + x = test_v_u16(x, 42); + printf("%d\n", -(i16)x[I]); + } + + { + v_i8 x = {}; + x = test_v_i8(x, 42); + printf("%d\n", -x[I]); + } + + { + v_u8 x = {}; + x = test_v_u8(x, 42); + printf("%d\n", -(i8)x[I]); + } + + return 0; +} +--EXPECT-- +42.42 +42.42 +42 +42 +42 +42 +42 +42 +42 +42 diff --git a/tests/vector/not-001.test b/tests/vector/not-001.test new file mode 100644 index 0000000..bf6e490 --- /dev/null +++ b/tests/vector/not-001.test @@ -0,0 +1,139 @@ +--TEST-- +NOT.001: 128-bit vectors SSE2 +--TARGET-- +!aarch64 +--ARGS-- +-mno-sse4 -mno-avx2 --run +--CODE-- +#define N 16 +#define I 1 + +int printf(const char *, ...); + +typedef long long i64; +typedef unsigned long long u64; +typedef int i32; +typedef unsigned int u32; +typedef short i16; +typedef unsigned short u16; +typedef char i8; +typedef unsigned char u8; + +typedef i64 __attribute__((__vector_size__(N))) v_i64; +typedef u64 __attribute__((__vector_size__(N))) v_u64; +typedef i32 __attribute__((__vector_size__(N))) v_i32; +typedef u32 __attribute__((__vector_size__(N))) v_u32; +typedef i16 __attribute__((__vector_size__(N))) v_i16; +typedef u16 __attribute__((__vector_size__(N))) v_u16; +typedef i8 __attribute__((__vector_size__(N))) v_i8; +typedef u8 __attribute__((__vector_size__(N))) v_u8; + +v_i64 __attribute__((noinline)) test_v_i64(v_i64 v, i64 x) +{ + v[I] = x; + return ~v; +} + +v_u64 __attribute__((noinline)) test_v_u64(v_u64 v, u64 x) +{ + v[I] = x; + return ~v; +} + +v_i32 __attribute__((noinline)) test_v_i32(v_i32 v, i32 x) +{ + v[I] = x; + return ~v; +} + +v_u32 __attribute__((noinline)) test_v_u32(v_u32 v, u32 x) +{ + v[I] = x; + return ~v; +} + +v_i16 __attribute__((noinline)) test_v_i16(v_i16 v, i16 x) +{ + v[I] = x; + return ~v; +} + +v_u16 __attribute__((noinline)) test_v_u16(v_u16 v, u16 x) +{ + v[I] = x; + return ~v; +} + +v_i8 __attribute__((noinline)) test_v_i8(v_i8 v, i8 x) +{ + v[I] = x; + return ~v; +} + +v_u8 __attribute__((noinline)) test_v_u8(v_u8 v, u8 x) +{ + v[I] = x; + return ~v; +} + +int main() +{ + { + v_i64 x = {}; + x = test_v_i64(x, 42); + printf("%lld\n", ~x[I]); + } + + { + v_u64 x = {}; + x = test_v_u64(x, 42); + printf("%lld\n", ~x[I]); + } + + { + v_i32 x = {}; + x = test_v_i32(x, 42); + printf("%d\n", ~x[I]); + } + + { + v_u32 x = {}; + x = test_v_u32(x, 42); + printf("%d\n", ~x[I]); + } + + { + v_i16 x = {}; + x = test_v_i16(x, 42); + printf("%d\n", ~x[I]); + } + + { + v_u16 x = {}; + x = test_v_u16(x, 42); + printf("%d\n", ~(i16)x[I]); + } + + { + v_i8 x = {}; + x = test_v_i8(x, 42); + printf("%d\n", ~x[I]); + } + + { + v_u8 x = {}; + x = test_v_u8(x, 42); + printf("%d\n", ~(i8)x[I]); + } + + return 0; +} +--EXPECT-- +42 +42 +42 +42 +42 +42 +42 +42 diff --git a/tests/vector/not-002.test b/tests/vector/not-002.test new file mode 100644 index 0000000..27d0665 --- /dev/null +++ b/tests/vector/not-002.test @@ -0,0 +1,139 @@ +--TEST-- +NOT.002: 128-bit vectors SSE2+SSE4 +--TARGET-- +!aarch64 +--ARGS-- +-mno-avx2 --run +--CODE-- +#define N 16 +#define I 1 + +int printf(const char *, ...); + +typedef long long i64; +typedef unsigned long long u64; +typedef int i32; +typedef unsigned int u32; +typedef short i16; +typedef unsigned short u16; +typedef char i8; +typedef unsigned char u8; + +typedef i64 __attribute__((__vector_size__(N))) v_i64; +typedef u64 __attribute__((__vector_size__(N))) v_u64; +typedef i32 __attribute__((__vector_size__(N))) v_i32; +typedef u32 __attribute__((__vector_size__(N))) v_u32; +typedef i16 __attribute__((__vector_size__(N))) v_i16; +typedef u16 __attribute__((__vector_size__(N))) v_u16; +typedef i8 __attribute__((__vector_size__(N))) v_i8; +typedef u8 __attribute__((__vector_size__(N))) v_u8; + +v_i64 __attribute__((noinline)) test_v_i64(v_i64 v, i64 x) +{ + v[I] = x; + return ~v; +} + +v_u64 __attribute__((noinline)) test_v_u64(v_u64 v, u64 x) +{ + v[I] = x; + return ~v; +} + +v_i32 __attribute__((noinline)) test_v_i32(v_i32 v, i32 x) +{ + v[I] = x; + return ~v; +} + +v_u32 __attribute__((noinline)) test_v_u32(v_u32 v, u32 x) +{ + v[I] = x; + return ~v; +} + +v_i16 __attribute__((noinline)) test_v_i16(v_i16 v, i16 x) +{ + v[I] = x; + return ~v; +} + +v_u16 __attribute__((noinline)) test_v_u16(v_u16 v, u16 x) +{ + v[I] = x; + return ~v; +} + +v_i8 __attribute__((noinline)) test_v_i8(v_i8 v, i8 x) +{ + v[I] = x; + return ~v; +} + +v_u8 __attribute__((noinline)) test_v_u8(v_u8 v, u8 x) +{ + v[I] = x; + return ~v; +} + +int main() +{ + { + v_i64 x = {}; + x = test_v_i64(x, 42); + printf("%lld\n", ~x[I]); + } + + { + v_u64 x = {}; + x = test_v_u64(x, 42); + printf("%lld\n", ~x[I]); + } + + { + v_i32 x = {}; + x = test_v_i32(x, 42); + printf("%d\n", ~x[I]); + } + + { + v_u32 x = {}; + x = test_v_u32(x, 42); + printf("%d\n", ~x[I]); + } + + { + v_i16 x = {}; + x = test_v_i16(x, 42); + printf("%d\n", ~x[I]); + } + + { + v_u16 x = {}; + x = test_v_u16(x, 42); + printf("%d\n", ~(i16)x[I]); + } + + { + v_i8 x = {}; + x = test_v_i8(x, 42); + printf("%d\n", ~x[I]); + } + + { + v_u8 x = {}; + x = test_v_u8(x, 42); + printf("%d\n", ~(i8)x[I]); + } + + return 0; +} +--EXPECT-- +42 +42 +42 +42 +42 +42 +42 +42 diff --git a/tests/vector/not-003.test b/tests/vector/not-003.test new file mode 100644 index 0000000..f6d709a --- /dev/null +++ b/tests/vector/not-003.test @@ -0,0 +1,139 @@ +--TEST-- +NOT.003: 128-bit vectors AVX +--TARGET-- +!aarch64 +--ARGS-- +-mavx -mno-avx2 --run +--CODE-- +#define N 16 +#define I 1 + +int printf(const char *, ...); + +typedef long long i64; +typedef unsigned long long u64; +typedef int i32; +typedef unsigned int u32; +typedef short i16; +typedef unsigned short u16; +typedef char i8; +typedef unsigned char u8; + +typedef i64 __attribute__((__vector_size__(N))) v_i64; +typedef u64 __attribute__((__vector_size__(N))) v_u64; +typedef i32 __attribute__((__vector_size__(N))) v_i32; +typedef u32 __attribute__((__vector_size__(N))) v_u32; +typedef i16 __attribute__((__vector_size__(N))) v_i16; +typedef u16 __attribute__((__vector_size__(N))) v_u16; +typedef i8 __attribute__((__vector_size__(N))) v_i8; +typedef u8 __attribute__((__vector_size__(N))) v_u8; + +v_i64 __attribute__((noinline)) test_v_i64(v_i64 v, i64 x) +{ + v[I] = x; + return ~v; +} + +v_u64 __attribute__((noinline)) test_v_u64(v_u64 v, u64 x) +{ + v[I] = x; + return ~v; +} + +v_i32 __attribute__((noinline)) test_v_i32(v_i32 v, i32 x) +{ + v[I] = x; + return ~v; +} + +v_u32 __attribute__((noinline)) test_v_u32(v_u32 v, u32 x) +{ + v[I] = x; + return ~v; +} + +v_i16 __attribute__((noinline)) test_v_i16(v_i16 v, i16 x) +{ + v[I] = x; + return ~v; +} + +v_u16 __attribute__((noinline)) test_v_u16(v_u16 v, u16 x) +{ + v[I] = x; + return ~v; +} + +v_i8 __attribute__((noinline)) test_v_i8(v_i8 v, i8 x) +{ + v[I] = x; + return ~v; +} + +v_u8 __attribute__((noinline)) test_v_u8(v_u8 v, u8 x) +{ + v[I] = x; + return ~v; +} + +int main() +{ + { + v_i64 x = {}; + x = test_v_i64(x, 42); + printf("%lld\n", ~x[I]); + } + + { + v_u64 x = {}; + x = test_v_u64(x, 42); + printf("%lld\n", ~x[I]); + } + + { + v_i32 x = {}; + x = test_v_i32(x, 42); + printf("%d\n", ~x[I]); + } + + { + v_u32 x = {}; + x = test_v_u32(x, 42); + printf("%d\n", ~x[I]); + } + + { + v_i16 x = {}; + x = test_v_i16(x, 42); + printf("%d\n", ~x[I]); + } + + { + v_u16 x = {}; + x = test_v_u16(x, 42); + printf("%d\n", ~(i16)x[I]); + } + + { + v_i8 x = {}; + x = test_v_i8(x, 42); + printf("%d\n", ~x[I]); + } + + { + v_u8 x = {}; + x = test_v_u8(x, 42); + printf("%d\n", ~(i8)x[I]); + } + + return 0; +} +--EXPECT-- +42 +42 +42 +42 +42 +42 +42 +42 diff --git a/tests/vector/not-004.test b/tests/vector/not-004.test new file mode 100644 index 0000000..7da0922 --- /dev/null +++ b/tests/vector/not-004.test @@ -0,0 +1,139 @@ +--TEST-- +NOT.004: 128-bit vectors AVX+AVX2 +--TARGET-- +!aarch64 +--ARGS-- +-mavx --run +--CODE-- +#define N 16 +#define I 1 + +int printf(const char *, ...); + +typedef long long i64; +typedef unsigned long long u64; +typedef int i32; +typedef unsigned int u32; +typedef short i16; +typedef unsigned short u16; +typedef char i8; +typedef unsigned char u8; + +typedef i64 __attribute__((__vector_size__(N))) v_i64; +typedef u64 __attribute__((__vector_size__(N))) v_u64; +typedef i32 __attribute__((__vector_size__(N))) v_i32; +typedef u32 __attribute__((__vector_size__(N))) v_u32; +typedef i16 __attribute__((__vector_size__(N))) v_i16; +typedef u16 __attribute__((__vector_size__(N))) v_u16; +typedef i8 __attribute__((__vector_size__(N))) v_i8; +typedef u8 __attribute__((__vector_size__(N))) v_u8; + +v_i64 __attribute__((noinline)) test_v_i64(v_i64 v, i64 x) +{ + v[I] = x; + return ~v; +} + +v_u64 __attribute__((noinline)) test_v_u64(v_u64 v, u64 x) +{ + v[I] = x; + return ~v; +} + +v_i32 __attribute__((noinline)) test_v_i32(v_i32 v, i32 x) +{ + v[I] = x; + return ~v; +} + +v_u32 __attribute__((noinline)) test_v_u32(v_u32 v, u32 x) +{ + v[I] = x; + return ~v; +} + +v_i16 __attribute__((noinline)) test_v_i16(v_i16 v, i16 x) +{ + v[I] = x; + return ~v; +} + +v_u16 __attribute__((noinline)) test_v_u16(v_u16 v, u16 x) +{ + v[I] = x; + return ~v; +} + +v_i8 __attribute__((noinline)) test_v_i8(v_i8 v, i8 x) +{ + v[I] = x; + return ~v; +} + +v_u8 __attribute__((noinline)) test_v_u8(v_u8 v, u8 x) +{ + v[I] = x; + return ~v; +} + +int main() +{ + { + v_i64 x = {}; + x = test_v_i64(x, 42); + printf("%lld\n", ~x[I]); + } + + { + v_u64 x = {}; + x = test_v_u64(x, 42); + printf("%lld\n", ~x[I]); + } + + { + v_i32 x = {}; + x = test_v_i32(x, 42); + printf("%d\n", ~x[I]); + } + + { + v_u32 x = {}; + x = test_v_u32(x, 42); + printf("%d\n", ~x[I]); + } + + { + v_i16 x = {}; + x = test_v_i16(x, 42); + printf("%d\n", ~x[I]); + } + + { + v_u16 x = {}; + x = test_v_u16(x, 42); + printf("%d\n", ~(i16)x[I]); + } + + { + v_i8 x = {}; + x = test_v_i8(x, 42); + printf("%d\n", ~x[I]); + } + + { + v_u8 x = {}; + x = test_v_u8(x, 42); + printf("%d\n", ~(i8)x[I]); + } + + return 0; +} +--EXPECT-- +42 +42 +42 +42 +42 +42 +42 +42 diff --git a/tests/vector/not-005.test b/tests/vector/not-005.test new file mode 100644 index 0000000..02c7454 --- /dev/null +++ b/tests/vector/not-005.test @@ -0,0 +1,139 @@ +--TEST-- +NOT.005: 64-bit vectors SSE2 +--TARGET-- +!aarch64 +--ARGS-- +-mno-sse4 -mno-avx2 --run +--CODE-- +#define N 8 +#define I 0 + +int printf(const char *, ...); + +typedef long long i64; +typedef unsigned long long u64; +typedef int i32; +typedef unsigned int u32; +typedef short i16; +typedef unsigned short u16; +typedef char i8; +typedef unsigned char u8; + +typedef i64 __attribute__((__vector_size__(N))) v_i64; +typedef u64 __attribute__((__vector_size__(N))) v_u64; +typedef i32 __attribute__((__vector_size__(N))) v_i32; +typedef u32 __attribute__((__vector_size__(N))) v_u32; +typedef i16 __attribute__((__vector_size__(N))) v_i16; +typedef u16 __attribute__((__vector_size__(N))) v_u16; +typedef i8 __attribute__((__vector_size__(N))) v_i8; +typedef u8 __attribute__((__vector_size__(N))) v_u8; + +v_i64 __attribute__((noinline)) test_v_i64(v_i64 v, i64 x) +{ + v[I] = x; + return ~v; +} + +v_u64 __attribute__((noinline)) test_v_u64(v_u64 v, u64 x) +{ + v[I] = x; + return ~v; +} + +v_i32 __attribute__((noinline)) test_v_i32(v_i32 v, i32 x) +{ + v[I] = x; + return ~v; +} + +v_u32 __attribute__((noinline)) test_v_u32(v_u32 v, u32 x) +{ + v[I] = x; + return ~v; +} + +v_i16 __attribute__((noinline)) test_v_i16(v_i16 v, i16 x) +{ + v[I] = x; + return ~v; +} + +v_u16 __attribute__((noinline)) test_v_u16(v_u16 v, u16 x) +{ + v[I] = x; + return ~v; +} + +v_i8 __attribute__((noinline)) test_v_i8(v_i8 v, i8 x) +{ + v[I] = x; + return ~v; +} + +v_u8 __attribute__((noinline)) test_v_u8(v_u8 v, u8 x) +{ + v[I] = x; + return ~v; +} + +int main() +{ + { + v_i64 x = {}; + x = test_v_i64(x, 42); + printf("%lld\n", ~x[I]); + } + + { + v_u64 x = {}; + x = test_v_u64(x, 42); + printf("%lld\n", ~x[I]); + } + + { + v_i32 x = {}; + x = test_v_i32(x, 42); + printf("%d\n", ~x[I]); + } + + { + v_u32 x = {}; + x = test_v_u32(x, 42); + printf("%d\n", ~x[I]); + } + + { + v_i16 x = {}; + x = test_v_i16(x, 42); + printf("%d\n", ~x[I]); + } + + { + v_u16 x = {}; + x = test_v_u16(x, 42); + printf("%d\n", ~(i16)x[I]); + } + + { + v_i8 x = {}; + x = test_v_i8(x, 42); + printf("%d\n", ~x[I]); + } + + { + v_u8 x = {}; + x = test_v_u8(x, 42); + printf("%d\n", ~(i8)x[I]); + } + + return 0; +} +--EXPECT-- +42 +42 +42 +42 +42 +42 +42 +42 diff --git a/tests/vector/not-006.test b/tests/vector/not-006.test new file mode 100644 index 0000000..accd186 --- /dev/null +++ b/tests/vector/not-006.test @@ -0,0 +1,139 @@ +--TEST-- +NOT.006: 256-bit vectors AVX +--TARGET-- +!aarch64 +--ARGS-- +-mavx -mno-avx2 --run +--CODE-- +#define N 32 +#define I 3 + +int printf(const char *, ...); + +typedef long long i64; +typedef unsigned long long u64; +typedef int i32; +typedef unsigned int u32; +typedef short i16; +typedef unsigned short u16; +typedef char i8; +typedef unsigned char u8; + +typedef i64 __attribute__((__vector_size__(N))) v_i64; +typedef u64 __attribute__((__vector_size__(N))) v_u64; +typedef i32 __attribute__((__vector_size__(N))) v_i32; +typedef u32 __attribute__((__vector_size__(N))) v_u32; +typedef i16 __attribute__((__vector_size__(N))) v_i16; +typedef u16 __attribute__((__vector_size__(N))) v_u16; +typedef i8 __attribute__((__vector_size__(N))) v_i8; +typedef u8 __attribute__((__vector_size__(N))) v_u8; + +v_i64 __attribute__((noinline)) test_v_i64(v_i64 v, i64 x) +{ + v[I] = x; + return ~v; +} + +v_u64 __attribute__((noinline)) test_v_u64(v_u64 v, u64 x) +{ + v[I] = x; + return ~v; +} + +v_i32 __attribute__((noinline)) test_v_i32(v_i32 v, i32 x) +{ + v[I] = x; + return ~v; +} + +v_u32 __attribute__((noinline)) test_v_u32(v_u32 v, u32 x) +{ + v[I] = x; + return ~v; +} + +v_i16 __attribute__((noinline)) test_v_i16(v_i16 v, i16 x) +{ + v[I] = x; + return ~v; +} + +v_u16 __attribute__((noinline)) test_v_u16(v_u16 v, u16 x) +{ + v[I] = x; + return ~v; +} + +v_i8 __attribute__((noinline)) test_v_i8(v_i8 v, i8 x) +{ + v[I] = x; + return ~v; +} + +v_u8 __attribute__((noinline)) test_v_u8(v_u8 v, u8 x) +{ + v[I] = x; + return ~v; +} + +int main() +{ + { + v_i64 x = {}; + x = test_v_i64(x, 42); + printf("%lld\n", ~x[I]); + } + + { + v_u64 x = {}; + x = test_v_u64(x, 42); + printf("%lld\n", ~x[I]); + } + + { + v_i32 x = {}; + x = test_v_i32(x, 42); + printf("%d\n", ~x[I]); + } + + { + v_u32 x = {}; + x = test_v_u32(x, 42); + printf("%d\n", ~x[I]); + } + + { + v_i16 x = {}; + x = test_v_i16(x, 42); + printf("%d\n", ~x[I]); + } + + { + v_u16 x = {}; + x = test_v_u16(x, 42); + printf("%d\n", ~(i16)x[I]); + } + + { + v_i8 x = {}; + x = test_v_i8(x, 42); + printf("%d\n", ~x[I]); + } + + { + v_u8 x = {}; + x = test_v_u8(x, 42); + printf("%d\n", ~(i8)x[I]); + } + + return 0; +} +--EXPECT-- +42 +42 +42 +42 +42 +42 +42 +42 diff --git a/tests/vector/or-001.test b/tests/vector/or-001.test new file mode 100644 index 0000000..da4dad7 --- /dev/null +++ b/tests/vector/or-001.test @@ -0,0 +1,139 @@ +--TEST-- +OR.001: 128-bit vectors SSE2 +--TARGET-- +!aarch64 +--ARGS-- +-mno-sse4 -mno-avx2 --run +--CODE-- +#define N 16 +#define I 1 + +int printf(const char *, ...); + +typedef long long i64; +typedef unsigned long long u64; +typedef int i32; +typedef unsigned int u32; +typedef short i16; +typedef unsigned short u16; +typedef char i8; +typedef unsigned char u8; + +typedef i64 __attribute__((__vector_size__(N))) v_i64; +typedef u64 __attribute__((__vector_size__(N))) v_u64; +typedef i32 __attribute__((__vector_size__(N))) v_i32; +typedef u32 __attribute__((__vector_size__(N))) v_u32; +typedef i16 __attribute__((__vector_size__(N))) v_i16; +typedef u16 __attribute__((__vector_size__(N))) v_u16; +typedef i8 __attribute__((__vector_size__(N))) v_i8; +typedef u8 __attribute__((__vector_size__(N))) v_u8; + +v_i64 __attribute__((noinline)) test_v_i64(v_i64 v, i64 x) +{ + v |= x; + return v; +} + +v_u64 __attribute__((noinline)) test_v_u64(v_u64 v, u64 x) +{ + v |= x; + return v; +} + +v_i32 __attribute__((noinline)) test_v_i32(v_i32 v, i32 x) +{ + v |= x; + return v; +} + +v_u32 __attribute__((noinline)) test_v_u32(v_u32 v, u32 x) +{ + v |= x; + return v; +} + +v_i16 __attribute__((noinline)) test_v_i16(v_i16 v, i16 x) +{ + v |= x; + return v; +} + +v_u16 __attribute__((noinline)) test_v_u16(v_u16 v, u16 x) +{ + v |= x; + return v; +} + +v_i8 __attribute__((noinline)) test_v_i8(v_i8 v, i8 x) +{ + v |= x; + return v; +} + +v_u8 __attribute__((noinline)) test_v_u8(v_u8 v, u8 x) +{ + v |= x; + return v; +} + +int main() +{ + { + v_i64 x = {}; + x = test_v_i64(x, 42); + printf("%lld\n", x[I]); + } + + { + v_u64 x = {}; + x = test_v_u64(x, 42); + printf("%lld\n", x[I]); + } + + { + v_i32 x = {}; + x = test_v_i32(x, 42); + printf("%d\n", x[I]); + } + + { + v_u32 x = {}; + x = test_v_u32(x, 42); + printf("%d\n", x[I]); + } + + { + v_i16 x = {}; + x = test_v_i16(x, 42); + printf("%d\n", x[I]); + } + + { + v_u16 x = {}; + x = test_v_u16(x, 42); + printf("%d\n", x[I]); + } + + { + v_i8 x = {}; + x = test_v_i8(x, 42); + printf("%d\n", x[I]); + } + + { + v_u8 x = {}; + x = test_v_u8(x, 42); + printf("%d\n", x[I]); + } + + return 0; +} +--EXPECT-- +42 +42 +42 +42 +42 +42 +42 +42 diff --git a/tests/vector/or-002.test b/tests/vector/or-002.test new file mode 100644 index 0000000..3cac7c6 --- /dev/null +++ b/tests/vector/or-002.test @@ -0,0 +1,139 @@ +--TEST-- +OR.002: 128-bit vectors SSE2+SSE4 +--TARGET-- +!aarch64 +--ARGS-- +-mno-avx2 --run +--CODE-- +#define N 16 +#define I 1 + +int printf(const char *, ...); + +typedef long long i64; +typedef unsigned long long u64; +typedef int i32; +typedef unsigned int u32; +typedef short i16; +typedef unsigned short u16; +typedef char i8; +typedef unsigned char u8; + +typedef i64 __attribute__((__vector_size__(N))) v_i64; +typedef u64 __attribute__((__vector_size__(N))) v_u64; +typedef i32 __attribute__((__vector_size__(N))) v_i32; +typedef u32 __attribute__((__vector_size__(N))) v_u32; +typedef i16 __attribute__((__vector_size__(N))) v_i16; +typedef u16 __attribute__((__vector_size__(N))) v_u16; +typedef i8 __attribute__((__vector_size__(N))) v_i8; +typedef u8 __attribute__((__vector_size__(N))) v_u8; + +v_i64 __attribute__((noinline)) test_v_i64(v_i64 v, i64 x) +{ + v |= x; + return v; +} + +v_u64 __attribute__((noinline)) test_v_u64(v_u64 v, u64 x) +{ + v |= x; + return v; +} + +v_i32 __attribute__((noinline)) test_v_i32(v_i32 v, i32 x) +{ + v |= x; + return v; +} + +v_u32 __attribute__((noinline)) test_v_u32(v_u32 v, u32 x) +{ + v |= x; + return v; +} + +v_i16 __attribute__((noinline)) test_v_i16(v_i16 v, i16 x) +{ + v |= x; + return v; +} + +v_u16 __attribute__((noinline)) test_v_u16(v_u16 v, u16 x) +{ + v |= x; + return v; +} + +v_i8 __attribute__((noinline)) test_v_i8(v_i8 v, i8 x) +{ + v |= x; + return v; +} + +v_u8 __attribute__((noinline)) test_v_u8(v_u8 v, u8 x) +{ + v |= x; + return v; +} + +int main() +{ + { + v_i64 x = {}; + x = test_v_i64(x, 42); + printf("%lld\n", x[I]); + } + + { + v_u64 x = {}; + x = test_v_u64(x, 42); + printf("%lld\n", x[I]); + } + + { + v_i32 x = {}; + x = test_v_i32(x, 42); + printf("%d\n", x[I]); + } + + { + v_u32 x = {}; + x = test_v_u32(x, 42); + printf("%d\n", x[I]); + } + + { + v_i16 x = {}; + x = test_v_i16(x, 42); + printf("%d\n", x[I]); + } + + { + v_u16 x = {}; + x = test_v_u16(x, 42); + printf("%d\n", x[I]); + } + + { + v_i8 x = {}; + x = test_v_i8(x, 42); + printf("%d\n", x[I]); + } + + { + v_u8 x = {}; + x = test_v_u8(x, 42); + printf("%d\n", x[I]); + } + + return 0; +} +--EXPECT-- +42 +42 +42 +42 +42 +42 +42 +42 diff --git a/tests/vector/or-003.test b/tests/vector/or-003.test new file mode 100644 index 0000000..3ed181a --- /dev/null +++ b/tests/vector/or-003.test @@ -0,0 +1,139 @@ +--TEST-- +OR.003: 128-bit vectors AVX +--TARGET-- +!aarch64 +--ARGS-- +-mavx -mno-avx2 --run +--CODE-- +#define N 16 +#define I 1 + +int printf(const char *, ...); + +typedef long long i64; +typedef unsigned long long u64; +typedef int i32; +typedef unsigned int u32; +typedef short i16; +typedef unsigned short u16; +typedef char i8; +typedef unsigned char u8; + +typedef i64 __attribute__((__vector_size__(N))) v_i64; +typedef u64 __attribute__((__vector_size__(N))) v_u64; +typedef i32 __attribute__((__vector_size__(N))) v_i32; +typedef u32 __attribute__((__vector_size__(N))) v_u32; +typedef i16 __attribute__((__vector_size__(N))) v_i16; +typedef u16 __attribute__((__vector_size__(N))) v_u16; +typedef i8 __attribute__((__vector_size__(N))) v_i8; +typedef u8 __attribute__((__vector_size__(N))) v_u8; + +v_i64 __attribute__((noinline)) test_v_i64(v_i64 v, i64 x) +{ + v |= x; + return v; +} + +v_u64 __attribute__((noinline)) test_v_u64(v_u64 v, u64 x) +{ + v |= x; + return v; +} + +v_i32 __attribute__((noinline)) test_v_i32(v_i32 v, i32 x) +{ + v |= x; + return v; +} + +v_u32 __attribute__((noinline)) test_v_u32(v_u32 v, u32 x) +{ + v |= x; + return v; +} + +v_i16 __attribute__((noinline)) test_v_i16(v_i16 v, i16 x) +{ + v |= x; + return v; +} + +v_u16 __attribute__((noinline)) test_v_u16(v_u16 v, u16 x) +{ + v |= x; + return v; +} + +v_i8 __attribute__((noinline)) test_v_i8(v_i8 v, i8 x) +{ + v |= x; + return v; +} + +v_u8 __attribute__((noinline)) test_v_u8(v_u8 v, u8 x) +{ + v |= x; + return v; +} + +int main() +{ + { + v_i64 x = {}; + x = test_v_i64(x, 42); + printf("%lld\n", x[I]); + } + + { + v_u64 x = {}; + x = test_v_u64(x, 42); + printf("%lld\n", x[I]); + } + + { + v_i32 x = {}; + x = test_v_i32(x, 42); + printf("%d\n", x[I]); + } + + { + v_u32 x = {}; + x = test_v_u32(x, 42); + printf("%d\n", x[I]); + } + + { + v_i16 x = {}; + x = test_v_i16(x, 42); + printf("%d\n", x[I]); + } + + { + v_u16 x = {}; + x = test_v_u16(x, 42); + printf("%d\n", x[I]); + } + + { + v_i8 x = {}; + x = test_v_i8(x, 42); + printf("%d\n", x[I]); + } + + { + v_u8 x = {}; + x = test_v_u8(x, 42); + printf("%d\n", x[I]); + } + + return 0; +} +--EXPECT-- +42 +42 +42 +42 +42 +42 +42 +42 diff --git a/tests/vector/or-004.test b/tests/vector/or-004.test new file mode 100644 index 0000000..8ad2a3c --- /dev/null +++ b/tests/vector/or-004.test @@ -0,0 +1,139 @@ +--TEST-- +OR.004: 128-bit vectors AVX+AVX2 +--TARGET-- +!aarch64 +--ARGS-- +-mavx --run +--CODE-- +#define N 16 +#define I 1 + +int printf(const char *, ...); + +typedef long long i64; +typedef unsigned long long u64; +typedef int i32; +typedef unsigned int u32; +typedef short i16; +typedef unsigned short u16; +typedef char i8; +typedef unsigned char u8; + +typedef i64 __attribute__((__vector_size__(N))) v_i64; +typedef u64 __attribute__((__vector_size__(N))) v_u64; +typedef i32 __attribute__((__vector_size__(N))) v_i32; +typedef u32 __attribute__((__vector_size__(N))) v_u32; +typedef i16 __attribute__((__vector_size__(N))) v_i16; +typedef u16 __attribute__((__vector_size__(N))) v_u16; +typedef i8 __attribute__((__vector_size__(N))) v_i8; +typedef u8 __attribute__((__vector_size__(N))) v_u8; + +v_i64 __attribute__((noinline)) test_v_i64(v_i64 v, i64 x) +{ + v |= x; + return v; +} + +v_u64 __attribute__((noinline)) test_v_u64(v_u64 v, u64 x) +{ + v |= x; + return v; +} + +v_i32 __attribute__((noinline)) test_v_i32(v_i32 v, i32 x) +{ + v |= x; + return v; +} + +v_u32 __attribute__((noinline)) test_v_u32(v_u32 v, u32 x) +{ + v |= x; + return v; +} + +v_i16 __attribute__((noinline)) test_v_i16(v_i16 v, i16 x) +{ + v |= x; + return v; +} + +v_u16 __attribute__((noinline)) test_v_u16(v_u16 v, u16 x) +{ + v |= x; + return v; +} + +v_i8 __attribute__((noinline)) test_v_i8(v_i8 v, i8 x) +{ + v |= x; + return v; +} + +v_u8 __attribute__((noinline)) test_v_u8(v_u8 v, u8 x) +{ + v |= x; + return v; +} + +int main() +{ + { + v_i64 x = {}; + x = test_v_i64(x, 42); + printf("%lld\n", x[I]); + } + + { + v_u64 x = {}; + x = test_v_u64(x, 42); + printf("%lld\n", x[I]); + } + + { + v_i32 x = {}; + x = test_v_i32(x, 42); + printf("%d\n", x[I]); + } + + { + v_u32 x = {}; + x = test_v_u32(x, 42); + printf("%d\n", x[I]); + } + + { + v_i16 x = {}; + x = test_v_i16(x, 42); + printf("%d\n", x[I]); + } + + { + v_u16 x = {}; + x = test_v_u16(x, 42); + printf("%d\n", x[I]); + } + + { + v_i8 x = {}; + x = test_v_i8(x, 42); + printf("%d\n", x[I]); + } + + { + v_u8 x = {}; + x = test_v_u8(x, 42); + printf("%d\n", x[I]); + } + + return 0; +} +--EXPECT-- +42 +42 +42 +42 +42 +42 +42 +42 diff --git a/tests/vector/or-005.test b/tests/vector/or-005.test new file mode 100644 index 0000000..61759b0 --- /dev/null +++ b/tests/vector/or-005.test @@ -0,0 +1,139 @@ +--TEST-- +OR.005: 64-bit vectors SSE2 +--TARGET-- +!aarch64 +--ARGS-- +-mno-sse4 -mno-avx2 --run +--CODE-- +#define N 16 +#define I 1 + +int printf(const char *, ...); + +typedef long long i64; +typedef unsigned long long u64; +typedef int i32; +typedef unsigned int u32; +typedef short i16; +typedef unsigned short u16; +typedef char i8; +typedef unsigned char u8; + +typedef i64 __attribute__((__vector_size__(N))) v_i64; +typedef u64 __attribute__((__vector_size__(N))) v_u64; +typedef i32 __attribute__((__vector_size__(N))) v_i32; +typedef u32 __attribute__((__vector_size__(N))) v_u32; +typedef i16 __attribute__((__vector_size__(N))) v_i16; +typedef u16 __attribute__((__vector_size__(N))) v_u16; +typedef i8 __attribute__((__vector_size__(N))) v_i8; +typedef u8 __attribute__((__vector_size__(N))) v_u8; + +v_i64 __attribute__((noinline)) test_v_i64(v_i64 v, i64 x) +{ + v |= x; + return v; +} + +v_u64 __attribute__((noinline)) test_v_u64(v_u64 v, u64 x) +{ + v |= x; + return v; +} + +v_i32 __attribute__((noinline)) test_v_i32(v_i32 v, i32 x) +{ + v |= x; + return v; +} + +v_u32 __attribute__((noinline)) test_v_u32(v_u32 v, u32 x) +{ + v |= x; + return v; +} + +v_i16 __attribute__((noinline)) test_v_i16(v_i16 v, i16 x) +{ + v |= x; + return v; +} + +v_u16 __attribute__((noinline)) test_v_u16(v_u16 v, u16 x) +{ + v |= x; + return v; +} + +v_i8 __attribute__((noinline)) test_v_i8(v_i8 v, i8 x) +{ + v |= x; + return v; +} + +v_u8 __attribute__((noinline)) test_v_u8(v_u8 v, u8 x) +{ + v |= x; + return v; +} + +int main() +{ + { + v_i64 x = {}; + x = test_v_i64(x, 42); + printf("%lld\n", x[I]); + } + + { + v_u64 x = {}; + x = test_v_u64(x, 42); + printf("%lld\n", x[I]); + } + + { + v_i32 x = {}; + x = test_v_i32(x, 42); + printf("%d\n", x[I]); + } + + { + v_u32 x = {}; + x = test_v_u32(x, 42); + printf("%d\n", x[I]); + } + + { + v_i16 x = {}; + x = test_v_i16(x, 42); + printf("%d\n", x[I]); + } + + { + v_u16 x = {}; + x = test_v_u16(x, 42); + printf("%d\n", x[I]); + } + + { + v_i8 x = {}; + x = test_v_i8(x, 42); + printf("%d\n", x[I]); + } + + { + v_u8 x = {}; + x = test_v_u8(x, 42); + printf("%d\n", x[I]); + } + + return 0; +} +--EXPECT-- +42 +42 +42 +42 +42 +42 +42 +42 diff --git a/tests/vector/or-006.test b/tests/vector/or-006.test new file mode 100644 index 0000000..9dba59a --- /dev/null +++ b/tests/vector/or-006.test @@ -0,0 +1,139 @@ +--TEST-- +OR.006: 256-bit vectors AVX +--TARGET-- +!aarch64 +--ARGS-- +-mavx -mno-avx2 --run +--CODE-- +#define N 16 +#define I 1 + +int printf(const char *, ...); + +typedef long long i64; +typedef unsigned long long u64; +typedef int i32; +typedef unsigned int u32; +typedef short i16; +typedef unsigned short u16; +typedef char i8; +typedef unsigned char u8; + +typedef i64 __attribute__((__vector_size__(N))) v_i64; +typedef u64 __attribute__((__vector_size__(N))) v_u64; +typedef i32 __attribute__((__vector_size__(N))) v_i32; +typedef u32 __attribute__((__vector_size__(N))) v_u32; +typedef i16 __attribute__((__vector_size__(N))) v_i16; +typedef u16 __attribute__((__vector_size__(N))) v_u16; +typedef i8 __attribute__((__vector_size__(N))) v_i8; +typedef u8 __attribute__((__vector_size__(N))) v_u8; + +v_i64 __attribute__((noinline)) test_v_i64(v_i64 v, i64 x) +{ + v |= x; + return v; +} + +v_u64 __attribute__((noinline)) test_v_u64(v_u64 v, u64 x) +{ + v |= x; + return v; +} + +v_i32 __attribute__((noinline)) test_v_i32(v_i32 v, i32 x) +{ + v |= x; + return v; +} + +v_u32 __attribute__((noinline)) test_v_u32(v_u32 v, u32 x) +{ + v |= x; + return v; +} + +v_i16 __attribute__((noinline)) test_v_i16(v_i16 v, i16 x) +{ + v |= x; + return v; +} + +v_u16 __attribute__((noinline)) test_v_u16(v_u16 v, u16 x) +{ + v |= x; + return v; +} + +v_i8 __attribute__((noinline)) test_v_i8(v_i8 v, i8 x) +{ + v |= x; + return v; +} + +v_u8 __attribute__((noinline)) test_v_u8(v_u8 v, u8 x) +{ + v |= x; + return v; +} + +int main() +{ + { + v_i64 x = {}; + x = test_v_i64(x, 42); + printf("%lld\n", x[I]); + } + + { + v_u64 x = {}; + x = test_v_u64(x, 42); + printf("%lld\n", x[I]); + } + + { + v_i32 x = {}; + x = test_v_i32(x, 42); + printf("%d\n", x[I]); + } + + { + v_u32 x = {}; + x = test_v_u32(x, 42); + printf("%d\n", x[I]); + } + + { + v_i16 x = {}; + x = test_v_i16(x, 42); + printf("%d\n", x[I]); + } + + { + v_u16 x = {}; + x = test_v_u16(x, 42); + printf("%d\n", x[I]); + } + + { + v_i8 x = {}; + x = test_v_i8(x, 42); + printf("%d\n", x[I]); + } + + { + v_u8 x = {}; + x = test_v_u8(x, 42); + printf("%d\n", x[I]); + } + + return 0; +} +--EXPECT-- +42 +42 +42 +42 +42 +42 +42 +42 diff --git a/tests/vector/replace-001.test b/tests/vector/replace-001.test new file mode 100644 index 0000000..6fa5180 --- /dev/null +++ b/tests/vector/replace-001.test @@ -0,0 +1,167 @@ +--TEST-- +REPLACE.001: 128-bit vectors SSE2 +--TARGET-- +!aarch64 +--ARGS-- +-mno-sse4 -mno-avx2 --run +--CODE-- +#define N 16 +#define I 1 + +int printf(const char *, ...); + +typedef long long i64; +typedef unsigned long long u64; +typedef int i32; +typedef unsigned int u32; +typedef short i16; +typedef unsigned short u16; +typedef char i8; +typedef unsigned char u8; + +typedef double __attribute__((__vector_size__(N))) v_d; +typedef float __attribute__((__vector_size__(N))) v_f; +typedef i64 __attribute__((__vector_size__(N))) v_i64; +typedef u64 __attribute__((__vector_size__(N))) v_u64; +typedef i32 __attribute__((__vector_size__(N))) v_i32; +typedef u32 __attribute__((__vector_size__(N))) v_u32; +typedef i16 __attribute__((__vector_size__(N))) v_i16; +typedef u16 __attribute__((__vector_size__(N))) v_u16; +typedef i8 __attribute__((__vector_size__(N))) v_i8; +typedef u8 __attribute__((__vector_size__(N))) v_u8; + +v_d __attribute__((noinline)) test_v_d(v_d v, double x) +{ + v[I] = x; + return v; +} + +v_f __attribute__((noinline)) test_v_f(v_f v, float x) +{ + v[I] = x; + return v; +} + +v_i64 __attribute__((noinline)) test_v_i64(v_i64 v, i64 x) +{ + v[I] = x; + return v; +} + +v_u64 __attribute__((noinline)) test_v_u64(v_u64 v, u64 x) +{ + v[I] = x; + return v; +} + +v_i32 __attribute__((noinline)) test_v_i32(v_i32 v, i32 x) +{ + v[I] = x; + return v; +} + +v_u32 __attribute__((noinline)) test_v_u32(v_u32 v, u32 x) +{ + v[I] = x; + return v; +} + +v_i16 __attribute__((noinline)) test_v_i16(v_i16 v, i16 x) +{ + v[I] = x; + return v; +} + +v_u16 __attribute__((noinline)) test_v_u16(v_u16 v, u16 x) +{ + v[I] = x; + return v; +} + +v_i8 __attribute__((noinline)) test_v_i8(v_i8 v, i8 x) +{ + v[I] = x; + return v; +} + +v_u8 __attribute__((noinline)) test_v_u8(v_u8 v, u8 x) +{ + v[I] = x; + return v; +} + +int main() +{ + { + v_d x = {}; + x = test_v_d(x, 42.42); + printf("%g\n", x[I]); + } + + { + v_f x = {}; + x = test_v_f(x, 42.42); + printf("%g\n", x[I]); + } + + { + v_i64 x = {}; + x = test_v_i64(x, 42); + printf("%lld\n", x[I]); + } + + { + v_u64 x = {}; + x = test_v_u64(x, 42); + printf("%lld\n", x[I]); + } + + { + v_i32 x = {}; + x = test_v_i32(x, 42); + printf("%d\n", x[I]); + } + + { + v_u32 x = {}; + x = test_v_u32(x, 42); + printf("%d\n", x[I]); + } + + { + v_i16 x = {}; + x = test_v_i16(x, 42); + printf("%d\n", x[I]); + } + + { + v_u16 x = {}; + x = test_v_u16(x, 42); + printf("%d\n", x[I]); + } + + { + v_i8 x = {}; + x = test_v_i8(x, 42); + printf("%d\n", x[I]); + } + + { + v_u8 x = {}; + x = test_v_u8(x, 42); + printf("%d\n", x[I]); + } + + return 0; +} +--EXPECT-- +42.42 +42.42 +42 +42 +42 +42 +42 +42 +42 +42 diff --git a/tests/vector/replace-002.test b/tests/vector/replace-002.test new file mode 100644 index 0000000..8ade7ab --- /dev/null +++ b/tests/vector/replace-002.test @@ -0,0 +1,167 @@ +--TEST-- +REPLACE.002: 128-bit vectors SSE2+SSE4 +--TARGET-- +!aarch64 +--ARGS-- +-mno-avx2 --run +--CODE-- +#define N 16 +#define I 1 + +int printf(const char *, ...); + +typedef long long i64; +typedef unsigned long long u64; +typedef int i32; +typedef unsigned int u32; +typedef short i16; +typedef unsigned short u16; +typedef char i8; +typedef unsigned char u8; + +typedef double __attribute__((__vector_size__(N))) v_d; +typedef float __attribute__((__vector_size__(N))) v_f; +typedef i64 __attribute__((__vector_size__(N))) v_i64; +typedef u64 __attribute__((__vector_size__(N))) v_u64; +typedef i32 __attribute__((__vector_size__(N))) v_i32; +typedef u32 __attribute__((__vector_size__(N))) v_u32; +typedef i16 __attribute__((__vector_size__(N))) v_i16; +typedef u16 __attribute__((__vector_size__(N))) v_u16; +typedef i8 __attribute__((__vector_size__(N))) v_i8; +typedef u8 __attribute__((__vector_size__(N))) v_u8; + +v_d __attribute__((noinline)) test_v_d(v_d v, double x) +{ + v[I] = x; + return v; +} + +v_f __attribute__((noinline)) test_v_f(v_f v, float x) +{ + v[I] = x; + return v; +} + +v_i64 __attribute__((noinline)) test_v_i64(v_i64 v, i64 x) +{ + v[I] = x; + return v; +} + +v_u64 __attribute__((noinline)) test_v_u64(v_u64 v, u64 x) +{ + v[I] = x; + return v; +} + +v_i32 __attribute__((noinline)) test_v_i32(v_i32 v, i32 x) +{ + v[I] = x; + return v; +} + +v_u32 __attribute__((noinline)) test_v_u32(v_u32 v, u32 x) +{ + v[I] = x; + return v; +} + +v_i16 __attribute__((noinline)) test_v_i16(v_i16 v, i16 x) +{ + v[I] = x; + return v; +} + +v_u16 __attribute__((noinline)) test_v_u16(v_u16 v, u16 x) +{ + v[I] = x; + return v; +} + +v_i8 __attribute__((noinline)) test_v_i8(v_i8 v, i8 x) +{ + v[I] = x; + return v; +} + +v_u8 __attribute__((noinline)) test_v_u8(v_u8 v, u8 x) +{ + v[I] = x; + return v; +} + +int main() +{ + { + v_d x = {}; + x = test_v_d(x, 42.42); + printf("%g\n", x[I]); + } + + { + v_f x = {}; + x = test_v_f(x, 42.42); + printf("%g\n", x[I]); + } + + { + v_i64 x = {}; + x = test_v_i64(x, 42); + printf("%lld\n", x[I]); + } + + { + v_u64 x = {}; + x = test_v_u64(x, 42); + printf("%lld\n", x[I]); + } + + { + v_i32 x = {}; + x = test_v_i32(x, 42); + printf("%d\n", x[I]); + } + + { + v_u32 x = {}; + x = test_v_u32(x, 42); + printf("%d\n", x[I]); + } + + { + v_i16 x = {}; + x = test_v_i16(x, 42); + printf("%d\n", x[I]); + } + + { + v_u16 x = {}; + x = test_v_u16(x, 42); + printf("%d\n", x[I]); + } + + { + v_i8 x = {}; + x = test_v_i8(x, 42); + printf("%d\n", x[I]); + } + + { + v_u8 x = {}; + x = test_v_u8(x, 42); + printf("%d\n", x[I]); + } + + return 0; +} +--EXPECT-- +42.42 +42.42 +42 +42 +42 +42 +42 +42 +42 +42 diff --git a/tests/vector/replace-003.test b/tests/vector/replace-003.test new file mode 100644 index 0000000..7731043 --- /dev/null +++ b/tests/vector/replace-003.test @@ -0,0 +1,167 @@ +--TEST-- +REPLACE.003: 128-bit vectors AVX +--TARGET-- +!aarch64 +--ARGS-- +-mavx -mno-avx2 --run +--CODE-- +#define N 16 +#define I 1 + +int printf(const char *, ...); + +typedef long long i64; +typedef unsigned long long u64; +typedef int i32; +typedef unsigned int u32; +typedef short i16; +typedef unsigned short u16; +typedef char i8; +typedef unsigned char u8; + +typedef double __attribute__((__vector_size__(N))) v_d; +typedef float __attribute__((__vector_size__(N))) v_f; +typedef i64 __attribute__((__vector_size__(N))) v_i64; +typedef u64 __attribute__((__vector_size__(N))) v_u64; +typedef i32 __attribute__((__vector_size__(N))) v_i32; +typedef u32 __attribute__((__vector_size__(N))) v_u32; +typedef i16 __attribute__((__vector_size__(N))) v_i16; +typedef u16 __attribute__((__vector_size__(N))) v_u16; +typedef i8 __attribute__((__vector_size__(N))) v_i8; +typedef u8 __attribute__((__vector_size__(N))) v_u8; + +v_d __attribute__((noinline)) test_v_d(v_d v, double x) +{ + v[I] = x; + return v; +} + +v_f __attribute__((noinline)) test_v_f(v_f v, float x) +{ + v[I] = x; + return v; +} + +v_i64 __attribute__((noinline)) test_v_i64(v_i64 v, i64 x) +{ + v[I] = x; + return v; +} + +v_u64 __attribute__((noinline)) test_v_u64(v_u64 v, u64 x) +{ + v[I] = x; + return v; +} + +v_i32 __attribute__((noinline)) test_v_i32(v_i32 v, i32 x) +{ + v[I] = x; + return v; +} + +v_u32 __attribute__((noinline)) test_v_u32(v_u32 v, u32 x) +{ + v[I] = x; + return v; +} + +v_i16 __attribute__((noinline)) test_v_i16(v_i16 v, i16 x) +{ + v[I] = x; + return v; +} + +v_u16 __attribute__((noinline)) test_v_u16(v_u16 v, u16 x) +{ + v[I] = x; + return v; +} + +v_i8 __attribute__((noinline)) test_v_i8(v_i8 v, i8 x) +{ + v[I] = x; + return v; +} + +v_u8 __attribute__((noinline)) test_v_u8(v_u8 v, u8 x) +{ + v[I] = x; + return v; +} + +int main() +{ + { + v_d x = {}; + x = test_v_d(x, 42.42); + printf("%g\n", x[I]); + } + + { + v_f x = {}; + x = test_v_f(x, 42.42); + printf("%g\n", x[I]); + } + + { + v_i64 x = {}; + x = test_v_i64(x, 42); + printf("%lld\n", x[I]); + } + + { + v_u64 x = {}; + x = test_v_u64(x, 42); + printf("%lld\n", x[I]); + } + + { + v_i32 x = {}; + x = test_v_i32(x, 42); + printf("%d\n", x[I]); + } + + { + v_u32 x = {}; + x = test_v_u32(x, 42); + printf("%d\n", x[I]); + } + + { + v_i16 x = {}; + x = test_v_i16(x, 42); + printf("%d\n", x[I]); + } + + { + v_u16 x = {}; + x = test_v_u16(x, 42); + printf("%d\n", x[I]); + } + + { + v_i8 x = {}; + x = test_v_i8(x, 42); + printf("%d\n", x[I]); + } + + { + v_u8 x = {}; + x = test_v_u8(x, 42); + printf("%d\n", x[I]); + } + + return 0; +} +--EXPECT-- +42.42 +42.42 +42 +42 +42 +42 +42 +42 +42 +42 diff --git a/tests/vector/replace-004.test b/tests/vector/replace-004.test new file mode 100644 index 0000000..3e160dd --- /dev/null +++ b/tests/vector/replace-004.test @@ -0,0 +1,167 @@ +--TEST-- +REPLACE.004: 128-bit vectors AVX+AVX2 +--TARGET-- +!aarch64 +--ARGS-- +-mavx --run +--CODE-- +#define N 16 +#define I 1 + +int printf(const char *, ...); + +typedef long long i64; +typedef unsigned long long u64; +typedef int i32; +typedef unsigned int u32; +typedef short i16; +typedef unsigned short u16; +typedef char i8; +typedef unsigned char u8; + +typedef double __attribute__((__vector_size__(N))) v_d; +typedef float __attribute__((__vector_size__(N))) v_f; +typedef i64 __attribute__((__vector_size__(N))) v_i64; +typedef u64 __attribute__((__vector_size__(N))) v_u64; +typedef i32 __attribute__((__vector_size__(N))) v_i32; +typedef u32 __attribute__((__vector_size__(N))) v_u32; +typedef i16 __attribute__((__vector_size__(N))) v_i16; +typedef u16 __attribute__((__vector_size__(N))) v_u16; +typedef i8 __attribute__((__vector_size__(N))) v_i8; +typedef u8 __attribute__((__vector_size__(N))) v_u8; + +v_d __attribute__((noinline)) test_v_d(v_d v, double x) +{ + v[I] = x; + return v; +} + +v_f __attribute__((noinline)) test_v_f(v_f v, float x) +{ + v[I] = x; + return v; +} + +v_i64 __attribute__((noinline)) test_v_i64(v_i64 v, i64 x) +{ + v[I] = x; + return v; +} + +v_u64 __attribute__((noinline)) test_v_u64(v_u64 v, u64 x) +{ + v[I] = x; + return v; +} + +v_i32 __attribute__((noinline)) test_v_i32(v_i32 v, i32 x) +{ + v[I] = x; + return v; +} + +v_u32 __attribute__((noinline)) test_v_u32(v_u32 v, u32 x) +{ + v[I] = x; + return v; +} + +v_i16 __attribute__((noinline)) test_v_i16(v_i16 v, i16 x) +{ + v[I] = x; + return v; +} + +v_u16 __attribute__((noinline)) test_v_u16(v_u16 v, u16 x) +{ + v[I] = x; + return v; +} + +v_i8 __attribute__((noinline)) test_v_i8(v_i8 v, i8 x) +{ + v[I] = x; + return v; +} + +v_u8 __attribute__((noinline)) test_v_u8(v_u8 v, u8 x) +{ + v[I] = x; + return v; +} + +int main() +{ + { + v_d x = {}; + x = test_v_d(x, 42.42); + printf("%g\n", x[I]); + } + + { + v_f x = {}; + x = test_v_f(x, 42.42); + printf("%g\n", x[I]); + } + + { + v_i64 x = {}; + x = test_v_i64(x, 42); + printf("%lld\n", x[I]); + } + + { + v_u64 x = {}; + x = test_v_u64(x, 42); + printf("%lld\n", x[I]); + } + + { + v_i32 x = {}; + x = test_v_i32(x, 42); + printf("%d\n", x[I]); + } + + { + v_u32 x = {}; + x = test_v_u32(x, 42); + printf("%d\n", x[I]); + } + + { + v_i16 x = {}; + x = test_v_i16(x, 42); + printf("%d\n", x[I]); + } + + { + v_u16 x = {}; + x = test_v_u16(x, 42); + printf("%d\n", x[I]); + } + + { + v_i8 x = {}; + x = test_v_i8(x, 42); + printf("%d\n", x[I]); + } + + { + v_u8 x = {}; + x = test_v_u8(x, 42); + printf("%d\n", x[I]); + } + + return 0; +} +--EXPECT-- +42.42 +42.42 +42 +42 +42 +42 +42 +42 +42 +42 diff --git a/tests/vector/replace-005.test b/tests/vector/replace-005.test new file mode 100644 index 0000000..7ec13fd --- /dev/null +++ b/tests/vector/replace-005.test @@ -0,0 +1,167 @@ +--TEST-- +REPLACE.005: 64-bit vectors SSE2 +--TARGET-- +!aarch64 +--ARGS-- +-mno-sse4 -mno-avx2 --run +--CODE-- +#define N 8 +#define I 0 + +int printf(const char *, ...); + +typedef long long i64; +typedef unsigned long long u64; +typedef int i32; +typedef unsigned int u32; +typedef short i16; +typedef unsigned short u16; +typedef char i8; +typedef unsigned char u8; + +typedef double __attribute__((__vector_size__(N))) v_d; +typedef float __attribute__((__vector_size__(N))) v_f; +typedef i64 __attribute__((__vector_size__(N))) v_i64; +typedef u64 __attribute__((__vector_size__(N))) v_u64; +typedef i32 __attribute__((__vector_size__(N))) v_i32; +typedef u32 __attribute__((__vector_size__(N))) v_u32; +typedef i16 __attribute__((__vector_size__(N))) v_i16; +typedef u16 __attribute__((__vector_size__(N))) v_u16; +typedef i8 __attribute__((__vector_size__(N))) v_i8; +typedef u8 __attribute__((__vector_size__(N))) v_u8; + +v_d __attribute__((noinline)) test_v_d(v_d v, double x) +{ + v[I] = x; + return v; +} + +v_f __attribute__((noinline)) test_v_f(v_f v, float x) +{ + v[I] = x; + return v; +} + +v_i64 __attribute__((noinline)) test_v_i64(v_i64 v, i64 x) +{ + v[I] = x; + return v; +} + +v_u64 __attribute__((noinline)) test_v_u64(v_u64 v, u64 x) +{ + v[I] = x; + return v; +} + +v_i32 __attribute__((noinline)) test_v_i32(v_i32 v, i32 x) +{ + v[I] = x; + return v; +} + +v_u32 __attribute__((noinline)) test_v_u32(v_u32 v, u32 x) +{ + v[I] = x; + return v; +} + +v_i16 __attribute__((noinline)) test_v_i16(v_i16 v, i16 x) +{ + v[I] = x; + return v; +} + +v_u16 __attribute__((noinline)) test_v_u16(v_u16 v, u16 x) +{ + v[I] = x; + return v; +} + +v_i8 __attribute__((noinline)) test_v_i8(v_i8 v, i8 x) +{ + v[I] = x; + return v; +} + +v_u8 __attribute__((noinline)) test_v_u8(v_u8 v, u8 x) +{ + v[I] = x; + return v; +} + +int main() +{ + { + v_d x = {}; + x = test_v_d(x, 42.42); + printf("%g\n", x[I]); + } + + { + v_f x = {}; + x = test_v_f(x, 42.42); + printf("%g\n", x[I]); + } + + { + v_i64 x = {}; + x = test_v_i64(x, 42); + printf("%lld\n", x[I]); + } + + { + v_u64 x = {}; + x = test_v_u64(x, 42); + printf("%lld\n", x[I]); + } + + { + v_i32 x = {}; + x = test_v_i32(x, 42); + printf("%d\n", x[I]); + } + + { + v_u32 x = {}; + x = test_v_u32(x, 42); + printf("%d\n", x[I]); + } + + { + v_i16 x = {}; + x = test_v_i16(x, 42); + printf("%d\n", x[I]); + } + + { + v_u16 x = {}; + x = test_v_u16(x, 42); + printf("%d\n", x[I]); + } + + { + v_i8 x = {}; + x = test_v_i8(x, 42); + printf("%d\n", x[I]); + } + + { + v_u8 x = {}; + x = test_v_u8(x, 42); + printf("%d\n", x[I]); + } + + return 0; +} +--EXPECT-- +42.42 +42.42 +42 +42 +42 +42 +42 +42 +42 +42 diff --git a/tests/vector/replace-006.test b/tests/vector/replace-006.test new file mode 100644 index 0000000..852b275 --- /dev/null +++ b/tests/vector/replace-006.test @@ -0,0 +1,167 @@ +--TEST-- +REPLACE.006: 64-bit vectors SSE2+SSE4 +--TARGET-- +!aarch64 +--ARGS-- +-mno-avx2 --run +--CODE-- +#define N 8 +#define I 0 + +int printf(const char *, ...); + +typedef long long i64; +typedef unsigned long long u64; +typedef int i32; +typedef unsigned int u32; +typedef short i16; +typedef unsigned short u16; +typedef char i8; +typedef unsigned char u8; + +typedef double __attribute__((__vector_size__(N))) v_d; +typedef float __attribute__((__vector_size__(N))) v_f; +typedef i64 __attribute__((__vector_size__(N))) v_i64; +typedef u64 __attribute__((__vector_size__(N))) v_u64; +typedef i32 __attribute__((__vector_size__(N))) v_i32; +typedef u32 __attribute__((__vector_size__(N))) v_u32; +typedef i16 __attribute__((__vector_size__(N))) v_i16; +typedef u16 __attribute__((__vector_size__(N))) v_u16; +typedef i8 __attribute__((__vector_size__(N))) v_i8; +typedef u8 __attribute__((__vector_size__(N))) v_u8; + +v_d __attribute__((noinline)) test_v_d(v_d v, double x) +{ + v[I] = x; + return v; +} + +v_f __attribute__((noinline)) test_v_f(v_f v, float x) +{ + v[I] = x; + return v; +} + +v_i64 __attribute__((noinline)) test_v_i64(v_i64 v, i64 x) +{ + v[I] = x; + return v; +} + +v_u64 __attribute__((noinline)) test_v_u64(v_u64 v, u64 x) +{ + v[I] = x; + return v; +} + +v_i32 __attribute__((noinline)) test_v_i32(v_i32 v, i32 x) +{ + v[I] = x; + return v; +} + +v_u32 __attribute__((noinline)) test_v_u32(v_u32 v, u32 x) +{ + v[I] = x; + return v; +} + +v_i16 __attribute__((noinline)) test_v_i16(v_i16 v, i16 x) +{ + v[I] = x; + return v; +} + +v_u16 __attribute__((noinline)) test_v_u16(v_u16 v, u16 x) +{ + v[I] = x; + return v; +} + +v_i8 __attribute__((noinline)) test_v_i8(v_i8 v, i8 x) +{ + v[I] = x; + return v; +} + +v_u8 __attribute__((noinline)) test_v_u8(v_u8 v, u8 x) +{ + v[I] = x; + return v; +} + +int main() +{ + { + v_d x = {}; + x = test_v_d(x, 42.42); + printf("%g\n", x[I]); + } + + { + v_f x = {}; + x = test_v_f(x, 42.42); + printf("%g\n", x[I]); + } + + { + v_i64 x = {}; + x = test_v_i64(x, 42); + printf("%lld\n", x[I]); + } + + { + v_u64 x = {}; + x = test_v_u64(x, 42); + printf("%lld\n", x[I]); + } + + { + v_i32 x = {}; + x = test_v_i32(x, 42); + printf("%d\n", x[I]); + } + + { + v_u32 x = {}; + x = test_v_u32(x, 42); + printf("%d\n", x[I]); + } + + { + v_i16 x = {}; + x = test_v_i16(x, 42); + printf("%d\n", x[I]); + } + + { + v_u16 x = {}; + x = test_v_u16(x, 42); + printf("%d\n", x[I]); + } + + { + v_i8 x = {}; + x = test_v_i8(x, 42); + printf("%d\n", x[I]); + } + + { + v_u8 x = {}; + x = test_v_u8(x, 42); + printf("%d\n", x[I]); + } + + return 0; +} +--EXPECT-- +42.42 +42.42 +42 +42 +42 +42 +42 +42 +42 +42 diff --git a/tests/vector/replace-007.test b/tests/vector/replace-007.test new file mode 100644 index 0000000..5fbb784 --- /dev/null +++ b/tests/vector/replace-007.test @@ -0,0 +1,167 @@ +--TEST-- +REPLACE.007: 64-bit vectors AVX +--TARGET-- +!aarch64 +--ARGS-- +-mavx -mno-avx2 --run +--CODE-- +#define N 8 +#define I 0 + +int printf(const char *, ...); + +typedef long long i64; +typedef unsigned long long u64; +typedef int i32; +typedef unsigned int u32; +typedef short i16; +typedef unsigned short u16; +typedef char i8; +typedef unsigned char u8; + +typedef double __attribute__((__vector_size__(N))) v_d; +typedef float __attribute__((__vector_size__(N))) v_f; +typedef i64 __attribute__((__vector_size__(N))) v_i64; +typedef u64 __attribute__((__vector_size__(N))) v_u64; +typedef i32 __attribute__((__vector_size__(N))) v_i32; +typedef u32 __attribute__((__vector_size__(N))) v_u32; +typedef i16 __attribute__((__vector_size__(N))) v_i16; +typedef u16 __attribute__((__vector_size__(N))) v_u16; +typedef i8 __attribute__((__vector_size__(N))) v_i8; +typedef u8 __attribute__((__vector_size__(N))) v_u8; + +v_d __attribute__((noinline)) test_v_d(v_d v, double x) +{ + v[I] = x; + return v; +} + +v_f __attribute__((noinline)) test_v_f(v_f v, float x) +{ + v[I] = x; + return v; +} + +v_i64 __attribute__((noinline)) test_v_i64(v_i64 v, i64 x) +{ + v[I] = x; + return v; +} + +v_u64 __attribute__((noinline)) test_v_u64(v_u64 v, u64 x) +{ + v[I] = x; + return v; +} + +v_i32 __attribute__((noinline)) test_v_i32(v_i32 v, i32 x) +{ + v[I] = x; + return v; +} + +v_u32 __attribute__((noinline)) test_v_u32(v_u32 v, u32 x) +{ + v[I] = x; + return v; +} + +v_i16 __attribute__((noinline)) test_v_i16(v_i16 v, i16 x) +{ + v[I] = x; + return v; +} + +v_u16 __attribute__((noinline)) test_v_u16(v_u16 v, u16 x) +{ + v[I] = x; + return v; +} + +v_i8 __attribute__((noinline)) test_v_i8(v_i8 v, i8 x) +{ + v[I] = x; + return v; +} + +v_u8 __attribute__((noinline)) test_v_u8(v_u8 v, u8 x) +{ + v[I] = x; + return v; +} + +int main() +{ + { + v_d x = {}; + x = test_v_d(x, 42.42); + printf("%g\n", x[I]); + } + + { + v_f x = {}; + x = test_v_f(x, 42.42); + printf("%g\n", x[I]); + } + + { + v_i64 x = {}; + x = test_v_i64(x, 42); + printf("%lld\n", x[I]); + } + + { + v_u64 x = {}; + x = test_v_u64(x, 42); + printf("%lld\n", x[I]); + } + + { + v_i32 x = {}; + x = test_v_i32(x, 42); + printf("%d\n", x[I]); + } + + { + v_u32 x = {}; + x = test_v_u32(x, 42); + printf("%d\n", x[I]); + } + + { + v_i16 x = {}; + x = test_v_i16(x, 42); + printf("%d\n", x[I]); + } + + { + v_u16 x = {}; + x = test_v_u16(x, 42); + printf("%d\n", x[I]); + } + + { + v_i8 x = {}; + x = test_v_i8(x, 42); + printf("%d\n", x[I]); + } + + { + v_u8 x = {}; + x = test_v_u8(x, 42); + printf("%d\n", x[I]); + } + + return 0; +} +--EXPECT-- +42.42 +42.42 +42 +42 +42 +42 +42 +42 +42 +42 diff --git a/tests/vector/replace-008.test b/tests/vector/replace-008.test new file mode 100644 index 0000000..0174ff5 --- /dev/null +++ b/tests/vector/replace-008.test @@ -0,0 +1,167 @@ +--TEST-- +REPLACE.008: 64-bit vectors AVX+AVX2 +--TARGET-- +!aarch64 +--ARGS-- +-mavx --run +--CODE-- +#define N 8 +#define I 0 + +int printf(const char *, ...); + +typedef long long i64; +typedef unsigned long long u64; +typedef int i32; +typedef unsigned int u32; +typedef short i16; +typedef unsigned short u16; +typedef char i8; +typedef unsigned char u8; + +typedef double __attribute__((__vector_size__(N))) v_d; +typedef float __attribute__((__vector_size__(N))) v_f; +typedef i64 __attribute__((__vector_size__(N))) v_i64; +typedef u64 __attribute__((__vector_size__(N))) v_u64; +typedef i32 __attribute__((__vector_size__(N))) v_i32; +typedef u32 __attribute__((__vector_size__(N))) v_u32; +typedef i16 __attribute__((__vector_size__(N))) v_i16; +typedef u16 __attribute__((__vector_size__(N))) v_u16; +typedef i8 __attribute__((__vector_size__(N))) v_i8; +typedef u8 __attribute__((__vector_size__(N))) v_u8; + +v_d __attribute__((noinline)) test_v_d(v_d v, double x) +{ + v[I] = x; + return v; +} + +v_f __attribute__((noinline)) test_v_f(v_f v, float x) +{ + v[I] = x; + return v; +} + +v_i64 __attribute__((noinline)) test_v_i64(v_i64 v, i64 x) +{ + v[I] = x; + return v; +} + +v_u64 __attribute__((noinline)) test_v_u64(v_u64 v, u64 x) +{ + v[I] = x; + return v; +} + +v_i32 __attribute__((noinline)) test_v_i32(v_i32 v, i32 x) +{ + v[I] = x; + return v; +} + +v_u32 __attribute__((noinline)) test_v_u32(v_u32 v, u32 x) +{ + v[I] = x; + return v; +} + +v_i16 __attribute__((noinline)) test_v_i16(v_i16 v, i16 x) +{ + v[I] = x; + return v; +} + +v_u16 __attribute__((noinline)) test_v_u16(v_u16 v, u16 x) +{ + v[I] = x; + return v; +} + +v_i8 __attribute__((noinline)) test_v_i8(v_i8 v, i8 x) +{ + v[I] = x; + return v; +} + +v_u8 __attribute__((noinline)) test_v_u8(v_u8 v, u8 x) +{ + v[I] = x; + return v; +} + +int main() +{ + { + v_d x = {}; + x = test_v_d(x, 42.42); + printf("%g\n", x[I]); + } + + { + v_f x = {}; + x = test_v_f(x, 42.42); + printf("%g\n", x[I]); + } + + { + v_i64 x = {}; + x = test_v_i64(x, 42); + printf("%lld\n", x[I]); + } + + { + v_u64 x = {}; + x = test_v_u64(x, 42); + printf("%lld\n", x[I]); + } + + { + v_i32 x = {}; + x = test_v_i32(x, 42); + printf("%d\n", x[I]); + } + + { + v_u32 x = {}; + x = test_v_u32(x, 42); + printf("%d\n", x[I]); + } + + { + v_i16 x = {}; + x = test_v_i16(x, 42); + printf("%d\n", x[I]); + } + + { + v_u16 x = {}; + x = test_v_u16(x, 42); + printf("%d\n", x[I]); + } + + { + v_i8 x = {}; + x = test_v_i8(x, 42); + printf("%d\n", x[I]); + } + + { + v_u8 x = {}; + x = test_v_u8(x, 42); + printf("%d\n", x[I]); + } + + return 0; +} +--EXPECT-- +42.42 +42.42 +42 +42 +42 +42 +42 +42 +42 +42 diff --git a/tests/vector/replace-009.test b/tests/vector/replace-009.test new file mode 100644 index 0000000..856a312 --- /dev/null +++ b/tests/vector/replace-009.test @@ -0,0 +1,167 @@ +--TEST-- +REPLACE.009: 256-bit vectors AVX (low) +--TARGET-- +!aarch64 +--ARGS-- +-mavx -mno-avx2 --run +--CODE-- +#define N 32 +#define I 1 + +int printf(const char *, ...); + +typedef long long i64; +typedef unsigned long long u64; +typedef int i32; +typedef unsigned int u32; +typedef short i16; +typedef unsigned short u16; +typedef char i8; +typedef unsigned char u8; + +typedef double __attribute__((__vector_size__(N))) v_d; +typedef float __attribute__((__vector_size__(N))) v_f; +typedef i64 __attribute__((__vector_size__(N))) v_i64; +typedef u64 __attribute__((__vector_size__(N))) v_u64; +typedef i32 __attribute__((__vector_size__(N))) v_i32; +typedef u32 __attribute__((__vector_size__(N))) v_u32; +typedef i16 __attribute__((__vector_size__(N))) v_i16; +typedef u16 __attribute__((__vector_size__(N))) v_u16; +typedef i8 __attribute__((__vector_size__(N))) v_i8; +typedef u8 __attribute__((__vector_size__(N))) v_u8; + +v_d __attribute__((noinline)) test_v_d(v_d v, double x) +{ + v[I] = x; + return v; +} + +v_f __attribute__((noinline)) test_v_f(v_f v, float x) +{ + v[I] = x; + return v; +} + +v_i64 __attribute__((noinline)) test_v_i64(v_i64 v, i64 x) +{ + v[I] = x; + return v; +} + +v_u64 __attribute__((noinline)) test_v_u64(v_u64 v, u64 x) +{ + v[I] = x; + return v; +} + +v_i32 __attribute__((noinline)) test_v_i32(v_i32 v, i32 x) +{ + v[I] = x; + return v; +} + +v_u32 __attribute__((noinline)) test_v_u32(v_u32 v, u32 x) +{ + v[I] = x; + return v; +} + +v_i16 __attribute__((noinline)) test_v_i16(v_i16 v, i16 x) +{ + v[I] = x; + return v; +} + +v_u16 __attribute__((noinline)) test_v_u16(v_u16 v, u16 x) +{ + v[I] = x; + return v; +} + +v_i8 __attribute__((noinline)) test_v_i8(v_i8 v, i8 x) +{ + v[I] = x; + return v; +} + +v_u8 __attribute__((noinline)) test_v_u8(v_u8 v, u8 x) +{ + v[I] = x; + return v; +} + +int main() +{ + { + v_d x = {}; + x = test_v_d(x, 42.42); + printf("%g\n", x[I]); + } + + { + v_f x = {}; + x = test_v_f(x, 42.42); + printf("%g\n", x[I]); + } + + { + v_i64 x = {}; + x = test_v_i64(x, 42); + printf("%lld\n", x[I]); + } + + { + v_u64 x = {}; + x = test_v_u64(x, 42); + printf("%lld\n", x[I]); + } + + { + v_i32 x = {}; + x = test_v_i32(x, 42); + printf("%d\n", x[I]); + } + + { + v_u32 x = {}; + x = test_v_u32(x, 42); + printf("%d\n", x[I]); + } + + { + v_i16 x = {}; + x = test_v_i16(x, 42); + printf("%d\n", x[I]); + } + + { + v_u16 x = {}; + x = test_v_u16(x, 42); + printf("%d\n", x[I]); + } + + { + v_i8 x = {}; + x = test_v_i8(x, 42); + printf("%d\n", x[I]); + } + + { + v_u8 x = {}; + x = test_v_u8(x, 42); + printf("%d\n", x[I]); + } + + return 0; +} +--EXPECT-- +42.42 +42.42 +42 +42 +42 +42 +42 +42 +42 +42 diff --git a/tests/vector/replace-010.test b/tests/vector/replace-010.test new file mode 100644 index 0000000..bf91c0f --- /dev/null +++ b/tests/vector/replace-010.test @@ -0,0 +1,167 @@ +--TEST-- +REPLACE.010: 256-bit vectors AVX+AVX2 (low) +--TARGET-- +!aarch64 +--ARGS-- +-mavx --run +--CODE-- +#define N 32 +#define I 1 + +int printf(const char *, ...); + +typedef long long i64; +typedef unsigned long long u64; +typedef int i32; +typedef unsigned int u32; +typedef short i16; +typedef unsigned short u16; +typedef char i8; +typedef unsigned char u8; + +typedef double __attribute__((__vector_size__(N))) v_d; +typedef float __attribute__((__vector_size__(N))) v_f; +typedef i64 __attribute__((__vector_size__(N))) v_i64; +typedef u64 __attribute__((__vector_size__(N))) v_u64; +typedef i32 __attribute__((__vector_size__(N))) v_i32; +typedef u32 __attribute__((__vector_size__(N))) v_u32; +typedef i16 __attribute__((__vector_size__(N))) v_i16; +typedef u16 __attribute__((__vector_size__(N))) v_u16; +typedef i8 __attribute__((__vector_size__(N))) v_i8; +typedef u8 __attribute__((__vector_size__(N))) v_u8; + +v_d __attribute__((noinline)) test_v_d(v_d v, double x) +{ + v[I] = x; + return v; +} + +v_f __attribute__((noinline)) test_v_f(v_f v, float x) +{ + v[I] = x; + return v; +} + +v_i64 __attribute__((noinline)) test_v_i64(v_i64 v, i64 x) +{ + v[I] = x; + return v; +} + +v_u64 __attribute__((noinline)) test_v_u64(v_u64 v, u64 x) +{ + v[I] = x; + return v; +} + +v_i32 __attribute__((noinline)) test_v_i32(v_i32 v, i32 x) +{ + v[I] = x; + return v; +} + +v_u32 __attribute__((noinline)) test_v_u32(v_u32 v, u32 x) +{ + v[I] = x; + return v; +} + +v_i16 __attribute__((noinline)) test_v_i16(v_i16 v, i16 x) +{ + v[I] = x; + return v; +} + +v_u16 __attribute__((noinline)) test_v_u16(v_u16 v, u16 x) +{ + v[I] = x; + return v; +} + +v_i8 __attribute__((noinline)) test_v_i8(v_i8 v, i8 x) +{ + v[I] = x; + return v; +} + +v_u8 __attribute__((noinline)) test_v_u8(v_u8 v, u8 x) +{ + v[I] = x; + return v; +} + +int main() +{ + { + v_d x = {}; + x = test_v_d(x, 42.42); + printf("%g\n", x[I]); + } + + { + v_f x = {}; + x = test_v_f(x, 42.42); + printf("%g\n", x[I]); + } + + { + v_i64 x = {}; + x = test_v_i64(x, 42); + printf("%lld\n", x[I]); + } + + { + v_u64 x = {}; + x = test_v_u64(x, 42); + printf("%lld\n", x[I]); + } + + { + v_i32 x = {}; + x = test_v_i32(x, 42); + printf("%d\n", x[I]); + } + + { + v_u32 x = {}; + x = test_v_u32(x, 42); + printf("%d\n", x[I]); + } + + { + v_i16 x = {}; + x = test_v_i16(x, 42); + printf("%d\n", x[I]); + } + + { + v_u16 x = {}; + x = test_v_u16(x, 42); + printf("%d\n", x[I]); + } + + { + v_i8 x = {}; + x = test_v_i8(x, 42); + printf("%d\n", x[I]); + } + + { + v_u8 x = {}; + x = test_v_u8(x, 42); + printf("%d\n", x[I]); + } + + return 0; +} +--EXPECT-- +42.42 +42.42 +42 +42 +42 +42 +42 +42 +42 +42 diff --git a/tests/vector/replace-011.test b/tests/vector/replace-011.test new file mode 100644 index 0000000..d2dad6e --- /dev/null +++ b/tests/vector/replace-011.test @@ -0,0 +1,166 @@ +--TEST-- +REPLACE.011: 256-bit vectors AVX (high) +--TARGET-- +!aarch64 +--ARGS-- +-mavx -mno-avx2 --run +--CODE-- +#define N 32 + +int printf(const char *, ...); + +typedef long long i64; +typedef unsigned long long u64; +typedef int i32; +typedef unsigned int u32; +typedef short i16; +typedef unsigned short u16; +typedef char i8; +typedef unsigned char u8; + +typedef double __attribute__((__vector_size__(N))) v_d; +typedef float __attribute__((__vector_size__(N))) v_f; +typedef i64 __attribute__((__vector_size__(N))) v_i64; +typedef u64 __attribute__((__vector_size__(N))) v_u64; +typedef i32 __attribute__((__vector_size__(N))) v_i32; +typedef u32 __attribute__((__vector_size__(N))) v_u32; +typedef i16 __attribute__((__vector_size__(N))) v_i16; +typedef u16 __attribute__((__vector_size__(N))) v_u16; +typedef i8 __attribute__((__vector_size__(N))) v_i8; +typedef u8 __attribute__((__vector_size__(N))) v_u8; + +v_d __attribute__((noinline)) test_v_d(v_d v, double x) +{ + v[3] = x; + return v; +} + +v_f __attribute__((noinline)) test_v_f(v_f v, float x) +{ + v[5] = x; + return v; +} + +v_i64 __attribute__((noinline)) test_v_i64(v_i64 v, i64 x) +{ + v[3] = x; + return v; +} + +v_u64 __attribute__((noinline)) test_v_u64(v_u64 v, u64 x) +{ + v[3] = x; + return v; +} + +v_i32 __attribute__((noinline)) test_v_i32(v_i32 v, i32 x) +{ + v[5] = x; + return v; +} + +v_u32 __attribute__((noinline)) test_v_u32(v_u32 v, u32 x) +{ + v[5] = x; + return v; +} + +v_i16 __attribute__((noinline)) test_v_i16(v_i16 v, i16 x) +{ + v[9] = x; + return v; +} + +v_u16 __attribute__((noinline)) test_v_u16(v_u16 v, u16 x) +{ + v[9] = x; + return v; +} + +v_i8 __attribute__((noinline)) test_v_i8(v_i8 v, i8 x) +{ + v[17] = x; + return v; +} + +v_u8 __attribute__((noinline)) test_v_u8(v_u8 v, u8 x) +{ + v[17] = x; + return v; +} + +int main() +{ + { + v_d x = {}; + x = test_v_d(x, 42.42); + printf("%g\n", x[3]); + } + + { + v_f x = {}; + x = test_v_f(x, 42.42); + printf("%g\n", x[5]); + } + + { + v_i64 x = {}; + x = test_v_i64(x, 42); + printf("%lld\n", x[3]); + } + + { + v_u64 x = {}; + x = test_v_u64(x, 42); + printf("%lld\n", x[3]); + } + + { + v_i32 x = {}; + x = test_v_i32(x, 42); + printf("%d\n", x[5]); + } + + { + v_u32 x = {}; + x = test_v_u32(x, 42); + printf("%d\n", x[5]); + } + + { + v_i16 x = {}; + x = test_v_i16(x, 42); + printf("%d\n", x[9]); + } + + { + v_u16 x = {}; + x = test_v_u16(x, 42); + printf("%d\n", x[9]); + } + + { + v_i8 x = {}; + x = test_v_i8(x, 42); + printf("%d\n", x[17]); + } + + { + v_u8 x = {}; + x = test_v_u8(x, 42); + printf("%d\n", x[17]); + } + + return 0; +} +--EXPECT-- +42.42 +42.42 +42 +42 +42 +42 +42 +42 +42 +42 diff --git a/tests/vector/replace-012.test b/tests/vector/replace-012.test new file mode 100644 index 0000000..b4c442b --- /dev/null +++ b/tests/vector/replace-012.test @@ -0,0 +1,166 @@ +--TEST-- +REPLACE.012: 256-bit vectors AVX+AVX2 (high) +--TARGET-- +!aarch64 +--ARGS-- +-mavx --run +--CODE-- +#define N 32 + +int printf(const char *, ...); + +typedef long long i64; +typedef unsigned long long u64; +typedef int i32; +typedef unsigned int u32; +typedef short i16; +typedef unsigned short u16; +typedef char i8; +typedef unsigned char u8; + +typedef double __attribute__((__vector_size__(N))) v_d; +typedef float __attribute__((__vector_size__(N))) v_f; +typedef i64 __attribute__((__vector_size__(N))) v_i64; +typedef u64 __attribute__((__vector_size__(N))) v_u64; +typedef i32 __attribute__((__vector_size__(N))) v_i32; +typedef u32 __attribute__((__vector_size__(N))) v_u32; +typedef i16 __attribute__((__vector_size__(N))) v_i16; +typedef u16 __attribute__((__vector_size__(N))) v_u16; +typedef i8 __attribute__((__vector_size__(N))) v_i8; +typedef u8 __attribute__((__vector_size__(N))) v_u8; + +v_d __attribute__((noinline)) test_v_d(v_d v, double x) +{ + v[3] = x; + return v; +} + +v_f __attribute__((noinline)) test_v_f(v_f v, float x) +{ + v[5] = x; + return v; +} + +v_i64 __attribute__((noinline)) test_v_i64(v_i64 v, i64 x) +{ + v[3] = x; + return v; +} + +v_u64 __attribute__((noinline)) test_v_u64(v_u64 v, u64 x) +{ + v[3] = x; + return v; +} + +v_i32 __attribute__((noinline)) test_v_i32(v_i32 v, i32 x) +{ + v[5] = x; + return v; +} + +v_u32 __attribute__((noinline)) test_v_u32(v_u32 v, u32 x) +{ + v[5] = x; + return v; +} + +v_i16 __attribute__((noinline)) test_v_i16(v_i16 v, i16 x) +{ + v[9] = x; + return v; +} + +v_u16 __attribute__((noinline)) test_v_u16(v_u16 v, u16 x) +{ + v[9] = x; + return v; +} + +v_i8 __attribute__((noinline)) test_v_i8(v_i8 v, i8 x) +{ + v[17] = x; + return v; +} + +v_u8 __attribute__((noinline)) test_v_u8(v_u8 v, u8 x) +{ + v[17] = x; + return v; +} + +int main() +{ + { + v_d x = {}; + x = test_v_d(x, 42.42); + printf("%g\n", x[3]); + } + + { + v_f x = {}; + x = test_v_f(x, 42.42); + printf("%g\n", x[5]); + } + + { + v_i64 x = {}; + x = test_v_i64(x, 42); + printf("%lld\n", x[3]); + } + + { + v_u64 x = {}; + x = test_v_u64(x, 42); + printf("%lld\n", x[3]); + } + + { + v_i32 x = {}; + x = test_v_i32(x, 42); + printf("%d\n", x[5]); + } + + { + v_u32 x = {}; + x = test_v_u32(x, 42); + printf("%d\n", x[5]); + } + + { + v_i16 x = {}; + x = test_v_i16(x, 42); + printf("%d\n", x[9]); + } + + { + v_u16 x = {}; + x = test_v_u16(x, 42); + printf("%d\n", x[9]); + } + + { + v_i8 x = {}; + x = test_v_i8(x, 42); + printf("%d\n", x[17]); + } + + { + v_u8 x = {}; + x = test_v_u8(x, 42); + printf("%d\n", x[17]); + } + + return 0; +} +--EXPECT-- +42.42 +42.42 +42 +42 +42 +42 +42 +42 +42 +42 diff --git a/tests/vector/shl-001.test b/tests/vector/shl-001.test new file mode 100644 index 0000000..fa78898 --- /dev/null +++ b/tests/vector/shl-001.test @@ -0,0 +1,139 @@ +--TEST-- +SHL.001: 128-bit vectors SSE2 +--TARGET-- +!aarch64 +--ARGS-- +-mno-sse4 -mno-avx2 --run +--CODE-- +#define N 16 +#define I 1 + +int printf(const char *, ...); + +typedef long long i64; +typedef unsigned long long u64; +typedef int i32; +typedef unsigned int u32; +typedef short i16; +typedef unsigned short u16; +typedef char i8; +typedef unsigned char u8; + +typedef i64 __attribute__((__vector_size__(N))) v_i64; +typedef u64 __attribute__((__vector_size__(N))) v_u64; +typedef i32 __attribute__((__vector_size__(N))) v_i32; +typedef u32 __attribute__((__vector_size__(N))) v_u32; +typedef i16 __attribute__((__vector_size__(N))) v_i16; +typedef u16 __attribute__((__vector_size__(N))) v_u16; +typedef i8 __attribute__((__vector_size__(N))) v_i8; +typedef u8 __attribute__((__vector_size__(N))) v_u8; + +v_i64 __attribute__((noinline)) test_v_i64(v_i64 v, i64 x) +{ + v = v << x; + return v; +} + +v_u64 __attribute__((noinline)) test_v_u64(v_u64 v, u64 x) +{ + v = v << x; + return v; +} + +v_i32 __attribute__((noinline)) test_v_i32(v_i32 v, i32 x) +{ + v = v << x; + return v; +} + +v_u32 __attribute__((noinline)) test_v_u32(v_u32 v, u32 x) +{ + v = v << x; + return v; +} + +v_i16 __attribute__((noinline)) test_v_i16(v_i16 v, i16 x) +{ + v = v << x; + return v; +} + +v_u16 __attribute__((noinline)) test_v_u16(v_u16 v, u16 x) +{ + v = v << x; + return v; +} + +v_i8 __attribute__((noinline)) test_v_i8(v_i8 v, i8 x) +{ + v = v << x; + return v; +} + +v_u8 __attribute__((noinline)) test_v_u8(v_u8 v, u8 x) +{ + v = v << x; + return v; +} + +int main() +{ + { + v_i64 x = {42, 42}; + x = test_v_i64(x, 2); + printf("%lld\n", x[I]); + } + + { + v_u64 x = {42, 42}; + x = test_v_u64(x, 2); + printf("%lld\n", x[I]); + } + + { + v_i32 x = {42, 42, 42, 42}; + x = test_v_i32(x, 2); + printf("%d\n", x[I]); + } + + { + v_u32 x = {42, 42, 42, 42}; + x = test_v_u32(x, 2); + printf("%d\n", x[I]); + } + + { + v_i16 x = {42, 42, 42, 42, 42, 42, 42, 42}; + x = test_v_i16(x, 2); + printf("%d\n", x[I]); + } + + { + v_u16 x = {42, 42, 42, 42, 42, 42, 42, 42}; + x = test_v_u16(x, 2); + printf("%d\n", x[I]); + } + + { + v_i8 x = {42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42}; + x = test_v_i8(x, 2); + printf("%d\n", (u8)x[I]); + } + + { + v_u8 x = {42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42}; + x = test_v_u8(x, 2); + printf("%d\n", x[I]); + } + + return 0; +} +--EXPECT-- +168 +168 +168 +168 +168 +168 +168 +168 diff --git a/tests/vector/shr-001.test b/tests/vector/shr-001.test new file mode 100644 index 0000000..ecf04ff --- /dev/null +++ b/tests/vector/shr-001.test @@ -0,0 +1,139 @@ +--TEST-- +SHR.001: 128-bit vectors SSE2 +--TARGET-- +!aarch64 +--ARGS-- +-mno-sse4 -mno-avx2 --run +--CODE-- +#define N 16 +#define I 1 + +int printf(const char *, ...); + +typedef long long i64; +typedef unsigned long long u64; +typedef int i32; +typedef unsigned int u32; +typedef short i16; +typedef unsigned short u16; +typedef char i8; +typedef unsigned char u8; + +typedef i64 __attribute__((__vector_size__(N))) v_i64; +typedef u64 __attribute__((__vector_size__(N))) v_u64; +typedef i32 __attribute__((__vector_size__(N))) v_i32; +typedef u32 __attribute__((__vector_size__(N))) v_u32; +typedef i16 __attribute__((__vector_size__(N))) v_i16; +typedef u16 __attribute__((__vector_size__(N))) v_u16; +typedef i8 __attribute__((__vector_size__(N))) v_i8; +typedef u8 __attribute__((__vector_size__(N))) v_u8; + +v_i64 __attribute__((noinline)) test_v_i64(v_i64 v, i64 x) +{ + v = v >> x; + return v; +} + +v_u64 __attribute__((noinline)) test_v_u64(v_u64 v, u64 x) +{ + v = v >> x; + return v; +} + +v_i32 __attribute__((noinline)) test_v_i32(v_i32 v, i32 x) +{ + v = v >> x; + return v; +} + +v_u32 __attribute__((noinline)) test_v_u32(v_u32 v, u32 x) +{ + v = v >> x; + return v; +} + +v_i16 __attribute__((noinline)) test_v_i16(v_i16 v, i16 x) +{ + v = v >> x; + return v; +} + +v_u16 __attribute__((noinline)) test_v_u16(v_u16 v, u16 x) +{ + v = v >> x; + return v; +} + +v_i8 __attribute__((noinline)) test_v_i8(v_i8 v, i8 x) +{ + v = v >> x; + return v; +} + +v_u8 __attribute__((noinline)) test_v_u8(v_u8 v, u8 x) +{ + v = v >> x; + return v; +} + +int main() +{ + { + v_i64 x = {42, 42}; + x = test_v_i64(x, 2); + printf("%lld\n", x[I]); + } + + { + v_u64 x = {42, 42}; + x = test_v_u64(x, 2); + printf("%lld\n", x[I]); + } + + { + v_i32 x = {42, 42, 42, 42}; + x = test_v_i32(x, 2); + printf("%d\n", x[I]); + } + + { + v_u32 x = {42, 42, 42, 42}; + x = test_v_u32(x, 2); + printf("%d\n", x[I]); + } + + { + v_i16 x = {42, 42, 42, 42, 42, 42, 42, 42}; + x = test_v_i16(x, 2); + printf("%d\n", x[I]); + } + + { + v_u16 x = {42, 42, 42, 42, 42, 42, 42, 42}; + x = test_v_u16(x, 2); + printf("%d\n", x[I]); + } + + { + v_i8 x = {42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42}; + x = test_v_i8(x, 2); + printf("%d\n", x[I]); + } + + { + v_u8 x = {42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42}; + x = test_v_u8(x, 2); + printf("%d\n", x[I]); + } + + return 0; +} +--EXPECT-- +10 +10 +10 +10 +10 +10 +10 +10 diff --git a/tests/vector/shuffle-001.test b/tests/vector/shuffle-001.test new file mode 100644 index 0000000..4343efa --- /dev/null +++ b/tests/vector/shuffle-001.test @@ -0,0 +1,158 @@ +--TEST-- +SHUFFLE.001: 128-bit vectors SSE2 variable mask +--TARGET-- +!aarch64 +--ARGS-- +-mno-sse4 -mno-avx2 --run +--CODE-- +#define N 16 + +int printf(const char *, ...); + +typedef long long i64; +typedef unsigned long long u64; +typedef int i32; +typedef unsigned int u32; +typedef short i16; +typedef unsigned short u16; +typedef char i8; +typedef unsigned char u8; + +typedef double __attribute__((__vector_size__(N))) v_d; +typedef float __attribute__((__vector_size__(N))) v_f; +typedef i64 __attribute__((__vector_size__(N))) v_i64; +typedef u64 __attribute__((__vector_size__(N))) v_u64; +typedef i32 __attribute__((__vector_size__(N))) v_i32; +typedef u32 __attribute__((__vector_size__(N))) v_u32; +typedef i16 __attribute__((__vector_size__(N))) v_i16; +typedef u16 __attribute__((__vector_size__(N))) v_u16; +typedef i8 __attribute__((__vector_size__(N))) v_i8; +typedef u8 __attribute__((__vector_size__(N))) v_u8; + +v_d __attribute__((noinline)) test_v_d(v_d v, v_i64 m) +{ + return __builtin_shuffle(v, m); +} + +v_f __attribute__((noinline)) test_v_f(v_f v, v_i32 m) +{ + return __builtin_shuffle(v, m); +} + +v_i64 __attribute__((noinline)) test_v_i64(v_i64 v, v_i64 m) +{ + return __builtin_shuffle(v, m); +} + +v_u64 __attribute__((noinline)) test_v_u64(v_u64 v, v_i64 m) +{ + return __builtin_shuffle(v, m); +} + +v_i32 __attribute__((noinline)) test_v_i32(v_i32 v, v_i32 m) +{ + return __builtin_shuffle(v, m); +} + +v_u32 __attribute__((noinline)) test_v_u32(v_u32 v, v_i32 m) +{ + return __builtin_shuffle(v, m); +} + +v_i16 __attribute__((noinline)) test_v_i16(v_i16 v, v_i16 m) +{ + return __builtin_shuffle(v, m); +} + +v_u16 __attribute__((noinline)) test_v_u16(v_u16 v, v_i16 m) +{ + return __builtin_shuffle(v, m); +} + +v_i8 __attribute__((noinline)) test_v_i8(v_i8 v, v_i8 m) +{ + return __builtin_shuffle(v, m); +} + +v_u8 __attribute__((noinline)) test_v_u8(v_u8 v, v_i8 m) +{ + return __builtin_shuffle(v, m); +} + +int main() +{ + { + v_d x = {1.1, 2.2}; + x = test_v_d(x, (v_i64){1, 0}); + printf("%g %g\n", x[0], x[1]); + } + + { + v_f x = {1.1f, 2.2f, 3.3f, 4.4f}; + x = test_v_f(x, (v_i32){1, 2, 3, 0}); + printf("%g %g %g %g\n", x[0], x[1], x[2], x[3]); + } + + { + v_i64 x = {1, 2}; + x = test_v_i64(x, (v_i64){1, 0}); + printf("%lld %lld\n", x[0], x[1]); + } + + { + v_u64 x = {1, 2}; + x = test_v_u64(x, (v_i64){1, 0}); + printf("%lld %lld\n", x[0], x[1]); + } + + { + v_i32 x = {1,2,3,4}; + x = test_v_i32(x, (v_i32){1, 2, 3, 0}); + printf("%d %d %d %d\n", x[0], x[1], x[2], x[3]); + } + + { + v_u32 x = {1,2,3,4}; + x = test_v_u32(x, (v_i32){1, 2, 3, 0}); + printf("%d %d %d %d\n", x[0], x[1], x[2], x[3]); + } + + { + v_i16 x = {1,2,3,4,5,6,7,8}; + x = test_v_i16(x, (v_i16){1,2,3,4,5,6,7,0}); + printf("%d %d %d %d %d %d %d %d\n", x[0], x[1], x[2], x[3], x[4], x[5], x[6], x[7]); + } + + { + v_u16 x = {1,2,3,4,5,6,7,8}; + x = test_v_u16(x, (v_i16){1,2,3,4,5,6,7,0}); + printf("%d %d %d %d %d %d %d %d\n", x[0], x[1], x[2], x[3], x[4], x[5], x[6], x[7]); + } + + { + v_i8 x = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16}; + x = test_v_i8(x, (v_i8){1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,0}); + printf("%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d\n", + x[0], x[1], x[2], x[3], x[4], x[5], x[6], x[7], x[8], x[9], x[10], x[11], x[12], x[13], x[14], x[15]); + } + + { + v_u8 x = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16}; + x = test_v_u8(x, (v_i8){1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,0}); + printf("%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d\n", + x[0], x[1], x[2], x[3], x[4], x[5], x[6], x[7], x[8], x[9], x[10], x[11], x[12], x[13], x[14], x[15]); + } + + return 0; +} +--EXPECT-- +2.2 1.1 +2.2 3.3 4.4 1.1 +2 1 +2 1 +2 3 4 1 +2 3 4 1 +2 3 4 5 6 7 8 1 +2 3 4 5 6 7 8 1 +2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 +2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 diff --git a/tests/vector/shuffle-002.test b/tests/vector/shuffle-002.test new file mode 100644 index 0000000..7d617c2 --- /dev/null +++ b/tests/vector/shuffle-002.test @@ -0,0 +1,158 @@ +--TEST-- +SHUFFLE.002: 128-bit vectors SSE2 constant mask +--TARGET-- +!aarch64 +--ARGS-- +-mno-sse4 -mno-avx2 --run +--CODE-- +#define N 16 + +int printf(const char *, ...); + +typedef long long i64; +typedef unsigned long long u64; +typedef int i32; +typedef unsigned int u32; +typedef short i16; +typedef unsigned short u16; +typedef char i8; +typedef unsigned char u8; + +typedef double __attribute__((__vector_size__(N))) v_d; +typedef float __attribute__((__vector_size__(N))) v_f; +typedef i64 __attribute__((__vector_size__(N))) v_i64; +typedef u64 __attribute__((__vector_size__(N))) v_u64; +typedef i32 __attribute__((__vector_size__(N))) v_i32; +typedef u32 __attribute__((__vector_size__(N))) v_u32; +typedef i16 __attribute__((__vector_size__(N))) v_i16; +typedef u16 __attribute__((__vector_size__(N))) v_u16; +typedef i8 __attribute__((__vector_size__(N))) v_i8; +typedef u8 __attribute__((__vector_size__(N))) v_u8; + +v_d __attribute__((noinline)) test_v_d(v_d v) +{ + return __builtin_shufflevector(v, v, 1, 0); +} + +v_f __attribute__((noinline)) test_v_f(v_f v) +{ + return __builtin_shufflevector(v, v, 1, 2, 3, 0); +} + +v_i64 __attribute__((noinline)) test_v_i64(v_i64 v) +{ + return __builtin_shufflevector(v, v, 1, 0); +} + +v_u64 __attribute__((noinline)) test_v_u64(v_u64 v) +{ + return __builtin_shufflevector(v, v, 1, 0); +} + +v_i32 __attribute__((noinline)) test_v_i32(v_i32 v) +{ + return __builtin_shufflevector(v, v, 1, 2, 3, 0); +} + +v_u32 __attribute__((noinline)) test_v_u32(v_u32 v) +{ + return __builtin_shufflevector(v, v, 1, 2, 3, 0); +} + +v_i16 __attribute__((noinline)) test_v_i16(v_i16 v) +{ + return __builtin_shufflevector(v, v, 1,2,3,4,5,6,7,0); +} + +v_u16 __attribute__((noinline)) test_v_u16(v_u16 v) +{ + return __builtin_shufflevector(v, v, 1,2,3,4,5,6,7,0); +} + +v_i8 __attribute__((noinline)) test_v_i8(v_i8 v) +{ + return __builtin_shufflevector(v, v, 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,0); +} + +v_u8 __attribute__((noinline)) test_v_u8(v_u8 v) +{ + return __builtin_shufflevector(v, v, 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,0); +} + +int main() +{ + { + v_d x = {1.1, 2.2}; + x = test_v_d(x); + printf("%g %g\n", x[0], x[1]); + } + + { + v_f x = {1.1f, 2.2f, 3.3f, 4.4f}; + x = test_v_f(x); + printf("%g %g %g %g\n", x[0], x[1], x[2], x[3]); + } + + { + v_i64 x = {1, 2}; + x = test_v_i64(x); + printf("%lld %lld\n", x[0], x[1]); + } + + { + v_u64 x = {1, 2}; + x = test_v_u64(x); + printf("%lld %lld\n", x[0], x[1]); + } + + { + v_i32 x = {1,2,3,4}; + x = test_v_i32(x); + printf("%d %d %d %d\n", x[0], x[1], x[2], x[3]); + } + + { + v_u32 x = {1,2,3,4}; + x = test_v_u32(x); + printf("%d %d %d %d\n", x[0], x[1], x[2], x[3]); + } + + { + v_i16 x = {1,2,3,4,5,6,7,8}; + x = test_v_i16(x); + printf("%d %d %d %d %d %d %d %d\n", x[0], x[1], x[2], x[3], x[4], x[5], x[6], x[7]); + } + + { + v_u16 x = {1,2,3,4,5,6,7,8}; + x = test_v_u16(x); + printf("%d %d %d %d %d %d %d %d\n", x[0], x[1], x[2], x[3], x[4], x[5], x[6], x[7]); + } + + { + v_i8 x = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16}; + x = test_v_i8(x); + printf("%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d\n", + x[0], x[1], x[2], x[3], x[4], x[5], x[6], x[7], x[8], x[9], x[10], x[11], x[12], x[13], x[14], x[15]); + } + + { + v_u8 x = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16}; + x = test_v_u8(x); + printf("%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d\n", + x[0], x[1], x[2], x[3], x[4], x[5], x[6], x[7], x[8], x[9], x[10], x[11], x[12], x[13], x[14], x[15]); + } + + return 0; +} +--EXPECT-- +2.2 1.1 +2.2 3.3 4.4 1.1 +2 1 +2 1 +2 3 4 1 +2 3 4 1 +2 3 4 5 6 7 8 1 +2 3 4 5 6 7 8 1 +2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 +2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1