From 01c288035aa960631dd0ffd9131ed0a824a95f30 Mon Sep 17 00:00:00 2001 From: Alex Coplan Date: Fri, 2 Oct 2020 11:16:31 +0100 Subject: [PATCH] aarch64: ilp32 testsuite fixes This fixes test failures on ilp32 introduced in r11-3032-gd4febc75e8dfab23bd3132d5747eded918f85107. The assembler checks in extend-syntax.c simply needed adjusting for 32-bit pointers. It appears the subsp.c test has never passed on ILP32 due to a missed optimisation there. Since this isn't a code quality regression, disable that check on ILP32. gcc/testsuite/ChangeLog: * gcc.target/aarch64/extend-syntax.c: Fix assembler checks for ilp32, disable check-function-bodies on ilp32. * gcc.target/aarch64/subsp.c: Only check second scan-assembler on lp64 since the code on ilp32 is missing the optimization needed for this test to pass. --- gcc/testsuite/gcc.target/aarch64/extend-syntax.c | 13 +++++++++++-- gcc/testsuite/gcc.target/aarch64/subsp.c | 2 +- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/gcc/testsuite/gcc.target/aarch64/extend-syntax.c b/gcc/testsuite/gcc.target/aarch64/extend-syntax.c index 23fa9f4ffc5..1bfcdb59dde 100644 --- a/gcc/testsuite/gcc.target/aarch64/extend-syntax.c +++ b/gcc/testsuite/gcc.target/aarch64/extend-syntax.c @@ -20,6 +20,7 @@ unsigned long long *add1(unsigned long long *p, unsigned x) */ unsigned long long add2(unsigned long long x, unsigned y) { + /* { dg-final { scan-assembler-times "add\tx0, x0, w1, uxtw" 1 { target ilp32 } } } */ return x + y; } @@ -34,6 +35,9 @@ double *add3(double *p, int x) return p + x; } +// add1 and add3 should both generate this on ILP32: +/* { dg-final { scan-assembler-times "add\tw0, w0, w1, lsl 3" 2 { target ilp32 } } } */ + // Hits *sub_zero_extendsi_di (*sub__). /* ** sub1: @@ -42,6 +46,7 @@ double *add3(double *p, int x) */ unsigned long long sub1(unsigned long long x, unsigned n) { + /* { dg-final { scan-assembler-times "sub\tx0, x0, w1, uxtw" 1 { target ilp32 } } } */ return x - n; } @@ -67,6 +72,9 @@ double *sub3(double *p, int n) return p - n; } +// sub2 and sub3 should both generate this on ILP32: +/* { dg-final { scan-assembler-times "sub\tw0, w0, w1, lsl 3" 2 { target ilp32 } } } */ + // Hits *adds_zero_extendsi_di (*adds__). int adds1(unsigned long long x, unsigned y) { @@ -97,7 +105,8 @@ int subs1(unsigned long long x, unsigned y) unsigned long long *w; int subs2(unsigned long long *x, int y) { - /* { dg-final { scan-assembler-times "subs\tx\[0-9\]+, x\[0-9\]+, w\[0-9\]+, sxtw 3" 1 } } */ + /* { dg-final { scan-assembler-times "subs\tx\[0-9\]+, x\[0-9\]+, w\[0-9\]+, sxtw 3" 1 { target lp64 } } } */ + /* { dg-final { scan-assembler-times "subs\tw\[0-9\]+, w\[0-9\]+, w\[0-9\]+, lsl 3" 1 { target ilp32 } } } */ unsigned long long *t = x - y; w = t; return !!t; @@ -117,4 +126,4 @@ int cmp2(unsigned long long x, int y) return x == ((unsigned long long)y << 3); } -/* { dg-final { check-function-bodies "**" "" "" } } */ +/* { dg-final { check-function-bodies "**" "" "" { target lp64 } } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/subsp.c b/gcc/testsuite/gcc.target/aarch64/subsp.c index 341b83dca86..e7f61e0799b 100644 --- a/gcc/testsuite/gcc.target/aarch64/subsp.c +++ b/gcc/testsuite/gcc.target/aarch64/subsp.c @@ -16,4 +16,4 @@ f2 (int *x, int y) } /* { dg-final { scan-assembler "sub\tsp, sp, x\[0-9\]*\n" } } */ -/* { dg-final { scan-assembler "sub\tsp, sp, w\[0-9\]*, sxtw 4\n" } } */ +/* { dg-final { scan-assembler "sub\tsp, sp, w\[0-9\]*, sxtw 4\n" { target lp64 } } } */ -- 2.30.2