From patchwork Mon Jul 20 14:12:32 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexey Brodkin X-Patchwork-Id: 497750 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by ozlabs.org (Postfix) with ESMTP id 2D75C140187 for ; Tue, 21 Jul 2015 00:12:48 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 1506133A4E; Mon, 20 Jul 2015 14:12:47 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id lbhpTLPlFPW6; Mon, 20 Jul 2015 14:12:44 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by silver.osuosl.org (Postfix) with ESMTP id B279E33A3D; Mon, 20 Jul 2015 14:12:44 +0000 (UTC) X-Original-To: uclibc@lists.busybox.net Delivered-To: uclibc@osuosl.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id 94C2A1C0FDB for ; Mon, 20 Jul 2015 14:12:43 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 8EB88920C5 for ; Mon, 20 Jul 2015 14:12:43 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id fFO3hldG20mM for ; Mon, 20 Jul 2015 14:12:42 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from smtprelay.synopsys.com (smtprelay2.synopsys.com [198.182.60.111]) by whitealder.osuosl.org (Postfix) with ESMTPS id BE6B191F80 for ; Mon, 20 Jul 2015 14:12:42 +0000 (UTC) Received: from us02secmta1.synopsys.com (us02secmta1.synopsys.com [10.12.235.96]) by smtprelay.synopsys.com (Postfix) with ESMTP id E5E1310C0F28 for ; Mon, 20 Jul 2015 07:12:41 -0700 (PDT) Received: from us02secmta1.internal.synopsys.com (us02secmta1.internal.synopsys.com [127.0.0.1]) by us02secmta1.internal.synopsys.com (Service) with ESMTP id C42D54E213 for ; Mon, 20 Jul 2015 07:12:41 -0700 (PDT) Received: from mailhost.synopsys.com (mailhost3.synopsys.com [10.12.238.238]) by us02secmta1.internal.synopsys.com (Service) with ESMTP id A51574E202 for ; Mon, 20 Jul 2015 07:12:41 -0700 (PDT) Received: from mailhost.synopsys.com (localhost [127.0.0.1]) by mailhost.synopsys.com (Postfix) with ESMTP id 933929F2; Mon, 20 Jul 2015 07:12:41 -0700 (PDT) Received: from abrodkin-e7440l.internal.synopsys.com (abrodkin-e7440l.internal.synopsys.com [10.121.3.47]) by mailhost.synopsys.com (Postfix) with ESMTP id 0A0239DB; Mon, 20 Jul 2015 07:12:39 -0700 (PDT) From: Alexey Brodkin To: uClibc@uclibc.org Subject: [PATCH] ARCv2: update memset() so it could be used without double load/stores Date: Mon, 20 Jul 2015 17:12:32 +0300 Message-Id: <1437401552-30993-1-git-send-email-abrodkin@synopsys.com> X-Mailer: git-send-email 2.4.3 Cc: Vineet Gupta , Alexey Brodkin , Claudiu Zissulescu X-BeenThere: uclibc@uclibc.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "Discussion and development of uClibc \(the embedded C library\)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: uclibc-bounces@uclibc.org Sender: "uClibc" From: Claudiu Zissulescu Existing version of memset() relies on existence of 64-bit load/stores. While ARC HS38 may not have those instructions implemented in SoC. Proposed implementation checks if "-mno-ll64" option was passed to gcc (for ARCv2 "-mll64" is set implicitly by default) by checking __LL64__ definition and if it is not defined uses 32-bit load/stores. Signed-off-by: Claudiu Zissulescu Signed-off-by: Alexey Brodkin Cc: Vineet Gupta --- libc/string/arc/arcv2/memset.S | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/libc/string/arc/arcv2/memset.S b/libc/string/arc/arcv2/memset.S index d076ad1..0918d37 100644 --- a/libc/string/arc/arcv2/memset.S +++ b/libc/string/arc/arcv2/memset.S @@ -52,6 +52,7 @@ ENTRY(memset) lpnz @.Lset64bytes ;; LOOP START PREWRITE(r3, 64) ;Prefetch the next write location +#ifdef __LL64__ std.ab r4, [r3, 8] std.ab r4, [r3, 8] std.ab r4, [r3, 8] @@ -60,16 +61,45 @@ ENTRY(memset) std.ab r4, [r3, 8] std.ab r4, [r3, 8] std.ab r4, [r3, 8] +#else + st.ab r4, [r3, 4] + st.ab r4, [r3, 4] + st.ab r4, [r3, 4] + st.ab r4, [r3, 4] + st.ab r4, [r3, 4] + st.ab r4, [r3, 4] + st.ab r4, [r3, 4] + st.ab r4, [r3, 4] + st.ab r4, [r3, 4] + st.ab r4, [r3, 4] + st.ab r4, [r3, 4] + st.ab r4, [r3, 4] + st.ab r4, [r3, 4] + st.ab r4, [r3, 4] + st.ab r4, [r3, 4] + st.ab r4, [r3, 4] +#endif .Lset64bytes: lsr.f lp_count, r2, 5 ;Last remaining max 124 bytes lpnz .Lset32bytes ;; LOOP START prefetchw [r3, 32] ;Prefetch the next write location +#ifdef __LL64__ std.ab r4, [r3, 8] std.ab r4, [r3, 8] std.ab r4, [r3, 8] std.ab r4, [r3, 8] +#else + st.ab r4, [r3, 4] + st.ab r4, [r3, 4] + st.ab r4, [r3, 4] + st.ab r4, [r3, 4] + st.ab r4, [r3, 4] + st.ab r4, [r3, 4] + st.ab r4, [r3, 4] + st.ab r4, [r3, 4] +#endif .Lset32bytes: and.f lp_count, r2, 0x1F ;Last remaining 31 bytes