From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by sourceware.org (Postfix) with ESMTPS id 4E2F1386482F for ; Fri, 25 Jun 2021 16:09:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 4E2F1386482F Received: from pps.filterd (m0098417.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 15PG3Xis066960; Fri, 25 Jun 2021 12:09:28 -0400 Received: from ppma04ams.nl.ibm.com (63.31.33a9.ip4.static.sl-reverse.com [169.51.49.99]) by mx0a-001b2d01.pphosted.com with ESMTP id 39dj46rqmk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 25 Jun 2021 12:09:27 -0400 Received: from pps.filterd (ppma04ams.nl.ibm.com [127.0.0.1]) by ppma04ams.nl.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 15PG9GBK017843; Fri, 25 Jun 2021 16:09:25 GMT Received: from b06avi18878370.portsmouth.uk.ibm.com (b06avi18878370.portsmouth.uk.ibm.com [9.149.26.194]) by ppma04ams.nl.ibm.com with ESMTP id 399878b4q1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 25 Jun 2021 16:09:25 +0000 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06avi18878370.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 15PG7t6720513234 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 25 Jun 2021 16:07:55 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C6E0CAE071; Fri, 25 Jun 2021 16:09:22 +0000 (GMT) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 87208AE064; Fri, 25 Jun 2021 16:09:22 +0000 (GMT) Received: from li-926bd7cc-2dd1-11b2-a85c-f6adc0f5efec.ibm.com (unknown [9.171.46.33]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 25 Jun 2021 16:09:22 +0000 (GMT) From: Robin Dapp To: gcc-patches@gcc.gnu.org, richard.sandiford@arm.com Subject: [PATCH 6/7] testsuite/s390: Add tests for noce_convert_multiple. Date: Fri, 25 Jun 2021 18:09:04 +0200 Message-Id: <20210625160905.23786-7-rdapp@linux.ibm.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210625160905.23786-1-rdapp@linux.ibm.com> References: <20210625160905.23786-1-rdapp@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-GUID: Wdkm6J6TUpp3pvtXzs4Ynjjglr6DZYAA X-Proofpoint-ORIG-GUID: Wdkm6J6TUpp3pvtXzs4Ynjjglr6DZYAA X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391, 18.0.790 definitions=2021-06-25_06:2021-06-25, 2021-06-25 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=999 suspectscore=0 spamscore=0 priorityscore=1501 clxscore=1015 impostorscore=0 lowpriorityscore=0 adultscore=0 bulkscore=0 mlxscore=0 malwarescore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2106250094 X-Spam-Status: No, score=-11.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Jun 2021 16:09:31 -0000 Add new s390-specific tests that check if we convert two SETs into two loads on condition. Remove the s390-specific target-check in gcc.dg/ifcvt-4.c. --- gcc/testsuite/gcc.dg/ifcvt-4.c | 2 +- .../gcc.target/s390/ifcvt-two-insns-bool.c | 39 +++++++++++++++++++ .../gcc.target/s390/ifcvt-two-insns-int.c | 39 +++++++++++++++++++ .../gcc.target/s390/ifcvt-two-insns-long.c | 39 +++++++++++++++++++ 4 files changed, 118 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.target/s390/ifcvt-two-insns-bool.c create mode 100644 gcc/testsuite/gcc.target/s390/ifcvt-two-insns-int.c create mode 100644 gcc/testsuite/gcc.target/s390/ifcvt-two-insns-long.c diff --git a/gcc/testsuite/gcc.dg/ifcvt-4.c b/gcc/testsuite/gcc.dg/ifcvt-4.c index ec142cfd943..871ab950756 100644 --- a/gcc/testsuite/gcc.dg/ifcvt-4.c +++ b/gcc/testsuite/gcc.dg/ifcvt-4.c @@ -2,7 +2,7 @@ /* { dg-additional-options "-misel" { target { powerpc*-*-* } } } */ /* { dg-additional-options "-march=z196" { target { s390x-*-* } } } */ /* { dg-additional-options "-mtune-ctrl=^one_if_conv_insn" { target { i?86-*-* x86_64-*-* } } } */ -/* { dg-skip-if "Multiple set if-conversion not guaranteed on all subtargets" { "arm*-*-* avr-*-* hppa*64*-*-* s390-*-* visium-*-*" riscv*-*-* msp430-*-* } } */ +/* { dg-skip-if "Multiple set if-conversion not guaranteed on all subtargets" { "arm*-*-* avr-*-* hppa*64*-*-* visium-*-*" riscv*-*-* msp430-*-* } } */ /* { dg-skip-if "" { "s390x-*-*" } { "-m31" } } */ typedef int word __attribute__((mode(word))); diff --git a/gcc/testsuite/gcc.target/s390/ifcvt-two-insns-bool.c b/gcc/testsuite/gcc.target/s390/ifcvt-two-insns-bool.c new file mode 100644 index 00000000000..4415cb49f11 --- /dev/null +++ b/gcc/testsuite/gcc.target/s390/ifcvt-two-insns-bool.c @@ -0,0 +1,39 @@ +/* Check if conversion for two instructions. */ + +/* { dg-do run } */ +/* { dg-options "-O2 -march=z13 --save-temps" } */ + +/* { dg-final { scan-assembler "lochinhe\t%r.?,1" } } */ +/* { dg-final { scan-assembler "locrnhe\t.*" } } */ +#include +#include +#include +#include + +__attribute__ ((noinline)) +int foo (int *a, unsigned int n) +{ + int min = 999999; + bool bla = false; + for (int i = 0; i < n; i++) + { + if (a[i] < min) + { + min = a[i]; + bla = true; + } + } + + if (bla) + min += 1; + return min; +} + +int main() +{ + int a[] = {2, 1, -13, INT_MAX, INT_MIN, 0}; + + int res = foo (a, sizeof (a)); + + assert (res == (INT_MIN + 1)); +} diff --git a/gcc/testsuite/gcc.target/s390/ifcvt-two-insns-int.c b/gcc/testsuite/gcc.target/s390/ifcvt-two-insns-int.c new file mode 100644 index 00000000000..db8df84cced --- /dev/null +++ b/gcc/testsuite/gcc.target/s390/ifcvt-two-insns-int.c @@ -0,0 +1,39 @@ +/* Check if conversion for two instructions. */ + +/* { dg-do run } */ +/* { dg-options "-O2 -march=z13 --save-temps" } */ + +/* { dg-final { scan-assembler "lochinhe\t%r.?,1" } } */ +/* { dg-final { scan-assembler "locrnhe\t.*" } } */ +#include +#include +#include +#include + +__attribute__ ((noinline)) +int foo (int *a, unsigned int n) +{ + int min = 999999; + int bla = 0; + for (int i = 0; i < n; i++) + { + if (a[i] < min) + { + min = a[i]; + bla = 1; + } + } + + if (bla) + min += 1; + return min; +} + +int main() +{ + int a[] = {2, 1, -13, INT_MAX, INT_MIN, 0}; + + int res = foo (a, sizeof (a)); + + assert (res == (INT_MIN + 1)); +} diff --git a/gcc/testsuite/gcc.target/s390/ifcvt-two-insns-long.c b/gcc/testsuite/gcc.target/s390/ifcvt-two-insns-long.c new file mode 100644 index 00000000000..bee63328729 --- /dev/null +++ b/gcc/testsuite/gcc.target/s390/ifcvt-two-insns-long.c @@ -0,0 +1,39 @@ +/* Check if conversion for two instructions. */ + +/* { dg-do run } */ +/* { dg-options "-O2 -march=z13 --save-temps" } */ + +/* { dg-final { scan-assembler "locghinhe\t%r.?,1" } } */ +/* { dg-final { scan-assembler "locgrnhe\t.*" } } */ +#include +#include +#include +#include + +__attribute__ ((noinline)) +long foo (long *a, unsigned long n) +{ + long min = 999999; + long bla = 0; + for (int i = 0; i < n; i++) + { + if (a[i] < min) + { + min = a[i]; + bla = 1; + } + } + + if (bla) + min += 1; + return min; +} + +int main() +{ + long a[] = {2, 1, -13, LONG_MAX, LONG_MIN, 0}; + + long res = foo (a, sizeof (a)); + + assert (res == (LONG_MIN + 1)); +} -- 2.31.1