@@ -117,9 +117,10 @@ enum aarch64_type_qualifiers
qualifier_maybe_immediate = 0x10, /* 1 << 4 */
/* void foo (...). */
qualifier_void = 0x20, /* 1 << 5 */
- /* Some patterns may have internal operands, this qualifier is an
- instruction to the initialisation code to skip this operand. */
- qualifier_internal = 0x40, /* 1 << 6 */
+ /* Tells the initialisation code to skip this operand when generating
+ the type of the builtin function (and the expander to skip it when
+ expanding a call to said builtin function). */
+ qualifier_scratch = 0x40, /* 1 << 6 */
/* Some builtins should use the T_*mode* encoded in a simd_builtin_datum
rather than using the type of the operand. */
qualifier_map_mode = 0x80, /* 1 << 7 */
@@ -140,11 +141,11 @@ typedef struct
enum aarch64_type_qualifiers *qualifiers;
} aarch64_simd_builtin_datum;
-/* The qualifier_internal allows generation of a unary builtin from
- a pattern with a third pseudo-operand such as a match_scratch. */
+/* The qualifier_scratch allows generation of a unary builtin from
+ a pattern with a third pseudo-operand i.e. match_scratch. */
static enum aarch64_type_qualifiers
aarch64_types_unop_qualifiers[SIMD_MAX_BUILTIN_ARGS]
- = { qualifier_none, qualifier_none, qualifier_internal };
+ = { qualifier_none, qualifier_none, qualifier_scratch };
#define TYPES_UNOP (aarch64_types_unop_qualifiers)
static enum aarch64_type_qualifiers
aarch64_types_unopu_qualifiers[SIMD_MAX_BUILTIN_ARGS]
@@ -791,7 +792,7 @@ aarch64_init_simd_builtins (void)
type_signature[arg_num] = 's';
/* Skip an internal operand for vget_{low, high}. */
- if (qualifiers & qualifier_internal)
+ if (qualifiers & qualifier_scratch)
continue;
/* Some builtins have different user-facing types
@@ -899,6 +900,7 @@ typedef enum
{
SIMD_ARG_COPY_TO_REG,
SIMD_ARG_CONSTANT,
+ SIMD_ARG_SCRATCH,
SIMD_ARG_STOP
} builtin_simd_arg;
@@ -919,13 +921,13 @@ aarch64_simd_expand_args (rtx target, int icode, int have_retval,
|| !(*insn_data[icode].operand[0].predicate) (target, tmode)))
target = gen_reg_rtx (tmode);
- for (;;)
+ for (;; args++)
{
- builtin_simd_arg thisarg = args[argc];
+ builtin_simd_arg thisarg = *args;
if (thisarg == SIMD_ARG_STOP)
break;
- else
+ else if (thisarg != SIMD_ARG_SCRATCH)
{
arg[argc] = CALL_EXPR_ARG (exp, argc);
op[argc] = expand_normal (arg[argc]);
@@ -950,6 +952,7 @@ aarch64_simd_expand_args (rtx target, int icode, int have_retval,
break;
case SIMD_ARG_STOP:
+ case SIMD_ARG_SCRATCH:
gcc_unreachable ();
}
@@ -1061,6 +1064,8 @@ aarch64_simd_expand_builtin (int fcode, tree exp, rtx target)
(arg, insn_data[icode].operand[operands_k].mode));
args[k] = op_const_int_p ? SIMD_ARG_CONSTANT : SIMD_ARG_COPY_TO_REG;
}
+ else if (d->qualifiers[qualifiers_k] & qualifier_scratch)
+ args[k] = SIMD_ARG_SCRATCH;
else
args[k] = SIMD_ARG_COPY_TO_REG;
@@ -1317,9 +1322,6 @@ aarch64_fold_builtin (tree fndecl, int n_args ATTRIBUTE_UNUSED, tree *args,
switch (fcode)
{
- BUILTIN_VALLDI (UNOP, abs, 2)
- return fold_build1 (ABS_EXPR, type, args[0]);
- break;
BUILTIN_VALLDI (BINOP, cmge, 0)
return fold_build2 (GE_EXPR, type, args[0], args[1]);
break;