From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 54C0C385700C for ; Fri, 21 Oct 2022 07:23:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 54C0C385700C Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1666337005; h=from:from:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type; bh=oEFVHSjmft/+SRhi+moArD/eKcz2YqvTPrUf0f3kI5s=; b=I8eVdGtAjh+oRnnUYb34wQ/YC9KrF0AKCyd3dKTULVwZkpMLMrj12sxy9k44P9U3iPKwmf jvFS+aqKMTK3piv+dsyq1LrybUeqb1bNWPlUVJMUxNyybaFqC0VxYV89r2FlgxX6SlMiVH 0FUB1F/HVpRhd8i0u0tz0/NzoSrYc78= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-85-EKqWttj4MGmf6ET6PWLllQ-1; Fri, 21 Oct 2022 03:23:23 -0400 X-MC-Unique: EKqWttj4MGmf6ET6PWLllQ-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 242CB8027EC; Fri, 21 Oct 2022 07:23:23 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.39.193.252]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D481D140EBF3; Fri, 21 Oct 2022 07:23:22 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.17.1/8.17.1) with ESMTPS id 29L7NJCf3484825 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Fri, 21 Oct 2022 09:23:20 +0200 Received: (from jakub@localhost) by tucnak.zalov.cz (8.17.1/8.17.1/Submit) id 29L7NI6Y3484824; Fri, 21 Oct 2022 09:23:18 +0200 Date: Fri, 21 Oct 2022 09:23:17 +0200 From: Jakub Jelinek To: "Joseph S. Myers" , Richard Biener , Jeff Law Cc: gcc-patches@gcc.gnu.org, Jonathan Wakely Subject: [PATCH] builtins: Add __builtin_nextafterf16b builtin Message-ID: Reply-To: Jakub Jelinek MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-3.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,KAM_SHORT,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,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 List-Id: Hi! On top of the pending https://gcc.gnu.org/pipermail/gcc-patches/2022-October/603665.html patch, the following patch adds another needed builtin. The above patch adds among other things __builtin_nextafterf16 builtin which we need in order to constexpr evaluate std::nextafter(_Float16) overload (patch for that to be posted momentarily). While there is inline implementation of the overload, it isn't constant evaluation friendly, and the builtin doesn't need libm implementation because it will be used only during constant expression evaluation. We need the same thing also for std::nextafter(__gnu_cxx::__bfloat16_t) though and this patch does that. Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? 2022-10-21 Jakub Jelinek * builtin-types.def (BT_FN_BFLOAT16_BFLOAT16_BFLOAT16): New. * builtins.def (BUILT_IN_NEXTAFTERF16B): New builtin. * fold-const-call.cc (fold_const_call_sss): Handle CFN_BUILT_IN_NEXTAFTERF16B. --- gcc/builtin-types.def.jj 2022-10-20 16:43:03.031928876 +0200 +++ gcc/builtin-types.def 2022-10-20 16:44:15.768934809 +0200 @@ -461,6 +461,8 @@ DEF_FUNCTION_TYPE_2 (BT_FN_FLOAT64X_FLOA BT_FLOAT64X, BT_FLOAT64X, BT_FLOAT64X) DEF_FUNCTION_TYPE_2 (BT_FN_FLOAT128X_FLOAT128X_FLOAT128X, BT_FLOAT128X, BT_FLOAT128X, BT_FLOAT128X) +DEF_FUNCTION_TYPE_2 (BT_FN_BFLOAT16_BFLOAT16_BFLOAT16, + BT_BFLOAT16, BT_BFLOAT16, BT_BFLOAT16) DEF_FUNCTION_TYPE_2 (BT_FN_FLOAT_FLOAT_FLOATPTR, BT_FLOAT, BT_FLOAT, BT_FLOAT_PTR) DEF_FUNCTION_TYPE_2 (BT_FN_DOUBLE_DOUBLE_DOUBLEPTR, --- gcc/builtins.def.jj 2022-10-20 16:43:03.033928849 +0200 +++ gcc/builtins.def 2022-10-20 16:46:27.467135944 +0200 @@ -591,6 +591,7 @@ DEF_C99_BUILTIN (BUILT_IN_NEXTAFT DEF_C99_BUILTIN (BUILT_IN_NEXTAFTERL, "nextafterl", BT_FN_LONGDOUBLE_LONGDOUBLE_LONGDOUBLE, ATTR_MATHFN_ERRNO) #define NEXTAFTER_TYPE(F) BT_FN_##F##_##F##_##F DEF_EXT_LIB_FLOATN_NX_BUILTINS (BUILT_IN_NEXTAFTER, "nextafter", NEXTAFTER_TYPE, ATTR_MATHFN_ERRNO) +DEF_GCC_BUILTIN (BUILT_IN_NEXTAFTERF16B, "nextafterf16b", BT_FN_BFLOAT16_BFLOAT16_BFLOAT16, ATTR_MATHFN_ERRNO) DEF_C99_BUILTIN (BUILT_IN_NEXTTOWARD, "nexttoward", BT_FN_DOUBLE_DOUBLE_LONGDOUBLE, ATTR_MATHFN_ERRNO) DEF_C99_BUILTIN (BUILT_IN_NEXTTOWARDF, "nexttowardf", BT_FN_FLOAT_FLOAT_LONGDOUBLE, ATTR_MATHFN_ERRNO) DEF_C99_BUILTIN (BUILT_IN_NEXTTOWARDL, "nexttowardl", BT_FN_LONGDOUBLE_LONGDOUBLE_LONGDOUBLE, ATTR_MATHFN_ERRNO) --- gcc/fold-const-call.cc.jj 2022-10-20 16:43:03.033928849 +0200 +++ gcc/fold-const-call.cc 2022-10-20 16:50:14.300038009 +0200 @@ -1438,6 +1438,7 @@ fold_const_call_sss (real_value *result, CASE_CFN_NEXTAFTER: CASE_CFN_NEXTAFTER_FN: + case CFN_BUILT_IN_NEXTAFTERF16B: CASE_CFN_NEXTTOWARD: return fold_const_nextafter (result, arg0, arg1, format); Jakub