From a7e94dc09a4470fde623197382e8dea4553e2d6b Mon Sep 17 00:00:00 2001 From: Michael Meissner Date: Mon, 20 Aug 2018 23:46:37 +0000 Subject: [PATCH] re PR target/87033 (The compiler does not generate the LWAX instruction) [gcc] 2018-08-20 Michael Meissner PR target/87033 * config/rs6000/rs6000.md (extendsi2): Change constraints from 'Y' to 'YZ' to enable the LWAX instruction to be generated for indexed loads. [gcc/testsuite] 2018-08-20 Michael Meissner PR target/87033 * gcc.target/powerpc/pr87033.c: New test. From-SVN: r263678 --- gcc/ChangeLog | 7 +++++++ gcc/config/rs6000/rs6000.md | 2 +- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.target/powerpc/pr87033.c | 12 ++++++++++++ 4 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.target/powerpc/pr87033.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ca49dba4437..cb9f5528e4b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2018-08-20 Michael Meissner + + PR target/87033 + * config/rs6000/rs6000.md (extendsi2): Change constraints + from 'Y' to 'YZ' to enable the LWAX instruction to be generated + for indexed loads. + 2018-08-20 Nathan Sidwell Jeff Law diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md index d34fcf0966b..49e209072a6 100644 --- a/gcc/config/rs6000/rs6000.md +++ b/gcc/config/rs6000/rs6000.md @@ -988,7 +988,7 @@ "=r, r, wl, wu, wj, wK, wH, wr") (sign_extend:EXTSI (match_operand:SI 1 "lwa_operand" - "Y, r, Z, Z, r, wK, wH, ?wIwH")))] + "YZ, r, Z, Z, r, wK, wH, ?wIwH")))] "" "@ lwa%U1%X1 %0,%1 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 3708a5c4438..af8615607fb 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-08-20 Michael Meissner + + PR target/87033 + * gcc.target/powerpc/pr87033.c: New test. + 2018-08-20 Martin Sebor PR tree-optimization/87034 diff --git a/gcc/testsuite/gcc.target/powerpc/pr87033.c b/gcc/testsuite/gcc.target/powerpc/pr87033.c new file mode 100644 index 00000000000..9d62ce73d32 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/pr87033.c @@ -0,0 +1,12 @@ +/* { dg-do compile { target { powerpc*-*-* && lp64 } } } */ +/* { dg-options "-O2" } */ + +/* Insure that a LWAX is generated instead of ADD + LWA. LP64 is needed + because the LWA and LWAX instructions are only available in 64-bit mode. */ +long func (int *p, unsigned long n) +{ + return p[n]; +} + +/* { dg-final { scan-assembler {\mlwax\M} } } */ +/* { dg-final { scan-assembler-not {\mlwa\M} } } */ -- 2.30.2