long foo (int i) { float x; x = i; return __builtin_lroundf (x); } and
long foo (int i) { return __builtin_lroundf ((float)i); } should generate the same code. The former is before expansion return __builtin_lroundf ((float) i); which is unfolded while the latter is return (long int) (float) i; This has to be addressed in a tree-combiner. -- Summary: Should combine float/int conversion and rounding functions Product: gcc Version: 4.3.0 Status: UNCONFIRMED Keywords: missed-optimization Severity: enhancement Priority: P3 Component: tree-optimization AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: rguenth at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33145