Commit 116b7a5e by Richard Henderson Committed by Richard Henderson

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
parent 0cec6af1
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> 2002-06-11 Hans-Peter Nilsson <hp@axis.com>
PR target/6997 PR target/6997
......
...@@ -6345,6 +6345,8 @@ enum alpha_builtin ...@@ -6345,6 +6345,8 @@ enum alpha_builtin
ALPHA_BUILTIN_AMASK, ALPHA_BUILTIN_AMASK,
ALPHA_BUILTIN_IMPLVER, ALPHA_BUILTIN_IMPLVER,
ALPHA_BUILTIN_RPCC, ALPHA_BUILTIN_RPCC,
ALPHA_BUILTIN_THREAD_POINTER,
ALPHA_BUILTIN_SET_THREAD_POINTER,
/* TARGET_MAX */ /* TARGET_MAX */
ALPHA_BUILTIN_MINUB8, ALPHA_BUILTIN_MINUB8,
...@@ -6398,6 +6400,8 @@ static unsigned int const code_for_builtin[ALPHA_BUILTIN_max] = { ...@@ -6398,6 +6400,8 @@ static unsigned int const code_for_builtin[ALPHA_BUILTIN_max] = {
CODE_FOR_builtin_amask, CODE_FOR_builtin_amask,
CODE_FOR_builtin_implver, CODE_FOR_builtin_implver,
CODE_FOR_builtin_rpcc, CODE_FOR_builtin_rpcc,
CODE_FOR_load_tp,
CODE_FOR_set_tp,
/* TARGET_MAX */ /* TARGET_MAX */
CODE_FOR_builtin_minub8, CODE_FOR_builtin_minub8,
...@@ -6515,6 +6519,16 @@ alpha_init_builtins () ...@@ -6515,6 +6519,16 @@ alpha_init_builtins ()
for (i = 0; i < ARRAY_SIZE (two_arg_builtins); ++i, ++p) for (i = 0; i < ARRAY_SIZE (two_arg_builtins); ++i, ++p)
if ((target_flags & p->target_mask) == p->target_mask) if ((target_flags & p->target_mask) == p->target_mask)
builtin_function (p->name, ftype, p->code, BUILT_IN_MD, NULL); 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, /* Expand an expression EXP that calls a built-in function,
...@@ -6539,7 +6553,7 @@ alpha_expand_builtin (exp, target, subtarget, mode, ignore) ...@@ -6539,7 +6553,7 @@ alpha_expand_builtin (exp, target, subtarget, mode, ignore)
enum insn_code icode; enum insn_code icode;
rtx op[MAX_ARGS], pat; rtx op[MAX_ARGS], pat;
int arity; int arity;
enum machine_mode tmode; bool nonvoid;
if (fcode >= ALPHA_BUILTIN_max) if (fcode >= ALPHA_BUILTIN_max)
internal_error ("bad builtin fcode"); internal_error ("bad builtin fcode");
...@@ -6547,6 +6561,8 @@ alpha_expand_builtin (exp, target, subtarget, mode, ignore) ...@@ -6547,6 +6561,8 @@ alpha_expand_builtin (exp, target, subtarget, mode, ignore)
if (icode == 0) if (icode == 0)
internal_error ("bad builtin fcode"); internal_error ("bad builtin fcode");
nonvoid = TREE_TYPE (TREE_TYPE (fndecl)) != void_type_node;
for (arglist = TREE_OPERAND (exp, 1), arity = 0; for (arglist = TREE_OPERAND (exp, 1), arity = 0;
arglist; arglist;
arglist = TREE_CHAIN (arglist), arity++) arglist = TREE_CHAIN (arglist), arity++)
...@@ -6559,18 +6575,22 @@ alpha_expand_builtin (exp, target, subtarget, mode, ignore) ...@@ -6559,18 +6575,22 @@ alpha_expand_builtin (exp, target, subtarget, mode, ignore)
if (arity > MAX_ARGS) if (arity > MAX_ARGS)
return NULL_RTX; 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)) if (!(*insn_op->predicate) (op[arity], insn_op->mode))
op[arity] = copy_to_mode_reg (insn_op->mode, op[arity]); op[arity] = copy_to_mode_reg (insn_op->mode, op[arity]);
} }
tmode = insn_data[icode].operand[0].mode; if (nonvoid)
if (!target {
|| GET_MODE (target) != tmode enum machine_mode tmode = insn_data[icode].operand[0].mode;
|| !(*insn_data[icode].operand[0].predicate) (target, tmode)) if (!target
target = gen_reg_rtx (tmode); || GET_MODE (target) != tmode
|| !(*insn_data[icode].operand[0].predicate) (target, tmode))
target = gen_reg_rtx (tmode);
}
switch (arity) switch (arity)
{ {
...@@ -6578,7 +6598,10 @@ alpha_expand_builtin (exp, target, subtarget, mode, ignore) ...@@ -6578,7 +6598,10 @@ alpha_expand_builtin (exp, target, subtarget, mode, ignore)
pat = GEN_FCN (icode) (target); pat = GEN_FCN (icode) (target);
break; break;
case 1: 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; break;
case 2: case 2:
pat = GEN_FCN (icode) (target, op[0], op[1]); pat = GEN_FCN (icode) (target, op[0], op[1]);
...@@ -6590,7 +6613,10 @@ alpha_expand_builtin (exp, target, subtarget, mode, ignore) ...@@ -6590,7 +6613,10 @@ alpha_expand_builtin (exp, target, subtarget, mode, ignore)
return NULL_RTX; return NULL_RTX;
emit_insn (pat); 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 /* This page contains routines that are used to determine what the function
......
...@@ -4834,6 +4834,16 @@ long __builtin_alpha_ctlz (long) ...@@ -4834,6 +4834,16 @@ long __builtin_alpha_ctlz (long)
long __builtin_alpha_ctpop (long) long __builtin_alpha_ctpop (long)
@end example @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 @node X86 Built-in Functions
@subsection X86 Built-in Functions @subsection X86 Built-in Functions
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment