public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/17387] New:  Redundant instructions in loop optimization
@ 2004-09-09 23:54 hjl at lucon dot org
  2004-09-10  0:36 ` [Bug rtl-optimization/17387] " pinskia at gcc dot gnu dot org
                   ` (20 more replies)
  0 siblings, 21 replies; 27+ messages in thread
From: hjl at lucon dot org @ 2004-09-09 23:54 UTC (permalink / raw)
  To: gcc-bugs

For this code:

extern unsigned int S[];
extern unsigned int state[];
 
unsigned int
foo ()
{
  register unsigned int t;
  register int j;
 
  j=0;
  t=0;
  for (j=0; j<16; j+=4)
   {
     t= state[j+ 0]^=S[t];
     t= state[j+ 1]^=S[t];
     t= state[j+ 2]^=S[t];
     t= state[j+ 3]^=S[t];
   }
  t=(t)&0xff;
  return t;
 }

With -O3, gcc generates:

foo:
.LFB2:
        xorl    %esi, %esi
        xorl    %ecx, %ecx
        .p2align 4,,7
.L2:
        movslq  %esi,%rdx
        mov     %ecx, %eax
        movl    S(,%rax,4), %eax
        xorl    state(,%rdx,4), %eax
        movl    %eax, state(,%rdx,4)
        leal    1(%rsi), %edx
        mov     %eax, %eax              <====== Why?
        movl    S(,%rax,4), %eax
        movslq  %edx,%rdx
        xorl    state(,%rdx,4), %eax
        movl    %eax, state(,%rdx,4)
        leal    2(%rsi), %edx
        mov     %eax, %eax               <====== Why?
        movl    S(,%rax,4), %eax
        movslq  %edx,%rdx
        xorl    state(,%rdx,4), %eax
        movl    %eax, state(,%rdx,4)
        leal    3(%rsi), %edx
        mov     %eax, %eax               <====== Why?
        movl    S(,%rax,4), %ecx
        leal    4(%rsi), %eax
        movslq  %edx,%rdx
        xorl    state(,%rdx,4), %ecx
        cmpl    $16, %eax
        movl    %eax, %esi
        movl    %ecx, state(,%rdx,4)
        jne     .L2
        movzbl  %cl,%eax
        ret

With -O3, gcc 3.4.3 gets

foo:
.LFB2:
        xorl    %edi, %edi
        xorl    %ecx, %ecx
        movl    $state, %esi
        .p2align 4,,7
.L5:
        movslq  %ecx,%rdx
        mov     %edi, %eax
        addl    $4, %ecx
        movl    S(,%rax,4), %r11d
        xorl    state(,%rdx,4), %r11d
        mov     %r11d, %r10d            <====== Why?
        movl    %r11d, state(,%rdx,4)
        movl    S(,%r10,4), %r9d
        xorl    state+4(,%rdx,4), %r9d
        mov     %r9d, %r8d               <====== Why?  
        movl    %r9d, 4(%rsi,%rdx,4)
        movl    S(,%r8,4), %edi
        xorl    state+8(,%rdx,4), %edi
        mov     %edi, %eax               <====== Why?
        movl    %edi, 8(%rsi,%rdx,4)
        movl    S(,%rax,4), %eax
        xorl    state+12(,%rdx,4), %eax
        cmpl    $15, %ecx
        movl    %eax, 12(%rsi,%rdx,4)
        movl    %eax, %edi
        jle     .L5
        andl    $255, %eax
        ret

-- 
           Summary:  Redundant instructions in loop optimization
           Product: gcc
           Version: 4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: hjl at lucon dot org
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: x86_64-unknown-linux-gnu
  GCC host triplet: x86_64-unknown-linux-gnu
GCC target triplet: x86_64-unknown-linux-gnu


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


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [Bug rtl-optimization/17387] Redundant instructions in loop optimization
  2004-09-09 23:54 [Bug c/17387] New: Redundant instructions in loop optimization hjl at lucon dot org
@ 2004-09-10  0:36 ` pinskia at gcc dot gnu dot org
  2004-09-10  2:50 ` law at gcc dot gnu dot org
                   ` (19 subsequent siblings)
  20 siblings, 0 replies; 27+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-09-10  0:36 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|c                           |rtl-optimization
           Keywords|                            |missed-optimization
            Summary| Redundant instructions in  |Redundant instructions in
                   |loop optimization           |loop optimization


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


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [Bug rtl-optimization/17387] Redundant instructions in loop optimization
  2004-09-09 23:54 [Bug c/17387] New: Redundant instructions in loop optimization hjl at lucon dot org
  2004-09-10  0:36 ` [Bug rtl-optimization/17387] " pinskia at gcc dot gnu dot org
@ 2004-09-10  2:50 ` law at gcc dot gnu dot org
  2004-09-10  8:05 ` pinskia at gcc dot gnu dot org
                   ` (18 subsequent siblings)
  20 siblings, 0 replies; 27+ messages in thread
From: law at gcc dot gnu dot org @ 2004-09-10  2:50 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |law at redhat dot com


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


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [Bug rtl-optimization/17387] Redundant instructions in loop optimization
  2004-09-09 23:54 [Bug c/17387] New: Redundant instructions in loop optimization hjl at lucon dot org
  2004-09-10  0:36 ` [Bug rtl-optimization/17387] " pinskia at gcc dot gnu dot org
  2004-09-10  2:50 ` law at gcc dot gnu dot org
@ 2004-09-10  8:05 ` pinskia at gcc dot gnu dot org
  2004-09-10  9:53 ` hubicka at gcc dot gnu dot org
                   ` (17 subsequent siblings)
  20 siblings, 0 replies; 27+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-09-10  8:05 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-09-10 08:05 -------
The patch listed here might help: <http://gcc.gnu.org/ml/gcc/2004-09/msg00377.html>.

-- 


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


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [Bug rtl-optimization/17387] Redundant instructions in loop optimization
  2004-09-09 23:54 [Bug c/17387] New: Redundant instructions in loop optimization hjl at lucon dot org
                   ` (2 preceding siblings ...)
  2004-09-10  8:05 ` pinskia at gcc dot gnu dot org
@ 2004-09-10  9:53 ` hubicka at gcc dot gnu dot org
  2004-09-10 23:22 ` pinskia at gcc dot gnu dot org
                   ` (16 subsequent siblings)
  20 siblings, 0 replies; 27+ messages in thread
From: hubicka at gcc dot gnu dot org @ 2004-09-10  9:53 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From hubicka at gcc dot gnu dot org  2004-09-10 09:53 -------
The funny instruction is a zero extension done via 32bit move.  tree-ssa-ivopts should promote the induction variable to 64bit counter for sure.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |rakdver at atrey dot karlin
                   |dot org                     |dot mff dot cuni dot cz
             Status|UNCONFIRMED                 |ASSIGNED
   Target Milestone|---                         |4.0.0


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


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [Bug rtl-optimization/17387] Redundant instructions in loop optimization
  2004-09-09 23:54 [Bug c/17387] New: Redundant instructions in loop optimization hjl at lucon dot org
                   ` (3 preceding siblings ...)
  2004-09-10  9:53 ` hubicka at gcc dot gnu dot org
@ 2004-09-10 23:22 ` pinskia at gcc dot gnu dot org
  2004-09-11 19:55 ` rakdver at gcc dot gnu dot org
                   ` (15 subsequent siblings)
  20 siblings, 0 replies; 27+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-09-10 23:22 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-09-10 23:21 -------
Actually this can be reproduce without IV.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|rakdver at atrey dot karlin |unassigned at gcc dot gnu
                   |dot mff dot cuni dot cz     |dot org
             Status|ASSIGNED                    |NEW
   Target Milestone|4.0.0                       |---


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


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [Bug rtl-optimization/17387] Redundant instructions in loop optimization
  2004-09-09 23:54 [Bug c/17387] New: Redundant instructions in loop optimization hjl at lucon dot org
                   ` (4 preceding siblings ...)
  2004-09-10 23:22 ` pinskia at gcc dot gnu dot org
@ 2004-09-11 19:55 ` rakdver at gcc dot gnu dot org
  2004-11-27 20:49 ` pinskia at gcc dot gnu dot org
                   ` (14 subsequent siblings)
  20 siblings, 0 replies; 27+ messages in thread
From: rakdver at gcc dot gnu dot org @ 2004-09-11 19:55 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From rakdver at gcc dot gnu dot org  2004-09-11 19:55 -------
ivopts gets rid of the extends once the record_bounds pass is enabled by the 
following patch.  The nonsensical "mov     %eax, %eax" type moves however
still remain in the code.

Zdenek

Index: tree-optimize.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-optimize.c,v
retrieving revision 2.45
diff -c -3 -p -r2.45 tree-optimize.c
*** tree-optimize.c     9 Sep 2004 20:53:36 -0000       2.45
--- tree-optimize.c     11 Sep 2004 19:44:56 -0000
*************** init_tree_optimization_passes (void)
*** 392,397 ****
--- 392,398 ----
    NEXT_PASS (pass_loop_init);
    NEXT_PASS (pass_lim);
    NEXT_PASS (pass_iv_canon);
+   NEXT_PASS (pass_record_bounds);
    NEXT_PASS (pass_if_conversion);
    NEXT_PASS (pass_vectorize);
    NEXT_PASS (pass_linear_transform);
Index: tree-pass.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-pass.h,v
retrieving revision 2.15
diff -c -3 -p -r2.15 tree-pass.h
*** tree-pass.h 9 Sep 2004 20:53:37 -0000       2.15
--- tree-pass.h 11 Sep 2004 19:44:56 -0000
*************** extern struct tree_opt_pass pass_loop;
*** 126,131 ****
--- 126,132 ----
  extern struct tree_opt_pass pass_loop_init;
  extern struct tree_opt_pass pass_lim;
  extern struct tree_opt_pass pass_iv_canon;
+ extern struct tree_opt_pass pass_record_bounds;
  extern struct tree_opt_pass pass_if_conversion;
  extern struct tree_opt_pass pass_vectorize;
  extern struct tree_opt_pass pass_complete_unroll;
Index: tree-ssa-loop.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-ssa-loop.c,v
retrieving revision 2.17
diff -c -3 -p -r2.17 tree-ssa-loop.c
*** tree-ssa-loop.c     8 Sep 2004 15:28:56 -0000       2.17
--- tree-ssa-loop.c     11 Sep 2004 19:44:57 -0000
*************** struct tree_opt_pass pass_iv_canon =
*** 263,268 ****
--- 263,297 ----
    0                                   /* letter */
  };

+ /* Record bounds on numbers of iterations of loops.  */
+
+ static void
+ tree_ssa_loop_bounds (void)
+ {
+   if (!current_loops)
+     return;
+
+   estimate_numbers_of_iterations (current_loops);
+   scev_reset ();
+ }
+
+ struct tree_opt_pass pass_record_bounds =
+ {
+   "bounds",                           /* name */
+   NULL,                                       /* gate */
+   tree_ssa_loop_bounds,                       /* execute */
+   NULL,                                       /* sub */
+   NULL,                                       /* next */
+   0,                                  /* static_pass_number */
+   0,                                  /* tv_id */
+   PROP_cfg | PROP_ssa,                        /* properties_required */
+   0,                                  /* properties_provided */
+   0,                                  /* properties_destroyed */
+   0,                                  /* todo_flags_start */
+   0,                                  /* todo_flags_finish */
+   0                                   /* letter */
+ };
+
  /* Complete unrolling of loops.  */

  static void


-- 


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


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [Bug rtl-optimization/17387] Redundant instructions in loop optimization
  2004-09-09 23:54 [Bug c/17387] New: Redundant instructions in loop optimization hjl at lucon dot org
                   ` (5 preceding siblings ...)
  2004-09-11 19:55 ` rakdver at gcc dot gnu dot org
@ 2004-11-27 20:49 ` pinskia at gcc dot gnu dot org
  2005-01-23 13:36 ` steven at gcc dot gnu dot org
                   ` (13 subsequent siblings)
  20 siblings, 0 replies; 27+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-11-27 20:49 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement
   Last reconfirmed|0000-00-00 00:00:00         |2004-11-27 20:49:43
               date|                            |


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


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [Bug rtl-optimization/17387] Redundant instructions in loop optimization
  2004-09-09 23:54 [Bug c/17387] New: Redundant instructions in loop optimization hjl at lucon dot org
                   ` (6 preceding siblings ...)
  2004-11-27 20:49 ` pinskia at gcc dot gnu dot org
@ 2005-01-23 13:36 ` steven at gcc dot gnu dot org
  2005-01-24 18:17 ` hjl at lucon dot org
                   ` (12 subsequent siblings)
  20 siblings, 0 replies; 27+ messages in thread
From: steven at gcc dot gnu dot org @ 2005-01-23 13:36 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From steven at gcc dot gnu dot org  2005-01-23 13:35 -------
Mainline today produces: 
 
foo: 
.LFB2: 
        xorl    %eax, %eax 
        movl    $4, %ecx 
        movl    $state, %edx 
        .p2align 4,,7 
.L2: 
        mov     %eax, %eax 
        movl    S(,%rax,4), %eax 
        xorl    (%rdx), %eax 
        movl    %eax, (%rdx) 
        mov     %eax, %eax 
        movl    S(,%rax,4), %eax 
        xorl    4(%rdx), %eax 
        movl    %eax, 4(%rdx) 
        mov     %eax, %eax 
        movl    S(,%rax,4), %eax 
        xorl    8(%rdx), %eax 
        movl    %eax, 8(%rdx) 
        mov     %eax, %eax 
        movl    S(,%rax,4), %eax 
        xorl    12(%rdx), %eax 
        movl    %eax, 12(%rdx) 
        addq    $16, %rdx 
        decl    %ecx 
        jne     .L2 
        andl    $255, %eax 
        ret 
 

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.0.0


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


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [Bug rtl-optimization/17387] Redundant instructions in loop optimization
  2004-09-09 23:54 [Bug c/17387] New: Redundant instructions in loop optimization hjl at lucon dot org
                   ` (7 preceding siblings ...)
  2005-01-23 13:36 ` steven at gcc dot gnu dot org
@ 2005-01-24 18:17 ` hjl at lucon dot org
  2005-01-24 18:53 ` pinskia at gcc dot gnu dot org
                   ` (11 subsequent siblings)
  20 siblings, 0 replies; 27+ messages in thread
From: hjl at lucon dot org @ 2005-01-24 18:17 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From hjl at lucon dot org  2005-01-24 18:17 -------
Looking at the mainline result, I still see "mov %eax, %eax", which was
the original bug report for mainline.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |UNCONFIRMED
         Resolution|FIXED                       |


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


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [Bug rtl-optimization/17387] Redundant instructions in loop optimization
  2004-09-09 23:54 [Bug c/17387] New: Redundant instructions in loop optimization hjl at lucon dot org
                   ` (8 preceding siblings ...)
  2005-01-24 18:17 ` hjl at lucon dot org
@ 2005-01-24 18:53 ` pinskia at gcc dot gnu dot org
  2005-01-27  1:27 ` steven at gcc dot gnu dot org
                   ` (10 subsequent siblings)
  20 siblings, 0 replies; 27+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-01-24 18:53 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-01-24 18:52 -------
Confirmed again.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
   Last reconfirmed|2004-11-27 20:49:43         |2005-01-24 18:52:13
               date|                            |
   Target Milestone|4.0.0                       |---


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


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [Bug rtl-optimization/17387] Redundant instructions in loop optimization
  2004-09-09 23:54 [Bug c/17387] New: Redundant instructions in loop optimization hjl at lucon dot org
                   ` (9 preceding siblings ...)
  2005-01-24 18:53 ` pinskia at gcc dot gnu dot org
@ 2005-01-27  1:27 ` steven at gcc dot gnu dot org
  2005-01-27  1:36 ` steven at gcc dot gnu dot org
                   ` (9 subsequent siblings)
  20 siblings, 0 replies; 27+ messages in thread
From: steven at gcc dot gnu dot org @ 2005-01-27  1:27 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From steven at gcc dot gnu dot org  2005-01-27 01:27 -------
Uhm, right.  OK then, lemme have a look. 

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |steven at gcc dot gnu dot
                   |dot org                     |org
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2005-01-24 18:52:13         |2005-01-27 01:27:34
               date|                            |


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


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [Bug rtl-optimization/17387] Redundant instructions in loop optimization
  2004-09-09 23:54 [Bug c/17387] New: Redundant instructions in loop optimization hjl at lucon dot org
                   ` (10 preceding siblings ...)
  2005-01-27  1:27 ` steven at gcc dot gnu dot org
@ 2005-01-27  1:36 ` steven at gcc dot gnu dot org
  2005-01-27  1:43 ` steven at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  20 siblings, 0 replies; 27+ messages in thread
From: steven at gcc dot gnu dot org @ 2005-01-27  1:36 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From steven at gcc dot gnu dot org  2005-01-27 01:36 -------
My first suspicion was the `register' keyword, but that's not it: 
 
-------------------------------------------------- 
extern unsigned int S[]; 
extern unsigned int state[]; 
 
unsigned int 
foo () 
{ 
  unsigned int t; 
  int j; 
 
  t=0; 
  for (j=0; j<16; j+=4) 
   { 
     t = state[j + 0] ^= S[t]; 
     t = state[j + 1] ^= S[t]; 
   } 
  return t; 
} 
-------------------------------------------------- 
 
--> 
 
-------------------------------------------------- 
foo: 
.LFB2: 
        xorl    %eax, %eax 
        movl    $4, %ecx 
        movl    $state, %edx 
        .p2align 4,,7 
.L2: 
        mov     %eax, %eax 
        movl    S(,%rax,4), %eax 
        xorl    (%rdx), %eax 
        movl    %eax, (%rdx) 
        mov     %eax, %eax        <-- bah! 
        movl    S(,%rax,4), %eax 
        xorl    4(%rdx), %eax 
        movl    %eax, 4(%rdx) 
        addq    $16, %rdx 
        decl    %ecx 
        jne     .L2 
        rep ; ret 
.LFE2: 
-------------------------------------------------- 

-- 


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


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [Bug rtl-optimization/17387] Redundant instructions in loop optimization
  2004-09-09 23:54 [Bug c/17387] New: Redundant instructions in loop optimization hjl at lucon dot org
                   ` (11 preceding siblings ...)
  2005-01-27  1:36 ` steven at gcc dot gnu dot org
@ 2005-01-27  1:43 ` steven at gcc dot gnu dot org
  2005-01-27  4:03 ` hjl at lucon dot org
                   ` (7 subsequent siblings)
  20 siblings, 0 replies; 27+ messages in thread
From: steven at gcc dot gnu dot org @ 2005-01-27  1:43 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From steven at gcc dot gnu dot org  2005-01-27 01:43 -------
GCC can't see that this is a NOP because of the zero_extend: 
 
#(insn 34 30 37 (set (reg:DI 0 ax [orig:76 D.1460 ] [76]) 
#        (zero_extend:DI (reg:SI 0 ax [orig:70 D.1460 ] [70]))) 111 
{zero_extendsidi2_rex64} (insn_list:REG_DEP_ANTI 30 (insn_list:REG_DEP_TRUE 29 
(nil))) 
#    (nil)) 
        mov     %eax, %eax      # D.1460, D.1460        # 34    
zero_extendsidi2_rex64/1        [length = 3] 
 
Perhaps we should have a peephole2 for this.  I'm curious why we can not 
eliminate the move earlier on, though. 
 
 

-- 


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


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [Bug rtl-optimization/17387] Redundant instructions in loop optimization
  2004-09-09 23:54 [Bug c/17387] New: Redundant instructions in loop optimization hjl at lucon dot org
                   ` (12 preceding siblings ...)
  2005-01-27  1:43 ` steven at gcc dot gnu dot org
@ 2005-01-27  4:03 ` hjl at lucon dot org
  2005-01-27  6:05 ` rth at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  20 siblings, 0 replies; 27+ messages in thread
From: hjl at lucon dot org @ 2005-01-27  4:03 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From hjl at lucon dot org  2005-01-27 04:03 -------
Gcc doesn't know/remember

movl    S(,%rax,4), %eax

will zero extend to 64bit. I don't know you can touch only the lower
32bit bits.

-- 


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


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [Bug rtl-optimization/17387] Redundant instructions in loop optimization
  2004-09-09 23:54 [Bug c/17387] New: Redundant instructions in loop optimization hjl at lucon dot org
                   ` (13 preceding siblings ...)
  2005-01-27  4:03 ` hjl at lucon dot org
@ 2005-01-27  6:05 ` rth at gcc dot gnu dot org
  2005-01-27  7:14 ` stevenb at suse dot de
                   ` (5 subsequent siblings)
  20 siblings, 0 replies; 27+ messages in thread
From: rth at gcc dot gnu dot org @ 2005-01-27  6:05 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From rth at gcc dot gnu dot org  2005-01-27 06:05 -------
Steven, you do realize this is essentially unfixable without a new pass that
optimially places widened operations, don't you?

-- 


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


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [Bug rtl-optimization/17387] Redundant instructions in loop optimization
  2004-09-09 23:54 [Bug c/17387] New: Redundant instructions in loop optimization hjl at lucon dot org
                   ` (14 preceding siblings ...)
  2005-01-27  6:05 ` rth at gcc dot gnu dot org
@ 2005-01-27  7:14 ` stevenb at suse dot de
  2005-01-27 10:14 ` steven at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  20 siblings, 0 replies; 27+ messages in thread
From: stevenb at suse dot de @ 2005-01-27  7:14 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From stevenb at suse dot de  2005-01-27 07:14 -------
Subject: Re:  Redundant instructions in loop optimization

On Thursday 27 January 2005 07:05, rth at gcc dot gnu dot org wrote:
> ------- Additional Comments From rth at gcc dot gnu dot org  2005-01-27
> 06:05 ------- Steven, you do realize this is essentially unfixable without
> a new pass that optimially places widened operations, don't you?

No, I didn't :-)

So you suggest closing this as SUSPEND?


-- 


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


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [Bug rtl-optimization/17387] Redundant instructions in loop optimization
  2004-09-09 23:54 [Bug c/17387] New: Redundant instructions in loop optimization hjl at lucon dot org
                   ` (15 preceding siblings ...)
  2005-01-27  7:14 ` stevenb at suse dot de
@ 2005-01-27 10:14 ` steven at gcc dot gnu dot org
  2005-01-27 10:27 ` steven at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  20 siblings, 0 replies; 27+ messages in thread
From: steven at gcc dot gnu dot org @ 2005-01-27 10:14 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From steven at gcc dot gnu dot org  2005-01-27 10:13 -------
More knowledgable sources than me say: 
"[mov     %eax, %eax ] is not nop.  32bit operations implicitly zero 
extend, so this is zero extension.  There is no movqzx." 
 
 

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED


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


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [Bug rtl-optimization/17387] Redundant instructions in loop optimization
  2004-09-09 23:54 [Bug c/17387] New: Redundant instructions in loop optimization hjl at lucon dot org
                   ` (16 preceding siblings ...)
  2005-01-27 10:14 ` steven at gcc dot gnu dot org
@ 2005-01-27 10:27 ` steven at gcc dot gnu dot org
  2005-01-27 10:28 ` steven at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  20 siblings, 0 replies; 27+ messages in thread
From: steven at gcc dot gnu dot org @ 2005-01-27 10:27 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From steven at gcc dot gnu dot org  2005-01-27 10:23 -------
moron alert 

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|FIXED                       |


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


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [Bug rtl-optimization/17387] Redundant instructions in loop optimization
  2004-09-09 23:54 [Bug c/17387] New: Redundant instructions in loop optimization hjl at lucon dot org
                   ` (17 preceding siblings ...)
  2005-01-27 10:27 ` steven at gcc dot gnu dot org
@ 2005-01-27 10:28 ` steven at gcc dot gnu dot org
  2005-01-27 13:36 ` pinskia at gcc dot gnu dot org
  2005-09-29  3:44 ` pinskia at gcc dot gnu dot org
  20 siblings, 0 replies; 27+ messages in thread
From: steven at gcc dot gnu dot org @ 2005-01-27 10:28 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From steven at gcc dot gnu dot org  2005-01-27 10:24 -------
/me should read up on the amd64 instruction set first :-( 

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|steven at gcc dot gnu dot   |unassigned at gcc dot gnu
                   |org                         |dot org
             Status|REOPENED                    |NEW


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


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [Bug rtl-optimization/17387] Redundant instructions in loop optimization
  2004-09-09 23:54 [Bug c/17387] New: Redundant instructions in loop optimization hjl at lucon dot org
                   ` (18 preceding siblings ...)
  2005-01-27 10:28 ` steven at gcc dot gnu dot org
@ 2005-01-27 13:36 ` pinskia at gcc dot gnu dot org
  2005-09-29  3:44 ` pinskia at gcc dot gnu dot org
  20 siblings, 0 replies; 27+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-01-27 13:36 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-01-27 13:36 -------
(In reply to comment #13)
> No, I didn't :-)
> 
> So you suggest closing this as SUSPEND?

Yes.  But note IBM haifa is going to submit a pass for this and has been outlined before.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |SUSPENDED


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


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [Bug rtl-optimization/17387] Redundant instructions in loop optimization
  2004-09-09 23:54 [Bug c/17387] New: Redundant instructions in loop optimization hjl at lucon dot org
                   ` (19 preceding siblings ...)
  2005-01-27 13:36 ` pinskia at gcc dot gnu dot org
@ 2005-09-29  3:44 ` pinskia at gcc dot gnu dot org
  20 siblings, 0 replies; 27+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-09-29  3:44 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-09-29 03:44 -------
New patch was posted:
http://gcc.gnu.org/ml/gcc-patches/2005-09/msg01769.html

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
 GCC target triplet|x86_64-*-linux-gnu          |x86_64-*-*


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


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [Bug rtl-optimization/17387] Redundant instructions in loop optimization
       [not found] <bug-17387-682@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2007-04-20 21:10 ` steven at gcc dot gnu dot org
@ 2007-05-25 20:32 ` steven at gcc dot gnu dot org
  4 siblings, 0 replies; 27+ messages in thread
From: steven at gcc dot gnu dot org @ 2007-05-25 20:32 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #22 from steven at gcc dot gnu dot org  2007-05-25 20:32 -------
With the current implementation of SEE it is almost impossible to make it work
on x86.  You have to take into account the liveness of the flags register, and
there currently is no way to include that in the dataflow equations.  Maybe
someone else knows how to do this...


-- 

steven at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|steven at gcc dot gnu dot   |unassigned at gcc dot gnu
                   |org                         |dot org
             Status|ASSIGNED                    |NEW


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


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [Bug rtl-optimization/17387] Redundant instructions in loop optimization
       [not found] <bug-17387-682@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2007-04-20 20:58 ` steven at gcc dot gnu dot org
@ 2007-04-20 21:10 ` steven at gcc dot gnu dot org
  2007-05-25 20:32 ` steven at gcc dot gnu dot org
  4 siblings, 0 replies; 27+ messages in thread
From: steven at gcc dot gnu dot org @ 2007-04-20 21:10 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #21 from steven at gcc dot gnu dot org  2007-04-20 22:10 -------
Collection of important related links:
http://gcc.gnu.org/ml/gcc-patches/2006-04/msg00766.html
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27437#c5


-- 

steven at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  BugsThisDependsOn|                            |27437


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


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [Bug rtl-optimization/17387] Redundant instructions in loop optimization
       [not found] <bug-17387-682@http.gcc.gnu.org/bugzilla/>
  2006-01-15 20:30 ` pinskia at gcc dot gnu dot org
  2006-02-27 23:55 ` hjl at lucon dot org
@ 2007-04-20 20:58 ` steven at gcc dot gnu dot org
  2007-04-20 21:10 ` steven at gcc dot gnu dot org
  2007-05-25 20:32 ` steven at gcc dot gnu dot org
  4 siblings, 0 replies; 27+ messages in thread
From: steven at gcc dot gnu dot org @ 2007-04-20 20:58 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #20 from steven at gcc dot gnu dot org  2007-04-20 21:58 -------
It is my intention to fix see.c to work on x86* hardware, so I'm taking this
bug.


-- 

steven at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |steven at gcc dot gnu dot
                   |dot org                     |org
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2006-01-15 20:30:45         |2007-04-20 21:58:36
               date|                            |


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


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [Bug rtl-optimization/17387] Redundant instructions in loop optimization
       [not found] <bug-17387-682@http.gcc.gnu.org/bugzilla/>
  2006-01-15 20:30 ` pinskia at gcc dot gnu dot org
@ 2006-02-27 23:55 ` hjl at lucon dot org
  2007-04-20 20:58 ` steven at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 27+ messages in thread
From: hjl at lucon dot org @ 2006-02-27 23:55 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #19 from hjl at lucon dot org  2006-02-27 23:40 -------
Even with the new patch

http://gcc.gnu.org/ml/gcc-patches/2006-02/msg01994.html

I still got the same result. The new see pass won't touch

(insn:HI 13 9 14 2 (set (reg/v:SI 73 [ t ])
        (mem/s:SI (symbol_ref:DI ("state") [flags 0x40] <var_decl 0x2a98541420
state>) [3 state+0 S4 A32])) 40 {*movsi_1} (nil)
    (nil))

(insn:HI 14 13 16 2 (parallel [
            (set (reg/v:SI 73 [ t ])
                (xor:SI (mem/s:SI (symbol_ref:DI ("S") [flags 0x40] <var_decl
0x2a985412c0 S>) [3 S+0 S4 A32])
                    (reg/v:SI 73 [ t ])))
            (clobber (reg:CC 17 flags))
        ]) 340 {*xorsi_1} (insn_list:REG_DEP_TRUE 13 (nil))
    (expr_list:REG_UNUSED (reg:CC 17 flags)
        (expr_list:REG_EQUAL (xor:SI (mem/s:SI (symbol_ref:DI ("S") [flags
0x40] <var_decl 0x2a985412c0 S>) [3 S+0 S4 A32])
                (mem/s:SI (symbol_ref:DI ("state") [flags 0x40] <var_decl
0x2a98541420 state>) [3 state+0 S4 A32]))
            (nil))))

(insn:HI 16 14 18 2 (set (mem/s:SI (symbol_ref:DI ("state") [flags 0x40]
<var_decl 0x2a98541420 state>) [3 state+0 S4 A32])
        (reg/v:SI 73 [ t ])) 40 {*movsi_1} (insn_list:REG_DEP_TRUE 14 (nil))
    (nil))

(insn:HI 18 16 21 2 (set (reg:DI 79 [ t ])
        (zero_extend:DI (reg/v:SI 73 [ t ]))) 111 {zero_extendsidi2_rex64}
(nil)
    (expr_list:REG_DEAD (reg/v:SI 73 [ t ])
        (nil)))


-- 

hjl at lucon dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Version|4.0.0                       |4.2.0


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


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [Bug rtl-optimization/17387] Redundant instructions in loop optimization
       [not found] <bug-17387-682@http.gcc.gnu.org/bugzilla/>
@ 2006-01-15 20:30 ` pinskia at gcc dot gnu dot org
  2006-02-27 23:55 ` hjl at lucon dot org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 27+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-01-15 20:30 UTC (permalink / raw)
  To: gcc-bugs



-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|SUSPENDED                   |NEW
   Last reconfirmed|2005-05-04 18:12:43         |2006-01-15 20:30:45
               date|                            |


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


^ permalink raw reply	[flat|nested] 27+ messages in thread

end of thread, other threads:[~2007-05-25 20:32 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-09-09 23:54 [Bug c/17387] New: Redundant instructions in loop optimization hjl at lucon dot org
2004-09-10  0:36 ` [Bug rtl-optimization/17387] " pinskia at gcc dot gnu dot org
2004-09-10  2:50 ` law at gcc dot gnu dot org
2004-09-10  8:05 ` pinskia at gcc dot gnu dot org
2004-09-10  9:53 ` hubicka at gcc dot gnu dot org
2004-09-10 23:22 ` pinskia at gcc dot gnu dot org
2004-09-11 19:55 ` rakdver at gcc dot gnu dot org
2004-11-27 20:49 ` pinskia at gcc dot gnu dot org
2005-01-23 13:36 ` steven at gcc dot gnu dot org
2005-01-24 18:17 ` hjl at lucon dot org
2005-01-24 18:53 ` pinskia at gcc dot gnu dot org
2005-01-27  1:27 ` steven at gcc dot gnu dot org
2005-01-27  1:36 ` steven at gcc dot gnu dot org
2005-01-27  1:43 ` steven at gcc dot gnu dot org
2005-01-27  4:03 ` hjl at lucon dot org
2005-01-27  6:05 ` rth at gcc dot gnu dot org
2005-01-27  7:14 ` stevenb at suse dot de
2005-01-27 10:14 ` steven at gcc dot gnu dot org
2005-01-27 10:27 ` steven at gcc dot gnu dot org
2005-01-27 10:28 ` steven at gcc dot gnu dot org
2005-01-27 13:36 ` pinskia at gcc dot gnu dot org
2005-09-29  3:44 ` pinskia at gcc dot gnu dot org
     [not found] <bug-17387-682@http.gcc.gnu.org/bugzilla/>
2006-01-15 20:30 ` pinskia at gcc dot gnu dot org
2006-02-27 23:55 ` hjl at lucon dot org
2007-04-20 20:58 ` steven at gcc dot gnu dot org
2007-04-20 21:10 ` steven at gcc dot gnu dot org
2007-05-25 20:32 ` steven at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).