Re: clear_bit_unlock_is_negative_byte

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Jul 22 2023, Matthew Wilcox wrote:

On Sat, Jul 22, 2023 at 08:24:34AM +0200, Andreas Schwab wrote:
On Jul 21 2023, Michael Schmitz wrote:

static inline bool clear_bit_unlock_is_negative_byte(unsigned int nr,
                volatile unsigned long *p)
{
        unsigned char *cp = (unsigned char *) p;
        char result;
        char mask = 1 << nr;    /* nr guaranteed to be < 7 */

        __asm__ __volatile__ ("eori.b %1, %2; smi %0"
                : "=d" (result)
                : "i" (mask), "o" (*(cp+3))

That should use "id" as constraint, so that the compiler can share the
constant with other insns.  Also, the third operand is modified, so it
needs to be marked as in/out.

The "o" constraint is shared with bfset_mem_set_bit,
bfclr_mem_test_and_clear_bit and a few other functions.  Should they
all be changed?

They use a memory clobber, because the "o" constraint cannot accurately
describe the situation there.

-- 
Andreas Schwab, schwab@xxxxxxxxxxxxxx
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."



[Index of Archives]     [Video for Linux]     [Yosemite News]     [Linux S/390]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux