------- Additional Comments From schlie at comcast dot net 2004-12-25 21:39 ------- Subject: Re: miss-optimization of (x & pow2C) avr conditionals returning bool equivalent values
> I think the issue here is rtx_cost for avr sucks and does not give a good > accurate cost matrix. I considered that, and sure it doesn't help; but the form of the conditional presented for code generation is actually different in otherwise identical expressions, therefore implying that it's presumed that: if ((x >> C') & 1) 1 else 0; => ((x >> C') & 1) Is more efficient than: if ((x >> C') & 1) 1 else 0; => if (x & C) 1 else 0; Which is target specific, and should not be presumed, as for targets which support bit-test&branch: if (x & C) 1 else 0; => bit-test&branch x log2C; return 0; return 1; Is significantly more efficient than a (multi-bit-shift & 1). (therefore it doesn't seem proper for such return value dependant assumptions to be made in a target neutral way) -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19154