This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/18908] Missed folding opportunities with bools
- From: "rguenth at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 30 Apr 2008 19:26:56 -0000
- Subject: [Bug middle-end/18908] Missed folding opportunities with bools
- References: <bug-18908-2744@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #11 from rguenth at gcc dot gnu dot org 2008-04-30 19:26 -------
On the trunk we have:
f1 (const _Bool * p)
{
<bb 2>:
return (_Bool) ((int) *p & 1);
f2 (const _Bool * p)
{
<bb 2>:
return *p;
f3 (_Bool * p)
{
<bb 2>:
*p = (_Bool) !*p;
f4 (_Bool * p)
{
<bb 2>:
*p = 1;
where i686 assembly looks good for all cases.
Still f4 looks weird (wrong-code?!) as we fold *p = ~*p to *p = (int) *p != -1;
I'll open a PR for this.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18908