https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81085
Bug ID: 81085 Summary: inefficient union with long double argument on 32-bit x86 Product: gcc Version: 7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: jsm28 at gcc dot gnu.org Target Milestone: --- Target: i?86-*-* Consider the following code accessing part of the representation of a long double function argument (which is similar to what various code in glibc libm does). union u { long double d; unsigned int u[4]; }; unsigned int f (long double x) { union u u = { .d = x }; return u.u[0]; } On x86_64-linux-gnu, building with -m64 -O2, I get the expected code: movl 8(%rsp), %eax ret But with -m32 -O2 I get: subl $28, %esp .cfi_def_cfa_offset 32 fldt 32(%esp) fstpt (%esp) movl (%esp), %eax addl $28, %esp .cfi_def_cfa_offset 4 ret The argument is already on the stack. There is no need to load and store a copy of it in order to access part of it as an integer.