https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82883
Bug ID: 82883 Summary: eax register unnecessary consumed Product: gcc Version: 8.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: antoshkka at gmail dot com Target Milestone: --- Following example: void foo(char* ch) { __builtin_memcpy(ch, "Hello word", 6); } Produces the assembly foo(char*): mov eax, 8303 <=== This is not required mov DWORD PTR [rdi], 1819043144 mov WORD PTR [rdi+4], ax ret The code could be further optimized to not use the eax register. For example clang does the following: foo(char*): # @foo(char*) mov word ptr [rdi + 4], 8303 mov dword ptr [rdi], 1819043144 ret