@@ -3902,9 +3902,19 @@
return 0;
}
+ /* Honor the C++ memory model and mimic what RTL expansion does. */
+ unsigned HOST_WIDE_INT bitstart = 0;
+ unsigned HOST_WIDE_INT bitend = 0;
+ if (TREE_CODE (lhs) == COMPONENT_REF)
+ {
+ get_bit_range (&bitstart, &bitend, lhs, &lbitpos, &offset);
+ if (offset != NULL_TREE)
+ return 0;
+ }
+
/* See if we can find a mode to refer to this field. We should be able to,
but fail if we can't. */
- nmode = get_best_mode (lbitsize, lbitpos, 0, 0,
+ nmode = get_best_mode (lbitsize, lbitpos, bitstart, bitend,
const_p ? TYPE_ALIGN (TREE_TYPE (linner))
: MIN (TYPE_ALIGN (TREE_TYPE (linner)),
TYPE_ALIGN (TREE_TYPE (rinner))),
@@ -4795,7 +4795,7 @@ optimize_bitfield_assignment_op (unsigne
If the access does not need to be restricted, 0 is returned in both
*BITSTART and *BITEND. */
-static void
+void
get_bit_range (unsigned HOST_WIDE_INT *bitstart,
unsigned HOST_WIDE_INT *bitend,
tree exp,
@@ -242,6 +242,10 @@ extern rtx push_block (rtx, int, int);
extern bool emit_push_insn (rtx, machine_mode, tree, rtx, unsigned int,
int, rtx, int, rtx, rtx, int, rtx, bool);
+/* Extract the accessible bit-range from a COMPONENT_REF. */
+extern void get_bit_range (unsigned HOST_WIDE_INT *, unsigned HOST_WIDE_INT *,
+ tree, HOST_WIDE_INT *, tree *);
+
/* Expand an assignment that stores the value of FROM into TO. */
extern void expand_assignment (tree, tree, bool);
@@ -0,0 +1,23 @@
+/* { dg-do compile { target { powerpc*-*-* } } } */
+/* { dg-options "-O2" } */
+
+/* { dg-final { scan-assembler-not {\mld} } } */
+/* { dg-final { scan-assembler-not {\mlwz} } } */
+/* { dg-final { scan-assembler-times {\mlbz} 2 } } */
+
+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);
+}