[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZRsi7smLotWDwoNP@casper.infradead.org>
Date: Mon, 2 Oct 2023 21:07:10 +0100
From: Matthew Wilcox <willy@...radead.org>
To: Greg Ungerer <gregungerer@...tnet.com.au>
Cc: David Laight <David.Laight@...lab.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-fsdevel@...r.kernel.org" <linux-fsdevel@...r.kernel.org>,
"linux-arch@...r.kernel.org" <linux-arch@...r.kernel.org>,
"torvalds@...ux-foundation.org" <torvalds@...ux-foundation.org>,
Nicholas Piggin <npiggin@...il.com>
Subject: Re: [PATCH 09/17] m68k: Implement xor_unlock_is_negative_byte
On Wed, Sep 20, 2023 at 05:22:33PM +1000, Greg Ungerer wrote:
> On 20/9/23 01:14, Matthew Wilcox wrote:
> > I have a 68020 book; what I don't have is a Coldfire manual.
>
> You can find it here: https://www.nxp.com/docs/en/reference-manual/CFPRM.pdf
Thanks, Greg. This is almost good:
static inline bool xor_unlock_is_negative_byte(unsigned long mask,
volatile unsigned long *p)
{
#ifdef CONFIG_COLDFIRE
__asm__ __volatile__ ("eorl %1, %0"
: "+m" (*p)
: "d" (mask)
: "memory");
return *p & (1 << 7);
#else
char result;
char *cp = (char *)p + 3; /* m68k is big-endian */
__asm__ __volatile__ ("eor.b %1, %2; smi %0"
: "=d" (result)
: "di" (mask), "o" (*cp)
: "memory");
return result;
#endif
}
folio_end_read() does about as well as can be expected:
00000708 <folio_end_read>:
708: 206f 0004 moveal %sp@(4),%a0
70c: 7009 moveq #9,%d0
70e: 4a2f 000b tstb %sp@(11)
712: 6602 bnes 716 <folio_end_read+0xe>
714: 7001 moveq #1,%d0
716: b190 eorl %d0,%a0@
718: 2010 movel %a0@,%d0
71a: 4a00 tstb %d0
71c: 6a0c bpls 72a <folio_end_read+0x22>
71e: 42af 0008 clrl %sp@(8)
722: 2f48 0004 movel %a0,%sp@(4)
726: 6000 fcfe braw 426 <folio_wake_bit>
72a: 4e75 rts
However, it seems that folio_unlock() could shave off an instruction:
00000918 <folio_unlock>:
918: 206f 0004 moveal %sp@(4),%a0
91c: 7001 moveq #1,%d0
91e: b190 eorl %d0,%a0@
920: 2010 movel %a0@,%d0
922: 4a00 tstb %d0
924: 6a0a bpls 930 <folio_unlock+0x18>
926: 42a7 clrl %sp@-
928: 2f08 movel %a0,%sp@-
92a: 4eba fafa jsr %pc@(426 <folio_wake_bit>)
92e: 508f addql #8,%sp
930: 4e75 rts
We could use eori instead of eorl, at least according to table 3-9 on
page 3-8:
EOR Dy,<ea>x L Source ^ Destination → Destination ISA_A
EORI #<data>,Dx L Immediate Data ^ Destination → Destination ISA_A
but gas is unhappy with everything I've tried to use eori. I'm building
with stmark2_defconfig, which I assume should work.
Powered by blists - more mailing lists