@@ -23,6 +23,8 @@
#define _A3(a,b,c) {a, b, c, SPU_BTI_END_OF_PARAMS}
#define _A4(a,b,c,d) {a, b, c, d, SPU_BTI_END_OF_PARAMS}
+#define SPU_MAX_ARGS_TO_BUILTIN 3
+
/* definitions to support si intrinsic functions: (These and other builtin
* definitions must precede definitions of the overloaded generic intrinsics */
@@ -5777,9 +5777,10 @@ spu_init_builtins (void)
sure nodes are shared. */
for (i = 0, d = spu_builtins; i < NUM_SPU_BUILTINS; i++, d++)
{
- tree p;
+ tree ftype;
char name[64]; /* build_function will make a copy. */
- int parm;
+ int parm, i;
+ tree args[SPU_MAX_ARGS_TO_BUILTIN];
if (d->name == 0)
continue;
@@ -5788,15 +5789,23 @@ spu_init_builtins (void)
for (parm = 1; d->parm[parm] != SPU_BTI_END_OF_PARAMS; parm++)
;
- p = void_list_node;
+ gcc_assert (parm <= (SPU_MAX_ARGS_TO_BUILTIN + 1));
+
+ for (i = 0; i < ARRAY_SIZE (args); i++)
+ args[i] = NULL_TREE;
+
while (parm > 1)
- p = tree_cons (NULL_TREE, spu_builtin_types[d->parm[--parm]], p);
+ {
+ tree arg = spu_builtin_types[d->parm[--parm]];
+ args[parm-1] = arg;
+ }
- p = build_function_type (spu_builtin_types[d->parm[0]], p);
+ ftype = build_function_type_list (spu_builtin_types[d->parm[0]],
+ args[0], args[1], args[2], NULL_TREE);
sprintf (name, "__builtin_%s", d->name);
spu_builtin_decls[i] =
- add_builtin_function (name, p, i, BUILT_IN_MD, NULL, NULL_TREE);
+ add_builtin_function (name, ftype, i, BUILT_IN_MD, NULL, NULL_TREE);
if (d->fcode == SPU_MASK_FOR_LOAD)
TREE_READONLY (spu_builtin_decls[i]) = 1;