http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60540
Bug ID: 60540 Summary: Don't convert int to float when comparing int with float constant Product: gcc Version: 4.9.0 Status: UNCONFIRMED Severity: enhancement Priority: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: olegendo at gcc dot gnu.org Target: sh*-*-* This is probably not something that one would write on purpose, but I've seen it somewhere: bool test (int a) { return a > 1.0; } On SH with -O2 -m4 this compiles to: lds r4,fpul mova .L3,r0 fmov.s @r0+,fr5 // load double constant 1.0 fmov.s @r0+,fr4 float fpul,dr2 // convert 'a' to double fcmp/gt dr4,dr2 // double > double rts movt r0 .L4: .align 2 .L3: .long 0 .long 1072693248 In this case an integer comparison could be done instead, which does not require converting the integer variable to float/double. This seems like a target independent issue.