This is the mail archive of the gcc-bugs@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]
Other format: [Raw text]

[Bug tree-optimization/59999] New: Sign extension in loop regression blocks generation of zero overhead loop


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

            Bug ID: 59999
           Summary: Sign extension in loop regression blocks generation of
                    zero overhead loop
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: paulo@matos-sorge.com

Following the discussion in the mailing list thread:
http://gcc.gnu.org/ml/gcc/2014-01/msg00319.html

I removed the undefined behaviour mentioned by Andreas. This code:

extern short delayLength;
typedef int Sample;
extern Sample *temp_ptr;
extern Sample x;

void
foo (short blockSize)
{
  short i;
  unsigned short loopCount;

  loopCount = (unsigned short)(blockSize + delayLength) % 8;

  for (i = 0; (int)i < (int)loopCount; i++)
    {
      *temp_ptr = x ^ *temp_ptr;
      temp_ptr++;
    }
}

displays the same regression.
v850 on trunk with -O2 -mv850e3v5:
_foo:
.LFB0:
        mov hilo(_delayLength),r10
        ld.h 0[r10],r10
        add r10,r6
        andi 7,r6,r6
        be .L1
        mov hilo(_temp_ptr),r15
        mov 0,r10
        ld.w 0[r15],r11
        mov hilo(_x),r14
.L4:
        ld.w 0[r11],r13
        ld.w 0[r14],r12
        add 1,r10
        add 4,r11
        xor r13,r12
        sxh r10
        st.w r12,-4[r11]
        cmp r6,r10
        blt .L4
        st.w r11,0[r15]
.L1:
        jmp [r31]
.LFE0:
        .size   _foo, .-_foo
        .section        .debug_frame,"",@progbits


GCC until 
commit e0ae2fe2a0bebe9de31e3d8eb4feace4909ef009
Author: vries <vries@138bc75d-0d04-0410-961f-82ee72b054a4>
Date:   Fri May 20 19:32:30 2011 +0000

    2011-05-20  Tom de Vries  <tom@codesourcery.com>

        PR target/45098
        * tree-ssa-loop-ivopts.c: Include expmed.h.
        (get_shiftadd_cost): New function.
        (force_expr_to_var_cost): Declare forward.  Use get_shiftadd_cost.


    git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@173976
138bc75d-0d04-0410-961f-82ee72b054a4

could do better by avoiding the sign extend inside the loop.
At the time it was not such of a problem. Nowadays we support zero overhead
loop for v850 and it is not being generated because of the sign extend. Similar
situation for the mep backend.


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