https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113185
Bug ID: 113185 Summary: bad performance on big-endian&64bit port for struct 16 16 Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: rtl-optimization Assignee: unassigned at gcc dot gnu.org Reporter: syq at gcc dot gnu.org Target Milestone: --- ``` struct xx { int a:16; int b:16; }; struct xx xx (struct xx a, long long b) { a.b = b; return a; } ``` On little-endian&64, only 1 or 2 instructions are used, such as on AARCH64el: ``` bfi w0, w1, 16, 16 ret ``` On MIPS64el ``` move $2,$4 sll $5,$5,0 jr $31 ins $2,$5,16,16 ``` While for 64EB ``` .cfi_startproc sub sp, sp, #16 .cfi_def_cfa_offset 16 str x0, [sp, 8] strh w1, [sp, 10] ldr w0, [sp, 8] add sp, sp, 16 .cfi_def_cfa_offset 0 lsl x0, x0, 32 ret .cfi_endproc ``` ``` daddiu $sp,$sp,-16 sd $4,0($sp) sh $5,2($sp) lw $2,0($sp) daddiu $sp,$sp,16 jr $31 dsll $2,$2,32 ```