http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59784
Bug ID: 59784 Summary: Nios2: Wrong code generation for fextsd custom instruction Product: gcc Version: unknown Status: UNCONFIRMED Severity: major Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: savin.zlobec at gmail dot com Created attachment 31819 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=31819&action=edit Fix The following code: double f2d(float x) { return (double)x; } Compiled with -O2 ... -mcustom-frdy=2 ... -mcustom-fextsd=37 Compiles to: 0: 2009c972 custom 37,r4,r4,zero 4: 0009c0b2 custom 2,r4,zero,zero 8: 2005883a mov r2,r4 c: 2807883a mov r3,r5 10: f800283a ret Note the 'custom 37,r4,r4,zero', should be 'custom 37,r5,r4,zero'. Patch attached.