From patchwork Mon Dec 6 18:43:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robin Dapp X-Patchwork-Id: 1564197 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=MkHSa2FJ; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4J7CHp715Yz9s5P for ; Tue, 7 Dec 2021 05:53:26 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id BC8573858425 for ; Mon, 6 Dec 2021 18:53:24 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BC8573858425 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1638816804; bh=AddDOVqQ8cUBhfJPKazF1c/NgSWdyNezAfx1/yl+4fE=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=MkHSa2FJ0KhuT3GrokZau1OrdDOR+uPrkTjs/gPbmRwW27quMW8hIlYFnmnbTKsug nBgDXsT/LWmSqfeZMcXxlnKgtEshHgal22T1VIkvPlySH3sGIlbpLFT3HBy5a7K0gz uPOLFgem0sOjlca8K3SzZe3+nEtrvbiFH7Y0pgfg= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by sourceware.org (Postfix) with ESMTPS id 51BFA3858436 for ; Mon, 6 Dec 2021 18:46:34 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 51BFA3858436 Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 1B6Ho1qb014470; Mon, 6 Dec 2021 18:46:30 GMT Received: from ppma01fra.de.ibm.com (46.49.7a9f.ip4.static.sl-reverse.com [159.122.73.70]) by mx0a-001b2d01.pphosted.com with ESMTP id 3cspsustce-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 06 Dec 2021 18:46:29 +0000 Received: from pps.filterd (ppma01fra.de.ibm.com [127.0.0.1]) by ppma01fra.de.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 1B6IiR8H015962; Mon, 6 Dec 2021 18:46:27 GMT Received: from b06cxnps4075.portsmouth.uk.ibm.com (d06relay12.portsmouth.uk.ibm.com [9.149.109.197]) by ppma01fra.de.ibm.com with ESMTP id 3cqyy96xte-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 06 Dec 2021 18:46:27 +0000 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 1B6IkO5D30146848 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 6 Dec 2021 18:46:24 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 36A4511C04C; Mon, 6 Dec 2021 18:46:24 +0000 (GMT) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E4C9A11C054; Mon, 6 Dec 2021 18:46:23 +0000 (GMT) Received: from li-926bd7cc-2dd1-11b2-a85c-f6adc0f5efec.ibm.com (unknown [9.171.69.25]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP; Mon, 6 Dec 2021 18:46:23 +0000 (GMT) To: gcc-patches@gcc.gnu.org, richard.sandiford@arm.com Subject: [PATCH v3 6/7] testsuite/s390: Add tests for noce_convert_multiple. Date: Mon, 6 Dec 2021 19:43:51 +0100 Message-Id: <20211206184352.42264-7-rdapp@linux.ibm.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20211206184352.42264-1-rdapp@linux.ibm.com> References: <20211206184352.42264-1-rdapp@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: adryorcLHvBD-RweNSpuST9xuCFpXwBh X-Proofpoint-ORIG-GUID: adryorcLHvBD-RweNSpuST9xuCFpXwBh X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.790,Hydra:6.0.425,FMLib:17.11.62.513 definitions=2021-12-06_07,2021-12-06_02,2021-12-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 phishscore=0 lowpriorityscore=0 malwarescore=0 suspectscore=0 spamscore=0 clxscore=1015 priorityscore=1501 adultscore=0 mlxlogscore=999 bulkscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2110150000 definitions=main-2112060111 X-Spam-Status: No, score=-11.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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-Patchwork-Original-From: Robin Dapp via Gcc-patches From: Robin Dapp Reply-To: Robin Dapp Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" 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)); +}