>>> I was looking at the implementation of floorLog2() in >>> src/base/intmath.hh. I >>> think this implementation is not the best that can be done. We should use >>> a >>> GCC builtin __builtin_clz* to implement these functions. I have not >>> carried >>> out any test to get the execution times for two different >>> implementations. >>> But I looked at the assembly code generated for the two implementations >>> for >>> 64-bit version of the function. The ratio of number of instructions is >>> probably about 1:4 for builtin versus current implementation. >> >> Sounds good, though I think it would be best to use some sort of >> #ifdef to pick which one of the two should be used. > > What would be the condition for #ifdef? GCC version? Something like that. I'm not sure when the builtin became available, but if you know that our minimum version supports it, then you can just do something like "#ifdef __GNUC__"
Nate _______________________________________________ m5-dev mailing list m5-dev@m5sim.org http://m5sim.org/mailman/listinfo/m5-dev