Patchwork [i386] : Remove FP_REG_P and FP_REGNO_P

login
register
mail settings
Submitter Uros Bizjak
Date Aug. 25, 2012, 5:21 p.m.
Message ID <CAFULd4YieNwYMGd791nK9TGJTftOovZWftZ8FLKUi5LJTCdV8w@mail.gmail.com>
Download mbox | patch
Permalink /patch/179980/
State New
Headers show

Comments

Uros Bizjak - Aug. 25, 2012, 5:21 p.m.
Hello!

These macros are the same as STACK_REG_P and STACK_REGNO_P.

Also changes one instance that leaked to reg-stack.c

2012-08-25  Uros Bizjak  <ubizjak@gmail.com>

	* config/i386/i386.h (FP_REG_P): Remove macro.
	(FP_REGNO_P): Ditto.
	(HARD_REGNO_NREGS): Use STACK_REGNO_P instead of FP_REGNO_P.
	(HARD_REGNO_NREGS_HAS_PADDING): Ditto.
	(ANY_FP_REGNO_P): Ditto.
	(HARD_REGNO_RENAME_OK): Use STACK_REGNO_P.
	* config/i386/i386.c (output_387_ffreep): Use STACK_REGNO_P
	instead of FP_REGNO_P.
	(ix86_hard_regno_mode_ok): Ditto.
	* config/i386/predicates.md (fp_register_operand): Ditto.
	(register_and_not_fp_reg_operand): Ditto.
	* config/i386/sync.md (atomic_loaddi_fpu): Use STACK_REG_P instead
	of FP_REG_P.

	* reg-stack.c (get_true_reg): Use STACK_REG_P instead of FP_REG_P.

Tested on x86_64-pc-linux-gnu {,-m32} and committed to mainline SVN.

Uros.

Patch

Index: reg-stack.c
===================================================================
--- reg-stack.c	(revision 190665)
+++ reg-stack.c	(working copy)
@@ -413,7 +413,7 @@  get_true_reg (rtx *pat)
 	   actual FP register in use.  */
 	{
 	  rtx subreg;
-	  if (FP_REG_P (subreg = SUBREG_REG (*pat)))
+	  if (STACK_REG_P (subreg = SUBREG_REG (*pat)))
 	    {
 	      int regno_off = subreg_regno_offset (REGNO (subreg),
 						   GET_MODE (subreg),
Index: config/i386/i386.c
===================================================================
--- config/i386/i386.c	(revision 190665)
+++ config/i386/i386.c	(working copy)
@@ -15554,7 +15626,7 @@  output_387_ffreep (rtx *operands ATTRIBUTE_UNUSED,
       static char retval[32];
       int regno = REGNO (operands[opno]);
 
-      gcc_assert (FP_REGNO_P (regno));
+      gcc_assert (STACK_REGNO_P (regno));
 
       regno -= FIRST_STACK_REG;
 
@@ -32169,7 +32241,7 @@  ix86_hard_regno_mode_ok (int regno, enum machine_m
       || GET_MODE_CLASS (mode) == MODE_RANDOM
       || GET_MODE_CLASS (mode) == MODE_PARTIAL_INT)
     return false;
-  if (FP_REGNO_P (regno))
+  if (STACK_REGNO_P (regno))
     return VALID_FP_MODE_P (mode);
   if (SSE_REGNO_P (regno))
     {
Index: config/i386/i386.h
===================================================================
--- config/i386/i386.h	(revision 190665)
+++ config/i386/i386.h	(working copy)
@@ -1008,7 +1008,7 @@  enum target_cpu_default
    applied to them.  */
 
 #define HARD_REGNO_NREGS(REGNO, MODE)					\
-  (FP_REGNO_P (REGNO) || SSE_REGNO_P (REGNO) || MMX_REGNO_P (REGNO)	\
+  (STACK_REGNO_P (REGNO) || SSE_REGNO_P (REGNO) || MMX_REGNO_P (REGNO)	\
    ? (COMPLEX_MODE_P (MODE) ? 2 : 1)					\
    : ((MODE) == XFmode							\
       ? (TARGET_64BIT ? 2 : 3)						\
@@ -1018,7 +1018,7 @@  enum target_cpu_default
 
 #define HARD_REGNO_NREGS_HAS_PADDING(REGNO, MODE)			\
   ((TARGET_128BIT_LONG_DOUBLE && !TARGET_64BIT)				\
-   ? (FP_REGNO_P (REGNO) || SSE_REGNO_P (REGNO) || MMX_REGNO_P (REGNO)	\
+   ? (STACK_REGNO_P (REGNO) || SSE_REGNO_P (REGNO) || MMX_REGNO_P (REGNO) \
       ? 0								\
       : ((MODE) == XFmode || (MODE) == XCmode))				\
    : 0)
@@ -1337,11 +1337,11 @@  enum reg_class
 #define REX_INT_REGNO_P(N) \
   IN_RANGE ((N), FIRST_REX_INT_REG, LAST_REX_INT_REG)
 
-#define FP_REG_P(X) (REG_P (X) && FP_REGNO_P (REGNO (X)))
-#define FP_REGNO_P(N) IN_RANGE ((N), FIRST_STACK_REG, LAST_STACK_REG)
+#define STACK_REG_P(X) (REG_P (X) && STACK_REGNO_P (REGNO (X)))
+#define STACK_REGNO_P(N) IN_RANGE ((N), FIRST_STACK_REG, LAST_STACK_REG)
 
 #define ANY_FP_REG_P(X) (REG_P (X) && ANY_FP_REGNO_P (REGNO (X)))
-#define ANY_FP_REGNO_P(N) (FP_REGNO_P (N) || SSE_REGNO_P (N))
+#define ANY_FP_REGNO_P(N) (STACK_REGNO_P (N) || SSE_REGNO_P (N))
 
 #define X87_FLOAT_MODE_P(MODE)	\
   (TARGET_80387 && ((MODE) == SFmode || (MODE) == DFmode || (MODE) == XFmode))
@@ -1367,9 +1367,6 @@  enum reg_class
 #define MMX_REG_P(X) (REG_P (X) && MMX_REGNO_P (REGNO (X)))
 #define MMX_REGNO_P(N) IN_RANGE ((N), FIRST_MMX_REG, LAST_MMX_REG)
 
-#define STACK_REG_P(X) (REG_P (X) && STACK_REGNO_P (REGNO (X)))
-#define STACK_REGNO_P(N) IN_RANGE ((N), FIRST_STACK_REG, LAST_STACK_REG)
-
 #define STACK_TOP_P(X) (REG_P (X) && REGNO (X) == FIRST_STACK_REG)
 
 #define CC_REG_P(X) (REG_P (X) && CC_REGNO_P (REGNO (X)))
@@ -2204,8 +2201,7 @@  enum ix86_stack_slot
 
    ??? Maybe Pentium chips benefits from renaming, someone can try....  */
 
-#define HARD_REGNO_RENAME_OK(SRC, TARGET)  \
-  (! IN_RANGE ((SRC), FIRST_STACK_REG, LAST_STACK_REG))
+#define HARD_REGNO_RENAME_OK(SRC, TARGET) !STACK_REGNO_P (SRC)
 
 
 #define FASTCALL_PREFIX '@'
Index: config/i386/predicates.md
===================================================================
--- config/i386/predicates.md	(revision 190665)
+++ config/i386/predicates.md	(working copy)
@@ -26,7 +26,7 @@ 
 ;; Return true if OP is an i387 fp register.
 (define_predicate "fp_register_operand"
   (and (match_code "reg")
-       (match_test "FP_REGNO_P (REGNO (op))")))
+       (match_test "STACK_REGNO_P (REGNO (op))")))
 
 ;; Return true if OP is a non-fp register_operand.
 (define_predicate "register_and_not_any_fp_reg_operand"
@@ -36,7 +36,7 @@ 
 ;; Return true if OP is a register operand other than an i387 fp register.
 (define_predicate "register_and_not_fp_reg_operand"
   (and (match_code "reg")
-       (not (match_test "FP_REGNO_P (REGNO (op))"))))
+       (not (match_test "STACK_REGNO_P (REGNO (op))"))))
 
 ;; True if the operand is an MMX register.
 (define_predicate "mmx_reg_operand"
Index: config/i386/sync.md
===================================================================
--- config/i386/sync.md	(revision 190665)
+++ config/i386/sync.md	(working copy)
@@ -181,7 +181,7 @@ 
       if (MEM_P (dst))
 	mem = dst;
 
-      if (FP_REG_P (tmp))
+      if (STACK_REG_P (tmp))
         {
 	  emit_insn (gen_loaddi_via_fpu (tmp, src));
 	  emit_insn (gen_storedi_via_fpu (mem, tmp));
@@ -261,7 +261,7 @@ 
 	  src = mem;
 	}
 
-      if (FP_REG_P (tmp))
+      if (STACK_REG_P (tmp))
 	{
 	  emit_insn (gen_loaddi_via_fpu (tmp, src));
 	  emit_insn (gen_storedi_via_fpu (dst, tmp));
Index: config/i386/i386.md
===================================================================
--- config/i386/i386.md	(revision 190665)
+++ config/i386/i386.md	(working copy)
@@ -3388,7 +3388,7 @@ 
   int r = REGNO (operands[0]);
 
   if ((SSE_REGNO_P (r) && !standard_sse_constant_p (c))
-      || (FP_REGNO_P (r) && standard_80387_constant_p (c) < 1))
+      || (STACK_REGNO_P (r) && standard_80387_constant_p (c) < 1))
     FAIL;
 })
 
@@ -3406,7 +3406,7 @@ 
   int r = REGNO (operands[0]);
 
   if ((SSE_REGNO_P (r) && !standard_sse_constant_p (c))
-      || (FP_REGNO_P (r) && standard_80387_constant_p (c) < 1))
+      || (STACK_REGNO_P (r) && standard_80387_constant_p (c) < 1))
     FAIL;
 })