obvious split_di fix
Jan Hubicka
jh@suse.cz
Sat Oct 20 05:45:00 GMT 2001
Hi,
the split_di is "missused" for splitting the DFmode variables too over
the i386.md and my revamp to simplify_gen_subreg makes it to abort in
enable_checking compilation on these cases.
I am just testing the attached patch I will install as obvious in case it
passes as the crashes are relativly common.
Honza
Sat Oct 20 14:43:21 CEST 2001 Jan Hubicka <jh@suse.cz>
* i386.c (split_di): Handle splitting of DFmode.
Index: config/i386/i386.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/i386/i386.c,v
retrieving revision 1.320
diff -c -3 -p -r1.320 i386.c
*** i386.c 2001/10/20 10:03:54 1.320
--- i386.c 2001/10/20 12:35:28
*************** split_di (operands, num, lo_half, hi_hal
*** 5937,5944 ****
}
else
{
! lo_half[num] = simplify_gen_subreg (SImode, op, DImode, 0);
! hi_half[num] = simplify_gen_subreg (SImode, op, DImode, 4);
}
}
}
--- 5937,5948 ----
}
else
{
! lo_half[num] = simplify_gen_subreg (SImode, op,
! GET_MODE (op) == VOIDmode
! ? DImode : GET_MODE (op), 0);
! hi_half[num] = simplify_gen_subreg (SImode, op,
! GET_MODE (op) == VOIDmode
! ? DImode : GET_MODE (op), 4);
}
}
}
*************** ix86_expand_int_movcc (operands)
*** 7874,7879 ****
--- 7878,7884 ----
enum rtx_code code = GET_CODE (operands[1]), compare_code;
rtx compare_seq, compare_op;
rtx second_test, bypass_test;
+ enum machine_mode mode = GET_MODE (operands[0]);
/* When the compare code is not LTU or GEU, we can not use sbbl case.
In case comparsion is done with immediate, we can convert it to LTU or
*************** ix86_expand_int_movcc (operands)
*** 7881,7887 ****
if ((code == LEU || code == GTU)
&& GET_CODE (ix86_compare_op1) == CONST_INT
! && GET_MODE (operands[0]) != HImode
&& (unsigned int)INTVAL (ix86_compare_op1) != 0xffffffff
&& GET_CODE (operands[2]) == CONST_INT
&& GET_CODE (operands[3]) == CONST_INT)
--- 7886,7892 ----
if ((code == LEU || code == GTU)
&& GET_CODE (ix86_compare_op1) == CONST_INT
! && mode != HImode
&& (unsigned int)INTVAL (ix86_compare_op1) != 0xffffffff
&& GET_CODE (operands[2]) == CONST_INT
&& GET_CODE (operands[3]) == CONST_INT)
*************** ix86_expand_int_movcc (operands)
*** 7903,7910 ****
/* Don't attempt mode expansion here -- if we had to expand 5 or 6
HImode insns, we'd be swallowed in word prefix ops. */
! if (GET_MODE (operands[0]) != HImode
! && (GET_MODE (operands[0]) != DImode || TARGET_64BIT)
&& GET_CODE (operands[2]) == CONST_INT
&& GET_CODE (operands[3]) == CONST_INT)
{
--- 7908,7915 ----
/* Don't attempt mode expansion here -- if we had to expand 5 or 6
HImode insns, we'd be swallowed in word prefix ops. */
! if (mode != HImode
! && (mode != DImode || TARGET_64BIT)
&& GET_CODE (operands[2]) == CONST_INT
&& GET_CODE (operands[3]) == CONST_INT)
{
*************** ix86_expand_int_movcc (operands)
*** 7933,7942 ****
if (reg_overlap_mentioned_p (out, ix86_compare_op0)
|| reg_overlap_mentioned_p (out, ix86_compare_op1))
! tmp = gen_reg_rtx (GET_MODE (operands[0]));
emit_insn (compare_seq);
! if (GET_MODE (tmp) == DImode)
emit_insn (gen_x86_movdicc_0_m1_rex64 (tmp));
else
emit_insn (gen_x86_movsicc_0_m1 (tmp));
--- 7938,7947 ----
if (reg_overlap_mentioned_p (out, ix86_compare_op0)
|| reg_overlap_mentioned_p (out, ix86_compare_op1))
! tmp = gen_reg_rtx (mode);
emit_insn (compare_seq);
! if (mode == DImode)
emit_insn (gen_x86_movdicc_0_m1_rex64 (tmp));
else
emit_insn (gen_x86_movsicc_0_m1 (tmp));
*************** ix86_expand_int_movcc (operands)
*** 7951,7962 ****
* Size 5 - 8.
*/
if (ct)
! {
! if (GET_MODE (tmp) == DImode)
! emit_insn (gen_adddi3 (tmp, tmp, GEN_INT (ct)));
! else
! emit_insn (gen_addsi3 (tmp, tmp, GEN_INT (ct)));
! }
}
else if (cf == -1)
{
--- 7956,7964 ----
* Size 5 - 8.
*/
if (ct)
! tmp = expand_simple_binop (mode, PLUS,
! tmp, GEN_INT (ct),
! tmp, 1, OPTAB_DIRECT);
}
else if (cf == -1)
{
*************** ix86_expand_int_movcc (operands)
*** 7967,7976 ****
*
* Size 8.
*/
! if (GET_MODE (tmp) == DImode)
! emit_insn (gen_iordi3 (tmp, tmp, GEN_INT (ct)));
! else
! emit_insn (gen_iorsi3 (tmp, tmp, GEN_INT (ct)));
}
else if (diff == -1 && ct)
{
--- 7969,7977 ----
*
* Size 8.
*/
! tmp = expand_simple_binop (mode, IOR,
! tmp, GEN_INT (ct),
! tmp, 1, OPTAB_DIRECT);
}
else if (diff == -1 && ct)
{
*************** ix86_expand_int_movcc (operands)
*** 7982,7999 ****
*
* Size 8 - 11.
*/
! if (GET_MODE (tmp) == DImode)
! {
! emit_insn (gen_one_cmpldi2 (tmp, tmp));
! if (cf)
! emit_insn (gen_adddi3 (tmp, tmp, GEN_INT (cf)));
! }
! else
! {
! emit_insn (gen_one_cmplsi2 (tmp, tmp));
! if (cf)
! emit_insn (gen_addsi3 (tmp, tmp, GEN_INT (cf)));
! }
}
else
{
--- 7983,7993 ----
*
* Size 8 - 11.
*/
! tmp = expand_simple_unop (mode, NOT, tmp, tmp, 1);
! if (ct)
! tmp = expand_simple_binop (mode, PLUS,
! tmp, GEN_INT (ct),
! tmp, 1, OPTAB_DIRECT);
}
else
{
*************** ix86_expand_int_movcc (operands)
*** 8005,8024 ****
*
* Size 8 - 11.
*/
! if (GET_MODE (tmp) == DImode)
! {
! emit_insn (gen_anddi3 (tmp, tmp, GEN_INT (trunc_int_for_mode
! (cf - ct, DImode))));
! if (ct)
! emit_insn (gen_adddi3 (tmp, tmp, GEN_INT (ct)));
! }
! else
! {
! emit_insn (gen_andsi3 (tmp, tmp, GEN_INT (trunc_int_for_mode
! (cf - ct, SImode))));
! if (ct)
! emit_insn (gen_addsi3 (tmp, tmp, GEN_INT (ct)));
! }
}
if (tmp != out)
--- 7999,8013 ----
*
* Size 8 - 11.
*/
! tmp = expand_simple_binop (mode, AND,
! tmp,
! GEN_INT (trunc_int_for_mode
! (cf - ct, mode)),
! tmp, 1, OPTAB_DIRECT);
! if (ct)
! tmp = expand_simple_binop (mode, PLUS,
! tmp, GEN_INT (ct),
! tmp, 1, OPTAB_DIRECT);
}
if (tmp != out)
*************** ix86_expand_int_movcc (operands)
*** 8048,8055 ****
code = reverse_condition (code);
}
}
! if (diff == 1 || diff == 2 || diff == 4 || diff == 8
! || diff == 3 || diff == 5 || diff == 9)
{
/*
* xorl dest,dest
--- 8037,8045 ----
code = reverse_condition (code);
}
}
! if ((diff == 1 || diff == 2 || diff == 4 || diff == 8
! || diff == 3 || diff == 5 || diff == 9)
! && (mode != DImode || x86_64_sign_extended_value (GEN_INT (cf))))
{
/*
* xorl dest,dest
*************** ix86_expand_int_movcc (operands)
*** 8077,8093 ****
{
rtx out1;
out1 = out;
! tmp = gen_rtx_MULT (GET_MODE (out), out1, GEN_INT (diff & ~1));
nops++;
if (diff & 1)
{
! tmp = gen_rtx_PLUS (GET_MODE (out), tmp, out1);
nops++;
}
}
if (cf != 0)
{
! tmp = gen_rtx_PLUS (GET_MODE (out), tmp, GEN_INT (cf));
nops++;
}
if (tmp != out
--- 8067,8083 ----
{
rtx out1;
out1 = out;
! tmp = gen_rtx_MULT (mode, out1, GEN_INT (diff & ~1));
nops++;
if (diff & 1)
{
! tmp = gen_rtx_PLUS (mode, tmp, out1);
nops++;
}
}
if (cf != 0)
{
! tmp = gen_rtx_PLUS (mode, tmp, GEN_INT (cf));
nops++;
}
if (tmp != out
*************** ix86_expand_int_movcc (operands)
*** 8157,8167 ****
out = emit_store_flag (out, code, ix86_compare_op0,
ix86_compare_op1, VOIDmode, 0, 1);
! emit_insn (gen_addsi3 (out, out, constm1_rtx));
! emit_insn (gen_andsi3 (out, out, GEN_INT (trunc_int_for_mode
! (cf - ct, SImode))));
! if (ct != 0)
! emit_insn (gen_addsi3 (out, out, GEN_INT (ct)));
if (out != operands[0])
emit_move_insn (operands[0], out);
--- 8147,8163 ----
out = emit_store_flag (out, code, ix86_compare_op0,
ix86_compare_op1, VOIDmode, 0, 1);
! out = expand_simple_binop (mode, PLUS,
! out, constm1_rtx,
! out, 1, OPTAB_DIRECT);
! out = expand_simple_binop (mode, AND,
! out,
! GEN_INT (trunc_int_for_mode
! (cf - ct, mode)),
! out, 1, OPTAB_DIRECT);
! out = expand_simple_binop (mode, PLUS,
! out, GEN_INT (ct),
! out, 1, OPTAB_DIRECT);
if (out != operands[0])
emit_move_insn (operands[0], out);
*************** ix86_expand_int_movcc (operands)
*** 8206,8212 ****
return 0; /* FAIL */
orig_out = operands[0];
! tmp = gen_reg_rtx (GET_MODE (orig_out));
operands[0] = tmp;
/* Recurse to get the constant loaded. */
--- 8202,8208 ----
return 0; /* FAIL */
orig_out = operands[0];
! tmp = gen_reg_rtx (mode);
operands[0] = tmp;
/* Recurse to get the constant loaded. */
*************** ix86_expand_int_movcc (operands)
*** 8214,8220 ****
return 0; /* FAIL */
/* Mask in the interesting variable. */
! out = expand_binop (GET_MODE (orig_out), op, var, tmp, orig_out, 0,
OPTAB_WIDEN);
if (out != orig_out)
emit_move_insn (orig_out, out);
--- 8210,8216 ----
return 0; /* FAIL */
/* Mask in the interesting variable. */
! out = expand_binop (mode, op, var, tmp, orig_out, 0,
OPTAB_WIDEN);
if (out != orig_out)
emit_move_insn (orig_out, out);
*************** ix86_expand_int_movcc (operands)
*** 8233,8273 ****
* Size 15.
*/
! if (! nonimmediate_operand (operands[2], GET_MODE (operands[0])))
! operands[2] = force_reg (GET_MODE (operands[0]), operands[2]);
! if (! nonimmediate_operand (operands[3], GET_MODE (operands[0])))
! operands[3] = force_reg (GET_MODE (operands[0]), operands[3]);
if (bypass_test && reg_overlap_mentioned_p (operands[0], operands[3]))
{
! rtx tmp = gen_reg_rtx (GET_MODE (operands[0]));
emit_move_insn (tmp, operands[3]);
operands[3] = tmp;
}
if (second_test && reg_overlap_mentioned_p (operands[0], operands[2]))
{
! rtx tmp = gen_reg_rtx (GET_MODE (operands[0]));
emit_move_insn (tmp, operands[2]);
operands[2] = tmp;
}
if (! register_operand (operands[2], VOIDmode)
&& ! register_operand (operands[3], VOIDmode))
! operands[2] = force_reg (GET_MODE (operands[0]), operands[2]);
emit_insn (compare_seq);
emit_insn (gen_rtx_SET (VOIDmode, operands[0],
! gen_rtx_IF_THEN_ELSE (GET_MODE (operands[0]),
compare_op, operands[2],
operands[3])));
if (bypass_test)
emit_insn (gen_rtx_SET (VOIDmode, operands[0],
! gen_rtx_IF_THEN_ELSE (GET_MODE (operands[0]),
bypass_test,
operands[3],
operands[0])));
if (second_test)
emit_insn (gen_rtx_SET (VOIDmode, operands[0],
! gen_rtx_IF_THEN_ELSE (GET_MODE (operands[0]),
second_test,
operands[2],
operands[0])));
--- 8229,8269 ----
* Size 15.
*/
! if (! nonimmediate_operand (operands[2], mode))
! operands[2] = force_reg (mode, operands[2]);
! if (! nonimmediate_operand (operands[3], mode))
! operands[3] = force_reg (mode, operands[3]);
if (bypass_test && reg_overlap_mentioned_p (operands[0], operands[3]))
{
! rtx tmp = gen_reg_rtx (mode);
emit_move_insn (tmp, operands[3]);
operands[3] = tmp;
}
if (second_test && reg_overlap_mentioned_p (operands[0], operands[2]))
{
! rtx tmp = gen_reg_rtx (mode);
emit_move_insn (tmp, operands[2]);
operands[2] = tmp;
}
if (! register_operand (operands[2], VOIDmode)
&& ! register_operand (operands[3], VOIDmode))
! operands[2] = force_reg (mode, operands[2]);
emit_insn (compare_seq);
emit_insn (gen_rtx_SET (VOIDmode, operands[0],
! gen_rtx_IF_THEN_ELSE (mode,
compare_op, operands[2],
operands[3])));
if (bypass_test)
emit_insn (gen_rtx_SET (VOIDmode, operands[0],
! gen_rtx_IF_THEN_ELSE (mode,
bypass_test,
operands[3],
operands[0])));
if (second_test)
emit_insn (gen_rtx_SET (VOIDmode, operands[0],
! gen_rtx_IF_THEN_ELSE (mode,
second_test,
operands[2],
operands[0])));
More information about the Gcc-patches
mailing list