From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kuninori Morimoto Date: Tue, 17 Dec 2019 08:37:01 +0000 Subject: Re: can someone solve string_32.h issue for SH ? Message-Id: <8736djgxg2.wl-kuninori.morimoto.gx@renesas.com> List-Id: References: <87h81zh4ap.wl-kuninori.morimoto.gx@renesas.com> In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Geert Uytterhoeven Cc: Yoshinori Sato , Rich Felker , Linux-SH , Linux-Renesas Hi Geert Thank you for your feedback > --- a/arch/sh/include/asm/string_32.h > +++ b/arch/sh/include/asm/string_32.h > @@ -40,15 +40,15 @@ static inline char *strncpy(char *__dest, const > char *__src, size_t __n) > __asm__ __volatile__( > "1:\n" > "mov.b @%1+, %2\n\t" > - "mov.b %2, @%0\n\t" > + "mov.b %2, @%0+\n\t" > "cmp/eq #0, %2\n\t" > "bt/s 2f\n\t" > - " cmp/eq %5,%1\n\t" > + " cmp/eq %5,%0\n\t" > "bf/s 1b\n\t" > - " add #1, %0\n" > + " nop\n" > "2:" > : "=r" (__dest), "=r" (__src), "=&z" (__dummy) > - : "0" (__dest), "1" (__src), "r" (__src+__n) > + : "0" (__dest), "1" (__src), "r" (__dest+__n) > : "memory", "t"); > > return __xdest; > > Does this make sense? > Can it be improved, by putting something useful in the delay slot? Unfortunately, I can't test it :( Can someone test it ? Thank you for your help !! Best regards --- Kuninori Morimoto From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 644FDC43603 for ; Tue, 17 Dec 2019 08:37:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4391D2082E for ; Tue, 17 Dec 2019 08:37:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726641AbfLQIhC (ORCPT ); Tue, 17 Dec 2019 03:37:02 -0500 Received: from relmlor1.renesas.com ([210.160.252.171]:3087 "EHLO relmlie5.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726383AbfLQIhC (ORCPT ); Tue, 17 Dec 2019 03:37:02 -0500 Date: 17 Dec 2019 17:37:01 +0900 X-IronPort-AV: E=Sophos;i="5.69,324,1571670000"; d="scan'208";a="34637730" Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie5.idc.renesas.com with ESMTP; 17 Dec 2019 17:37:01 +0900 Received: from morimoto-PC.renesas.com (unknown [10.166.18.140]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id 7A57141D280A; Tue, 17 Dec 2019 17:37:01 +0900 (JST) Message-ID: <8736djgxg2.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto To: Geert Uytterhoeven Cc: Yoshinori Sato , Rich Felker , Linux-SH , Linux-Renesas Subject: Re: can someone solve string_32.h issue for SH ? In-Reply-To: References: <87h81zh4ap.wl-kuninori.morimoto.gx@renesas.com> User-Agent: Wanderlust/2.15.9 Emacs/24.5 Mule/6.0 MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org Hi Geert Thank you for your feedback > --- a/arch/sh/include/asm/string_32.h > +++ b/arch/sh/include/asm/string_32.h > @@ -40,15 +40,15 @@ static inline char *strncpy(char *__dest, const > char *__src, size_t __n) > __asm__ __volatile__( > "1:\n" > "mov.b @%1+, %2\n\t" > - "mov.b %2, @%0\n\t" > + "mov.b %2, @%0+\n\t" > "cmp/eq #0, %2\n\t" > "bt/s 2f\n\t" > - " cmp/eq %5,%1\n\t" > + " cmp/eq %5,%0\n\t" > "bf/s 1b\n\t" > - " add #1, %0\n" > + " nop\n" > "2:" > : "=r" (__dest), "=r" (__src), "=&z" (__dummy) > - : "0" (__dest), "1" (__src), "r" (__src+__n) > + : "0" (__dest), "1" (__src), "r" (__dest+__n) > : "memory", "t"); > > return __xdest; > > Does this make sense? > Can it be improved, by putting something useful in the delay slot? Unfortunately, I can't test it :( Can someone test it ? Thank you for your help !! Best regards --- Kuninori Morimoto