rs6000/test: Adjust fold-vec-extract-double.p9.c for BE [PR108810]

Message ID e6303ed9-5ba8-ac10-719c-9eb2a414d5f4@linux.ibm.com
State Accepted
Headers
Series rs6000/test: Adjust fold-vec-extract-double.p9.c for BE [PR108810] |

Checks

Context Check Description
snail/gcc-patch-check success Github commit url

Commit Message

Kewen.Lin March 1, 2023, 5:55 a.m. UTC
  Hi,

On BE, the extracted index for the leftmost element is 0
rather than 1, adjust the test case accordingly.

Tested on powerpc64-linux-gnu P7/P8/P9 and
powerpc64le-linux-gnu P9/P10.

I'm going to push this soon if no objections.

BR,
Kewen
-----
	PR testsuite/108810

gcc/testsuite/ChangeLog:

	* gcc.target/powerpc/fold-vec-extract-double.p9.c (testd_cst): Adjust
	the extracted index for BE.
---
 .../gcc.target/powerpc/fold-vec-extract-double.p9.c       | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

--
2.39.2
  

Patch

diff --git a/gcc/testsuite/gcc.target/powerpc/fold-vec-extract-double.p9.c b/gcc/testsuite/gcc.target/powerpc/fold-vec-extract-double.p9.c
index 6c515035d1a..100f680fd02 100644
--- a/gcc/testsuite/gcc.target/powerpc/fold-vec-extract-double.p9.c
+++ b/gcc/testsuite/gcc.target/powerpc/fold-vec-extract-double.p9.c
@@ -18,9 +18,15 @@  testd_var (vector double vd2, signed int si)
   return vec_extract (vd2, si);
 }

+#ifdef __BIG_ENDIAN__
+#define LEFTMOST_ELEMENT_INDEX 0
+#else
+#define LEFTMOST_ELEMENT_INDEX 1
+#endif
+
 double
 testd_cst (vector double vd2)
 {
-  return vec_extract (vd2, 1);
+  return vec_extract (vd2, LEFTMOST_ELEMENT_INDEX);
 }