[rs6000] use index form addresses more often for l[wh]brx/st[wh]brx
diff mbox series

Message ID 52b70835-3faf-c136-9fc3-bcf34f93d196@linux.ibm.com
State New
Headers show
Series
  • [rs6000] use index form addresses more often for l[wh]brx/st[wh]brx
Related show

Commit Message

Aaron Sawdey Nov. 5, 2018, 5:08 p.m. UTC
This does the same thing for bswap<mode>2 that I previously did for bswapdi2.
The predicates for bswap<mode>2_{load,store} are now indexed_or_indirect_operand,
and bswap<mode>2 uses rs6000_force_indexed_or_indirect_mem to make sure the
address is appropriate for that predicate.

Bootstrap/regtest passes on ppc64le power8/power9, ok for trunk?

Thanks!
    Aaron



2018-11-05  Aaron Sawdey  <acsawdey@linux.ibm.com>

	* config/rs6000/rs6000.md (bswap<mode>2): Force address into register
	if not in indexed or indirect form.
	(bswap<mode>2_load): Change predicate to indexed_or_indirect_operand.
	(bswap<mode>2_store): Ditto.

Comments

Segher Boessenkool Nov. 5, 2018, 11:19 p.m. UTC | #1
Hi!

On Mon, Nov 05, 2018 at 11:08:39AM -0600, Aaron Sawdey wrote:
> This does the same thing for bswap<mode>2 that I previously did for bswapdi2.
> The predicates for bswap<mode>2_{load,store} are now indexed_or_indirect_operand,
> and bswap<mode>2 uses rs6000_force_indexed_or_indirect_mem to make sure the
> address is appropriate for that predicate.

This looks fine, one thing:

> --- gcc/config/rs6000/rs6000.md	(revision 265753)
> +++ gcc/config/rs6000/rs6000.md	(working copy)
> @@ -2411,9 +2411,15 @@
>      src = force_reg (<MODE>mode, src);
> 
>    if (MEM_P (src))
> -    emit_insn (gen_bswap<mode>2_load (dest, src));
> +    {
> +       src = rs6000_force_indexed_or_indirect_mem (src);
> +       emit_insn (gen_bswap<mode>2_load (dest, src));

These two lines are indented a space too much.

Okay with that fixed.  Thanks!


Segher

Patch
diff mbox series

Index: gcc/config/rs6000/rs6000.md
===================================================================
--- gcc/config/rs6000/rs6000.md	(revision 265753)
+++ gcc/config/rs6000/rs6000.md	(working copy)
@@ -2411,9 +2411,15 @@ 
     src = force_reg (<MODE>mode, src);

   if (MEM_P (src))
-    emit_insn (gen_bswap<mode>2_load (dest, src));
+    {
+       src = rs6000_force_indexed_or_indirect_mem (src);
+       emit_insn (gen_bswap<mode>2_load (dest, src));
+    }
   else if (MEM_P (dest))
-    emit_insn (gen_bswap<mode>2_store (dest, src));
+    {
+       dest = rs6000_force_indexed_or_indirect_mem (dest);
+       emit_insn (gen_bswap<mode>2_store (dest, src));
+    }
   else
     emit_insn (gen_bswap<mode>2_reg (dest, src));
   DONE;
@@ -2421,13 +2427,13 @@ 

 (define_insn "bswap<mode>2_load"
   [(set (match_operand:HSI 0 "gpc_reg_operand" "=r")
-	(bswap:HSI (match_operand:HSI 1 "memory_operand" "Z")))]
+	(bswap:HSI (match_operand:HSI 1 "indexed_or_indirect_operand" "Z")))]
   ""
   "l<wd>brx %0,%y1"
   [(set_attr "type" "load")])

 (define_insn "bswap<mode>2_store"
-  [(set (match_operand:HSI 0 "memory_operand" "=Z")
+  [(set (match_operand:HSI 0 "indexed_or_indirect_operand" "=Z")
 	(bswap:HSI (match_operand:HSI 1 "gpc_reg_operand" "r")))]
   ""
   "st<wd>brx %1,%y0"