[Bug target/71310] Bitfields cause load hit store with smaller store and larger load

2016-06-08 Thread segher at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71310

--- Comment #4 from Segher Boessenkool  ---
This happens because of

  /* Find the smallest nice mode to use.  */
  for (mode = GET_CLASS_NARROWEST_MODE (MODE_INT); mode != VOIDmode;
   mode = GET_MODE_WIDER_MODE (mode))
if (GET_MODE_BITSIZE (mode) >= bitsize)
  break;

in stor-layout.c:finish_bitfield_representative .

[Bug target/71310] Bitfields cause load hit store with smaller store and larger load

2016-06-08 Thread anton at samba dot org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71310

--- Comment #3 from Anton Blanchard  ---
Another case found in the kernel:

struct mmu_gather {
long end;
int fullmm : 1;
};

void __tlb_reset_range(struct mmu_gather *p1)
{
if (p1->fullmm)
p1->end = 0;
}

void tlb_gather_mmu(struct mmu_gather *p1)
{
p1->fullmm = 1;
__tlb_reset_range(p1);
}

  30:   08 00 23 89 lbz r9,8(r3)
  34:   01 00 29 61 ori r9,r9,1
  38:   08 00 23 99 stb r9,8(r3)
  3c:   00 00 42 60 ori r2,r2,0
  40:   08 00 23 e9 ld  r9,8(r3)
  44:   01 00 2a 71 andi.   r10,r9,1
  48:   0c 00 82 41 beq 54 
  4c:   00 00 20 39 li  r9,0
  50:   00 00 23 f9 std r9,0(r3)
  54:   20 00 80 4e blr

[Bug target/71310] Bitfields cause load hit store with smaller store and larger load

2016-05-27 Thread segher at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71310

Segher Boessenkool  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2016-05-27
 Ever confirmed|0   |1

--- Comment #2 from Segher Boessenkool  ---
At expand time this is

  skb_5(D)->csum_valid = 1;
  _1 = BIT_FIELD_REF <*skb_5(D), 64, 64>;
  _2 = _1 & 27021597764222976;
  _7 = _2 != 0;
  _8 = (int) _7;
  return _8;

The RMW of writing csum_valid is done as a SImode memory access.
The BIT_FIELD_REF is DImode however.  Why?

[Bug target/71310] Bitfields cause load hit store with smaller store and larger load

2016-05-27 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71310

Richard Biener  changed:

   What|Removed |Added

   Keywords||missed-optimization

--- Comment #1 from Richard Biener  ---
bit-field-lowering avoids this by lowering the store to a RMW of
the DECL_BIT_FIELD_REPRESENTATIVE and the load to a read of it plus a bit
extraction from the loaded word (so it ends up as a store after a load).