gcflags=-S shows the code of copy 3-field and 4-field structs:

    // struct{a, b, c int}
    0x0034 00052 (valuecopy.go:223)    MOVQ    $0, "".struct3_0(SB)
    0x003f 00063 (valuecopy.go:223)    XORPS    X0, X0
    0x0042 00066 (valuecopy.go:223)    MOVUPS    X0, "".struct3_0+8(SB)

    // struct{a, b, c, d int}
    0x0034 00052 (valuecopy.go:233)    XORPS    X0, X0
    0x0037 00055 (valuecopy.go:233)    MOVUPS    X0, "".struct4_0(SB)
    0x003e 00062 (valuecopy.go:233)    MOVUPS    X0, "".struct4_0+16(SB)

I don't understand the instructions.

On Sunday, May 30, 2021 at 7:04:15 AM UTC-4 Jan Mercl wrote:

> Within the benchmark loops of the linked code a sufficiently smart 
> compiler can optimize the source values away completely and/or collapse all 
> writes to the destination values to a single write.
>
> Have you looked at the actual code the CPU executes?
>
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/1fa0bcb6-6fc5-4031-8708-cf9e49299d8fn%40googlegroups.com.

Reply via email to