RE: [PATCH v2] kbuild: treat char as always unsigned

David Laight
2022-12-30T13:14:04Z

....
> > 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)