This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/19154] miss-optimization of (x & pow2C) avr conditionals returning bool equivalent values
- From: "schlie at comcast dot net" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 25 Dec 2004 21:39:15 -0000
- Subject: [Bug middle-end/19154] miss-optimization of (x & pow2C) avr conditionals returning bool equivalent values
- References: <20041225202132.19154.schlie@comcast.net>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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