Re: [PATCH, rs6000] Add xxswapd support for V2DF and V2DI modes

2019-11-06 Thread Segher Boessenkool
Hi!

On Wed, Nov 06, 2019 at 10:41:42AM -0600, Kelvin Nilsen wrote:
> It was recently discovered that the existing xxswapd instruction patterns 
> lack support for the V2DF and V2DI modes.  Support for these modes is 
> required for certain new instruction patterns that are being implemented.

Okay for trunk.  Thanks!


Segher


> 2019-11-06  Kelvin Nilsen  
> 
>   * config/rs6000/vsx.md (xxswapd_): Add support for V2DF and
>   V2DI modes.


[PATCH, rs6000] Add xxswapd support for V2DF and V2DI modes

2019-11-06 Thread Kelvin Nilsen


It was recently discovered that the existing xxswapd instruction patterns lack 
support for the V2DF and V2DI modes.  Support for these modes is required for 
certain new instruction patterns that are being implemented.

This patch adds the desired support.

The patch has been bootstrapped and tested without regressions on 
powerpc64le-unknown-linux.

Is this ok for trunk?

gcc/ChangeLog:

2019-11-06  Kelvin Nilsen  

* config/rs6000/vsx.md (xxswapd_): Add support for V2DF and
V2DI modes.

Index: gcc/config/rs6000/vsx.md
===
--- gcc/config/rs6000/vsx.md(revision 277861)
+++ gcc/config/rs6000/vsx.md(working copy)
@@ -2987,6 +2987,17 @@
   "xxpermdi %x0,%x1,%x1,2"
   [(set_attr "type" "vecperm")])
 
+(define_insn "xxswapd_"
+  [(set (match_operand:VSX_D 0 "vsx_register_operand" "=wa")
+   (vec_select:VSX_D
+ (match_operand:VSX_D 1 "vsx_register_operand" "wa")
+ (parallel [(const_int 1) (const_int 0)])))]
+  "TARGET_VSX"
+;; AIX does not support extended mnemonic xxswapd.  Use the basic
+;; mnemonic xxpermdi instead.
+  "xxpermdi %x0,%x1,%x1,2"
+  [(set_attr "type" "vecperm")])
+
 ;; lxvd2x for little endian loads.  We need several of
 ;; these since the form of the PARALLEL differs by mode.
 (define_insn "*vsx_lxvd2x2_le_"


Re: [PATCH RS6000], add xxswapd support

2019-09-23 Thread Segher Boessenkool
Hi Carl,

On Mon, Sep 23, 2019 at 08:07:32AM -0700, Carl Love wrote:
>   * config/rs6000/vsx.md (xxswapd_v4si, xxswapd_v8hi, xxswapd_v16qi):
>   New define_insn.
>   (vsx_xxpermdi4_le_, vsx_xxpermdi8_le_V8HI,
>   vsx_xxpermdi16_le_V16QI): Removed define_insn.

If you use "" in a changelog, it usually is handy to say what mode
it is here.  Like in this case, (vsx_xxpermdi4_le_ for VSX_W).

> +(define_insn "xxswapd_v16qi"
> +  [(set (match_operand:V16QI 0 "vsx_register_operand" "=wa")
> + (vec_select:V16QI
> +   (match_operand:V16QI 1 "vsx_register_operand" "wa")
> +   (parallel [(const_int 8) (const_int 9)
> +  (const_int 10) (const_int 11)
> +  (const_int 12) (const_int 13)
> +  (const_int 14) (const_int 15)
> +  (const_int 0) (const_int 1)
> +  (const_int 2) (const_int 3)
> +  (const_int 4) (const_int 5)
> +  (const_int 6) (const_int 7)])))]
> +   "TARGET_VSX"
> +;; AIX does not support the extended mnemonic xxswapd.  Use the basic
> +;; mnemonic xxpermdi instead.
> +   "xxpermdi %x0,%x1,%x1,2"
>    [(set_attr "type" "vecperm")])

Both of the strings ("TARGET_VSX" and "xxpermdi*") should be indented by
only two spacesC, just like the things above and below them are.

> +;; AIX does not support the extended mnemonic xxswapd.  Use the basic
> +;; mnemonic xxpermdi instead.
> +   "xxpermdi %x0,%x1,%x1,2"
> +   [(set_attr "type" "vecperm")])

For the other two, the [(set_attr... as well: only two spaces.

Okay for trunk with that fixed up.  Thanks!


Segher


[PATCH RS6000], add xxswapd support

2019-09-23 Thread Carl Love
GCC maintainers:

The following patch adds define_insn support for xxswapd mnemonic.  The
xxswapd mnemonic is the more prefered name for the xxpermdi mnemonic. 
The following patch replaces the define_insn xxpermdi with define_insn
xxswapd.

The patch has been tested on:

  powerpc64le-unknown-linux-gnu (Power 8 LE)
  powerpc64le-unknown-linux-gnu (Power 9 LE)

with no regressions.

Please let me know if the patch is acceptable for trunk.

Carl Love

P.S.  Note this is a repost as I missed copying  segher and dje on the
original messag.

--

gcc/ChangeLog:

2019-09-10  Carl Love  

* config/rs6000/vsx.md (xxswapd_v4si, xxswapd_v8hi, xxswapd_v16qi):
New define_insn.
(vsx_xxpermdi4_le_, vsx_xxpermdi8_le_V8HI,
vsx_xxpermdi16_le_V16QI): Removed define_insn.
---
 gcc/config/rs6000/vsx.md | 74 ++--
 1 file changed, 40 insertions(+), 34 deletions(-)

diff --git a/gcc/config/rs6000/vsx.md b/gcc/config/rs6000/vsx.md
index 7633171df..cd67131eb 100644
--- a/gcc/config/rs6000/vsx.md
+++ b/gcc/config/rs6000/vsx.md
@@ -2941,43 +2941,49 @@
   "xxpermdi %x0,%x1,%x1,2"
   [(set_attr "type" "vecperm")])
 
-(define_insn "*vsx_xxpermdi4_le_"
-  [(set (match_operand:VSX_W 0 "vsx_register_operand" "=wa")
-(vec_select:VSX_W
-  (match_operand:VSX_W 1 "vsx_register_operand" "wa")
-  (parallel [(const_int 2) (const_int 3)
- (const_int 0) (const_int 1)])))]
-  "!BYTES_BIG_ENDIAN && VECTOR_MEM_VSX_P (mode)"
-  "xxpermdi %x0,%x1,%x1,2"
+(define_insn "xxswapd_v16qi"
+  [(set (match_operand:V16QI 0 "vsx_register_operand" "=wa")
+   (vec_select:V16QI
+     (match_operand:V16QI 1 "vsx_register_operand" "wa")
+     (parallel [(const_int 8) (const_int 9)
+    (const_int 10) (const_int 11)
+    (const_int 12) (const_int 13)
+    (const_int 14) (const_int 15)
+    (const_int 0) (const_int 1)
+    (const_int 2) (const_int 3)
+    (const_int 4) (const_int 5)
+    (const_int 6) (const_int 7)])))]
+   "TARGET_VSX"
+;; AIX does not support the extended mnemonic xxswapd.  Use the basic
+;; mnemonic xxpermdi instead.
+   "xxpermdi %x0,%x1,%x1,2"
   [(set_attr "type" "vecperm")])
 
-(define_insn "*vsx_xxpermdi8_le_V8HI"
+(define_insn "xxswapd_v8hi"
   [(set (match_operand:V8HI 0 "vsx_register_operand" "=wa")
-(vec_select:V8HI
-  (match_operand:V8HI 1 "vsx_register_operand" "wa")
-  (parallel [(const_int 4) (const_int 5)
- (const_int 6) (const_int 7)
- (const_int 0) (const_int 1)
- (const_int 2) (const_int 3)])))]
-  "!BYTES_BIG_ENDIAN && VECTOR_MEM_VSX_P (V8HImode)"
-  "xxpermdi %x0,%x1,%x1,2"
-  [(set_attr "type" "vecperm")])
-
-(define_insn "*vsx_xxpermdi16_le_V16QI"
-  [(set (match_operand:V16QI 0 "vsx_register_operand" "=wa")
-(vec_select:V16QI
-  (match_operand:V16QI 1 "vsx_register_operand" "wa")
-  (parallel [(const_int 8) (const_int 9)
- (const_int 10) (const_int 11)
- (const_int 12) (const_int 13)
- (const_int 14) (const_int 15)
- (const_int 0) (const_int 1)
- (const_int 2) (const_int 3)
- (const_int 4) (const_int 5)
- (const_int 6) (const_int 7)])))]
-  "!BYTES_BIG_ENDIAN && VECTOR_MEM_VSX_P (V16QImode)"
-  "xxpermdi %x0,%x1,%x1,2"
-  [(set_attr "type" "vecperm")])
+   (vec_select:V8HI
+     (match_operand:V8HI 1 "vsx_register_operand" "wa")
+     (parallel [(const_int 4) (const_int 5)
+    (const_int 6) (const_int 7)
+    (const_int 0) (const_int 1)
+    (const_int 2) (const_int 3)])))]
+   "TARGET_VSX"
+;; AIX does not support the extended mnemonic xxswapd.  Use the basic
+;; mnemonic xxpermdi instead.
+   "xxpermdi %x0,%x1,%x1,2"
+   [(set_attr "type" "vecperm")])
+
+(define_insn "xxswapd_"
+  [(set (match_operand:VSX_W 0 "vsx_register_operand" "=wa")
+   (vec_select:VSX_W
+     (match_operand:VSX_W 1 "vsx_register_operand" "wa")
+     (parallel [(const_int 2) (const_int 3)
+    (const_int 0) (const_int 1)])))]
+   "TARGET_VSX"
+;; AIX does not support extended mnemonic xxswapd.  Use the basic
+;; mnemonic xxpermdi instead.
+   "xxpermdi %x0,%x1,%x1,2"
+   [(set_attr "type" "vecperm")])
 
 ;; lxvd2x for little endian loads.  We need several of
 ;; these since the form of the PARALLEL differs by mode.
-- 
2.17.1



[PATCH RS6000], add xxswapd support

2019-09-12 Thread Carl Love


GCC maintainers:

The following patch adds define_insn support for xxswapd mnemonic.  The
xxswapd mnemonic is the more prefered name for the xxpermdi mnemonic. 
The following patch replaces the define_insn xxpermdi with define_insn
xxswapd.

The patch has been tested on:

  powerpc64le-unknown-linux-gnu (Power 8 LE)
  powerpc64le-unknown-linux-gnu (Power 9 LE)

with no regressions.

Please let me know if the patch is acceptable for trunk.

Carl Love
---
RS6000, add xxswapd support

gcc/ChangeLog:

2019-09-10  Carl Love  

* config/rs6000/vsx.md (xxswapd_v4si, xxswapd_v8hi, xxswapd_v16qi):
New define_insn.
(vsx_xxpermdi4_le_, vsx_xxpermdi8_le_V8HI,
vsx_xxpermdi16_le_V16QI): Removed define_insn.
---
 gcc/config/rs6000/vsx.md | 74 ++--
 1 file changed, 40 insertions(+), 34 deletions(-)

diff --git a/gcc/config/rs6000/vsx.md b/gcc/config/rs6000/vsx.md
index 7633171df..cd67131eb 100644
--- a/gcc/config/rs6000/vsx.md
+++ b/gcc/config/rs6000/vsx.md
@@ -2941,43 +2941,49 @@
   "xxpermdi %x0,%x1,%x1,2"
   [(set_attr "type" "vecperm")])
 
-(define_insn "*vsx_xxpermdi4_le_"
-  [(set (match_operand:VSX_W 0 "vsx_register_operand" "=wa")
-(vec_select:VSX_W
-  (match_operand:VSX_W 1 "vsx_register_operand" "wa")
-  (parallel [(const_int 2) (const_int 3)
- (const_int 0) (const_int 1)])))]
-  "!BYTES_BIG_ENDIAN && VECTOR_MEM_VSX_P (mode)"
-  "xxpermdi %x0,%x1,%x1,2"
+(define_insn "xxswapd_v16qi"
+  [(set (match_operand:V16QI 0 "vsx_register_operand" "=wa")
+   (vec_select:V16QI
+ (match_operand:V16QI 1 "vsx_register_operand" "wa")
+ (parallel [(const_int 8) (const_int 9)
+(const_int 10) (const_int 11)
+(const_int 12) (const_int 13)
+(const_int 14) (const_int 15)
+(const_int 0) (const_int 1)
+(const_int 2) (const_int 3)
+(const_int 4) (const_int 5)
+(const_int 6) (const_int 7)])))]
+   "TARGET_VSX"
+;; AIX does not support the extended mnemonic xxswapd.  Use the basic
+;; mnemonic xxpermdi instead.
+   "xxpermdi %x0,%x1,%x1,2"
   [(set_attr "type" "vecperm")])
 
-(define_insn "*vsx_xxpermdi8_le_V8HI"
+(define_insn "xxswapd_v8hi"
   [(set (match_operand:V8HI 0 "vsx_register_operand" "=wa")
-(vec_select:V8HI
-  (match_operand:V8HI 1 "vsx_register_operand" "wa")
-  (parallel [(const_int 4) (const_int 5)
- (const_int 6) (const_int 7)
- (const_int 0) (const_int 1)
- (const_int 2) (const_int 3)])))]
-  "!BYTES_BIG_ENDIAN && VECTOR_MEM_VSX_P (V8HImode)"
-  "xxpermdi %x0,%x1,%x1,2"
-  [(set_attr "type" "vecperm")])
-
-(define_insn "*vsx_xxpermdi16_le_V16QI"
-  [(set (match_operand:V16QI 0 "vsx_register_operand" "=wa")
-(vec_select:V16QI
-  (match_operand:V16QI 1 "vsx_register_operand" "wa")
-  (parallel [(const_int 8) (const_int 9)
- (const_int 10) (const_int 11)
- (const_int 12) (const_int 13)
- (const_int 14) (const_int 15)
- (const_int 0) (const_int 1)
- (const_int 2) (const_int 3)
- (const_int 4) (const_int 5)
- (const_int 6) (const_int 7)])))]
-  "!BYTES_BIG_ENDIAN && VECTOR_MEM_VSX_P (V16QImode)"
-  "xxpermdi %x0,%x1,%x1,2"
-  [(set_attr "type" "vecperm")])
+   (vec_select:V8HI
+ (match_operand:V8HI 1 "vsx_register_operand" "wa")
+ (parallel [(const_int 4) (const_int 5)
+(const_int 6) (const_int 7)
+(const_int 0) (const_int 1)
+(const_int 2) (const_int 3)])))]
+   "TARGET_VSX"
+;; AIX does not support the extended mnemonic xxswapd.  Use the basic
+;; mnemonic xxpermdi instead.
+   "xxpermdi %x0,%x1,%x1,2"
+   [(set_attr "type" "vecperm")])
+
+(define_insn "xxswapd_"
+  [(set (match_operand:VSX_W 0 "vsx_register_operand" "=wa")
+   (vec_select:VSX_W
+ (match_operand:VSX_W 1 "vsx_register_operand" "wa")
+ (parallel [(const_int 2) (const_int 3)
+(const_int 0) (const_int 1)])))]
+   "TARGET_VSX"
+;; AIX does not support extended mnemonic xxswapd.  Use the basic
+;; mnemonic xxpermdi instead.
+   "xxpermdi %x0,%x1,%x1,2"
+   [(set_attr "type" "vecperm")])
 
 ;; lxvd2x for little endian loads.  We need several of
 ;; these since the form of the PARALLEL differs by mode.
-- 
2.17.1