[Bug rtl-optimization/44695] [4.6 Regression] ice in simplify_subreg, at simplify-rtx.c:5117

2010-07-07 Thread hjl at gcc dot gnu dot org


--- Comment #12 from hjl at gcc dot gnu dot org  2010-07-07 21:11 ---
Subject: Bug 44695

Author: hjl
Date: Wed Jul  7 21:11:25 2010
New Revision: 161933

URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=161933
Log:
Backport 8bit div/mod improvements.

gcc/

2010-07-07  H.J. Lu  hongjiu...@intel.com

Backport from mainline
2010-07-04  H.J. Lu  hongjiu...@intel.com

PR rtl-optimization/44695
* config/i386/i386.md (extract_code): Removed.
(udivmodqi4): Likewise.
(divmodqi4): New.
(udivmodqi4): Likewise.
(divmodhiqi3): Change div/mod to HImode and extend operand 2 to
HImode.
(udivmodhiqi3): Likewise.

2010-06-24  H.J. Lu  hongjiu...@intel.com

PR target/44588
* config/i386/i386.md (extract_code): New.
(udivmodqi4): Likewise.
(divmodhiqi3): Likewise.
(udivmodhiqi3): Likewise.
(udivqi3): Remvoved.

gcc/testsuite/

2010-07-07  H.J. Lu  hongjiu...@intel.com

Backport from mainline
2010-07-04  H.J. Lu  hongjiu...@intel.com

PR rtl-optimization/44695
* gcc.dg/torture/pr44695.c: New.

2010-06-24  H.J. Lu  hongjiu...@intel.com

PR target/44588
* gcc.target/i386/mod-1.c: New.
* gcc.target/i386/umod-1.c: Likewise.
* gcc.target/i386/umod-2.c: Likewise.
* gcc.target/i386/umod-3.c: Likewise.

Modified:
branches/ix86/gcc-4_5-branch/gcc/config/i386/i386.md


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44695



[Bug rtl-optimization/44695] [4.6 Regression] ice in simplify_subreg, at simplify-rtx.c:5117

2010-07-05 Thread jakub at gcc dot gnu dot org


--- Comment #11 from jakub at gcc dot gnu dot org  2010-07-05 12:21 ---
Fixed.


-- 

jakub at gcc dot gnu dot org changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution||FIXED


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44695



[Bug rtl-optimization/44695] [4.6 Regression] ice in simplify_subreg, at simplify-rtx.c:5117

2010-07-04 Thread hjl at gcc dot gnu dot org


--- Comment #10 from hjl at gcc dot gnu dot org  2010-07-04 23:18 ---
Subject: Bug 44695

Author: hjl
Date: Sun Jul  4 23:18:06 2010
New Revision: 161813

URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=161813
Log:
Change 8bit divmod to HImode.

gcc/

2010-07-04  H.J. Lu  hongjiu...@intel.com

PR rtl-optimization/44695
* config/i386/i386.md (extract_code): Removed.
(udivmodqi4): Likewise.
(divmodqi4): New.
(udivmodqi4): Likewise.
(divmodhiqi3): Change div/mod to HImode and extend operand 2 to
HImode.
(udivmodhiqi3): Likewise.

gcc/testsuite/

2010-07-04  H.J. Lu  hongjiu...@intel.com

PR rtl-optimization/44695
* gcc.dg/torture/pr44695.c: New.

Added:
trunk/gcc/testsuite/gcc.dg/torture/pr44695.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/config/i386/i386.md
trunk/gcc/testsuite/ChangeLog


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44695



[Bug rtl-optimization/44695] [4.6 Regression] ice in simplify_subreg, at simplify-rtx.c:5117

2010-07-01 Thread hjl dot tools at gmail dot com


--- Comment #8 from hjl dot tools at gmail dot com  2010-07-01 17:46 ---
The updated patch is at

http://gcc.gnu.org/ml/gcc-patches/2010-07/msg00076.html


-- 

hjl dot tools at gmail dot com changed:

   What|Removed |Added

URL|http://gcc.gnu.org/ml/gcc-  |http://gcc.gnu.org/ml/gcc-
   |patches/2010-   |patches/2010-
   |06/msg03173.html|07/msg00076.html


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44695



[Bug rtl-optimization/44695] [4.6 Regression] ice in simplify_subreg, at simplify-rtx.c:5117

2010-07-01 Thread hjl dot tools at gmail dot com


--- Comment #9 from hjl dot tools at gmail dot com  2010-07-02 00:37 ---
An updated patch is at

http://gcc.gnu.org/ml/gcc-patches/2010-07/msg00099.html


-- 

hjl dot tools at gmail dot com changed:

   What|Removed |Added

URL|http://gcc.gnu.org/ml/gcc-  |http://gcc.gnu.org/ml/gcc-
   |patches/2010-   |patches/2010-
   |07/msg00076.html|07/msg00099.html


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44695



[Bug rtl-optimization/44695] [4.6 Regression] ice in simplify_subreg, at simplify-rtx.c:5117

2010-06-30 Thread bonzini at gnu dot org


--- Comment #5 from bonzini at gnu dot org  2010-06-30 11:51 ---
I agree that the problem is a wrong pattern.

Here you have non-matching mode between the udiv/umod and the first argument:

 (ior:HI (ashift:HI (zero_extend:HI (umod:QI (reg:HI 68)
 (reg:QI 61 [ D.2750 ])))
 (const_int 8 [0x8]))
 (zero_extend:HI (udiv:QI (reg:HI 68)
 (reg:QI 61 [ D.2750 ]

Instead you need to have this before reload:

(set (match_operand:HI register_operand =a)
(ior:HI (ashift:HI
(zero_extend:HI (umod:QI (match_operand:QI register_operand 0)
 (match_operand:QI register_operand q)))
(const_int 8 [0x8]))
(zero_extend:HI (udiv:QI (match_dup 1) (match_dup 2

and after reload split it into a zero/sign extension of al into ax followed by

(set (match_dup 0)
(ior:HI (ashift:HI (umod:HI (match_dup 0)
 (zero_extend:HI (match_dup 2)))
(const_int 8 [0x8]))
(udiv:HI (match_dup 0)
(zero_extend:HI (match_dup 2

(or maybe sign extend into eax? QImode-SImode is definitely cheaper for zero
extension, I don't know about the cost of cbw because of partial register
stalls).


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44695



[Bug rtl-optimization/44695] [4.6 Regression] ice in simplify_subreg, at simplify-rtx.c:5117

2010-06-30 Thread hjl dot tools at gmail dot com


--- Comment #6 from hjl dot tools at gmail dot com  2010-06-30 18:15 ---
Created an attachment (id=21045)
 -- (http://gcc.gnu.org/bugzilla/attachment.cgi?id=21045action=view)
A patch

Using

(set (match_operand:HI register_operand =a)
(ior:HI (ashift:HI
(zero_extend:HI (umod:QI (match_operand:QI register_operand 0)
 (match_operand:QI register_operand q)))
(const_int 8 [0x8]))
(zero_extend:HI (udiv:QI (match_dup 1) (match_dup 2

before reload and split to

(set (match_dup 0)
(ior:HI (ashift:HI (umod:HI (match_dup 0)
 (zero_extend:HI (match_dup 2)))
(const_int 8 [0x8]))
(udiv:HI (match_dup 0)
(zero_extend:HI (match_dup 2

will generate extra QI-HI extend during split. This patch
uses subreg instead. Does it look OK?


-- 

hjl dot tools at gmail dot com changed:

   What|Removed |Added

  Attachment #21033|0   |1
is obsolete||


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44695



[Bug rtl-optimization/44695] [4.6 Regression] ice in simplify_subreg, at simplify-rtx.c:5117

2010-06-30 Thread hjl dot tools at gmail dot com


--- Comment #7 from hjl dot tools at gmail dot com  2010-06-30 18:46 ---
A patch is posted at

http://gcc.gnu.org/ml/gcc-patches/2010-06/msg03173.html


-- 

hjl dot tools at gmail dot com changed:

   What|Removed |Added

 CC||ubizjak at gmail dot com
URL||http://gcc.gnu.org/ml/gcc-
   ||patches/2010-
   ||06/msg03173.html


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44695



[Bug rtl-optimization/44695] [4.6 Regression] ice in simplify_subreg, at simplify-rtx.c:5117

2010-06-29 Thread hjl dot tools at gmail dot com


--- Comment #4 from hjl dot tools at gmail dot com  2010-06-29 19:16 ---
A patch is posted at

http://gcc.gnu.org/ml/gcc-patches/2010-06/msg03033.html


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44695



[Bug rtl-optimization/44695] [4.6 Regression] ice in simplify_subreg, at simplify-rtx.c:5117

2010-06-28 Thread rguenth at gcc dot gnu dot org


--- Comment #1 from rguenth at gcc dot gnu dot org  2010-06-28 09:17 ---
Confirmed.  A recent regression.

#2  0x009ad621 in simplify_subreg (outermode=HImode, 
op=0x77facd40, innermode=QImode, byte=0)
at /space/rguenther/src/svn/trunk/gcc/simplify-rtx.c:5116
5116  gcc_assert (GET_MODE (op) == innermode
5117  || GET_MODE (op) == VOIDmode);
(gdb) call debug_rtx (op)
(reg:HI 68)

during combine.


-- 

rguenth at gcc dot gnu dot org changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
  Component|c   |rtl-optimization
 Ever Confirmed|0   |1
   Last reconfirmed|-00-00 00:00:00 |2010-06-28 09:17:18
   date||
Summary|ice in simplify_subreg, at  |[4.6 Regression] ice in
   |simplify-rtx.c:5117 |simplify_subreg, at
   ||simplify-rtx.c:5117
   Target Milestone|--- |4.6.0
Version|unknown |4.6.0


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44695



[Bug rtl-optimization/44695] [4.6 Regression] ice in simplify_subreg, at simplify-rtx.c:5117

2010-06-28 Thread hjl dot tools at gmail dot com


--- Comment #2 from hjl dot tools at gmail dot com  2010-06-28 21:57 ---
I think it is a latent bug exposed by revision 161329. Now
x86 backend may generate:

(ior:HI (ashift:HI (zero_extend:HI (umod:QI (reg:HI 68)
(reg:QI 61 [ D.2750 ])))
(const_int 8 [0x8]))
(zero_extend:HI (udiv:QI (reg:HI 68)
(reg:QI 61 [ D.2750 ]

Combine ran into trouble:
(gdb) bt
#0  fancy_abort (
file=0x11e5860 /export/gnu/import/git/gcc/gcc/simplify-rtx.c, line=5117, 
function=0x11e6be0 simplify_subreg)
at /export/gnu/import/git/gcc/gcc/diagnostic.c:879
#1  0x009d76ad in simplify_subreg (outermode=HImode, 
op=0x71d04f00, innermode=QImode, byte=0)
at /export/gnu/import/git/gcc/gcc/simplify-rtx.c:5116
#2  0x009d87e6 in simplify_gen_subreg (outermode=HImode, 
op=0x71d04f00, innermode=QImode, byte=0)
at /export/gnu/import/git/gcc/gcc/simplify-rtx.c:5426
#3  0x00fcc60a in if_then_else_cond (x=0x71b6d390, 
ptrue=0x7fffd448, pfalse=0x7fffd438)
at /export/gnu/import/git/gcc/gcc/combine.c:8219
#4  0x00fcbf66 in if_then_else_cond (x=0x71b6d3a8, 
ptrue=0x7fffd4d0, pfalse=0x7fffd4c8)
at /export/gnu/import/git/gcc/gcc/combine.c:8103
#5  0x00fc305a in combine_simplify_rtx (x=0x71b6d3a8, 
op0_mode=VOIDmode, in_dest=0)
at /export/gnu/import/git/gcc/gcc/combine.c:4864
#6  0x00fc2def in subst (x=0x71b6d3a8, from=0x71c170c0, 
to=0x71c170c0, in_dest=0, unique_copy=0)
at /export/gnu/import/git/gcc/gcc/combine.c:4803
#7  0x00fc2ba7 in subst (x=0x71b64720, from=0x71c170c0, 
---Type return to continue, or q return to quit---
to=0x71c170c0, in_dest=0, unique_copy=0)
at /export/gnu/import/git/gcc/gcc/combine.c:4741
#8  0x00fc2ba7 in subst (x=0x71b64738, from=0x71c170c0, 
to=0x71c170c0, in_dest=0, unique_copy=0)
at /export/gnu/import/git/gcc/gcc/combine.c:4741
#9  0x00fbd20b in try_combine (i3=0x71b0a870, i2=0x71b0a798, 
i1=0x0, new_direct_jump_p=0x7fffdaf4)
at /export/gnu/import/git/gcc/gcc/combine.c:2885
#10 0x00fb911e in combine_instructions (f=0x71c227c0, nregs=70)
at /export/gnu/import/git/gcc/gcc/combine.c:1152
#11 0x00fd898f in rest_of_handle_combine ()
at /export/gnu/import/git/gcc/gcc/combine.c:13342


-- 

hjl dot tools at gmail dot com changed:

   What|Removed |Added

 CC||hjl dot tools at gmail dot
   ||com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44695



[Bug rtl-optimization/44695] [4.6 Regression] ice in simplify_subreg, at simplify-rtx.c:5117

2010-06-28 Thread hjl dot tools at gmail dot com


--- Comment #3 from hjl dot tools at gmail dot com  2010-06-28 23:21 ---
Created an attachment (id=21033)
 -- (http://gcc.gnu.org/bugzilla/attachment.cgi?id=21033action=view)
A patch

This patch avoids ICE. But it probably isn't the right fix.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44695