* config/i386/i386.c (ix86_expand_clear): New.
authorrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 22 Oct 2001 07:19:01 +0000 (07:19 +0000)
committerrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 22 Oct 2001 07:19:01 +0000 (07:19 +0000)
        * config/i386/i386-protos.h: Declare it.
        * config/i386/i386.md (setcc peep2s): Use it.
        (movsi_xor): Unexport.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@46404 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/config/i386/i386-protos.h
gcc/config/i386/i386.c
gcc/config/i386/i386.md

index c5113b3..3374a63 100644 (file)
@@ -1,5 +1,12 @@
 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.
 
index 111dc16..edd5446 100644 (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[]));
index 1731989..691a397 100644 (file)
@@ -6662,6 +6662,35 @@ ix86_output_addr_diff_elt (file, value, rel)
                 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;
index efede44..803a0eb 100644 (file)
   [(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.