}
/* Make sure this is a REG and not some instance
- of ZERO_EXTRACT or SUBREG or other dangerous stuff.
+ of ZERO_EXTRACT or non-paradoxical SUBREG or other dangerous stuff.
If we have a memory destination then we have a pair of simple
basic blocks performing an operation of the form [addr] = c ? a : b.
bb_valid_for_noce_process_p will have ensured that these are
to be renamed. Assert that the callers set this up properly. */
if (MEM_P (SET_DEST (sset_b)))
gcc_assert (rtx_equal_p (SET_DEST (sset_b), to_rename));
- else if (!REG_P (SET_DEST (sset_b)))
+ else if (!REG_P (SET_DEST (sset_b))
+ && !paradoxical_subreg_p (SET_DEST (sset_b)))
{
BITMAP_FREE (bba_sets);
return false;
rtx sset = single_set (insn);
gcc_assert (sset);
+ rtx dest = SET_DEST (sset);
+ if (SUBREG_P (dest))
+ dest = SUBREG_REG (dest);
if (contains_mem_rtx_p (SET_SRC (sset))
- || !REG_P (SET_DEST (sset))
- || reg_overlap_mentioned_p (SET_DEST (sset), cond))
+ || !REG_P (dest)
+ || reg_overlap_mentioned_p (dest, cond))
goto free_bitmap_and_fail;
potential_cost += pattern_cost (sset, speed_p);
- bitmap_set_bit (test_bb_temps, REGNO (SET_DEST (sset)));
+ bitmap_set_bit (test_bb_temps, REGNO (dest));
}
}
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+unsigned
+f1(int t, int t1)
+{
+ int tt = 0;
+ if(t)
+ tt = (t1&0x8)!=0;
+ return tt;
+}
+struct f
+{
+ unsigned t:3;
+ unsigned t1:4;
+};
+unsigned
+f2(int t, struct f y)
+{
+ int tt = 0;
+ if(t)
+ tt = y.t1;
+ return tt;
+}
+/* Both f1 and f2 should produce a csel and not a cbz on the argument. */
+/* { dg-final { scan-assembler-times "csel\t" 2 } } */
+/* { dg-final { scan-assembler-times "ubfx\t" 2 } } */
+/* { dg-final { scan-assembler-not "cbz\t" } } */