Fixing the ilp32 issue that Christophe found. The existing testcase uses `long` to represent a 64 bit integer. This breaks when compiled using the `-mabi=ilp32` flag. We switch the use of int/long for int32_t/int64_t to avoid this problem and show the requirement of a widening operation more clearly.
Ok for trunk? gcc/testsuite/Changelog 2018-07-31 Matthew Malcomson <matthew.malcom...@arm.com> * gcc.target/aarch64/simd/vect_su_add_sub.c: Use stdint types
diff --git a/gcc/testsuite/gcc.target/aarch64/simd/vect_su_add_sub.c b/gcc/testsuite/gcc.target/aarch64/simd/vect_su_add_sub.c index 338da54f6281c90e1c6b1c59fa50d9b719005c77..e3a2d0175e75b20e309c9b734b747512e466fbb1 100644 --- a/gcc/testsuite/gcc.target/aarch64/simd/vect_su_add_sub.c +++ b/gcc/testsuite/gcc.target/aarch64/simd/vect_su_add_sub.c @@ -1,21 +1,24 @@ /* { dg-do compile } */ /* { dg-options "-O3" } */ +#include <stdint.h> +#include <stdlib.h> + /* Ensure we use the signed/unsigned extend vectorized add and sub instructions. */ #define N 1024 -int a[N]; -long c[N]; -long d[N]; -unsigned int ua[N]; -unsigned long uc[N]; -unsigned long ud[N]; +int32_t a[N]; +int64_t c[N]; +int64_t d[N]; +uint32_t ua[N]; +uint64_t uc[N]; +uint64_t ud[N]; void add () { - for (int i = 0; i < N; i++) + for (size_t i = 0; i < N; i++) d[i] = a[i] + c[i]; } /* { dg-final { scan-assembler-times "\[ \t\]saddw2\[ \t\]+" 1 } } */ @@ -24,7 +27,7 @@ add () void subtract () { - for (int i = 0; i < N; i++) + for (size_t i = 0; i < N; i++) d[i] = c[i] - a[i]; } /* { dg-final { scan-assembler-times "\[ \t\]ssubw2\[ \t\]+" 1 } } */ @@ -33,7 +36,7 @@ subtract () void uadd () { - for (int i = 0; i < N; i++) + for (size_t i = 0; i < N; i++) ud[i] = ua[i] + uc[i]; } /* { dg-final { scan-assembler-times "\[ \t\]uaddw2\[ \t\]+" 1 } } */ @@ -42,7 +45,7 @@ uadd () void usubtract () { - for (int i = 0; i < N; i++) + for (size_t i = 0; i < N; i++) ud[i] = uc[i] - ua[i]; } /* { dg-final { scan-assembler-times "\[ \t\]usubw2\[ \t\]+" 1 } } */