From patchwork Mon Sep 9 07:42:05 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Zolotukhin X-Patchwork-Id: 273515 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "www.sourceware.org", Issuer "StartCom Class 1 Primary Intermediate Server CA" (not verified)) by ozlabs.org (Postfix) with ESMTPS id 750732C0116 for ; Mon, 9 Sep 2013 17:42:43 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; q=dns; s=default; b=QFNl7d/1S67dcMzQP 8vYb4kHdZXl3EXWW2BNC9zYjmjmDrBWGIZSP50jNSDPVuzlEzZ2hAqCfiiaGW4SI JAbr/Mc22exOqTpY9LXCT2E8M29OYv1FbNyEF2R9MFZFp58alnfsZiAGfUgVBkvt x/vKtAdqSIYkDC+PkYBwbTJuDg= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=default; bh=m/2IRq1lqgNPhgyIrElnsOC Kz0E=; b=FCBItTYFz/dtyMqaGRPiYcuTxW1ScpsvAaQbQqeFXXluGi/RoNPfpyH e8lcN5ogi4ukaYaUMluMW7Ebpz8VAfpVi4JYQX/PdQkUbzzOeKtVGG6rmIwVfkb6 TFF9eQ83xiHWb8AWjRHtzts/z8/v6KfTgLRmO4yoJ7EM2zsZuDQU= Received: (qmail 5069 invoked by alias); 9 Sep 2013 07:42:37 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 5057 invoked by uid 89); 9 Sep 2013 07:42:37 -0000 Received: from mail-pd0-f177.google.com (HELO mail-pd0-f177.google.com) (209.85.192.177) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Mon, 09 Sep 2013 07:42:37 +0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED, AWL, BAYES_00, FREEMAIL_FROM autolearn=ham version=3.3.2 X-HELO: mail-pd0-f177.google.com Received: by mail-pd0-f177.google.com with SMTP id y10so5848318pdj.22 for ; Mon, 09 Sep 2013 00:42:34 -0700 (PDT) X-Received: by 10.66.142.107 with SMTP id rv11mr18742237pab.17.1378712554734; Mon, 09 Sep 2013 00:42:34 -0700 (PDT) Received: from msticlxl57.ims.intel.com ([192.55.54.41]) by mx.google.com with ESMTPSA id ye1sm15811056pab.19.1969.12.31.16.00.00 (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 09 Sep 2013 00:42:33 -0700 (PDT) Date: Mon, 9 Sep 2013 11:42:05 +0400 From: "Michael V. Zolotukhin" To: Jan Hubicka Cc: "H.J. Lu" , Eric Botcazou , Kirill Yukhin , GCC Patches , Ond??ej B?lka , Uros Bizjak Subject: Re: [PATCH, x86] Use vector moves in memmove expanding Message-ID: <20130909074205.GB53568@msticlxl57.ims.intel.com> References: <20130705112534.GA10164@kam.mff.cuni.cz> <7703907.JSoGtmLQkn@polaris> <20130909072317.GA53568@msticlxl57.ims.intel.com> <20130909072434.GA21984@kam.mff.cuni.cz> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20130909072434.GA21984@kam.mff.cuni.cz> User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes > OK, > Would you mind adding a testcase? Thanks, here is the patch with Eric's test. OK to commit? Changelog: gcc: 2013-09-09 Michael Zolotukhin * config/i386/i386.c (ix86_expand_movmem): Fix epilogue generation. gcc/testsuite: 2013-09-09 Michael Zolotukhin * gcc.target/i386/memcpy-2.c: New test. Thanks, Michael > Honza diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index e2fa71a..1f07e6f 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -23329,7 +23329,7 @@ ix86_expand_movmem (rtx dst, rtx src, rtx count_exp, rtx align_exp, if (count_exp != const0_rtx && epilogue_size_needed > 1) expand_movmem_epilogue (dst, src, destreg, srcreg, count_exp, - size_needed); + epilogue_size_needed); if (jump_around_label) emit_label (jump_around_label); return true; diff --git a/gcc/testsuite/gcc.target/i386/memcpy-2.c b/gcc/testsuite/gcc.target/i386/memcpy-2.c new file mode 100644 index 0000000..c8dfbe3 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/memcpy-2.c @@ -0,0 +1,22 @@ +/* { dg-do run } */ +/* { dg-require-effective-target ia32 } */ +/* { dg-options "-O2 -march=pentiumpro -minline-all-stringops -fno-common" } */ + +static void __attribute__((noinline, noclone)) +my_memcpy (char *dest, const char *src, int n) +{ + __builtin_memcpy (dest, src, n); +} + +int +main (void) +{ + char a1[4], a2[4]; + __builtin_memset (a1, 'a', 4); + __builtin_memset (a2, 'b', 4); + my_memcpy (a2, a1, 4); + if (a2[0] != 'a') + __builtin_abort (); + return 0; +} +