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
free_EXPR_LIST_list for LOG_LINKS.
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[]));
ASM_LONG, LPREFIX, value);
}
\f
+/* 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;
[(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))]
{
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.
{
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]);
})
\f
;; Call instructions.