public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/60879] New: Wrong decision in decide_alg
@ 2014-04-18  0:33 hjl.tools at gmail dot com
  2014-04-18  7:14 ` [Bug target/60879] Wrong decision in decide_alg in i386.c jakub at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: hjl.tools at gmail dot com @ 2014-04-18  0:33 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 60879
           Summary: Wrong decision in decide_alg
           Product: gcc
           Version: 4.10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hjl.tools at gmail dot com
                CC: ubizjak at gmail dot com

decide_alg has

  /* Very tiny blocks are best handled via the loop, REP is expensive to
     setup.  */
  else if (expected_size != -1 && expected_size < 4)
    return loop_1_byte;

We use 1-byte loop on fixed size 1, 2 and 3.  We should simply unroll
loop.


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

* [Bug target/60879] Wrong decision in decide_alg in i386.c
  2014-04-18  0:33 [Bug target/60879] New: Wrong decision in decide_alg hjl.tools at gmail dot com
@ 2014-04-18  7:14 ` jakub at gcc dot gnu.org
  2014-04-18 15:59 ` hjl.tools at gmail dot com
  2021-08-28 19:02 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: jakub at gcc dot gnu.org @ 2014-04-18  7:14 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Does this ever matter though?  I mean, wouldn't we expand it as move by pieces
or store by pieces for such small constant length anyway and thus never reach
the target movmem/setmem expansion?


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

* [Bug target/60879] Wrong decision in decide_alg in i386.c
  2014-04-18  0:33 [Bug target/60879] New: Wrong decision in decide_alg hjl.tools at gmail dot com
  2014-04-18  7:14 ` [Bug target/60879] Wrong decision in decide_alg in i386.c jakub at gcc dot gnu.org
@ 2014-04-18 15:59 ` hjl.tools at gmail dot com
  2021-08-28 19:02 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: hjl.tools at gmail dot com @ 2014-04-18 15:59 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from H.J. Lu <hjl.tools at gmail dot com> ---
(In reply to Jakub Jelinek from comment #1)
> Does this ever matter though?  I mean, wouldn't we expand it as move by
> pieces or store by pieces for such small constant length anyway and thus
> never reach the target movmem/setmem expansion?

move by pieces or store by pieces are very efficient for
targets with unaligned move/store for integer and vector:

[hjl@gnu-6 partial]$ cat w.i
void
foo5 (const void *src, void *dest, int s)
{
  __builtin_memcpy (dest, src, 23);
}
[hjl@gnu-6 partial]$ gcc -S -O2 w.i
[hjl@gnu-6 partial]$ cat w.s

    .file    "w.i"
    .text
    .p2align 4,,15
    .globl    foo5
    .type    foo5, @function
foo5:
.LFB0:
    .cfi_startproc
    movq    (%rdi), %rax
    movq    %rax, (%rsi)
    movq    8(%rdi), %rax
    movq    %rax, 8(%rsi)
    movl    16(%rdi), %eax
    movl    %eax, 16(%rsi)
    movzwl    20(%rdi), %eax
    movw    %ax, 20(%rsi)
    movzbl    22(%rdi), %eax
    movb    %al, 22(%rsi)
    ret

I am working on a different set/mov memory strategy to generate

    movdqu    (%rdi), %xmm0
    movups    %xmm0, (%rsi)
    movq    15(%rdi), %rax
    movq    %rax, 15(%rsi)
    ret

by setting MOVE_RATIO to 1 and handling most of set/mov memory in
x86 backend.


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

* [Bug target/60879] Wrong decision in decide_alg in i386.c
  2014-04-18  0:33 [Bug target/60879] New: Wrong decision in decide_alg hjl.tools at gmail dot com
  2014-04-18  7:14 ` [Bug target/60879] Wrong decision in decide_alg in i386.c jakub at gcc dot gnu.org
  2014-04-18 15:59 ` hjl.tools at gmail dot com
@ 2021-08-28 19:02 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-28 19:02 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60879

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |12.0
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |FIXED
           Keywords|                            |missed-optimization

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Fixed on the trunk:

        movdqu  (%rdi), %xmm0
        movups  %xmm0, (%rsi)
        movq    15(%rdi), %rax
        movq    %rax, 15(%rsi)
        ret


While GCC 11 produced:

        movdqu  (%rdi), %xmm0
        movups  %xmm0, (%rsi)
        movl    16(%rdi), %eax
        movl    %eax, 16(%rsi)
        movzwl  20(%rdi), %eax
        movw    %ax, 20(%rsi)
        movzbl  22(%rdi), %eax
        movb    %al, 22(%rsi)
        ret

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

end of thread, other threads:[~2021-08-28 19:02 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-18  0:33 [Bug target/60879] New: Wrong decision in decide_alg hjl.tools at gmail dot com
2014-04-18  7:14 ` [Bug target/60879] Wrong decision in decide_alg in i386.c jakub at gcc dot gnu.org
2014-04-18 15:59 ` hjl.tools at gmail dot com
2021-08-28 19:02 ` pinskia 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).