This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH, PowerPC] Fix vector pack insns for little endian
- From: Bill Schmidt <wschmidt at linux dot vnet dot ibm dot com>
- To: gcc-patches at gcc dot gnu dot org
- Cc: dje at gcc dot gnu dot org
- Date: Wed, 24 Jul 2013 16:05:10 -0500
- Subject: [PATCH, PowerPC] Fix vector pack insns for little endian
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.
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>"