This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH 09/15] rs6000: Use xoris in constant construction
- From: Richard Henderson <rth at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Cc: David Edelsohn <dje dot gcc at gmail dot com>
- Date: Tue, 11 Aug 2015 18:11:38 -0700
- Subject: [PATCH 09/15] rs6000: Use xoris in constant construction
- Authentication-results: sourceware.org; auth=none
- References: <1439341904-9345-1-git-send-email-rth at redhat dot com>
Helps for constants like 0xfffff70008000ul, 0xffffffff55555555ul,
0xffffffff550ffffful.
There doesn't appear to be any benefit to using xori; every test that
I expected to use it found an alternate solution of the same cost.
Cc: David Edelsohn <dje.gcc@gmail.com>
---
* config/rs6000/rs6000.c (genimm_ppc::exam_search): Test for
inverting the second half-word.
(genimm_ppc::generate): Handle XOR.
---
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 9c08cca..40b29b0 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -8169,6 +8169,11 @@ genimm_ppc::exam_search (HOST_WIDE_INT c, int budget)
return true;
}
}
+ if (exam_sub (c | 0xffff0000u, sub_budget))
+ {
+ opN (XOR, ~c & 0xffff0000u); /* XORIS */
+ return true;
+ }
/* If C is a mask itself, apply it to all ones. */
if (exam_mask (-1, c, sub_budget))
@@ -8253,6 +8258,7 @@ genimm_ppc::generate (rtx dest, machine_mode mode) const
case PLUS:
case AND:
case IOR:
+ case XOR:
case ASHIFT:
x = gen_rtx_fmt_ee (r, mode, op1, op2);
break;
--
2.4.3