http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46942
Summary: x86_64 parameter passing unnecessary sign/zero extends Product: gcc Version: 4.6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target AssignedTo: unassig...@gcc.gnu.org ReportedBy: ja...@gcc.gnu.org CC: hubi...@gcc.gnu.org Target: x86_64-linux It seems we zero/sign extend < 64-bit integral parameters into 64-bit registers both on the caller and callee side on x86_64, one of those should be redundant. In http://blog.regehr.org/archives/320 Example 4 it seems that LLVM probably only zero/sign extends in the caller, not callee, not sure what ICC does. __attribute__((noinline, noclone)) unsigned long f1 (unsigned int a, int b, unsigned short c, short d, unsigned char e, signed char f) { return (unsigned long) a + b + c + d + e + f; } unsigned long l; unsigned long f2 (void) { return f1 (l + 41, l + 41, l + 41, l + 41, l + 41, l + 41); } unsigned long f3 (unsigned int a, int b, unsigned short c, short d, unsigned char e, signed char f) { return foo (a, b, c, d, e, f); }