
* > On Tue, 2005-11-01 at 17:30 +0100, Florian Weimer wrote:
use C control constructs rather than gotos.
With GCC version 4, this will have no effect because the gimplifier converts everything to goto-style anyway.
Felix generates C with gotos. The result is FASTER than native C using gcc 4.0 on x86_64.
Coincidence. 8-)
Felix generated C(++) code -- compiled with same options:
int FLX_REGPARM _i1860_f1301_ack( int _i1864_v1303_x, int _i1865_v1304_y) { _us2 _i1867_v1799_ack_mv_74; _us2 _i1868_v1821_ack_mv_84;
_us2 is unsigned, correct? BTW, you shouldn't generate identifiers with leading underscores because they are reserved for the implementation.
I have no real idea why the Felix generated C is faster. Two guesses:
(a) the two 'mv' variables declared at the top are optimised away, so the Felix version is only using 3 words of stack.
(b) the "parallel assigment in tail calls optimisation" is saving one word on the stack (evaluating y before x saves a temporary across the non-tail recursion).
Both variants do not use the stack. It seems that the goto-based version leads to different static branch prediction results, which happen to be favorable. If you want, try adding __builtin_expect to the if statement in both versions, and measure again.