Commit 20ba5f33 by Martin Sebor Committed by Martin Sebor

PR tree-optimization/15826 - don't use "if" to extract a single bit

PR tree-optimization/15826 - don't use "if" to extract a single bit
	bit-field
2016-02-26  Martin Sebor  <msebor@redhat.com>

        PR tree-optimization/15826
        * gcc.dg/tree-ssa/pr15826.c: New test.

From-SVN: r233771
parent e6fb01b0
2016-02-26 Martin Sebor <msebor@redhat.com>
PR tree-optimization/15826
* gcc.dg/tree-ssa/pr15826.c: New test.
2016-02-26 Jakub Jelinek <jakub@redhat.com>
PR target/69969
......
/* PR tree-optimization/15826 - don't use "if" to extract a single bit
bit-field */
/* { dg-do compile } */
/* { dg-options "-O2 -fdump-tree-optimized" } */
struct s {
unsigned int bit : 1;
};
unsigned int
foo (struct s *p)
{
if (p->bit)
return 1;
else
return 0;
}
unsigned int
bar (struct s *p)
{
return (unsigned int) (p->bit);
}
unsigned int
andrew (struct s *p)
{
int i;
if (p->bit)
i = 1;
else
i = 0;
return i;
}
/* { dg-final { scan-tree-dump-times " & | goto " 0 "optimized" } } */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment