alpha.c (ALPHA_BUILTIN_THREAD_POINTER): New.

* config/alpha/alpha.c (ALPHA_BUILTIN_THREAD_POINTER): New.
        (ALPHA_BUILTIN_SET_THREAD_POINTER): New.
        (code_for_builtns): Update.
        (alpha_init_builtins): Add __builtin_thread_pointer and
        __builtin_set_thread_pointer.
        (alpha_expand_builtin): Handle void builtins.
        * doc/extend.texi (Alpha Built-in Functions): Update.

From-SVN: r54543
This commit is contained in:
Richard Henderson 2002-06-11 19:57:02 -07:00 committed by Richard Henderson
parent 0cec6af13c
commit 116b7a5ea8
3 changed files with 56 additions and 10 deletions

View file

@ -1,3 +1,13 @@
2002-06-11 Richard Henderson <rth@redhat.com>
* config/alpha/alpha.c (ALPHA_BUILTIN_THREAD_POINTER): New.
(ALPHA_BUILTIN_SET_THREAD_POINTER): New.
(code_for_builtns): Update.
(alpha_init_builtins): Add __builtin_thread_pointer and
__builtin_set_thread_pointer.
(alpha_expand_builtin): Handle void builtins.
* doc/extend.texi (Alpha Built-in Functions): Update.
2002-06-11 Hans-Peter Nilsson <hp@axis.com>
PR target/6997

View file

@ -6345,6 +6345,8 @@ enum alpha_builtin
ALPHA_BUILTIN_AMASK,
ALPHA_BUILTIN_IMPLVER,
ALPHA_BUILTIN_RPCC,
ALPHA_BUILTIN_THREAD_POINTER,
ALPHA_BUILTIN_SET_THREAD_POINTER,
/* TARGET_MAX */
ALPHA_BUILTIN_MINUB8,
@ -6398,6 +6400,8 @@ static unsigned int const code_for_builtin[ALPHA_BUILTIN_max] = {
CODE_FOR_builtin_amask,
CODE_FOR_builtin_implver,
CODE_FOR_builtin_rpcc,
CODE_FOR_load_tp,
CODE_FOR_set_tp,
/* TARGET_MAX */
CODE_FOR_builtin_minub8,
@ -6515,6 +6519,16 @@ alpha_init_builtins ()
for (i = 0; i < ARRAY_SIZE (two_arg_builtins); ++i, ++p)
if ((target_flags & p->target_mask) == p->target_mask)
builtin_function (p->name, ftype, p->code, BUILT_IN_MD, NULL);
ftype = build_function_type (ptr_type_node, void_list_node);
builtin_function ("__builtin_thread_pointer", ftype,
ALPHA_BUILTIN_THREAD_POINTER, BUILT_IN_MD, NULL);
ftype = build_function_type (void_type_node, tree_cons (NULL_TREE,
ptr_type_node,
void_list_node));
builtin_function ("__builtin_set_thread_pointer", ftype,
ALPHA_BUILTIN_SET_THREAD_POINTER, BUILT_IN_MD, NULL);
}
/* Expand an expression EXP that calls a built-in function,
@ -6539,7 +6553,7 @@ alpha_expand_builtin (exp, target, subtarget, mode, ignore)
enum insn_code icode;
rtx op[MAX_ARGS], pat;
int arity;
enum machine_mode tmode;
bool nonvoid;
if (fcode >= ALPHA_BUILTIN_max)
internal_error ("bad builtin fcode");
@ -6547,6 +6561,8 @@ alpha_expand_builtin (exp, target, subtarget, mode, ignore)
if (icode == 0)
internal_error ("bad builtin fcode");
nonvoid = TREE_TYPE (TREE_TYPE (fndecl)) != void_type_node;
for (arglist = TREE_OPERAND (exp, 1), arity = 0;
arglist;
arglist = TREE_CHAIN (arglist), arity++)
@ -6559,18 +6575,22 @@ alpha_expand_builtin (exp, target, subtarget, mode, ignore)
if (arity > MAX_ARGS)
return NULL_RTX;
op[arity] = expand_expr (arg, NULL_RTX, VOIDmode, 0);
insn_op = &insn_data[icode].operand[arity + nonvoid];
op[arity] = expand_expr (arg, NULL_RTX, insn_op->mode, 0);
insn_op = &insn_data[icode].operand[arity + 1];
if (!(*insn_op->predicate) (op[arity], insn_op->mode))
op[arity] = copy_to_mode_reg (insn_op->mode, op[arity]);
}
tmode = insn_data[icode].operand[0].mode;
if (!target
|| GET_MODE (target) != tmode
|| !(*insn_data[icode].operand[0].predicate) (target, tmode))
target = gen_reg_rtx (tmode);
if (nonvoid)
{
enum machine_mode tmode = insn_data[icode].operand[0].mode;
if (!target
|| GET_MODE (target) != tmode
|| !(*insn_data[icode].operand[0].predicate) (target, tmode))
target = gen_reg_rtx (tmode);
}
switch (arity)
{
@ -6578,7 +6598,10 @@ alpha_expand_builtin (exp, target, subtarget, mode, ignore)
pat = GEN_FCN (icode) (target);
break;
case 1:
pat = GEN_FCN (icode) (target, op[0]);
if (nonvoid)
pat = GEN_FCN (icode) (target, op[0]);
else
pat = GEN_FCN (icode) (op[0]);
break;
case 2:
pat = GEN_FCN (icode) (target, op[0], op[1]);
@ -6590,7 +6613,10 @@ alpha_expand_builtin (exp, target, subtarget, mode, ignore)
return NULL_RTX;
emit_insn (pat);
return target;
if (nonvoid)
return target;
else
return const0_rtx;
}
/* This page contains routines that are used to determine what the function

View file

@ -4834,6 +4834,16 @@ long __builtin_alpha_ctlz (long)
long __builtin_alpha_ctpop (long)
@end example
The following builtins are available on systems that use the OSF/1
PALcode. Normally they invoke the @code{rduniq} and @code{wruniq}
PAL calls, but when invoked with @option{-mtls-kernel}, they invoke
@code{rdval} and @code{wrval}.
@example
void *__builtin_thread_pointer (void)
void __builtin_set_thread_pointer (void *)
@end example
@node X86 Built-in Functions
@subsection X86 Built-in Functions