From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by sourceware.org (Postfix) with ESMTPS id 1261D3858034 for ; Mon, 26 Apr 2021 19:00:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 1261D3858034 Received: from pps.filterd (m0098410.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 13QJ07EM002309; Mon, 26 Apr 2021 15:00:41 -0400 Received: from ppma03wdc.us.ibm.com (ba.79.3fa9.ip4.static.sl-reverse.com [169.63.121.186]) by mx0a-001b2d01.pphosted.com with ESMTP id 38625xhy67-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 26 Apr 2021 15:00:41 -0400 Received: from pps.filterd (ppma03wdc.us.ibm.com [127.0.0.1]) by ppma03wdc.us.ibm.com (8.16.0.43/8.16.0.43) with SMTP id 13QJ0G1V015435; Mon, 26 Apr 2021 19:00:40 GMT Received: from b01cxnp23034.gho.pok.ibm.com (b01cxnp23034.gho.pok.ibm.com [9.57.198.29]) by ppma03wdc.us.ibm.com with ESMTP id 384ay8r97g-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 26 Apr 2021 19:00:40 +0000 Received: from b01ledav004.gho.pok.ibm.com (b01ledav004.gho.pok.ibm.com [9.57.199.109]) by b01cxnp23034.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 13QJ0dqJ37814652 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 26 Apr 2021 19:00:39 GMT Received: from b01ledav004.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id EA1CA112065; Mon, 26 Apr 2021 19:00:38 +0000 (GMT) Received: from b01ledav004.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5F25A112064; Mon, 26 Apr 2021 19:00:38 +0000 (GMT) Received: from ltcden2-lp1.aus.stglabs.ibm.com (unknown [9.53.174.68]) by b01ledav004.gho.pok.ibm.com (Postfix) with ESMTPS; Mon, 26 Apr 2021 19:00:38 +0000 (GMT) Received: by ltcden2-lp1.aus.stglabs.ibm.com (Postfix, from userid 1008) id CD89444D7FCC; Mon, 26 Apr 2021 14:00:37 -0500 (CDT) From: acsawdey@linux.ibm.com To: gcc-patches@gcc.gnu.org Cc: segher@kernel.crashing.org, wschmidt@linux.ibm.com, will_schmidt@vnet.ibm.com, Aaron Sawdey Subject: [PATCH,rs6000] Test cases for p10 fusion patterns Date: Mon, 26 Apr 2021 14:00:36 -0500 Message-Id: <20210426190036.1122177-1-acsawdey@linux.ibm.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: e3febTvkg8CF0XpWnCkYLu6wtZJvJM5M X-Proofpoint-GUID: e3febTvkg8CF0XpWnCkYLu6wtZJvJM5M X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391, 18.0.761 definitions=2021-04-26_09:2021-04-26, 2021-04-26 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 phishscore=0 spamscore=0 impostorscore=0 suspectscore=0 bulkscore=0 malwarescore=0 priorityscore=1501 mlxscore=0 mlxlogscore=999 adultscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104060000 definitions=main-2104260143 X-Spam-Status: No, score=-14.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP, WEIRD_QUOTING 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: Mon, 26 Apr 2021 19:00:45 -0000 From: Aaron Sawdey This adds some test cases to make sure that the combine patterns for p10 fusion are working. OK for trunk? gcc/testsuite/ChangeLog: * gcc.target/powerpc/fusion-p10-ldcmpi.c: New file. * gcc.target/powerpc/fusion-p10-2logical.c: New file. --- .../gcc.target/powerpc/fusion-p10-2logical.c | 205 ++++++++++++++++++ .../gcc.target/powerpc/fusion-p10-ldcmpi.c | 66 ++++++ 2 files changed, 271 insertions(+) create mode 100644 gcc/testsuite/gcc.target/powerpc/fusion-p10-2logical.c create mode 100644 gcc/testsuite/gcc.target/powerpc/fusion-p10-ldcmpi.c diff --git a/gcc/testsuite/gcc.target/powerpc/fusion-p10-2logical.c b/gcc/testsuite/gcc.target/powerpc/fusion-p10-2logical.c new file mode 100644 index 00000000000..9a205373505 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/fusion-p10-2logical.c @@ -0,0 +1,205 @@ +/* { dg-do compile { target { powerpc*-*-* } } } */ +/* { dg-skip-if "" { powerpc*-*-darwin* } } */ +/* { dg-options "-mdejagnu-cpu=power10 -O3 -dp" } */ + +#include +#include + +/* and/andc/eqv/nand/nor/or/orc/xor */ +#define AND(a,b) ((a)&(b)) +#define ANDC1(a,b) ((a)&((~b))) +#define ANDC2(a,b) ((~(a))&(b)) +#define EQV(a,b) (~((a)^(b))) +#define NAND(a,b) (~((a)&(b))) +#define NOR(a,b) (~((a)|(b))) +#define OR(a,b) ((a)|(b)) +#define ORC1(a,b) ((a)|((~b))) +#define ORC2(a,b) ((~(a))|(b)) +#define XOR(a,b) ((a)^(b)) +#define TEST1(type, func) \ + type func ## _and_T_ ## type (type a, type b, type c) { return AND(func(a,b),c); } \ + type func ## _andc1_T_ ## type (type a, type b, type c) { return ANDC1(func(a,b),c); } \ + type func ## _andc2_T_ ## type (type a, type b, type c) { return ANDC2(func(a,b),c); } \ + type func ## _eqv_T_ ## type (type a, type b, type c) { return EQV(func(a,b),c); } \ + type func ## _nand_T_ ## type (type a, type b, type c) { return NAND(func(a,b),c); } \ + type func ## _nor_T_ ## type (type a, type b, type c) { return NOR(func(a,b),c); } \ + type func ## _or_T_ ## type (type a, type b, type c) { return OR(func(a,b),c); } \ + type func ## _orc1_T_ ## type (type a, type b, type c) { return ORC1(func(a,b),c); } \ + type func ## _orc2_T_ ## type (type a, type b, type c) { return ORC2(func(a,b),c); } \ + type func ## _xor_T_ ## type (type a, type b, type c) { return XOR(func(a,b),c); } \ + type func ## _rev_and_T_ ## type (type a, type b, type c) { return AND(c,func(a,b)); } \ + type func ## _rev_andc1_T_ ## type (type a, type b, type c) { return ANDC1(c,func(a,b)); } \ + type func ## _rev_andc2_T_ ## type (type a, type b, type c) { return ANDC2(c,func(a,b)); } \ + type func ## _rev_eqv_T_ ## type (type a, type b, type c) { return EQV(c,func(a,b)); } \ + type func ## _rev_nand_T_ ## type (type a, type b, type c) { return NAND(c,func(a,b)); } \ + type func ## _rev_nor_T_ ## type (type a, type b, type c) { return NOR(c,func(a,b)); } \ + type func ## _rev_or_T_ ## type (type a, type b, type c) { return OR(c,func(a,b)); } \ + type func ## _rev_orc1_T_ ## type (type a, type b, type c) { return ORC1(c,func(a,b)); } \ + type func ## _rev_orc2_T_ ## type (type a, type b, type c) { return ORC2(c,func(a,b)); } \ + type func ## _rev_xor_T_ ## type (type a, type b, type c) { return XOR(c,func(a,b)); } +#define TEST(type) \ + TEST1(type,AND) \ + TEST1(type,ANDC1) \ + TEST1(type,ANDC2) \ + TEST1(type,EQV) \ + TEST1(type,NAND) \ + TEST1(type,NOR) \ + TEST1(type,OR) \ + TEST1(type,ORC1) \ + TEST1(type,ORC2) \ + TEST1(type,XOR) + +typedef vector bool char vboolchar_t; +typedef vector unsigned int vuint_t; + +TEST(uint8_t); +TEST(int8_t); +TEST(uint16_t); +TEST(int16_t); +TEST(uint32_t); +TEST(int32_t); +TEST(uint64_t); +TEST(int64_t); +TEST(vboolchar_t); +TEST(vuint_t); + +/* Recreate with: + grep ' \*fuse_' fusion-p10-2logical.s|sed -e 's,^.*\*,,' |sort -k 7,7 |uniq -c|awk '{l=30-length($2); printf("/%s* { %s { scan-assembler-times \"%s\"%-*s %4d } } *%s/\n","","dg-final",$2,l,"",$1,"");}' + */ + +/* { dg-final { scan-assembler-times "fuse_and_and/1" 16 } } */ +/* { dg-final { scan-assembler-times "fuse_and_and/2" 16 } } */ +/* { dg-final { scan-assembler-times "fuse_andc_and/0" 16 } } */ +/* { dg-final { scan-assembler-times "fuse_andc_and/1" 26 } } */ +/* { dg-final { scan-assembler-times "fuse_andc_and/2" 48 } } */ +/* { dg-final { scan-assembler-times "fuse_andc_and/3" 6 } } */ +/* { dg-final { scan-assembler-times "fuse_andc_or/0" 16 } } */ +/* { dg-final { scan-assembler-times "fuse_andc_or/1" 16 } } */ +/* { dg-final { scan-assembler-times "fuse_andc_or/2" 32 } } */ +/* { dg-final { scan-assembler-times "fuse_andc_orc/0" 8 } } */ +/* { dg-final { scan-assembler-times "fuse_andc_orc/1" 8 } } */ +/* { dg-final { scan-assembler-times "fuse_andc_orc/2" 48 } } */ +/* { dg-final { scan-assembler-times "fuse_andc_xor/0" 16 } } */ +/* { dg-final { scan-assembler-times "fuse_andc_xor/1" 16 } } */ +/* { dg-final { scan-assembler-times "fuse_andc_xor/2" 32 } } */ +/* { dg-final { scan-assembler-times "fuse_and_eqv/0" 8 } } */ +/* { dg-final { scan-assembler-times "fuse_and_eqv/2" 24 } } */ +/* { dg-final { scan-assembler-times "fuse_and_or/0" 16 } } */ +/* { dg-final { scan-assembler-times "fuse_and_or/2" 16 } } */ +/* { dg-final { scan-assembler-times "fuse_and_orc/0" 8 } } */ +/* { dg-final { scan-assembler-times "fuse_and_orc/2" 24 } } */ +/* { dg-final { scan-assembler-times "fuse_and_xor/0" 16 } } */ +/* { dg-final { scan-assembler-times "fuse_and_xor/2" 16 } } */ +/* { dg-final { scan-assembler-times "fuse_eqv_and/0" 16 } } */ +/* { dg-final { scan-assembler-times "fuse_eqv_and/2" 16 } } */ +/* { dg-final { scan-assembler-times "fuse_eqv_andc/0" 8 } } */ +/* { dg-final { scan-assembler-times "fuse_eqv_andc/2" 24 } } */ +/* { dg-final { scan-assembler-times "fuse_eqv_or/0" 8 } } */ +/* { dg-final { scan-assembler-times "fuse_eqv_or/2" 24 } } */ +/* { dg-final { scan-assembler-times "fuse_nand_and/0" 16 } } */ +/* { dg-final { scan-assembler-times "fuse_nand_and/2" 16 } } */ +/* { dg-final { scan-assembler-times "fuse_nand_andc/0" 8 } } */ +/* { dg-final { scan-assembler-times "fuse_nand_andc/2" 24 } } */ +/* { dg-final { scan-assembler-times "fuse_nand_or/0" 14 } } */ +/* { dg-final { scan-assembler-times "fuse_nand_or/1" 2 } } */ +/* { dg-final { scan-assembler-times "fuse_nand_or/2" 72 } } */ +/* { dg-final { scan-assembler-times "fuse_nand_or/3" 8 } } */ +/* { dg-final { scan-assembler-times "fuse_nand_orc/2" 24 } } */ +/* { dg-final { scan-assembler-times "fuse_nand_orc/3" 8 } } */ +/* { dg-final { scan-assembler-times "fuse_nor_and/0" 28 } } */ +/* { dg-final { scan-assembler-times "fuse_nor_and/1" 4 } } */ +/* { dg-final { scan-assembler-times "fuse_nor_and/2" 48 } } */ +/* { dg-final { scan-assembler-times "fuse_nor_and/3" 16 } } */ +/* { dg-final { scan-assembler-times "fuse_nor_andc/2" 24 } } */ +/* { dg-final { scan-assembler-times "fuse_nor_andc/3" 8 } } */ +/* { dg-final { scan-assembler-times "fuse_nor_or/0" 8 } } */ +/* { dg-final { scan-assembler-times "fuse_nor_or/2" 24 } } */ +/* { dg-final { scan-assembler-times "fuse_nor_orc/0" 8 } } */ +/* { dg-final { scan-assembler-times "fuse_nor_orc/2" 24 } } */ +/* { dg-final { scan-assembler-times "fuse_or_and/0" 16 } } */ +/* { dg-final { scan-assembler-times "fuse_or_and/2" 16 } } */ +/* { dg-final { scan-assembler-times "fuse_or_andc/0" 16 } } */ +/* { dg-final { scan-assembler-times "fuse_or_andc/2" 16 } } */ +/* { dg-final { scan-assembler-times "fuse_orc_and/0" 16 } } */ +/* { dg-final { scan-assembler-times "fuse_orc_and/1" 16 } } */ +/* { dg-final { scan-assembler-times "fuse_orc_and/2" 32 } } */ +/* { dg-final { scan-assembler-times "fuse_orc_andc/0" 8 } } */ +/* { dg-final { scan-assembler-times "fuse_orc_andc/1" 8 } } */ +/* { dg-final { scan-assembler-times "fuse_orc_andc/2" 48 } } */ +/* { dg-final { scan-assembler-times "fuse_orc_or/0" 8 } } */ +/* { dg-final { scan-assembler-times "fuse_orc_or/1" 10 } } */ +/* { dg-final { scan-assembler-times "fuse_orc_or/2" 72 } } */ +/* { dg-final { scan-assembler-times "fuse_orc_or/3" 6 } } */ +/* { dg-final { scan-assembler-times "fuse_orc_xor/0" 8 } } */ +/* { dg-final { scan-assembler-times "fuse_orc_xor/1" 8 } } */ +/* { dg-final { scan-assembler-times "fuse_orc_xor/2" 48 } } */ +/* { dg-final { scan-assembler-times "fuse_or_eqv/0" 8 } } */ +/* { dg-final { scan-assembler-times "fuse_or_eqv/2" 24 } } */ +/* { dg-final { scan-assembler-times "fuse_or_or/1" 16 } } */ +/* { dg-final { scan-assembler-times "fuse_or_or/2" 16 } } */ +/* { dg-final { scan-assembler-times "fuse_or_xor/0" 16 } } */ +/* { dg-final { scan-assembler-times "fuse_or_xor/2" 16 } } */ +/* { dg-final { scan-assembler-times "fuse_vandc_vand/0" 8 } } */ +/* { dg-final { scan-assembler-times "fuse_vandc_vand/1" 10 } } */ +/* { dg-final { scan-assembler-times "fuse_vandc_vand/3" 6 } } */ +/* { dg-final { scan-assembler-times "fuse_vandc_vor/0" 8 } } */ +/* { dg-final { scan-assembler-times "fuse_vandc_vor/1" 8 } } */ +/* { dg-final { scan-assembler-times "fuse_vandc_vorc/0" 8 } } */ +/* { dg-final { scan-assembler-times "fuse_vandc_vorc/1" 8 } } */ +/* { dg-final { scan-assembler-times "fuse_vandc_vxor/0" 8 } } */ +/* { dg-final { scan-assembler-times "fuse_vandc_vxor/1" 8 } } */ +/* { dg-final { scan-assembler-times "fuse_vand_vand/1" 8 } } */ +/* { dg-final { scan-assembler-times "fuse_vand_veqv/0" 8 } } */ +/* { dg-final { scan-assembler-times "fuse_vand_vor/0" 8 } } */ +/* { dg-final { scan-assembler-times "fuse_vand_vorc/0" 8 } } */ +/* { dg-final { scan-assembler-times "fuse_vand_vxor/0" 8 } } */ +/* { dg-final { scan-assembler-times "fuse_veqv_vand/0" 8 } } */ +/* { dg-final { scan-assembler-times "fuse_veqv_vandc/0" 8 } } */ +/* { dg-final { scan-assembler-times "fuse_veqv_vor/0" 8 } } */ +/* { dg-final { scan-assembler-times "fuse_vnand_vand/0" 8 } } */ +/* { dg-final { scan-assembler-times "fuse_vnand_vandc/0" 8 } } */ +/* { dg-final { scan-assembler-times "fuse_vnand_vor/0" 14 } } */ +/* { dg-final { scan-assembler-times "fuse_vnand_vor/1" 2 } } */ +/* { dg-final { scan-assembler-times "fuse_vnand_vor/3" 8 } } */ +/* { dg-final { scan-assembler-times "fuse_vnand_vorc/3" 8 } } */ +/* { dg-final { scan-assembler-times "fuse_vnor_vand/0" 14 } } */ +/* { dg-final { scan-assembler-times "fuse_vnor_vand/1" 2 } } */ +/* { dg-final { scan-assembler-times "fuse_vnor_vand/3" 8 } } */ +/* { dg-final { scan-assembler-times "fuse_vnor_vandc/3" 8 } } */ +/* { dg-final { scan-assembler-times "fuse_vnor_vor/0" 8 } } */ +/* { dg-final { scan-assembler-times "fuse_vnor_vorc/0" 8 } } */ +/* { dg-final { scan-assembler-times "fuse_vorc_vand/0" 8 } } */ +/* { dg-final { scan-assembler-times "fuse_vorc_vand/1" 8 } } */ +/* { dg-final { scan-assembler-times "fuse_vorc_vandc/0" 8 } } */ +/* { dg-final { scan-assembler-times "fuse_vorc_vandc/1" 8 } } */ +/* { dg-final { scan-assembler-times "fuse_vorc_vor/0" 8 } } */ +/* { dg-final { scan-assembler-times "fuse_vorc_vor/1" 10 } } */ +/* { dg-final { scan-assembler-times "fuse_vorc_vor/3" 6 } } */ +/* { dg-final { scan-assembler-times "fuse_vorc_vxor/0" 8 } } */ +/* { dg-final { scan-assembler-times "fuse_vorc_vxor/1" 8 } } */ +/* { dg-final { scan-assembler-times "fuse_vor_vand/0" 8 } } */ +/* { dg-final { scan-assembler-times "fuse_vor_vandc/0" 8 } } */ +/* { dg-final { scan-assembler-times "fuse_vor_veqv/0" 8 } } */ +/* { dg-final { scan-assembler-times "fuse_vor_vor/1" 8 } } */ +/* { dg-final { scan-assembler-times "fuse_vor_vxor/0" 8 } } */ +/* { dg-final { scan-assembler-times "fuse_vxor_vand/0" 8 } } */ +/* { dg-final { scan-assembler-times "fuse_vxor_vandc/0" 8 } } */ +/* { dg-final { scan-assembler-times "fuse_vxor_veqv/3" 8 } } */ +/* { dg-final { scan-assembler-times "fuse_vxor_vnand/0" 8 } } */ +/* { dg-final { scan-assembler-times "fuse_vxor_vor/0" 8 } } */ +/* { dg-final { scan-assembler-times "fuse_vxor_vorc/0" 8 } } */ +/* { dg-final { scan-assembler-times "fuse_vxor_vxor/1" 8 } } */ +/* { dg-final { scan-assembler-times "fuse_xor_and/0" 16 } } */ +/* { dg-final { scan-assembler-times "fuse_xor_and/2" 16 } } */ +/* { dg-final { scan-assembler-times "fuse_xor_andc/0" 16 } } */ +/* { dg-final { scan-assembler-times "fuse_xor_andc/2" 16 } } */ +/* { dg-final { scan-assembler-times "fuse_xor_eqv/2" 24 } } */ +/* { dg-final { scan-assembler-times "fuse_xor_eqv/3" 8 } } */ +/* { dg-final { scan-assembler-times "fuse_xor_nand/0" 8 } } */ +/* { dg-final { scan-assembler-times "fuse_xor_nand/2" 24 } } */ +/* { dg-final { scan-assembler-times "fuse_xor_or/0" 16 } } */ +/* { dg-final { scan-assembler-times "fuse_xor_or/2" 16 } } */ +/* { dg-final { scan-assembler-times "fuse_xor_orc/0" 8 } } */ +/* { dg-final { scan-assembler-times "fuse_xor_orc/2" 24 } } */ +/* { dg-final { scan-assembler-times "fuse_xor_xor/1" 16 } } */ +/* { dg-final { scan-assembler-times "fuse_xor_xor/2" 16 } } */ diff --git a/gcc/testsuite/gcc.target/powerpc/fusion-p10-ldcmpi.c b/gcc/testsuite/gcc.target/powerpc/fusion-p10-ldcmpi.c new file mode 100644 index 00000000000..99f9e92eeaf --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/fusion-p10-ldcmpi.c @@ -0,0 +1,66 @@ +/* { dg-do compile { target { powerpc*-*-* } } } */ +/* { dg-skip-if "" { powerpc*-*-darwin* } } */ +/* { dg-options "-mdejagnu-cpu=power10 -O3 -dp" } */ + +#include + +#define TEST(type) \ + struct t ## type { type x[128],a,b,c; }; \ + struct s ## type { struct t ## type *p; int d,e,f; uint64_t g,h,i; }; \ +int \ +t ## type (struct s ## type *p) \ +{ \ + struct t ## type *tp = p->p; \ + if(!tp || tp->a > ((type)0)) { return p->d; } \ + if(!tp || tp->b > ((type)1)) { return p->e; } \ + if(!tp || ( ((type)(-1) < 0) && tp->c < ((type)-1))) { return p->f; } \ + return 0; \ +} \ +type \ +t ## type ## _ret (struct s ## type *p) \ +{ \ + struct t ## type *tp = p->p; \ + if(!tp || tp->a > ((type)0)) { return tp->a; } \ + if(!tp || tp->b > ((type)1)) { return tp->b; } \ + if(!tp || ( ((type)(-1) < 0) && tp->c < ((type)-1))) { return tp->c; } \ + return 0; \ +}\ +int \ +t ## type ## _x (struct s ## type *p) \ +{ \ + struct t ## type *tp = p->p; \ + if(!tp || tp->x[p->g] > ((type)0)) { return p->d; } \ + if(!tp || tp->x[p->h] > ((type)1)) { return p->e; } \ + if(!tp || ( ((type)(-1) < 0) && tp->x[p->i] < ((type)-1))) { return p->f; } \ + return 0; \ +} \ +type \ +t ## type ## _x_ret (struct s ## type *p) \ +{ \ + struct t ## type *tp = p->p; \ + if(!tp || tp->x[p->g] > ((type)0)) { return tp->x[p->g]; } \ + if(!tp || tp->x[p->h] > ((type)1)) { return tp->x[p->h]; } \ + if(!tp || ( ((type)(-1) < 0) && tp->x[p->i] < ((type)-1))) { return tp->x[p->i]; } \ + return 0; \ +} + +TEST(uint64_t) +TEST(int64_t) +TEST(uint32_t) +TEST(int32_t) +TEST(uint16_t) +TEST(int16_t) +TEST(uint8_t) +TEST(int8_t) + +/* { dg-final { scan-assembler-times "lbz_cmpldi_cr0_QI_clobber_CCUNS_zero" 2 } } */ +/* { dg-final { scan-assembler-times "ld_cmpdi_cr0_DI_DI_CC_none" 4 } } */ +/* { dg-final { scan-assembler-times "ld_cmpdi_cr0_DI_clobber_CC_none" 4 } } */ +/* { dg-final { scan-assembler-times "ld_cmpldi_cr0_DI_DI_CCUNS_none" 1 } } */ +/* { dg-final { scan-assembler-times "ld_cmpldi_cr0_DI_clobber_CCUNS_none" 1 } } */ +/* { dg-final { scan-assembler-times "lha_cmpdi_cr0_HI_clobber_CC_sign" 8 } } */ +/* { dg-final { scan-assembler-times "lhz_cmpldi_cr0_HI_clobber_CCUNS_zero" 2 } } */ +/* { dg-final { scan-assembler-times "lwa_cmpdi_cr0_SI_EXTSI_CC_sign" 3 } } */ +/* { dg-final { scan-assembler-times "lwa_cmpdi_cr0_SI_clobber_CC_none" 4 } } */ +/* { dg-final { scan-assembler-times "lwz_cmpldi_cr0_SI_EXTSI_CCUNS_zero" 2 } } */ +/* { dg-final { scan-assembler-times "lwz_cmpldi_cr0_SI_clobber_CCUNS_none" 2 } } */ -- 2.27.0