From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23853 invoked by alias); 18 Apr 2014 15:59:26 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 23820 invoked by uid 48); 18 Apr 2014 15:59:22 -0000 From: "hjl.tools at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/60879] Wrong decision in decide_alg in i386.c Date: Fri, 18 Apr 2014 15:59:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: 4.10.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: hjl.tools at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2014-04/txt/msg01351.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60879 --- Comment #2 from H.J. Lu --- (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.