]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
i386.c (ix86_expand_clear): New.
authorRichard Henderson <rth@redhat.com>
Mon, 22 Oct 2001 07:19:01 +0000 (00:19 -0700)
committerRichard Henderson <rth@gcc.gnu.org>
Mon, 22 Oct 2001 07:19:01 +0000 (00:19 -0700)
        * 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

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

index c5113b365913608587dae00d4733124ce41a3e99..3374a63be55cd3ef577640f4920e28dd46009a36 100644 (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
index 111dc1616a76fa055330f8bd9303957f2c3c01c5..edd5446ba33a0352d5a4484104d9c2562aca83e2 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 17319890eb76e4ac3c4a57c6811306edac81e339..691a3979feaacc84d4ee75a5c14ea8cf787c6f8d 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 efede44cda1af5d5f05ea7537202b7f66e8c89d3..803a0eb26643eb024a464e14117f2f7fcef17db3 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.