#include "rs6000-internal.h"
-static tree altivec_resolve_new_overloaded_builtin (location_t, tree, void *);
-
-
/* Handle the machine specific pragma longcall. Its syntax is
# pragma longcall ( TOGGLE )
/* Return true iff ARGTYPE can be compatibly passed as PARMTYPE. */
static bool
-rs6000_new_builtin_type_compatible (tree parmtype, tree argtype)
+rs6000_builtin_type_compatible (tree parmtype, tree argtype)
{
if (parmtype == error_mark_node)
return false;
return lang_hooks.types_compatible_p (parmtype, argtype);
}
-static inline bool
-rs6000_builtin_type_compatible (tree t, int id)
-{
- tree builtin_type;
- builtin_type = rs6000_builtin_type (id);
- if (t == error_mark_node)
- return false;
- if (INTEGRAL_TYPE_P (t) && INTEGRAL_TYPE_P (builtin_type))
- return true;
- else if (TARGET_IEEEQUAD && TARGET_LONG_DOUBLE_128
- && is_float128_p (t) && is_float128_p (builtin_type))
- return true;
- else
- return lang_hooks.types_compatible_p (t, builtin_type);
-}
-
-
/* In addition to calling fold_convert for EXPR of type TYPE, also
call c_fully_fold to remove any C_MAYBE_CONST_EXPRs that could be
hiding there (PR47197). */
return result;
}
-/* Implementation of the resolve_overloaded_builtin target hook, to
- support Altivec's overloaded builtins. */
-
-tree
-altivec_resolve_overloaded_builtin (location_t loc, tree fndecl,
- void *passed_arglist)
-{
- return altivec_resolve_new_overloaded_builtin (loc, fndecl, passed_arglist);
-}
-
/* Build a tree for a function call to an Altivec non-overloaded builtin.
The overloaded builtin that matched the types and args is described
by DESC. The N arguments are given in ARGS, respectively.
a small exception for vec_{all,any}_{ge,le} predicates. */
static tree
-altivec_build_new_resolved_builtin (tree *args, int n, tree fntype,
- tree ret_type,
- rs6000_gen_builtins bif_id,
- rs6000_gen_builtins ovld_id)
+altivec_build_resolved_builtin (tree *args, int n, tree fntype, tree ret_type,
+ rs6000_gen_builtins bif_id,
+ rs6000_gen_builtins ovld_id)
{
tree argtypes = TYPE_ARG_TYPES (fntype);
tree arg_type[MAX_OVLD_ARGS];
support Altivec's overloaded builtins. FIXME: This code needs
to be brutally factored. */
-static tree
-altivec_resolve_new_overloaded_builtin (location_t loc, tree fndecl,
- void *passed_arglist)
+tree
+altivec_resolve_overloaded_builtin (location_t loc, tree fndecl,
+ void *passed_arglist)
{
vec<tree, va_gc> *arglist = static_cast<vec<tree, va_gc> *> (passed_arglist);
unsigned int nargs = vec_safe_length (arglist);
vec<tree, va_gc> *params = make_tree_vector ();
vec_safe_push (params, arg0);
vec_safe_push (params, arg1);
- tree call = altivec_resolve_new_overloaded_builtin
+ tree call = altivec_resolve_overloaded_builtin
(loc, rs6000_builtin_decls_x[RS6000_OVLD_VEC_CMPEQ],
params);
/* Use save_expr to ensure that operands used more than once
params = make_tree_vector ();
vec_safe_push (params, call);
vec_safe_push (params, call);
- return altivec_resolve_new_overloaded_builtin
+ return altivec_resolve_overloaded_builtin
(loc, rs6000_builtin_decls_x[RS6000_OVLD_VEC_NOR], params);
}
/* Other types are errors. */
add_sub_builtin = rs6000_builtin_decls_x[RS6000_OVLD_VEC_SUB];
tree call
- = altivec_resolve_new_overloaded_builtin (loc,
- add_sub_builtin,
- params);
+ = altivec_resolve_overloaded_builtin (loc, add_sub_builtin,
+ params);
tree const1 = build_int_cstu (TREE_TYPE (arg0_type), 1);
tree ones_vector = build_vector_from_val (arg0_type, const1);
tree and_expr = fold_build2_loc (loc, BIT_AND_EXPR, arg0_type,
params = make_tree_vector ();
vec_safe_push (params, call);
vec_safe_push (params, and_expr);
- return altivec_resolve_new_overloaded_builtin (loc,
- add_sub_builtin,
- params);
+ return altivec_resolve_overloaded_builtin (loc, add_sub_builtin,
+ params);
}
/* For {un}signed __int128s use the vaddeuqm/vsubeuqm instruction
directly. */
else
as_c_builtin = rs6000_builtin_decls_x[RS6000_OVLD_VEC_SUBC];
- tree call1 = altivec_resolve_new_overloaded_builtin (loc,
- as_c_builtin,
- params);
+ tree call1 = altivec_resolve_overloaded_builtin (loc, as_c_builtin,
+ params);
params = make_tree_vector ();
vec_safe_push (params, arg0);
vec_safe_push (params, arg1);
else
as_builtin = rs6000_builtin_decls_x[RS6000_OVLD_VEC_SUB];
- tree call2 = altivec_resolve_new_overloaded_builtin (loc,
- as_builtin,
- params);
+ tree call2 = altivec_resolve_overloaded_builtin (loc, as_builtin,
+ params);
tree const1 = build_int_cstu (TREE_TYPE (arg0_type), 1);
tree ones_vector = build_vector_from_val (arg0_type, const1);
tree and_expr = fold_build2_loc (loc, BIT_AND_EXPR, arg0_type,
params = make_tree_vector ();
vec_safe_push (params, call2);
vec_safe_push (params, and_expr);
- call2 = altivec_resolve_new_overloaded_builtin (loc, as_c_builtin,
- params);
+ call2 = altivec_resolve_overloaded_builtin (loc, as_c_builtin,
+ params);
params = make_tree_vector ();
vec_safe_push (params, call1);
vec_safe_push (params, call2);
tree or_builtin = rs6000_builtin_decls_x[RS6000_OVLD_VEC_OR];
- return altivec_resolve_new_overloaded_builtin (loc, or_builtin,
- params);
+ return altivec_resolve_overloaded_builtin (loc, or_builtin,
+ params);
}
/* For {un}signed __int128s use the vaddecuq/vsubbecuq
instructions. This occurs through normal processing. */
tree parmtype0 = TREE_VALUE (TYPE_ARG_TYPES (fntype));
tree parmtype1 = TREE_VALUE (TREE_CHAIN (TYPE_ARG_TYPES (fntype)));
- if (rs6000_new_builtin_type_compatible (types[0], parmtype0)
- && rs6000_new_builtin_type_compatible (types[1], parmtype1))
+ if (rs6000_builtin_type_compatible (types[0], parmtype0)
+ && rs6000_builtin_type_compatible (types[1], parmtype1))
{
if (rs6000_builtin_decl (instance->bifid, false) != error_mark_node
- && rs6000_new_builtin_is_supported (instance->bifid))
+ && rs6000_builtin_is_supported (instance->bifid))
{
tree ret_type = TREE_TYPE (instance->fntype);
- return altivec_build_new_resolved_builtin (args, n, fntype,
- ret_type,
- instance->bifid,
- fcode);
+ return altivec_build_resolved_builtin (args, n, fntype,
+ ret_type,
+ instance->bifid,
+ fcode);
}
else
unsupported_builtin = true;
tree parmtype0 = TREE_VALUE (TYPE_ARG_TYPES (fntype));
tree parmtype1 = TREE_VALUE (TREE_CHAIN (TYPE_ARG_TYPES (fntype)));
- if (rs6000_new_builtin_type_compatible (types[0], parmtype0)
- && rs6000_new_builtin_type_compatible (types[1], parmtype1))
+ if (rs6000_builtin_type_compatible (types[0], parmtype0)
+ && rs6000_builtin_type_compatible (types[1], parmtype1))
{
if (rs6000_builtin_decl (instance->bifid, false) != error_mark_node
- && rs6000_new_builtin_is_supported (instance->bifid))
+ && rs6000_builtin_is_supported (instance->bifid))
{
tree ret_type = TREE_TYPE (instance->fntype);
- return altivec_build_new_resolved_builtin (args, n, fntype,
- ret_type,
- instance->bifid,
- fcode);
+ return altivec_build_resolved_builtin (args, n, fntype,
+ ret_type,
+ instance->bifid,
+ fcode);
}
else
unsupported_builtin = true;
arg_i++)
{
tree parmtype = TREE_VALUE (nextparm);
- if (!rs6000_new_builtin_type_compatible (types[arg_i],
- parmtype))
+ if (!rs6000_builtin_type_compatible (types[arg_i], parmtype))
{
mismatch = true;
break;
if (mismatch)
continue;
- supported = rs6000_new_builtin_is_supported (instance->bifid);
+ supported = rs6000_builtin_is_supported (instance->bifid);
if (rs6000_builtin_decl (instance->bifid, false) != error_mark_node
&& supported)
{
tree fntype = rs6000_builtin_info_x[instance->bifid].fntype;
tree ret_type = TREE_TYPE (instance->fntype);
- return altivec_build_new_resolved_builtin (args, n, fntype,
- ret_type,
- instance->bifid,
- fcode);
+ return altivec_build_resolved_builtin (args, n, fntype,
+ ret_type,
+ instance->bifid,
+ fcode);
}
else
{
/* Indicate that the instantiation of the overloaded builtin
name is not available with the target flags in effect. */
rs6000_gen_builtins fcode = (rs6000_gen_builtins) instance->bifid;
- rs6000_invalid_new_builtin (fcode);
+ rs6000_invalid_builtin (fcode);
/* Provide clarity of the relationship between the overload
and the instantiation. */
const char *internal_name
{ "arch_3_1", PPC_FEATURE2_ARCH_3_1, 1 },
{ "mma", PPC_FEATURE2_MMA, 1 },
};
-
-static rtx rs6000_expand_new_builtin (tree, rtx, rtx, machine_mode, int);
-static bool rs6000_gimple_fold_new_builtin (gimple_stmt_iterator *gsi);
\f
/* Nonzero if we can use a floating-point register to pass this arg. */
#define USE_FP_FOR_ARG_P(CUM,MODE) \
appropriate target options being set. */
void
-rs6000_invalid_new_builtin (enum rs6000_gen_builtins fncode)
+rs6000_invalid_builtin (enum rs6000_gen_builtins fncode)
{
size_t j = (size_t) fncode;
const char *name = rs6000_builtin_info_x[j].bifname;
gsi_replace (gsi, g, true);
}
-/* Fold a machine-dependent built-in in GIMPLE. (For folding into
- a constant, use rs6000_fold_builtin.) */
-
-bool
-rs6000_gimple_fold_builtin (gimple_stmt_iterator *gsi)
-{
- return rs6000_gimple_fold_new_builtin (gsi);
-}
-
/* Helper function to sort out which built-ins may be valid without having
a LHS. */
static bool
-rs6000_new_builtin_valid_without_lhs (enum rs6000_gen_builtins fn_code,
- tree fndecl)
+rs6000_builtin_valid_without_lhs (enum rs6000_gen_builtins fn_code,
+ tree fndecl)
{
if (TREE_TYPE (TREE_TYPE (fndecl)) == void_type_node)
return true;
/* Check whether a builtin function is supported in this target
configuration. */
bool
-rs6000_new_builtin_is_supported (enum rs6000_gen_builtins fncode)
+rs6000_builtin_is_supported (enum rs6000_gen_builtins fncode)
{
switch (rs6000_builtin_info_x[(size_t) fncode].enable)
{
__vector_quad arguments into pass-by-value arguments, leading to more
efficient code generation. */
static bool
-rs6000_gimple_fold_new_mma_builtin (gimple_stmt_iterator *gsi,
- rs6000_gen_builtins fn_code)
+rs6000_gimple_fold_mma_builtin (gimple_stmt_iterator *gsi,
+ rs6000_gen_builtins fn_code)
{
gimple *stmt = gsi_stmt (*gsi);
size_t fncode = (size_t) fn_code;
/* Fold a machine-dependent built-in in GIMPLE. (For folding into
a constant, use rs6000_fold_builtin.) */
-static bool
-rs6000_gimple_fold_new_builtin (gimple_stmt_iterator *gsi)
+bool
+rs6000_gimple_fold_builtin (gimple_stmt_iterator *gsi)
{
gimple *stmt = gsi_stmt (*gsi);
tree fndecl = gimple_call_fndecl (stmt);
: "nothing";
if (TARGET_DEBUG_BUILTIN)
- fprintf (stderr, "rs6000_gimple_fold_new_builtin %d %s %s\n",
+ fprintf (stderr, "rs6000_gimple_fold_builtin %d %s %s\n",
fn_code, fn_name1, fn_name2);
if (!rs6000_fold_gimple)
return false;
/* Prevent gimple folding for code that does not have a LHS, unless it is
- allowed per the rs6000_new_builtin_valid_without_lhs helper function. */
+ allowed per the rs6000_builtin_valid_without_lhs helper function. */
if (!gimple_call_lhs (stmt)
- && !rs6000_new_builtin_valid_without_lhs (fn_code, fndecl))
+ && !rs6000_builtin_valid_without_lhs (fn_code, fndecl))
return false;
/* Don't fold invalid builtins, let rs6000_expand_builtin diagnose it. */
- if (!rs6000_new_builtin_is_supported (fn_code))
+ if (!rs6000_builtin_is_supported (fn_code))
return false;
- if (rs6000_gimple_fold_new_mma_builtin (gsi, fn_code))
+ if (rs6000_gimple_fold_mma_builtin (gsi, fn_code))
return true;
switch (fn_code)
return false;
}
-/* Expand an expression EXP that calls a built-in function,
- with result going to TARGET if that's convenient
- (and in mode MODE if that's convenient).
- SUBTARGET may be used as the target for computing one of EXP's operands.
- IGNORE is nonzero if the value is to be ignored. */
-
-rtx
-rs6000_expand_builtin (tree exp, rtx target, rtx subtarget ATTRIBUTE_UNUSED,
- machine_mode mode ATTRIBUTE_UNUSED,
- int ignore ATTRIBUTE_UNUSED)
-{
- return rs6000_expand_new_builtin (exp, target, subtarget, mode, ignore);
-}
-
/* Expand ALTIVEC_BUILTIN_MASK_FOR_LOAD. */
rtx
rs6000_expand_ldst_mask (rtx target, tree arg0)
/* Expand the CPU builtin in FCODE and store the result in TARGET. */
static rtx
-new_cpu_expand_builtin (enum rs6000_gen_builtins fcode,
- tree exp ATTRIBUTE_UNUSED, rtx target)
+cpu_expand_builtin (enum rs6000_gen_builtins fcode,
+ tree exp ATTRIBUTE_UNUSED, rtx target)
{
/* __builtin_cpu_init () is a nop, so expand to nothing. */
if (fcode == RS6000_BIF_CPU_INIT)
/* Expand the MMA built-in in EXP, and return it. */
static rtx
-new_mma_expand_builtin (tree exp, rtx target, insn_code icode,
- rs6000_gen_builtins fcode)
+mma_expand_builtin (tree exp, rtx target, insn_code icode,
+ rs6000_gen_builtins fcode)
{
tree fndecl = TREE_OPERAND (CALL_EXPR_FN (exp), 0);
bool void_func = TREE_TYPE (TREE_TYPE (fndecl)) == void_type_node;
/* Return the appropriate SPR number associated with the given builtin. */
static inline HOST_WIDE_INT
-new_htm_spr_num (enum rs6000_gen_builtins code)
+htm_spr_num (enum rs6000_gen_builtins code)
{
if (code == RS6000_BIF_GET_TFHAR
|| code == RS6000_BIF_SET_TFHAR)
/* Expand the HTM builtin in EXP and store the result in TARGET.
Return the expanded rtx. */
static rtx
-new_htm_expand_builtin (bifdata *bifaddr, rs6000_gen_builtins fcode,
- tree exp, rtx target)
+htm_expand_builtin (bifdata *bifaddr, rs6000_gen_builtins fcode,
+ tree exp, rtx target)
{
if (!TARGET_POWERPC64
&& (fcode == RS6000_BIF_TABORTDC
if (uses_spr)
{
machine_mode mode = TARGET_POWERPC64 ? DImode : SImode;
- op[nopnds++] = gen_rtx_CONST_INT (mode, new_htm_spr_num (fcode));
+ op[nopnds++] = gen_rtx_CONST_INT (mode, htm_spr_num (fcode));
}
/* If this builtin accesses a CR field, then pass in a scratch
CR field as the last operand. */
SUBTARGET may be used as the target for computing one of EXP's operands.
IGNORE is nonzero if the value is to be ignored.
Use the new builtin infrastructure. */
-static rtx
-rs6000_expand_new_builtin (tree exp, rtx target,
- rtx /* subtarget */,
- machine_mode /* mode */,
- int ignore)
+rtx
+rs6000_expand_builtin (tree exp, rtx target, rtx /* subtarget */,
+ machine_mode /* mode */, int ignore)
{
tree fndecl = TREE_OPERAND (CALL_EXPR_FN (exp), 0);
enum rs6000_gen_builtins fcode
|| (e == ENB_P10_64 && TARGET_POWER10 && TARGET_POWERPC64)
|| (e == ENB_MMA && TARGET_MMA)))
{
- rs6000_invalid_new_builtin (fcode);
+ rs6000_invalid_builtin (fcode);
return expand_call (exp, target, ignore);
}
}
if (bif_is_cpu (*bifaddr))
- return new_cpu_expand_builtin (fcode, exp, target);
+ return cpu_expand_builtin (fcode, exp, target);
if (bif_is_init (*bifaddr))
return altivec_expand_vec_init_builtin (TREE_TYPE (exp), exp, target);
return altivec_expand_predicate_builtin (icode, exp, target);
if (bif_is_htm (*bifaddr))
- return new_htm_expand_builtin (bifaddr, fcode, exp, target);
+ return htm_expand_builtin (bifaddr, fcode, exp, target);
if (bif_is_32bit (*bifaddr) && TARGET_32BIT)
{
return lxvrze_expand_builtin (target, icode, op, mode[0], mode[1]);
if (bif_is_mma (*bifaddr))
- return new_mma_expand_builtin (exp, target, icode, fcode);
+ return mma_expand_builtin (exp, target, icode, fcode);
if (fcode == RS6000_BIF_PACK_IF
&& TARGET_LONG_DOUBLE_128
return;
}
-static tree
-rs6000_new_builtin_decl (unsigned code, bool /* initialize_p */)
+tree
+rs6000_builtin_decl (unsigned code, bool /* initialize_p */)
{
rs6000_gen_builtins fcode = (rs6000_gen_builtins) code;
return rs6000_builtin_decls_x[code];
}
-/* Returns the rs6000 builtin decl for CODE. Note that we don't check
- the builtin mask here since there could be some #pragma/attribute
- target functions and the rs6000_builtin_mask could be wrong when
- this checking happens, though it will be updated properly later. */
-
-tree
-rs6000_builtin_decl (unsigned code, bool initialize_p ATTRIBUTE_UNUSED)
-{
- return rs6000_new_builtin_decl (code, initialize_p);
-}
-
/* Return the internal arg pointer used for function incoming
arguments. When -fsplit-stack, the arg pointer is r12 so we need
to copy it to a pseudo in order for it to be preserved over calls
fprintf (header_file, "extern void rs6000_init_generated_builtins ();\n\n");
fprintf (header_file,
- "extern bool rs6000_new_builtin_is_supported "
- "(rs6000_gen_builtins);\n");
+ "extern bool rs6000_builtin_is_supported (rs6000_gen_builtins);\n");
fprintf (header_file,
"extern tree rs6000_builtin_decl (unsigned, "
"bool ATTRIBUTE_UNUSED);\n\n");
extern bool rs6000_output_addr_const_extra (FILE *file, rtx x);
extern bool rs6000_gimple_fold_builtin (gimple_stmt_iterator *gsi);
extern tree rs6000_build_builtin_va_list (void);
-extern void rs6000_invalid_new_builtin (rs6000_gen_builtins fncode);
+extern void rs6000_invalid_builtin (rs6000_gen_builtins fncode);
extern void rs6000_va_start (tree valist, rtx nextarg);
extern tree rs6000_gimplify_va_arg (tree valist, tree type, gimple_seq *pre_p,
gimple_seq *post_p);
Implement targetm.vectorize.builtin_vectorized_function. */
static tree
-rs6000_new_builtin_vectorized_function (unsigned int fn, tree type_out,
- tree type_in)
+rs6000_builtin_vectorized_function (unsigned int fn, tree type_out,
+ tree type_in)
{
machine_mode in_mode, out_mode;
int in_n, out_n;
if (TARGET_DEBUG_BUILTIN)
- fprintf (stderr, "rs6000_new_builtin_vectorized_function (%s, %s, %s)\n",
+ fprintf (stderr, "rs6000_builtin_vectorized_function (%s, %s, %s)\n",
combined_fn_name (combined_fn (fn)),
GET_MODE_NAME (TYPE_MODE (type_out)),
GET_MODE_NAME (TYPE_MODE (type_in)));
/* Implement targetm.vectorize.builtin_md_vectorized_function. */
static tree
-rs6000_new_builtin_md_vectorized_function (tree fndecl, tree type_out,
- tree type_in)
+rs6000_builtin_md_vectorized_function (tree fndecl, tree type_out,
+ tree type_in)
{
machine_mode in_mode, out_mode;
int in_n, out_n;
if (TARGET_DEBUG_BUILTIN)
fprintf (stderr,
- "rs6000_new_builtin_md_vectorized_function (%s, %s, %s)\n",
+ "rs6000_builtin_md_vectorized_function (%s, %s, %s)\n",
IDENTIFIER_POINTER (DECL_NAME (fndecl)),
GET_MODE_NAME (TYPE_MODE (type_out)),
GET_MODE_NAME (TYPE_MODE (type_in)));
return new_fndecl;
}
-/* Returns a function decl for a vectorized version of the builtin function
- with builtin function code FN and the result vector type TYPE, or NULL_TREE
- if it is not available. */
-
-static tree
-rs6000_builtin_vectorized_function (unsigned int fn, tree type_out,
- tree type_in)
-{
- return rs6000_new_builtin_vectorized_function (fn, type_out, type_in);
-}
-
-/* Implement TARGET_VECTORIZE_BUILTIN_MD_VECTORIZED_FUNCTION. */
-
-static tree
-rs6000_builtin_md_vectorized_function (tree fndecl, tree type_out,
- tree type_in)
-{
- return rs6000_new_builtin_md_vectorized_function (fndecl, type_out, type_in);
-}
\f
/* Default CPU string for rs6000*_file_start functions. */
static const char *rs6000_default_cpu;