From: Karl Nasrallah <knnspeed@aol.com> To: kuninori.morimoto.gx@renesas.com Cc: dalias@libc.org, geert@linux-m68k.org, ysato@users.sourceforge.jp, linux-sh@vger.kernel.org, linux-renesas-soc@vger.kernel.org Subject: Re: can someone solve string_32.h issue for SH ? Date: Wed, 18 Dec 2019 03:56:03 +0000 [thread overview] Message-ID: <2107393677.694216.1576641363699@mail.yahoo.com> (raw) In-Reply-To: <87tv5yjssb.wl-kuninori.morimoto.gx@renesas.com> Hello, Though ultimately I do not have a say in that, it would appear that string_32.h is in arch/sh/include/asm and has been there for a very long time. In fact, it appears that x86 also has similar utility functions defined in inline assembly: see arch/x86/include/asm. As straightforward as it would be to make C versions, there may be a reason that they are in inline assembly--optimization would be my guess--and converting it all to C may require an overhaul of the string.h backend (something I would not be much help with given that I am unable to get modern Linux booting on my machine, which is a Sega Dreamcast). I also do not know what the performance implications of switching it all to C would be, if there even are any. Hopefully this information may be useful and my asm version is alright for the time being; I have not been able to unearth much more on the topic of why this is structured the way it is, -Karl Nasrallah -----Original Message----- From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> To: Karl Nasrallah <knnspeed@aol.com> Cc: dalias <dalias@libc.org>; geert <geert@linux-m68k.org>; ysato <ysato@users.sourceforge.jp>; linux-sh <linux-sh@vger.kernel.org>; linux-renesas-soc <linux-renesas-soc@vger.kernel.org> Sent: Tue, Dec 17, 2019 9:01 pm Subject: Re: can someone solve string_32.h issue for SH ? Hi > You're using r0 explicitly in the asm but I don't see where you're > reserving it for your use. You need it either on the clobbers or bound > to a dummy output with earlyclobber. (snip) > __asm__ __volatile__ ( > "strncpy_start:\n\t" > "mov.b @%[src]+,%[r0_reg]\n\t" > "cmp/eq #0,%[r0_reg]\n\t" > "bt.s strncpy_pad\n\t" > "cmp/eq %[dest],%[dest_end]\n\t" > "bt.s strncpy_end\n\t" > "mov.b %[r0_reg],@%[dest]\n\t" > "bra strncpy_start\n\t" > "add #1,%[dest]\n\t" > "strncpy_pad:\n\t" > "bt.s strncpy_end\n\t" > "mov.b %[r0_reg],@%[dest]\n\t" > "add #1,%[dest]\n\t" > "bra strncpy_pad\n\t" > "cmp/eq %[dest],%[dest_end]\n\t" > "strncpy_end:\n\t" > : [src] "+r" (__src), [dest] "+r" (__dest), [r0_reg] "+&z" (r0_register) > : [dest_end] "r" (__dest_end) > : "t","memory" > ); Or, can we use general strncpy() instead of SH assemble one ? Thank you for your help !! Best regards --- Kuninori Morimoto
WARNING: multiple messages have this Message-ID (diff)
From: Karl Nasrallah <knnspeed@aol.com> To: kuninori.morimoto.gx@renesas.com Cc: dalias@libc.org, geert@linux-m68k.org, ysato@users.sourceforge.jp, linux-sh@vger.kernel.org, linux-renesas-soc@vger.kernel.org Subject: Re: can someone solve string_32.h issue for SH ? Date: Wed, 18 Dec 2019 03:56:03 +0000 (UTC) [thread overview] Message-ID: <2107393677.694216.1576641363699@mail.yahoo.com> (raw) In-Reply-To: <87tv5yjssb.wl-kuninori.morimoto.gx@renesas.com> Hello, Though ultimately I do not have a say in that, it would appear that string_32.h is in arch/sh/include/asm and has been there for a very long time. In fact, it appears that x86 also has similar utility functions defined in inline assembly: see arch/x86/include/asm. As straightforward as it would be to make C versions, there may be a reason that they are in inline assembly--optimization would be my guess--and converting it all to C may require an overhaul of the string.h backend (something I would not be much help with given that I am unable to get modern Linux booting on my machine, which is a Sega Dreamcast). I also do not know what the performance implications of switching it all to C would be, if there even are any. Hopefully this information may be useful and my asm version is alright for the time being; I have not been able to unearth much more on the topic of why this is structured the way it is, -Karl Nasrallah -----Original Message----- From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> To: Karl Nasrallah <knnspeed@aol.com> Cc: dalias <dalias@libc.org>; geert <geert@linux-m68k.org>; ysato <ysato@users.sourceforge.jp>; linux-sh <linux-sh@vger.kernel.org>; linux-renesas-soc <linux-renesas-soc@vger.kernel.org> Sent: Tue, Dec 17, 2019 9:01 pm Subject: Re: can someone solve string_32.h issue for SH ? Hi > You're using r0 explicitly in the asm but I don't see where you're > reserving it for your use. You need it either on the clobbers or bound > to a dummy output with earlyclobber. (snip) > __asm__ __volatile__ ( > "strncpy_start:\n\t" > "mov.b @%[src]+,%[r0_reg]\n\t" > "cmp/eq #0,%[r0_reg]\n\t" > "bt.s strncpy_pad\n\t" > "cmp/eq %[dest],%[dest_end]\n\t" > "bt.s strncpy_end\n\t" > "mov.b %[r0_reg],@%[dest]\n\t" > "bra strncpy_start\n\t" > "add #1,%[dest]\n\t" > "strncpy_pad:\n\t" > "bt.s strncpy_end\n\t" > "mov.b %[r0_reg],@%[dest]\n\t" > "add #1,%[dest]\n\t" > "bra strncpy_pad\n\t" > "cmp/eq %[dest],%[dest_end]\n\t" > "strncpy_end:\n\t" > : [src] "+r" (__src), [dest] "+r" (__dest), [r0_reg] "+&z" (r0_register) > : [dest_end] "r" (__dest_end) > : "t","memory" > ); Or, can we use general strncpy() instead of SH assemble one ? Thank you for your help !! Best regards --- Kuninori Morimoto
next prev parent reply other threads:[~2019-12-18 3:56 UTC|newest] Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top [not found] <339916914.636876.1576627652112.ref@mail.yahoo.com> 2019-12-18 0:07 ` can someone solve string_32.h issue for SH ? Karl Nasrallah 2019-12-18 0:07 ` Karl Nasrallah 2019-12-18 2:01 ` Kuninori Morimoto 2019-12-18 2:01 ` Kuninori Morimoto 2019-12-18 3:56 ` Karl Nasrallah [this message] 2019-12-18 3:56 ` Karl Nasrallah 2019-12-18 5:21 ` Kuninori Morimoto 2019-12-18 5:21 ` Kuninori Morimoto 2019-12-18 6:06 ` Karl Nasrallah 2019-12-18 6:06 ` Karl Nasrallah 2019-12-18 7:28 ` Kuninori Morimoto 2019-12-18 7:28 ` Kuninori Morimoto 2019-12-17 6:09 Kuninori Morimoto 2019-12-17 6:09 ` Kuninori Morimoto 2019-12-17 7:36 ` Karl Nasrallah 2019-12-17 7:46 ` Kuninori Morimoto 2019-12-17 8:03 ` Kuninori Morimoto 2019-12-17 8:15 ` Karl Nasrallah 2019-12-17 8:26 ` Karl Nasrallah 2019-12-17 8:29 ` Geert Uytterhoeven 2019-12-17 8:29 ` Geert Uytterhoeven 2019-12-17 8:37 ` Kuninori Morimoto 2019-12-17 8:37 ` Kuninori Morimoto 2019-12-17 8:43 ` Geert Uytterhoeven 2019-12-17 8:43 ` Geert Uytterhoeven 2019-12-17 8:40 ` Geert Uytterhoeven 2019-12-17 8:40 ` Geert Uytterhoeven 2019-12-17 8:51 ` Kuninori Morimoto 2019-12-17 8:51 ` Kuninori Morimoto 2019-12-17 9:09 ` Karl Nasrallah 2019-12-17 9:09 ` Karl Nasrallah 2019-12-17 22:16 ` Karl Nasrallah 2019-12-17 22:16 ` Karl Nasrallah 2019-12-17 23:13 ` Rich Felker 2019-12-17 23:13 ` Rich Felker 2019-12-17 8:50 ` Geert Uytterhoeven 2019-12-17 8:50 ` Geert Uytterhoeven
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=2107393677.694216.1576641363699@mail.yahoo.com \ --to=knnspeed@aol.com \ --cc=dalias@libc.org \ --cc=geert@linux-m68k.org \ --cc=kuninori.morimoto.gx@renesas.com \ --cc=linux-renesas-soc@vger.kernel.org \ --cc=linux-sh@vger.kernel.org \ --cc=ysato@users.sourceforge.jp \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.