Patchwork [PowerPC] Fix vector pack insns for little endian

login
register
mail settings
Submitter William J. Schmidt
Date July 24, 2013, 9:05 p.m.
Message ID <1374699910.3633.138.camel@gnopaine>
Download mbox | patch
Permalink /patch/261519/
State New
Headers show

Comments

William J. Schmidt - July 24, 2013, 9:05 p.m.
In little endian mode, we need to reverse the order of operands for
vector pack operations.  This corrects 20 failures in the test suite in
LE mode.

Patch based on work by Anton Blanchard; I simplified it and generalized
it to all the vector pack insns.

Bootstrapped and tested on powerpc64-unknown-linux-gnu with no new
regressions.  Ok for trunk?

Thanks,
Bill


2013-07-24  Bill Schmidt  <wschmidt@linux.ibm.com>
	    Anton Blanchard <anton@au1.ibm.com>

	* config/rs6000/altivec.md (altivec_vpkpx): Handle little endian.
	(altivec_vpks<VI_char>ss): Likewise.
	(altivec_vpks<VI_char>us): Likewise.
	(altivec_vpku<VI_char>us): Likewise.
	(altivec_vpku<VI_char>um): Likewise.
David Edelsohn - July 24, 2013, 9:36 p.m.
On Wed, Jul 24, 2013 at 5:05 PM, Bill Schmidt
<wschmidt@linux.vnet.ibm.com> wrote:
> In little endian mode, we need to reverse the order of operands for
> vector pack operations.  This corrects 20 failures in the test suite in
> LE mode.
>
> Patch based on work by Anton Blanchard; I simplified it and generalized
> it to all the vector pack insns.
>
> Bootstrapped and tested on powerpc64-unknown-linux-gnu with no new
> regressions.  Ok for trunk?
>
> Thanks,
> Bill
>
>
> 2013-07-24  Bill Schmidt  <wschmidt@linux.ibm.com>
>             Anton Blanchard <anton@au1.ibm.com>
>
>         * config/rs6000/altivec.md (altivec_vpkpx): Handle little endian.
>         (altivec_vpks<VI_char>ss): Likewise.
>         (altivec_vpks<VI_char>us): Likewise.
>         (altivec_vpku<VI_char>us): Likewise.
>         (altivec_vpku<VI_char>um): Likewise.

Okay.

Thanks, David

Patch

Index: gcc/config/rs6000/altivec.md
===================================================================
--- gcc/config/rs6000/altivec.md	(revision 201207)
+++ gcc/config/rs6000/altivec.md	(working copy)
@@ -1047,7 +1047,13 @@ 
                       (match_operand:V4SI 2 "register_operand" "v")]
 		     UNSPEC_VPKPX))]
   "TARGET_ALTIVEC"
-  "vpkpx %0,%1,%2"
+  "*
+  {
+    if (BYTES_BIG_ENDIAN)
+      return \"vpkpx %0,%1,%2\";
+    else
+      return \"vpkpx %0,%2,%1\";
+  }"
   [(set_attr "type" "vecperm")])
 
 (define_insn "altivec_vpks<VI_char>ss"
@@ -1056,7 +1062,13 @@ 
 			    (match_operand:VP 2 "register_operand" "v")]
 			   UNSPEC_VPACK_SIGN_SIGN_SAT))]
   "<VI_unit>"
-  "vpks<VI_char>ss %0,%1,%2"
+  "*
+  {
+    if (BYTES_BIG_ENDIAN)
+      return \"vpks<VI_char>ss %0,%1,%2\";
+    else
+      return \"vpks<VI_char>ss %0,%2,%1\";
+  }"
   [(set_attr "type" "vecperm")])
 
 (define_insn "altivec_vpks<VI_char>us"
@@ -1065,7 +1077,13 @@ 
 			    (match_operand:VP 2 "register_operand" "v")]
 			   UNSPEC_VPACK_SIGN_UNS_SAT))]
   "<VI_unit>"
-  "vpks<VI_char>us %0,%1,%2"
+  "*
+  {
+    if (BYTES_BIG_ENDIAN)
+      return \"vpks<VI_char>us %0,%1,%2\";
+    else
+      return \"vpks<VI_char>us %0,%2,%1\";
+  }"
   [(set_attr "type" "vecperm")])
 
 (define_insn "altivec_vpku<VI_char>us"
@@ -1074,7 +1092,13 @@ 
 			    (match_operand:VP 2 "register_operand" "v")]
 			   UNSPEC_VPACK_UNS_UNS_SAT))]
   "<VI_unit>"
-  "vpku<VI_char>us %0,%1,%2"
+  "*
+  {
+    if (BYTES_BIG_ENDIAN)
+      return \"vpku<VI_char>us %0,%1,%2\";
+    else
+      return \"vpku<VI_char>us %0,%2,%1\";
+  }"
   [(set_attr "type" "vecperm")])
 
 (define_insn "altivec_vpku<VI_char>um"
@@ -1083,7 +1107,13 @@ 
 			    (match_operand:VP 2 "register_operand" "v")]
 			   UNSPEC_VPACK_UNS_UNS_MOD))]
   "<VI_unit>"
-  "vpku<VI_char>um %0,%1,%2"
+  "*
+  {
+    if (BYTES_BIG_ENDIAN)
+      return \"vpku<VI_char>um %0,%1,%2\";
+    else
+      return \"vpku<VI_char>um %0,%2,%1\";
+  }"
   [(set_attr "type" "vecperm")])
 
 (define_insn "*altivec_vrl<VI_char>"