aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyrylo Tkachov <kyrylo.tkachov@arm.com>2018-09-18 13:28:50 +0000
committerKyrylo Tkachov <ktkachov@gcc.gnu.org>2018-09-18 13:28:50 +0000
commit92cb1fbc2774035b9ce7eaa9ff8c9a3dadbd8827 (patch)
tree82785d9fe703321c770bdfbb5e99c3370ae7ee46
parent6a8aa2e11b29c598ec24be8be0d87ca2ddd0f932 (diff)
downloadgcc-92cb1fbc2774035b9ce7eaa9ff8c9a3dadbd8827.zip
gcc-92cb1fbc2774035b9ce7eaa9ff8c9a3dadbd8827.tar.gz
gcc-92cb1fbc2774035b9ce7eaa9ff8c9a3dadbd8827.tar.bz2
[AArch64][testsuite][committed] Fix gcc.target/aarch64/combine_bfxil.c for -mabi=ilp32
As described in https://gcc.gnu.org/ml/gcc-patches/2018-09/msg00963.html this test generates UXTW instructions with -mabi=ilp32 because the foo* functions take pointers and store results into them. In ILP32 the callee clears the top bits with a UXTW. This trips the scan-assembler-not UXTW test that checks that the zero_extend form of the BFXIL pattern is used, which it is. This patch avoids this problem by not passing pointers to the results, but instead using global variables for which the foo* functions will synthesise the address using ADRP, avoiding the UXTW instructions. With this patch the test PASSes fully with -mabi=ilp32 and still PASSes on LP64. * gcc.target/aarch64/combine_bfxil.c: Avoid passing pointers to functions. From-SVN: r264389
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.target/aarch64/combine_bfxil.c76
2 files changed, 43 insertions, 38 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index ddf5f73..6794fb6 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2018-09-18 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
+
+ * gcc.target/aarch64/combine_bfxil.c: Avoid passing pointers to
+ functions.
+
2018-09-17 Cesar Philippidis <cesar@codesourcery.com>
Bernd Schmidt <bernds_cb1@t-online.de>
diff --git a/gcc/testsuite/gcc.target/aarch64/combine_bfxil.c b/gcc/testsuite/gcc.target/aarch64/combine_bfxil.c
index 98f6159..84e5377 100644
--- a/gcc/testsuite/gcc.target/aarch64/combine_bfxil.c
+++ b/gcc/testsuite/gcc.target/aarch64/combine_bfxil.c
@@ -19,7 +19,7 @@ combine_balanced (unsigned long long a, unsigned long long b)
unsigned long long
combine_minimal (unsigned long long a, unsigned long long b)
{
- return (a & 0xfffffffffffffffe) | (b & 0x0000000000000001);
+ return (a & 0xfffffffffffffffell) | (b & 0x0000000000000001ll);
}
unsigned long long
@@ -40,77 +40,77 @@ combine_unbalanced_int (unsigned int a, unsigned int b)
return (a & 0xffffff00ll) | (b & 0x000000ffll);
}
+unsigned long long c, d;
+
__attribute__ ((noinline)) void
-foo (unsigned long long a, unsigned long long b, unsigned long long *c,
- unsigned long long *d)
+foo (unsigned long long a, unsigned long long b)
{
- *c = combine_minimal (a, b);
- *d = combine_minimal (b, a);
+ c = combine_minimal (a, b);
+ d = combine_minimal (b, a);
}
__attribute__ ((noinline)) void
-foo2 (unsigned long long a, unsigned long long b, unsigned long long *c,
- unsigned long long *d)
+foo2 (unsigned long long a, unsigned long long b)
{
- *c = combine_balanced (a, b);
- *d = combine_balanced (b, a);
+ c = combine_balanced (a, b);
+ d = combine_balanced (b, a);
}
__attribute__ ((noinline)) void
-foo3 (unsigned long long a, unsigned long long b, unsigned long long *c,
- unsigned long long *d)
+foo3 (unsigned long long a, unsigned long long b)
{
- *c = combine_unbalanced (a, b);
- *d = combine_unbalanced (b, a);
+ c = combine_unbalanced (a, b);
+ d = combine_unbalanced (b, a);
}
+unsigned int ic, id;
+
void
-foo4 (unsigned int a, unsigned int b, unsigned int *c, unsigned int *d)
+foo4 (unsigned int a, unsigned int b)
{
- *c = combine_balanced_int (a, b);
- *d = combine_balanced_int (b, a);
+ ic = combine_balanced_int (a, b);
+ id = combine_balanced_int (b, a);
}
void
-foo5 (unsigned int a, unsigned int b, unsigned int *c, unsigned int *d)
+foo5 (unsigned int a, unsigned int b)
{
- *c = combine_unbalanced_int (a, b);
- *d = combine_unbalanced_int (b, a);
+ ic = combine_unbalanced_int (a, b);
+ id = combine_unbalanced_int (b, a);
}
void
-foo6 (unsigned int a, unsigned int b, unsigned long long *c, unsigned long long *d)
+foo6 (unsigned int a, unsigned int b)
{
- *c = combine_zero_extended_int(a, b);
- *d = combine_zero_extended_int(b, a);
+ c = combine_zero_extended_int(a, b);
+ d = combine_zero_extended_int(b, a);
}
int
main (void)
{
- unsigned long long a = 0x0123456789ABCDEF, b = 0xFEDCBA9876543210, c, d;
- foo3 (a, b, &c, &d);
+ unsigned long long a = 0x0123456789ABCDEF, b = 0xFEDCBA9876543210;
+ foo3 (a, b);
if (c != 0x0123456789543210) abort ();
if (d != 0xfedcba9876abcdef) abort ();
- foo2 (a, b, &c, &d);
+ foo2 (a, b);
if (c != 0x0123456776543210) abort ();
if (d != 0xfedcba9889abcdef) abort ();
- foo (a, b, &c, &d);
+ foo (a, b);
if (c != 0x0123456789abcdee) abort ();
if (d != 0xfedcba9876543211) abort ();
- unsigned int a2 = 0x01234567, b2 = 0xFEDCBA98, c2, d2;
- foo4 (a2, b2, &c2, &d2);
- if (c2 != 0x0123ba98) abort ();
- if (d2 != 0xfedc4567) abort ();
- foo5 (a2, b2, &c2, &d2);
- if (c2 != 0x01234598) abort ();
- if (d2 != 0xfedcba67) abort ();
-
- unsigned long long c3, d3;
- foo6 (a2, b2, &c3, &d3);
- if (c3 != 0x0123ba98) abort ();
- if (d3 != 0xfedc4567) abort ();
+ unsigned int a2 = 0x01234567, b2 = 0xFEDCBA98;
+ foo4 (a2, b2);
+ if (ic != 0x0123ba98) abort ();
+ if (id != 0xfedc4567) abort ();
+ foo5 (a2, b2);
+ if (ic != 0x01234598) abort ();
+ if (id != 0xfedcba67) abort ();
+
+ foo6 (a2, b2);
+ if (c != 0x0123ba98) abort ();
+ if (d != 0xfedc4567) abort ();
return 0;
}