i386.c (ix86_expand_clear): New.

* config/i386/i386.c (ix86_expand_clear): New.
        * config/i386/i386-protos.h: Declare it.
        * config/i386/i386.md (setcc peep2s): Use it.
        (movsi_xor): Unexport.

From-SVN: r46404
This commit is contained in:
Richard Henderson 2001-10-22 00:19:01 -07:00 committed by Richard Henderson
parent 8356429f83
commit a8bac9ab24
4 changed files with 40 additions and 9 deletions

View File

@ -1,3 +1,10 @@
2001-10-22 Richard Henderson <rth@redhat.com>
* config/i386/i386.c (ix86_expand_clear): New.
* config/i386/i386-protos.h: Declare it.
* config/i386/i386.md (setcc peep2s): Use it.
(movsi_xor): Unexport.
2001-10-22 Richard Henderson <rth@redhat.com>
* flow.c (clear_log_links): Use free_INSN_LIST_list, not

View File

@ -106,6 +106,7 @@ extern const char *output_fp_compare PARAMS ((rtx, rtx*, int, int));
extern void i386_dwarf_output_addr_const PARAMS ((FILE*, rtx));
extern rtx i386_simplify_dwarf_addr PARAMS ((rtx));
extern void ix86_expand_clear PARAMS ((rtx));
extern void ix86_expand_move PARAMS ((enum machine_mode, rtx[]));
extern void ix86_expand_binary_operator PARAMS ((enum rtx_code,
enum machine_mode, rtx[]));

View File

@ -6662,6 +6662,35 @@ ix86_output_addr_diff_elt (file, value, rel)
ASM_LONG, LPREFIX, value);
}
/* Generate either "mov $0, reg" or "xor reg, reg", as appropriate
for the target. */
void
ix86_expand_clear (dest)
rtx dest;
{
rtx tmp;
/* We play register width games, which are only valid after reload. */
if (!reload_completed)
abort ();
/* Avoid HImode and its attendant prefix byte. */
if (GET_MODE_SIZE (GET_MODE (dest)) < 4)
dest = gen_rtx_REG (SImode, REGNO (dest));
tmp = gen_rtx_SET (VOIDmode, dest, const0_rtx);
/* This predicate should match that for movsi_xor and movdi_xor_rex64. */
if (reload_completed && (!TARGET_USE_MOV0 || optimize_size))
{
rtx clob = gen_rtx_CLOBBER (VOIDmode, gen_rtx_REG (CCmode, 17));
tmp = gen_rtx_PARALLEL (VOIDmode, gen_rtvec (2, tmp, clob));
}
emit_insn (tmp);
}
void
ix86_expand_move (mode, operands)
enum machine_mode mode;

View File

@ -1711,7 +1711,7 @@
[(set_attr "type" "pop")
(set_attr "mode" "SI")])
(define_insn "movsi_xor"
(define_insn "*movsi_xor"
[(set (match_operand:SI 0 "register_operand" "=r")
(match_operand:SI 1 "const0_operand" "i"))
(clobber (reg:CC 17))]
@ -13277,10 +13277,7 @@
{
operands[4] = gen_rtx_REG (GET_MODE (operands[0]), 17);
operands[5] = gen_rtx_REG (QImode, REGNO (operands[3]));
if (HAVE_movsi_xor)
emit_insn (gen_movsi_xor (operands[3], const0_rtx));
else
emit_insn (gen_movsi (operands[3], const0_rtx));
ix86_expand_clear (operands[3]);
})
;; Similar, but match zero_extendhisi2_and, which adds a clobber.
@ -13302,10 +13299,7 @@
{
operands[4] = gen_rtx_REG (GET_MODE (operands[0]), 17);
operands[5] = gen_rtx_REG (QImode, REGNO (operands[3]));
if (HAVE_movsi_xor)
emit_insn (gen_movsi_xor (operands[3], const0_rtx));
else
emit_insn (gen_movsi (operands[3], const0_rtx));
ix86_expand_clear (operands[3]);
})
;; Call instructions.