Fix cprop_hardregs handling of SSE logical on fp patterns

Jan Hubicka jh@suse.cz
Tue Feb 12 09:15:00 GMT 2002


Hi,
the byte benchmark gets misscompiled with -mfpmath=sse because of following
pattern generated via fabs builtin:

(define_insn "*sse_andti3_df_1"
  [(set (subreg:TI (match_operand:DF 0 "register_operand" "=Y") 0)
        (and:TI (subreg:TI (match_operand:DF 1 "register_operand" "%0") 0)
		(subreg:TI (match_operand:DF 2 "register_operand" "Y") 0)))]
  "TARGET_SSE2"
  "andpd\t{%2, %0|%0, %2}"
  [(set_attr "type" "sse")])

As we've discussed earlier, the subreg is used to distinguish the "and of
doubles" from "and of integers" isntructions.  The register renaming pass
assumes all subregs to be killed and misses the store to register producing
invalid code.

The attached patch fixes it by teaching regrename to simplify subreg when
it appears, but I am not quite sure this is the optimal sollution.

Tue Feb 12 13:11:35 CET 2002  Jan Hubicka  <jh@suse.cz>

	* regrename.c (kill_value): Handle subregs.

Index: regrename.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/regrename.c,v
retrieving revision 1.40
diff -c -3 -p -r1.40 regrename.c
*** regrename.c	2002/01/22 18:34:56	1.40
--- regrename.c	2002/02/12 12:11:28
*************** kill_value (x, vd)
*** 1090,1095 ****
--- 1090,1098 ----
       rtx x;
       struct value_data *vd;
  {
+   if (GET_CODE (x) == SUBREG)
+     x = simplify_subreg (GET_MODE (x), SUBREG_REG (x),
+ 			 GET_MODE (SUBREG_REG (x)), SUBREG_BYTE (x));
    if (REG_P (x))
      {
        unsigned int regno = REGNO (x);



More information about the Gcc-patches mailing list