diff mbox

[09/15] rs6000: Use xoris in constant construction

Message ID 1439341904-9345-10-git-send-email-rth@redhat.com
State New
Headers show

Commit Message

Richard Henderson Aug. 12, 2015, 1:11 a.m. UTC
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 mbox

Patch

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;