Rather than only consider -1 as a base, consider any negative number. Cc: David Edelsohn <dje....@gmail.com> --- * config/rs6000/rs6000.c (genimm_ppc::exam_search): Attempt to mask negative numbers. --- gcc/config/rs6000/rs6000.c | 6 ++++++ 1 file changed, 6 insertions(+)
diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index b27e476..9c08cca 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -8174,6 +8174,12 @@ genimm_ppc::exam_search (HOST_WIDE_INT c, int budget) if (exam_mask (-1, c, sub_budget)) return true; + /* If the low 32-bits are negative, see if we can mask + those with RLDICL. */ + test = ((c & 0xffffffffu) ^ 0x80000000u) - 0x80000000u; + if (test < 0 && exam_mask (test, c | 0xffffffffu, sub_budget)) + return true; + /* If the two halves are equal, use an insert. */ if (c >> 32 == test && exam_sub (test, sub_budget)) { -- 2.4.3