ATTR builtin attribute information.
ICODE Insn code of the function that implements the builtin. */
+#ifndef RS6000_BUILTIN_COMPAT
+ #undef BU_COMPAT
+ #define BU_COMPAT(ENUM, COMPAT_NAME)
+
#ifndef RS6000_BUILTIN_0
#error "RS6000_BUILTIN_0 is not defined."
#endif
#error "RS6000_BUILTIN_X is not defined."
#endif
+#else
+ /* Compatibility builtins. These builtins are simply mapped into
+ their compatible builtin function identified by ENUM. */
+ #undef BU_COMPAT
+ #define BU_COMPAT(ENUM, COMPAT_NAME) { ENUM, "__builtin_" COMPAT_NAME },
+
+ #undef RS6000_BUILTIN_0
+ #undef RS6000_BUILTIN_1
+ #undef RS6000_BUILTIN_2
+ #undef RS6000_BUILTIN_3
+ #undef RS6000_BUILTIN_4
+ #undef RS6000_BUILTIN_A
+ #undef RS6000_BUILTIN_D
+ #undef RS6000_BUILTIN_H
+ #undef RS6000_BUILTIN_M
+ #undef RS6000_BUILTIN_P
+ #undef RS6000_BUILTIN_X
+ #define RS6000_BUILTIN_0(ENUM, NAME, MASK, ATTR, ICODE)
+ #define RS6000_BUILTIN_1(ENUM, NAME, MASK, ATTR, ICODE)
+ #define RS6000_BUILTIN_2(ENUM, NAME, MASK, ATTR, ICODE)
+ #define RS6000_BUILTIN_3(ENUM, NAME, MASK, ATTR, ICODE)
+ #define RS6000_BUILTIN_4(ENUM, NAME, MASK, ATTR, ICODE)
+ #define RS6000_BUILTIN_A(ENUM, NAME, MASK, ATTR, ICODE)
+ #define RS6000_BUILTIN_D(ENUM, NAME, MASK, ATTR, ICODE)
+ #define RS6000_BUILTIN_H(ENUM, NAME, MASK, ATTR, ICODE)
+ #define RS6000_BUILTIN_M(ENUM, NAME, MASK, ATTR, ICODE)
+ #define RS6000_BUILTIN_P(ENUM, NAME, MASK, ATTR, ICODE)
+ #define RS6000_BUILTIN_X(ENUM, NAME, MASK, ATTR, ICODE)
+#endif
+
#ifndef BU_AV_1
/* Define convenience macros using token pasting to allow fitting everything in
one line. */
| RS6000_BTC_UNARY), \
CODE_FOR_ ## ICODE) /* ICODE */
-#define BU_MMA_V2(ENUM, NAME, ATTR, ICODE) \
+#define BU_MMA_M2(ENUM, NAME, ATTR, ICODE) \
RS6000_BUILTIN_M (MMA_BUILTIN_ ## ENUM, /* ENUM */ \
"__builtin_mma_" NAME, /* NAME */ \
RS6000_BTM_MMA, /* MASK */ \
| RS6000_BTC_GIMPLE), \
CODE_FOR_nothing) /* ICODE */
+/* Like BU_MMA_M2, but uses "vsx" rather than "mma" naming. */
+#define BU_MMA_V2(ENUM, NAME, ATTR, ICODE) \
+ RS6000_BUILTIN_M (VSX_BUILTIN_ ## ENUM, /* ENUM */ \
+ "__builtin_vsx_" NAME, /* NAME */ \
+ RS6000_BTM_MMA, /* MASK */ \
+ (RS6000_BTC_ ## ATTR /* ATTR */ \
+ | RS6000_BTC_BINARY \
+ | RS6000_BTC_VOID \
+ | RS6000_BTC_GIMPLE), \
+ CODE_FOR_nothing) /* ICODE */
+
#define BU_MMA_3(ENUM, NAME, ATTR, ICODE) \
RS6000_BUILTIN_M (MMA_BUILTIN_ ## ENUM, /* ENUM */ \
"__builtin_mma_" NAME, /* NAME */ \
| RS6000_BTC_TERNARY), \
CODE_FOR_ ## ICODE) /* ICODE */
+/* Like BU_MMA_3, but uses "vsx" rather than "mma" naming. */
+#define BU_MMA_V3(ENUM, NAME, ATTR, ICODE) \
+ RS6000_BUILTIN_M (VSX_BUILTIN_ ## ENUM, /* ENUM */ \
+ "__builtin_vsx_" NAME, /* NAME */ \
+ RS6000_BTM_MMA, /* MASK */ \
+ (RS6000_BTC_ ## ATTR /* ATTR */ \
+ | RS6000_BTC_TERNARY \
+ | RS6000_BTC_VOID \
+ | RS6000_BTC_GIMPLE), \
+ CODE_FOR_nothing) /* ICODE */ \
+ RS6000_BUILTIN_M (VSX_BUILTIN_ ## ENUM ## _INTERNAL, /* ENUM */ \
+ "__builtin_vsx_" NAME "_internal", /* NAME */ \
+ RS6000_BTM_MMA, /* MASK */ \
+ (RS6000_BTC_ ## ATTR /* ATTR */ \
+ | RS6000_BTC_TERNARY), \
+ CODE_FOR_ ## ICODE) /* ICODE */
+
#define BU_MMA_5(ENUM, NAME, ATTR, ICODE) \
RS6000_BUILTIN_M (MMA_BUILTIN_ ## ENUM, /* ENUM */ \
"__builtin_mma_" NAME, /* NAME */ \
BU_MMA_1 (XXMTACC, "xxmtacc", QUAD, mma_xxmtacc)
BU_MMA_1 (XXSETACCZ, "xxsetaccz", MISC, mma_xxsetaccz)
-BU_MMA_V2 (DISASSEMBLE_ACC, "disassemble_acc", QUAD, nothing)
+BU_MMA_M2 (DISASSEMBLE_ACC, "disassemble_acc", QUAD, nothing)
BU_MMA_V2 (DISASSEMBLE_PAIR,"disassemble_pair", PAIR, nothing)
+BU_COMPAT (VSX_BUILTIN_DISASSEMBLE_PAIR, "mma_disassemble_pair")
-BU_MMA_3 (ASSEMBLE_PAIR, "assemble_pair", MISC, mma_assemble_pair)
+BU_MMA_V3 (ASSEMBLE_PAIR, "assemble_pair", MISC, vsx_assemble_pair)
+BU_COMPAT (VSX_BUILTIN_ASSEMBLE_PAIR, "mma_assemble_pair")
BU_MMA_3 (XVBF16GER2, "xvbf16ger2", MISC, mma_xvbf16ger2)
BU_MMA_3 (XVF16GER2, "xvf16ger2", MISC, mma_xvf16ger2)
BU_MMA_3 (XVF32GER, "xvf32ger", MISC, mma_xvf32ger)
#define TARGET_NO_PROTOTYPE 0
#endif
+struct builtin_compatibility
+{
+ const enum rs6000_builtins code;
+ const char *const name;
+};
+
struct builtin_description
{
const HOST_WIDE_INT mask;
(int)code, name, attr_string);
}
+static const struct builtin_compatibility bdesc_compat[] =
+{
+#define RS6000_BUILTIN_COMPAT
+#include "rs6000-builtin.def"
+};
+#undef RS6000_BUILTIN_COMPAT
+
/* Simple ternary operations: VECd = foo (VECa, VECb, VECc). */
#undef RS6000_BUILTIN_0
{
/* This is an MMA disassemble built-in function. */
gcc_assert (fncode == MMA_BUILTIN_DISASSEMBLE_ACC
- || fncode == MMA_BUILTIN_DISASSEMBLE_PAIR);
+ || fncode == VSX_BUILTIN_DISASSEMBLE_PAIR);
push_gimplify_context (true);
tree dst_ptr = gimple_call_arg (stmt, 0);
gcc_unreachable ();
}
- if (fncode == MMA_BUILTIN_ASSEMBLE_PAIR)
+ if (fncode == VSX_BUILTIN_ASSEMBLE_PAIR)
lhs = make_ssa_name (vector_pair_type_node);
else
lhs = make_ssa_name (vector_quad_type_node);
#ifdef SUBTARGET_INIT_BUILTINS
SUBTARGET_INIT_BUILTINS;
#endif
+
+ /* Register the compatibility builtins after all of the normal
+ builtins have been defined. */
+ const struct builtin_compatibility *d = bdesc_compat;
+ unsigned i;
+ for (i = 0; i < ARRAY_SIZE (bdesc_compat); i++, d++)
+ {
+ tree decl = rs6000_builtin_decls[(int)d->code];
+ gcc_assert (decl != NULL);
+ add_builtin_function (d->name, TREE_TYPE (decl), (int)d->code,
+ BUILT_IN_MD, NULL, NULL_TREE);
+ }
}
/* Returns the rs6000 builtin decl for CODE. */
/* This is a disassemble MMA built-in function. */
gcc_assert (attr_args == RS6000_BTC_BINARY
&& (d->code == MMA_BUILTIN_DISASSEMBLE_ACC
- || d->code == MMA_BUILTIN_DISASSEMBLE_PAIR));
+ || d->code == VSX_BUILTIN_DISASSEMBLE_PAIR));
op[nopnds++] = build_pointer_type (void_type_node);
if (attr & RS6000_BTC_QUAD)
op[nopnds++] = build_pointer_type (vector_quad_type_node);
if (gimple_func && mode == PXImode)
op[nopnds++] = build_pointer_type (vector_quad_type_node);
else if (gimple_func && mode == POImode
- && d->code == MMA_BUILTIN_ASSEMBLE_PAIR)
+ && d->code == VSX_BUILTIN_ASSEMBLE_PAIR)
op[nopnds++] = build_pointer_type (vector_pair_type_node);
else
/* MMA uses unsigned types. */