RE: [PATCH v3 2/2] iov_iter: Don't deal with iter->copy_mc in memcpy_from_iter_mc()

From: David Laight
Date: Thu Aug 17 2023 - 12:07:21 EST


From: Linus Torvalds
> Sent: Thursday, August 17, 2023 4:31 PM
...
> movzwl .LC1(%rip), %eax
> testl %esi, %esi
> movb $0, (%rdi)
> movb $1, 4(%rdi)
> movw %ax, 1(%rdi)
> movq $0, 8(%rdi)
> movq %rdx, 16(%rdi)
> movq %r8, 24(%rdi)
> movq %rcx, 32(%rdi)
> setne 3(%rdi)
>
> which is that disgusting "move two bytes from memory", and makes
> absolutely no sense as a way to "write 2 zero bytes":
>
> .LC1:
> .byte 0
> .byte 0
>
> I think that's some odd gcc bug, actually.

I get that with some code, but not others.
Seems to depend on random other stuff.
Happens for:
struct { unsigned char x:7, y:1; };
but not if I add anything after if (that gets zeroed).
Which seems to be the opposite of what you see.

If I use explicit assignments (rather than an initialiser)
I still get merged writes (even if not a bitfield) but also
lose the memory access.

David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)