From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2119) id BD7B43858C83; Sat, 22 Apr 2023 16:46:11 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BD7B43858C83 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1682181971; bh=wc0ZBQgeCDPFXBCKXA0lfqQe3GcWHhU6jJilLPX5puw=; h=From:To:Subject:Date:From; b=ZeTlmeA01UXVaZVfq9lwvk1gvpGSsL54zeQbFfy2T5J9CGARh07E4gqzZwvCht6vL 93LCqEE30hjxZEiAWiLRdXESCjc1u2uHV/OPRgO8rgSnu00TGPiI6HxoeFZ0DOwHj5 6yyDtiAcbJwr5huolPhW+6UvbdlGJZn1wiAnJGS8= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Jeff Law To: gcc-cvs@gcc.gnu.org Subject: [gcc r14-164] Adjust rx movsicc tests X-Act-Checkin: gcc X-Git-Author: Jeff Law X-Git-Refname: refs/heads/master X-Git-Oldrev: c58c0771b7a3dbd2a00cd4b6ca2301d74b6cd4e2 X-Git-Newrev: 00c49869fed445bf0f70cfa06b9bae1e75a393c8 Message-Id: <20230422164611.BD7B43858C83@sourceware.org> Date: Sat, 22 Apr 2023 16:46:11 +0000 (GMT) List-Id: https://gcc.gnu.org/g:00c49869fed445bf0f70cfa06b9bae1e75a393c8 commit r14-164-g00c49869fed445bf0f70cfa06b9bae1e75a393c8 Author: Jeff Law Date: Sat Apr 22 10:43:35 2023 -0600 Adjust rx movsicc tests The rx port has target specific test movsicc which is naturally meant to verify that if-conversion is happening on the expected cases. Unfortunately the test is poorly written. The core problem is there are 8 distinct tests and each of those tests is expected to generate a specific sequence. Unfortunately, various generic bits might turn an equality test into an inequality test or make other similar changes. The net result is the assembly matching patterns may find a particular sequence, but it may be for a different function than was originally intended. ie, test1's output may match the expected assembly for test5. Ugh! This patch breaks the movsicc test down into 8 distinct tests and adjusts the patterns they match. The nice thing is all these tests are supposed to have branches that use a bCC 1f form. So we can make them a bit more robust by ignoring the actual condition code used. So if we change eq to ne, as long as we match the movsicc pattern, we're OK. And the 1f style is only used by the movsicc pattern. With the tests broken down it's a lot easier to diagnose why one test fails after the recent changes to if-conversion. movsicc-3 fails because of the profitability test. It's more expensive than the other cases because of its use of (const_int 10) rather than (const_int 0). (const_int 0) naturally has a smaller cost. It looks to me like in this context (const_int 10) should have the same cost as (const_int 0). But I'm nowhere near well versed in the cost model for the rx port. So I'm just leaving the test as xfailed. If someone cares enough, they can dig into it further. gcc/testsuite * gcc.target/rx/movsicc.c: Broken down into ... * gcc.target/rx/movsicc-1.c: Here. * gcc.target/rx/movsicc-2.c: Here. * gcc.target/rx/movsicc-3.c: Here. xfail one test. * gcc.target/rx/movsicc-4.c: Here. * gcc.target/rx/movsicc-5.c: Here. * gcc.target/rx/movsicc-6.c: Here. * gcc.target/rx/movsicc-7.c: Here. * gcc.target/rx/movsicc-8.c: Here. Diff: --- gcc/testsuite/gcc.target/rx/movsicc-1.c | 18 +++++++ gcc/testsuite/gcc.target/rx/movsicc-2.c | 18 +++++++ gcc/testsuite/gcc.target/rx/movsicc-3.c | 18 +++++++ gcc/testsuite/gcc.target/rx/movsicc-4.c | 18 +++++++ gcc/testsuite/gcc.target/rx/movsicc-5.c | 18 +++++++ gcc/testsuite/gcc.target/rx/movsicc-6.c | 18 +++++++ gcc/testsuite/gcc.target/rx/movsicc-7.c | 17 ++++++ gcc/testsuite/gcc.target/rx/movsicc-8.c | 17 ++++++ gcc/testsuite/gcc.target/rx/movsicc.c | 94 --------------------------------- 9 files changed, 142 insertions(+), 94 deletions(-) diff --git a/gcc/testsuite/gcc.target/rx/movsicc-1.c b/gcc/testsuite/gcc.target/rx/movsicc-1.c new file mode 100644 index 00000000000..09234ea0642 --- /dev/null +++ b/gcc/testsuite/gcc.target/rx/movsicc-1.c @@ -0,0 +1,18 @@ +/* { dg-do compile } */ +/* { dg-options "-Os" } */ + +typedef unsigned char u8; +typedef unsigned short u16; +signed int Xa, Xb; + +signed int stzreg_beq(int i, int a, int b) +{ + signed int x; + x = a; + if (i) + x = b; + return x; +} + +/* { dg-final { scan-assembler "b.. 1f" } } */ + diff --git a/gcc/testsuite/gcc.target/rx/movsicc-2.c b/gcc/testsuite/gcc.target/rx/movsicc-2.c new file mode 100644 index 00000000000..7d730c4e6b3 --- /dev/null +++ b/gcc/testsuite/gcc.target/rx/movsicc-2.c @@ -0,0 +1,18 @@ +/* { dg-do compile } */ +/* { dg-options "-Os" } */ + +typedef unsigned char u8; +typedef unsigned short u16; +signed int Xa, Xb; + +signed int stzreg_bge(int i, int a, int b, int c) +{ + signed int x; + x = a; + if (i0) + x = b; + return x; +} + +/* { dg-final { scan-assembler "b.. 1f" } } */ + diff --git a/gcc/testsuite/gcc.target/rx/movsicc-5.c b/gcc/testsuite/gcc.target/rx/movsicc-5.c new file mode 100644 index 00000000000..0febb6800b6 --- /dev/null +++ b/gcc/testsuite/gcc.target/rx/movsicc-5.c @@ -0,0 +1,18 @@ +/* { dg-do compile } */ +/* { dg-options "-Os" } */ + +typedef unsigned char u8; +typedef unsigned short u16; +signed int Xa, Xb; + +signed int stzreg_blt(int i, int a, int b) +{ + signed int x; + x = a; + if (i<0) + x = b; + return x; +} + +/* { dg-final { scan-assembler "b.. 1f" } } */ + diff --git a/gcc/testsuite/gcc.target/rx/movsicc-6.c b/gcc/testsuite/gcc.target/rx/movsicc-6.c new file mode 100644 index 00000000000..69f312e6df4 --- /dev/null +++ b/gcc/testsuite/gcc.target/rx/movsicc-6.c @@ -0,0 +1,18 @@ +/* { dg-do compile } */ +/* { dg-options "-Os" } */ + +typedef unsigned char u8; +typedef unsigned short u16; +signed int Xa, Xb; + +signed int stzreg_bne(int i, int a, int b) +{ + signed int x; + x = a; + if (!i) + x = b; + return x; +} + +/* { dg-final { scan-assembler "b.. 1f" } } */ + diff --git a/gcc/testsuite/gcc.target/rx/movsicc-7.c b/gcc/testsuite/gcc.target/rx/movsicc-7.c new file mode 100644 index 00000000000..a1a22e2f16b --- /dev/null +++ b/gcc/testsuite/gcc.target/rx/movsicc-7.c @@ -0,0 +1,17 @@ +/* { dg-do compile } */ +/* { dg-options "-Os" } */ + +typedef unsigned char u8; +typedef unsigned short u16; +signed int Xa, Xb; + +signed int stzimm_le( int i, int a ) +{ + signed int x; + x = a; + if (i>0) + x = 5; + return x; +} + +/* { dg-final { scan-assembler "b.. 1f" } } */ diff --git a/gcc/testsuite/gcc.target/rx/movsicc-8.c b/gcc/testsuite/gcc.target/rx/movsicc-8.c new file mode 100644 index 00000000000..be59e643913 --- /dev/null +++ b/gcc/testsuite/gcc.target/rx/movsicc-8.c @@ -0,0 +1,17 @@ +/* { dg-do compile } */ +/* { dg-options "-Os" } */ + +typedef unsigned char u8; +typedef unsigned short u16; +signed int Xa, Xb; + +signed int stzimm_le_r( int i, int a ) +{ + signed int x; + x = a; + if (i<0) + x = 5; + return x; +} + +/* { dg-final { scan-assembler "b.. 1f" } } */ diff --git a/gcc/testsuite/gcc.target/rx/movsicc.c b/gcc/testsuite/gcc.target/rx/movsicc.c deleted file mode 100644 index d8e6bcc3055..00000000000 --- a/gcc/testsuite/gcc.target/rx/movsicc.c +++ /dev/null @@ -1,94 +0,0 @@ -/* { dg-do compile } */ -/* { dg-options "-Os" } */ - -typedef unsigned char u8; -typedef unsigned short u16; -signed int Xa, Xb; - -signed int stzreg_beq(int i, int a, int b) -{ - signed int x; - x = a; - if (i) - x = b; - return x; -} - -/* { dg-final { scan-assembler "bne 1f" } } */ - -signed int stzreg_bge(int i, int a, int b, int c) -{ - signed int x; - x = a; - if (i0) - x = b; - return x; -} - -/* { dg-final { scan-assembler "bgt 1f" } } */ - -signed int stzreg_blt(int i, int a, int b) -{ - signed int x; - x = a; - if (i<0) - x = b; - return x; -} - -/* { dg-final { scan-assembler "blt 1f" } } */ - -signed int stzreg_bne(int i, int a, int b) -{ - signed int x; - x = a; - if (!i) - x = b; - return x; -} - -/* { dg-final { scan-assembler "beq 1f" } } */ - -signed int stzimm_le( int i, int a ) -{ - signed int x; - x = a; - if (i>0) - x = 5; - return x; -} - -/* { dg-final { scan-assembler "ble 1f" } } */ - -signed int stzimm_le_r( int i, int a ) -{ - signed int x; - x = a; - if (i<0) - x = 5; - return x; -} - -/* { dg-final { scan-assembler "bge 1f" } } */