[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a296bd41278d4bd4a4e9f0d31a540613@AcuMS.aculab.com>
Date: Fri, 30 Dec 2022 13:13:55 +0000
From: David Laight <David.Laight@...LAB.COM>
To: David Laight <David.Laight@...LAB.COM>,
'Holger Lubitz' <holger.lubitz@...nline.de>,
'Linus Torvalds' <torvalds@...ux-foundation.org>,
Guenter Roeck <linux@...ck-us.net>
CC: Rasmus Villemoes <rasmus.villemoes@...vas.dk>,
Geert Uytterhoeven <geert@...ux-m68k.org>,
"Jason A. Donenfeld" <Jason@...c4.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-kbuild@...r.kernel.org" <linux-kbuild@...r.kernel.org>,
"linux-arch@...r.kernel.org" <linux-arch@...r.kernel.org>,
"linux-toolchains@...r.kernel.org" <linux-toolchains@...r.kernel.org>,
Masahiro Yamada <masahiroy@...nel.org>,
Kees Cook <keescook@...omium.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
"linux-m68k@...ts.linux-m68k.org" <linux-m68k@...ts.linux-m68k.org>
Subject: RE: [PATCH v2] kbuild: treat char as always unsigned
....
> > int strcmp1(const char *cs, const char *ct)
> > {
> > int res;
> >
> > asm ("\n"
> > "1: move.b (%0)+,%2\n" /* get *cs */
> > " jeq 2f\n" /* end of first string? */
> > " cmp.b (%1)+,%2\n" /* compare *ct */
> > " jeq 1b\n" /* if equal, continue */
> > " jra 3f\n" /* else skip to tail */
> > "2: cmp.b (%1)+,%2\n" /* compare one last byte */
> > "3: subx.l %2, %2\n" /* -1 if borrow, 0 if not */
> > " jls 4f\n" /* if set, z is from sub.b */
>
> The subx will set Z unless C was set.
> So that doesn't seem right.
Clearly my brain was asleep earlier.
subx will clear Z not set it.
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
Powered by blists - more mailing lists