ia64.c (ia64_expand_tls_address): Properly truncate result when op0 is SImode.

* config/ia64/ia64.c (ia64_expand_tls_address): Properly truncate
        result when op0 is SImode.

From-SVN: r70790
This commit is contained in:
Richard Henderson 2003-08-25 16:41:10 -07:00 committed by Richard Henderson
parent 1d10941673
commit 0d433a6a90
2 changed files with 31 additions and 26 deletions

View File

@ -1,3 +1,8 @@
2003-08-25 Richard Henderson <rth@redhat.com>
* config/ia64/ia64.c (ia64_expand_tls_address): Properly truncate
result when op0 is SImode.
2003-08-25 Nathanael Nerode <neroden@twcny.rr.com>
* fixinc/inclhack.def (svr4_sighandler_type): New fix, ported

View File

@ -1222,6 +1222,7 @@ static rtx
ia64_expand_tls_address (enum tls_model tls_kind, rtx op0, rtx op1)
{
rtx tga_op1, tga_op2, tga_ret, tga_eqv, tmp, insns;
rtx orig_op0 = op0;
switch (tls_kind)
{
@ -1245,8 +1246,10 @@ ia64_expand_tls_address (enum tls_model tls_kind, rtx op0, rtx op1)
insns = get_insns ();
end_sequence ();
if (GET_MODE (op0) != Pmode)
op0 = tga_ret;
emit_libcall_block (insns, op0, tga_ret, op1);
return NULL_RTX;
break;
case TLS_MODEL_LOCAL_DYNAMIC:
/* ??? This isn't the completely proper way to do local-dynamic
@ -1274,19 +1277,16 @@ ia64_expand_tls_address (enum tls_model tls_kind, rtx op0, rtx op1)
tmp = gen_reg_rtx (Pmode);
emit_libcall_block (insns, tmp, tga_ret, tga_eqv);
if (register_operand (op0, Pmode))
tga_ret = op0;
else
tga_ret = gen_reg_rtx (Pmode);
if (!register_operand (op0, Pmode))
op0 = gen_reg_rtx (Pmode);
if (TARGET_TLS64)
{
emit_insn (gen_load_dtprel (tga_ret, op1));
emit_insn (gen_adddi3 (tga_ret, tmp, tga_ret));
emit_insn (gen_load_dtprel (op0, op1));
emit_insn (gen_adddi3 (op0, tmp, op0));
}
else
emit_insn (gen_add_dtprel (tga_ret, tmp, op1));
return (tga_ret == op0 ? NULL_RTX : tga_ret);
emit_insn (gen_add_dtprel (op0, tmp, op1));
break;
case TLS_MODEL_INITIAL_EXEC:
tmp = gen_reg_rtx (Pmode);
@ -1295,32 +1295,32 @@ ia64_expand_tls_address (enum tls_model tls_kind, rtx op0, rtx op1)
RTX_UNCHANGING_P (tmp) = 1;
tmp = force_reg (Pmode, tmp);
if (register_operand (op0, Pmode))
op1 = op0;
else
op1 = gen_reg_rtx (Pmode);
emit_insn (gen_adddi3 (op1, tmp, gen_thread_pointer ()));
return (op1 == op0 ? NULL_RTX : op1);
if (!register_operand (op0, Pmode))
op0 = gen_reg_rtx (Pmode);
emit_insn (gen_adddi3 (op0, tmp, gen_thread_pointer ()));
break;
case TLS_MODEL_LOCAL_EXEC:
if (register_operand (op0, Pmode))
tmp = op0;
else
tmp = gen_reg_rtx (Pmode);
if (!register_operand (op0, Pmode))
op0 = gen_reg_rtx (Pmode);
if (TARGET_TLS64)
{
emit_insn (gen_load_tprel (tmp, op1));
emit_insn (gen_adddi3 (tmp, gen_thread_pointer (), tmp));
emit_insn (gen_load_tprel (op0, op1));
emit_insn (gen_adddi3 (op0, gen_thread_pointer (), op0));
}
else
emit_insn (gen_add_tprel (tmp, gen_thread_pointer (), op1));
return (tmp == op0 ? NULL_RTX : tmp);
emit_insn (gen_add_tprel (op0, gen_thread_pointer (), op1));
break;
default:
abort ();
}
if (orig_op0 == op0)
return NULL_RTX;
if (GET_MODE (orig_op0) == Pmode)
return op0;
return gen_lowpart (GET_MODE (orig_op0), op0);
}
rtx