Commit 45dc13b9 by Jakub Jelinek Committed by Jakub Jelinek

re PR middle-end/37248 (regression transformation bitfield to individual bytes)

	PR middle-end/37248
	* fold-const.c (make_bit_field_ref): Change bitpos and bitsize
	arguments to HOST_WIDE_INT.  If type has different signedness
	than unsignedp or different precision from bitsize, create
	the right type for BIT_FIELD_REF and cast to type.
	(fold_truthop): Change first_bit and end_bit to HOST_WIDE_INT.

	Revert:
	2008-03-05  Richard Guenther  <rguenther@suse.de>
	PR c++/35336
	* fold-const.c (fold_truthop): Remove code generating
	BIT_FIELD_REFs of structure bases.
	(fold_binary): Likewise.
	(make_bit_field_ref): Remove.
	(optimize_bit_field_compare): Remove.
	(all_ones_mask_p): Remove.

	* gcc.target/i386/pr37248-1.c: New test.
	* gcc.target/i386/pr37248-2.c: New test.
	* gcc.target/i386/pr37248-3.c: New test.

From-SVN: r142484
parent 2d95ef97
2008-12-05 Jakub Jelinek <jakub@redhat.com>
PR middle-end/37248
* fold-const.c (make_bit_field_ref): Change bitpos and bitsize
arguments to HOST_WIDE_INT. If type has different signedness
than unsignedp or different precision from bitsize, create
the right type for BIT_FIELD_REF and cast to type.
(fold_truthop): Change first_bit and end_bit to HOST_WIDE_INT.
Revert:
2008-03-05 Richard Guenther <rguenther@suse.de>
PR c++/35336
* fold-const.c (fold_truthop): Remove code generating
BIT_FIELD_REFs of structure bases.
(fold_binary): Likewise.
(make_bit_field_ref): Remove.
(optimize_bit_field_compare): Remove.
(all_ones_mask_p): Remove.
2008-12-05 Jakub Jelinek <jakub@redhat.com>
* tree-sra.c (sra_explode_bitfield_assignment): Always
call unsigned_type_for, if the precision is higher than
needed, call build_nonstandard_integer_type.
2008-12-05 Jakub Jelinek <jakub@redhat.com>
PR middle-end/37248
* gcc.target/i386/pr37248-1.c: New test.
* gcc.target/i386/pr37248-2.c: New test.
* gcc.target/i386/pr37248-3.c: New test.
2008-12-05 Jakub Jelinek <jakub@redhat.com>
PR middle-end/38338
* gcc.dg/pr38338.c: New test.
......
/* PR middle-end/37248 */
/* { dg-do compile } */
/* { dg-options "-O2 -fdump-tree-optimized" } */
struct S
{
unsigned char a : 1;
unsigned char b : 1;
unsigned char c : 1;
} s;
int
foo (struct S x)
{
return x.a && x.b && x.c;
}
/* { dg-final { scan-tree-dump "& 7\[^\n\t\]*== 7" "optimized" } } */
/* { dg-final { cleanup-tree-dump "optimized" } } */
/* PR middle-end/37248 */
/* { dg-do compile } */
/* { dg-options "-O2 -fdump-tree-optimized" } */
struct S
{
unsigned char a : 1;
unsigned char b : 1;
unsigned char c : 1;
unsigned int d : 26;
unsigned char e : 1;
unsigned char f : 1;
unsigned char g : 1;
} s;
int
foo (struct S x)
{
return x.a && x.g && x.b && x.f && x.c && x.e;
}
/* { dg-final { scan-tree-dump "& 3758096391\[^\n\t\]*== 3758096391" "optimized" } } */
/* { dg-final { cleanup-tree-dump "optimized" } } */
/* PR middle-end/37248 */
/* { dg-do compile } */
/* { dg-options "-O2 -fdump-tree-optimized" } */
struct S
{
unsigned char a : 1;
unsigned char b : 1;
unsigned char c : 1;
unsigned int d : 6;
unsigned int e : 14;
unsigned int f : 6;
unsigned char g : 1;
unsigned char h : 1;
unsigned char i : 1;
} s;
int
foo (struct S x)
{
return x.a && x.i && x.b && x.h && x.c && x.g && x.e == 131;
}
/* { dg-final { scan-tree-dump "& 3766484487\[^\n\t\]*== 3758163463" "optimized" } } */
/* { dg-final { cleanup-tree-dump "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