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
This commit is contained in:
parent
e6fb01b00c
commit
20ba5f3318
@ -1,3 +1,8 @@
|
||||
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
|
||||
|
36
gcc/testsuite/gcc.dg/tree-ssa/pr15826.c
Normal file
36
gcc/testsuite/gcc.dg/tree-ssa/pr15826.c
Normal file
@ -0,0 +1,36 @@
|
||||
/* 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" } } */
|
Loading…
Reference in New Issue
Block a user