This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

i386.md fix



Hi
This is patch to remove addqi_low_1 pattern from i386.md.  I am not quite
sure, why it has been added (no splitters seems to result to it), but it
causes problems with reload, since in/out operand is matched with input
one making them impossible to reload properly. In case we want gcc to be able
to generate such an "partial" arithmetic, this would require more work in
combine, different representation and to add rest of arithmetic patterns of
that form.

This fixes Jakub's testcase:

/* { dg-do run { target i?86-*-* } } */
/* { dg-options "-O2 -fno-strength-reduce" } */

void bar(char *p)
{
}

int main()
{
  union {
    unsigned int val;
    unsigned char p[4];
  } foo;
  char buf[8];
  int i;

  foo.val = 0;
  bar(buf);
  for(i = 0; i < 8; i += 4)
    {
      foo.p [0] += buf [i + 0];
      foo.p [1] += buf [i + 1];
      foo.p [2] += buf [i + 2];
      foo.p [3] += buf [i + 3];
    }
  return foo.val;
}

Honza

Wed Jun 21 18:01:31 MET DST 2000  Jan Hubicka  <jh@suse.cz>
	* i386.md (addqi_low_1): Remove.

Index: egcs/gcc/config/i386//i386.md
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/i386/i386.md,v
retrieving revision 1.158
diff -c -3 -p -r1.158 i386.md
*** i386.md	2000/06/16 00:59:02	1.158
--- i386.md	2000/06/21 16:00:01
***************
*** 3881,3913 ****
    "add{b}\\t{%2, %0|%0, %2}"
    [(set_attr "type" "alu")])
  
- (define_insn "*addqi_low_1"
-   [(set (strict_low_part (match_operand:QI 0 "register_operand" "+q"))
- 	(plus:QI (match_operand:QI 1 "register_operand" "0")
- 		 (match_operand:QI 2 "general_operand" "qmn")))
-    (clobber (reg:CC 17))]
-   ""
-   "*
- {
-   switch (get_attr_type (insn))
-     {
-     case TYPE_INCDEC:
-       if (operands[2] == const1_rtx)
- 	return \"inc{b}\\t%b0\";
-       else if (operands[2] == constm1_rtx
- 	       || (GET_CODE (operands[2]) == CONST_INT
- 		   && INTVAL (operands[2]) == 255))
- 	return \"dec{b}\\t%b0\";
-       abort();
- 
-     default:
-       return \"add{b}\\t{%2, %b0|%b0, %2}\";
-     }
- }"
-   [(set (attr "type")
-      (if_then_else (match_operand:QI 2 "incdec_operand" "")
- 	(const_string "incdec")
- 	(const_string "alu")))])
  
  (define_insn "addqi_ext_1"
    [(set (zero_extract:SI (match_operand 0 "ext_register_operand" "=q")
--- 3881,3886 ----

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]