public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/59999] New: Sign extension in loop regression blocks generation of zero overhead loop
@ 2014-01-30 21:41 paulo@matos-sorge.com
  2014-01-31 10:08 ` [Bug tree-optimization/59999] [4.9 Regression] " rguenth at gcc dot gnu.org
                   ` (23 more replies)
  0 siblings, 24 replies; 25+ messages in thread
From: paulo@matos-sorge.com @ 2014-01-30 21:41 UTC (permalink / raw)
  To: gcc-bugs

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.


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

end of thread, other threads:[~2014-02-12 13:39 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-30 21:41 [Bug tree-optimization/59999] New: Sign extension in loop regression blocks generation of zero overhead loop paulo@matos-sorge.com
2014-01-31 10:08 ` [Bug tree-optimization/59999] [4.9 Regression] " rguenth at gcc dot gnu.org
2014-01-31 10:14 ` paulo@matos-sorge.com
2014-01-31 11:41 ` [Bug rtl-optimization/59999] " rguenth at gcc dot gnu.org
2014-01-31 12:04 ` paulo@matos-sorge.com
2014-01-31 14:52 ` rguenth at gcc dot gnu.org
2014-01-31 15:09 ` paulo@matos-sorge.com
2014-02-05 11:03 ` paulo@matos-sorge.com
2014-02-05 12:14 ` paulo@matos-sorge.com
2014-02-05 12:15 ` paulo@matos-sorge.com
2014-02-05 15:37 ` paulo@matos-sorge.com
2014-02-05 17:09 ` paulo@matos-sorge.com
2014-02-06 10:28 ` rguenth at gcc dot gnu.org
2014-02-06 11:16 ` paulo@matos-sorge.com
2014-02-06 11:25 ` paulo@matos-sorge.com
2014-02-06 12:05 ` rguenther at suse dot de
2014-02-06 12:40 ` paulo@matos-sorge.com
2014-02-06 13:04 ` paulo@matos-sorge.com
2014-02-06 13:17 ` rguenther at suse dot de
2014-02-06 13:20 ` rguenther at suse dot de
2014-02-07 10:08 ` paulo@matos-sorge.com
2014-02-07 11:01 ` rguenther at suse dot de
2014-02-12 13:03 ` paulo@matos-sorge.com
2014-02-12 13:30 ` rguenther at suse dot de
2014-02-12 13:39 ` pmatos at gcc dot gnu.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).