From patchwork Tue Jan 14 08:57:24 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Schulze Frielinghaus X-Patchwork-Id: 104739 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 8BBE6385773E for ; Tue, 14 Jan 2025 08:58:43 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8BBE6385773E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1736845123; bh=DIv+kQ0zmTFxizHA7CYVU0j0/dGL0JxhyblgeDIvgEI=; h=From:To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From; b=hZtAMxUW7QC16PGnyyE7Nta6eBOLMSDttpUojt3dv/qPOYHNb36VjnQh3zkWdA8AF UWz1sKP3ozAEeDIU/qOxeUCaACn+JLWxcVjkFVKYyLL8xqas3wbmcWHD1Fg5S+bcQu Ykgri9tKoJBRGU58ladnonCEQWtQlwMUo+DPxPI0= 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 326D1385783B; Tue, 14 Jan 2025 08:57:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 326D1385783B Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=gcc.gnu.org Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=gcc.gnu.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 326D1385783B Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=148.163.156.1 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1736845063; cv=none; b=ZKboHCftWq0MS4ix9+BTREAQYljaoWQ4e4zCCwLx/Po7ZMBhh3yt9EraTurpCzUG8nA014cxDVywz6SZz16DU7QmX7xtaSjSKpbcl0fNMPbup86JKTKmLgDedp0jKK5L8EkAEZnxx6szReUOkTCHHDHdZEJs7HXc4Q9uOI2nF0M= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1736845063; c=relaxed/simple; bh=JnI126ye28JhzP2UeMtrSMz65yArQC3tdAwbKx8MF5U=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=o+0BdXt1LF2x7gC+oIEvM+6krcqtrVkIntx2TsW8hQa1Z3Y8a0hbtRicjrNP4rQRAtMkKpBih+v3skPMhWITz284LgAdshqL4oPEvFml8VdGuz5B5xCyLnmqkU17N8rDkmELm7KvBse8UrK36noUrJGJeeFx0Jyl6ijpXGX/sCI= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 326D1385783B Received: from pps.filterd (m0356517.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 50E3rBpF003718; Tue, 14 Jan 2025 08:57:42 GMT Received: from ppma21.wdc07v.mail.ibm.com (5b.69.3da9.ip4.static.sl-reverse.com [169.61.105.91]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 445gdjh0yu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 14 Jan 2025 08:57:41 +0000 (GMT) Received: from pps.filterd (ppma21.wdc07v.mail.ibm.com [127.0.0.1]) by ppma21.wdc07v.mail.ibm.com (8.18.1.2/8.18.1.2) with ESMTP id 50E4ndSJ007994; Tue, 14 Jan 2025 08:57:40 GMT Received: from smtprelay07.fra02v.mail.ibm.com ([9.218.2.229]) by ppma21.wdc07v.mail.ibm.com (PPS) with ESMTPS id 4443yn2dxn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 14 Jan 2025 08:57:40 +0000 Received: from smtpav07.fra02v.mail.ibm.com (smtpav07.fra02v.mail.ibm.com [10.20.54.106]) by smtprelay07.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 50E8vasR55443904 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 14 Jan 2025 08:57:36 GMT Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A37BD2004B; Tue, 14 Jan 2025 08:57:36 +0000 (GMT) Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 77B9A20040; Tue, 14 Jan 2025 08:57:36 +0000 (GMT) Received: from a8345010.lnxne.boe (unknown [9.152.108.100]) by smtpav07.fra02v.mail.ibm.com (Postfix) with ESMTPS; Tue, 14 Jan 2025 08:57:36 +0000 (GMT) From: Stefan Schulze Frielinghaus To: gcc-patches@gcc.gnu.org Cc: krebbel@linux.ibm.com, Stefan Schulze Frielinghaus Subject: [PATCH] s390: Implement isfinite and isnormal optabs Date: Tue, 14 Jan 2025 09:57:24 +0100 Message-ID: <20250114085725.3884856-1-stefansf@gcc.gnu.org> X-Mailer: git-send-email 2.47.0 MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: BJ88zTz4UiMsMqXPO-qAQJllksfkMG2x X-Proofpoint-ORIG-GUID: BJ88zTz4UiMsMqXPO-qAQJllksfkMG2x X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1051,Hydra:6.0.680,FMLib:17.12.62.30 definitions=2024-10-15_01,2024-10-11_01,2024-09-30_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=929 suspectscore=0 malwarescore=0 bulkscore=0 clxscore=1034 phishscore=0 priorityscore=1501 adultscore=0 impostorscore=0 spamscore=0 mlxscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2411120000 definitions=main-2501140070 X-Spam-Status: No, score=-10.5 required=5.0 tests=BAYES_00, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, KAM_SHORT, LOCAL_AUTHENTICATION_FAIL_SPF, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NEUTRAL, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces~patchwork=sourceware.org@gcc.gnu.org Merge new optabs with the existing implementations for signbit and isinf. gcc/ChangeLog: * config/s390/s390.h (S390_TDC_POSITIVE_ZERO): Remove. (S390_TDC_NEGATIVE_ZERO): Remove. (S390_TDC_POSITIVE_NORMALIZED_BFP_NUMBER): Remove. (S390_TDC_NEGATIVE_NORMALIZED_BFP_NUMBER): Remove. (S390_TDC_POSITIVE_DENORMALIZED_BFP_NUMBER): Remove. (S390_TDC_NEGATIVE_DENORMALIZED_BFP_NUMBER): Remove. (S390_TDC_POSITIVE_INFINITY): Remove. (S390_TDC_NEGATIVE_INFINITY): Remove. (S390_TDC_POSITIVE_QUIET_NAN): Remove. (S390_TDC_NEGATIVE_QUIET_NAN): Remove. (S390_TDC_POSITIVE_SIGNALING_NAN): Remove. (S390_TDC_NEGATIVE_SIGNALING_NAN): Remove. (S390_TDC_POSITIVE_DENORMALIZED_DFP_NUMBER): Remove. (S390_TDC_NEGATIVE_DENORMALIZED_DFP_NUMBER): Remove. (S390_TDC_POSITIVE_NORMALIZED_DFP_NUMBER): Remove. (S390_TDC_NEGATIVE_NORMALIZED_DFP_NUMBER): Remove. (S390_TDC_SIGNBIT_SET): Remove. (S390_TDC_INFINITY): Remove. * config/s390/s390.md (signbit2): Merge this one (isinf2): and this one into (2): new expander. (isnormal2): New BFP expander. (isnormal2): New DFP expander. * config/s390/vector.md (signbittf2_vr): Merge this one (isinftf2_vr): and this one into (tf2_vr): new expander. (signbittf2): Merge this one (isinftf2): and this one into (tf2): new expander. gcc/testsuite/ChangeLog: * gcc.target/s390/isfinite-isinf-isnormal-signbit-1.c: New test. * gcc.target/s390/isfinite-isinf-isnormal-signbit-2.c: New test. * gcc.target/s390/isfinite-isinf-isnormal-signbit-3.c: New test. * gcc.target/s390/isfinite-isinf-isnormal-signbit.h: New test. --- Bootstrap and regtest are running. About to push if they succeed and there are no comments. gcc/config/s390/s390.h | 31 ----- gcc/config/s390/s390.md | 114 +++++++++++++++--- gcc/config/s390/vector.md | 42 ++----- .../s390/isfinite-isinf-isnormal-signbit-1.c | 62 ++++++++++ .../s390/isfinite-isinf-isnormal-signbit-2.c | 13 ++ .../s390/isfinite-isinf-isnormal-signbit-3.c | 13 ++ .../s390/isfinite-isinf-isnormal-signbit.h | 23 ++++ 7 files changed, 215 insertions(+), 83 deletions(-) create mode 100644 gcc/testsuite/gcc.target/s390/isfinite-isinf-isnormal-signbit-1.c create mode 100644 gcc/testsuite/gcc.target/s390/isfinite-isinf-isnormal-signbit-2.c create mode 100644 gcc/testsuite/gcc.target/s390/isfinite-isinf-isnormal-signbit-3.c create mode 100644 gcc/testsuite/gcc.target/s390/isfinite-isinf-isnormal-signbit.h diff --git a/gcc/config/s390/s390.h b/gcc/config/s390/s390.h index 4a4dde1a9ba..9a4ddfe7f63 100644 --- a/gcc/config/s390/s390.h +++ b/gcc/config/s390/s390.h @@ -288,37 +288,6 @@ extern const char *s390_host_detect_local_cpu (int argc, const char **argv); "%{!mesa:%{!mzarch:%{m31:-mesa}%{m64:-mzarch}}}", \ "%{!march=*:-march=z900}" -/* Constants needed to control the TEST DATA CLASS (TDC) instruction. */ -#define S390_TDC_POSITIVE_ZERO (1 << 11) -#define S390_TDC_NEGATIVE_ZERO (1 << 10) -#define S390_TDC_POSITIVE_NORMALIZED_BFP_NUMBER (1 << 9) -#define S390_TDC_NEGATIVE_NORMALIZED_BFP_NUMBER (1 << 8) -#define S390_TDC_POSITIVE_DENORMALIZED_BFP_NUMBER (1 << 7) -#define S390_TDC_NEGATIVE_DENORMALIZED_BFP_NUMBER (1 << 6) -#define S390_TDC_POSITIVE_INFINITY (1 << 5) -#define S390_TDC_NEGATIVE_INFINITY (1 << 4) -#define S390_TDC_POSITIVE_QUIET_NAN (1 << 3) -#define S390_TDC_NEGATIVE_QUIET_NAN (1 << 2) -#define S390_TDC_POSITIVE_SIGNALING_NAN (1 << 1) -#define S390_TDC_NEGATIVE_SIGNALING_NAN (1 << 0) - -/* The following values are different for DFP. */ -#define S390_TDC_POSITIVE_DENORMALIZED_DFP_NUMBER (1 << 9) -#define S390_TDC_NEGATIVE_DENORMALIZED_DFP_NUMBER (1 << 8) -#define S390_TDC_POSITIVE_NORMALIZED_DFP_NUMBER (1 << 7) -#define S390_TDC_NEGATIVE_NORMALIZED_DFP_NUMBER (1 << 6) - -/* For signbit, the BFP-DFP-difference makes no difference. */ -#define S390_TDC_SIGNBIT_SET (S390_TDC_NEGATIVE_ZERO \ - | S390_TDC_NEGATIVE_NORMALIZED_BFP_NUMBER \ - | S390_TDC_NEGATIVE_DENORMALIZED_BFP_NUMBER\ - | S390_TDC_NEGATIVE_INFINITY \ - | S390_TDC_NEGATIVE_QUIET_NAN \ - | S390_TDC_NEGATIVE_SIGNALING_NAN ) - -#define S390_TDC_INFINITY (S390_TDC_POSITIVE_INFINITY \ - | S390_TDC_NEGATIVE_INFINITY ) - /* Target machine storage layout. */ /* Everything is big-endian. */ diff --git a/gcc/config/s390/s390.md b/gcc/config/s390/s390.md index 3d5759d6252..d2c8c2a1b7d 100644 --- a/gcc/config/s390/s390.md +++ b/gcc/config/s390/s390.md @@ -432,6 +432,81 @@ (define_constants [(TBEGIN_MASK 65292)]) ; 0xff0c (define_constants [(TBEGINC_MASK 65288)]) ; 0xff08 +;; TEST DATA CLASS + +; Data class bitmap: +; +; positive zero 11 +; negative zero 10 +; positive normalized bfp number 9 +; negative normalized bfp number 8 +; positive denormalized bfp number 7 +; negative denormalized bfp number 6 +; positive infinity 5 +; negative infinity 4 +; positive quiet nan 3 +; negative quiet nan 2 +; positive signaling nan 1 +; negative signaling nan 0 +; +; The following values are different for DFP: +; +; positive denormalized dfp number 9 +; negative denormalized dfp number 8 +; positive normalized dfp number 7 +; negative normalized dfp number 6 + +; For signbit, the BFP-DFP-difference makes no difference. +; S390_TDC_SIGNBIT_SET = negative_zero +; | negative_normalized_bfp_number +; | negative_denormalized_bfp_number +; | negative_infinity +; | negative_quiet_nan +; | negative_signaling_nan +; = 1365 +; +; For finite, the BFP-DFP-difference makes no difference. +; S390_TDC_FINITE = positive_zero +; | negative_zero +; | positive_normalized_bfp_number +; | negative_normalized_bfp_number +; | positive_denormalized_bfp_number +; | negative_denormalized_bfp_number +; = 4032 +; +; S390_TDC_INFINITY = positive_infinity +; | negative_infinity +; = 48 +; +; S390_TDC_NORMAL_BFP = positive_normalized_bfp_number +; | negative_normalized_bfp_number +; = 768 +; +; S390_TDC_NORMAL_DFP = positive_normalized_dfp_number +; | negative_normalized_dfp_number +; = 192 + +(define_constants [(S390_TDC_SIGNBIT_SET 1365) + (S390_TDC_FINITE 4032) + (S390_TDC_INFINITY 48) + (S390_TDC_NORMAL_BFP 768) + (S390_TDC_NORMAL_DFP 192)]) + +(define_int_iterator TDC_CLASS [S390_TDC_SIGNBIT_SET + S390_TDC_FINITE + S390_TDC_INFINITY]) + +(define_int_iterator TDC_CLASS_BFP [S390_TDC_SIGNBIT_SET + S390_TDC_FINITE + S390_TDC_INFINITY + S390_TDC_NORMAL_BFP]) + +(define_int_attr tdc_insn [(S390_TDC_SIGNBIT_SET "signbit") + (S390_TDC_FINITE "isfinite") + (S390_TDC_INFINITY "isinf") + (S390_TDC_NORMAL_BFP "isnormal") + (S390_TDC_NORMAL_DFP "isnormal")]) + ;; Instruction operand type as used in the Principles of Operation. ;; Used to determine defaults for length and other attribute values. @@ -3549,29 +3624,32 @@ ; Test data class. ; -(define_expand "signbit2" +(define_expand "2" [(set (reg:CCZ CC_REGNUM) - (unspec:CCZ [(match_operand:FP_ALL 1 "register_operand" "f") - (match_dup 2)] - UNSPEC_TDC_INSN)) + (unspec:CCZ [(match_operand:FP_ALL 1 "register_operand" "f") + (const_int TDC_CLASS)] + UNSPEC_TDC_INSN)) (set (match_operand:SI 0 "register_operand" "=d") - (unspec:SI [(reg:CCZ CC_REGNUM)] UNSPEC_CC_TO_INT))] - "TARGET_HARD_FLOAT" -{ - operands[2] = GEN_INT (S390_TDC_SIGNBIT_SET); -}) + (unspec:SI [(reg:CCZ CC_REGNUM)] UNSPEC_CC_TO_INT))] + "TARGET_HARD_FLOAT") -(define_expand "isinf2" +(define_expand "isnormal2" [(set (reg:CCZ CC_REGNUM) - (unspec:CCZ [(match_operand:FP_ALL 1 "register_operand" "f") - (match_dup 2)] - UNSPEC_TDC_INSN)) + (unspec:CCZ [(match_operand:BFP 1 "register_operand" "f") + (const_int S390_TDC_NORMAL_BFP)] + UNSPEC_TDC_INSN)) (set (match_operand:SI 0 "register_operand" "=d") - (unspec:SI [(reg:CCZ CC_REGNUM)] UNSPEC_CC_TO_INT))] - "TARGET_HARD_FLOAT" -{ - operands[2] = GEN_INT (S390_TDC_INFINITY); -}) + (unspec:SI [(reg:CCZ CC_REGNUM)] UNSPEC_CC_TO_INT))] + "TARGET_HARD_FLOAT") + +(define_expand "isnormal2" + [(set (reg:CCZ CC_REGNUM) + (unspec:CCZ [(match_operand:DFP_ALL 1 "register_operand" "f") + (const_int S390_TDC_NORMAL_DFP)] + UNSPEC_TDC_INSN)) + (set (match_operand:SI 0 "register_operand" "=d") + (unspec:SI [(reg:CCZ CC_REGNUM)] UNSPEC_CC_TO_INT))] + "TARGET_HARD_DFP") ; This extracts CC into a GPR properly shifted. The actual IPM ; instruction will be issued by reload. The constraint of operand 1 diff --git a/gcc/config/s390/vector.md b/gcc/config/s390/vector.md index a75b7cb5825..b3e14601dbd 100644 --- a/gcc/config/s390/vector.md +++ b/gcc/config/s390/vector.md @@ -3064,11 +3064,11 @@ ; test data class -(define_expand "signbittf2_vr" +(define_expand "tf2_vr" [(parallel [(set (reg:CCRAW CC_REGNUM) (unspec:CCRAW [(match_operand:TF 1 "register_operand" "") - (match_dup 2)] + (const_int TDC_CLASS_BFP)] UNSPEC_VEC_VFTCICC)) (clobber (scratch:V1TI))]) (set (match_operand:SI 0 "register_operand" "") @@ -3077,40 +3077,14 @@ (if_then_else:SI (eq (reg:CCRAW CC_REGNUM) (const_int 8)) (const_int 1) (match_dup 0)))] - "TARGET_VXE" -{ - operands[2] = GEN_INT (S390_TDC_SIGNBIT_SET); -}) - -(define_expand "signbittf2" - [(match_operand:SI 0 "register_operand" "") - (match_operand:TF 1 "register_operand" "")] - "HAVE_TF (signbittf2)" - { EXPAND_TF (signbittf2, 2); }) - -(define_expand "isinftf2_vr" - [(parallel - [(set (reg:CCRAW CC_REGNUM) - (unspec:CCRAW [(match_operand:TF 1 "register_operand" "") - (match_dup 2)] - UNSPEC_VEC_VFTCICC)) - (clobber (scratch:V1TI))]) - (set (match_operand:SI 0 "register_operand" "") - (const_int 0)) - (set (match_dup 0) - (if_then_else:SI (eq (reg:CCRAW CC_REGNUM) (const_int 8)) - (const_int 1) - (match_dup 0)))] - "TARGET_VXE" -{ - operands[2] = GEN_INT (S390_TDC_INFINITY); -}) + "TARGET_VXE") -(define_expand "isinftf2" +(define_expand "tf2" [(match_operand:SI 0 "register_operand" "") - (match_operand:TF 1 "register_operand" "")] - "HAVE_TF (isinftf2)" - { EXPAND_TF (isinftf2, 2); }) + (match_operand:TF 1 "register_operand" "") + (const_int TDC_CLASS_BFP)] + "HAVE_TF (tf2)" + { EXPAND_TF (tf2, 2); }) ; ; Vector byte swap patterns diff --git a/gcc/testsuite/gcc.target/s390/isfinite-isinf-isnormal-signbit-1.c b/gcc/testsuite/gcc.target/s390/isfinite-isinf-isnormal-signbit-1.c new file mode 100644 index 00000000000..a832036c88d --- /dev/null +++ b/gcc/testsuite/gcc.target/s390/isfinite-isinf-isnormal-signbit-1.c @@ -0,0 +1,62 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -march=z9-ec -mzarch" } */ + +#define SIGNBIT(T) \ + int signbit_##T (T x) { return __builtin_signbit (x); } + +SIGNBIT (float) +/* { dg-final { scan-assembler-times {tceb\t%f[0-9]+,1365} 1 } } */ + +SIGNBIT (double) +/* { dg-final { scan-assembler-times {tcdb\t%f[0-9]+,1365} 1 } } */ + +SIGNBIT (_Decimal32) +/* { dg-final { scan-assembler-times {tdcet\t%f[0-9]+,1365} 1 } } */ + +SIGNBIT (_Decimal64) +/* { dg-final { scan-assembler-times {tdcdt\t%f[0-9]+,1365} 1 } } */ + +#define ISFINITE(T) \ + int isfinite_##T (T x) { return __builtin_isfinite (x); } + +ISFINITE (float) +/* { dg-final { scan-assembler-times {tceb\t%f[0-9]+,4032} 1 } } */ + +ISFINITE (double) +/* { dg-final { scan-assembler-times {tcdb\t%f[0-9]+,4032} 1 } } */ + +ISFINITE (_Decimal32) +/* { dg-final { scan-assembler-times {tdcet\t%f[0-9]+,4032} 1 } } */ + +ISFINITE (_Decimal64) +/* { dg-final { scan-assembler-times {tdcdt\t%f[0-9]+,4032} 1 } } */ + +#define ISINF(T) \ + int isinf_##T (T x) { return __builtin_isinf (x); } + +ISINF (float) +/* { dg-final { scan-assembler-times {tceb\t%f[0-9]+,48} 1 } } */ + +ISINF (double) +/* { dg-final { scan-assembler-times {tcdb\t%f[0-9]+,48} 1 } } */ + +ISINF (_Decimal32) +/* { dg-final { scan-assembler-times {tdcet\t%f[0-9]+,48} 1 } } */ + +ISINF (_Decimal64) +/* { dg-final { scan-assembler-times {tdcdt\t%f[0-9]+,48} 1 } } */ + +#define ISNORMAL(T) \ + int isnormal_##T (T x) { return __builtin_isnormal (x); } + +ISNORMAL (float) +/* { dg-final { scan-assembler-times {tceb\t%f[0-9]+,768} 1 } } */ + +ISNORMAL (double) +/* { dg-final { scan-assembler-times {tcdb\t%f[0-9]+,768} 1 } } */ + +ISNORMAL (_Decimal32) +/* { dg-final { scan-assembler-times {tdcet\t%f[0-9]+,192} 1 } } */ + +ISNORMAL (_Decimal64) +/* { dg-final { scan-assembler-times {tdcdt\t%f[0-9]+,192} 1 } } */ diff --git a/gcc/testsuite/gcc.target/s390/isfinite-isinf-isnormal-signbit-2.c b/gcc/testsuite/gcc.target/s390/isfinite-isinf-isnormal-signbit-2.c new file mode 100644 index 00000000000..2ff5a37c0f0 --- /dev/null +++ b/gcc/testsuite/gcc.target/s390/isfinite-isinf-isnormal-signbit-2.c @@ -0,0 +1,13 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -march=z13 -mzarch" } */ + +#include "isfinite-isinf-isnormal-signbit.h" + +/* { dg-final { scan-assembler-times {tcxb\t%f[0-9]+,1365} 1 } } SIGNBIT long double */ +/* { dg-final { scan-assembler-times {tdcxt\t%f[0-9]+,1365} 1 } } SIGNBIT _Decimal128 */ +/* { dg-final { scan-assembler-times {tcxb\t%f[0-9]+,4032} 1 } } ISFINITE long double */ +/* { dg-final { scan-assembler-times {tdcxt\t%f[0-9]+,4032} 1 } } ISFINITE _Decimal128 */ +/* { dg-final { scan-assembler-times {tcxb\t%f[0-9]+,48} 1 } } ISINF long double */ +/* { dg-final { scan-assembler-times {tdcxt\t%f[0-9]+,48} 1 } } ISINF _Decimal128 */ +/* { dg-final { scan-assembler-times {tcxb\t%f[0-9]+,768} 1 } } ISNORMAL long double */ +/* { dg-final { scan-assembler-times {tdcxt\t%f[0-9]+,192} 1 } } ISNORMAL _Decimal128 */ diff --git a/gcc/testsuite/gcc.target/s390/isfinite-isinf-isnormal-signbit-3.c b/gcc/testsuite/gcc.target/s390/isfinite-isinf-isnormal-signbit-3.c new file mode 100644 index 00000000000..8f67553c7da --- /dev/null +++ b/gcc/testsuite/gcc.target/s390/isfinite-isinf-isnormal-signbit-3.c @@ -0,0 +1,13 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -march=z14 -mzarch" } */ + +#include "isfinite-isinf-isnormal-signbit.h" + +/* { dg-final { scan-assembler-times {wftcixb\t%v[0-9]+,%v[0-9]+,1365} 1 } } */ +/* { dg-final { scan-assembler-times {tdcxt\t%f[0-9]+,1365} 1 } } */ +/* { dg-final { scan-assembler-times {wftcixb\t%v[0-9]+,%v[0-9]+,4032} 1 } } */ +/* { dg-final { scan-assembler-times {tdcxt\t%f[0-9]+,4032} 1 } } */ +/* { dg-final { scan-assembler-times {wftcixb\t%v[0-9]+,%v[0-9]+,48} 1 } } */ +/* { dg-final { scan-assembler-times {tdcxt\t%f[0-9]+,48} 1 } } */ +/* { dg-final { scan-assembler-times {wftcixb\t%v[0-9]+,%v[0-9]+,768} 1 } } */ +/* { dg-final { scan-assembler-times {tdcxt\t%f[0-9]+,192} 1 } } */ diff --git a/gcc/testsuite/gcc.target/s390/isfinite-isinf-isnormal-signbit.h b/gcc/testsuite/gcc.target/s390/isfinite-isinf-isnormal-signbit.h new file mode 100644 index 00000000000..9195f7c5f67 --- /dev/null +++ b/gcc/testsuite/gcc.target/s390/isfinite-isinf-isnormal-signbit.h @@ -0,0 +1,23 @@ +#define SIGNBIT(T, U) \ + int signbit_##U (T x) { return __builtin_signbit (x); } + +SIGNBIT (long double, long_double) +SIGNBIT (_Decimal128, _Decimal128) + +#define ISFINITE(T, U) \ + int isfinite_##U (T x) { return __builtin_isfinite (x); } + +ISFINITE (long double, long_double) +ISFINITE (_Decimal128, _Decimal128) + +#define ISINF(T, U) \ + int isinf_##U (T x) { return __builtin_isinf (x); } + +ISINF (long double, long_double) +ISINF (_Decimal128, _Decimal128) + +#define ISNORMAL(T, U) \ + int isnormal_##U (T x) { return __builtin_isnormal (x); } + +ISNORMAL (long double, long_double) +ISNORMAL (_Decimal128, _Decimal128)