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.133.124]) by sourceware.org (Postfix) with ESMTPS id AD6A13858002 for ; Wed, 9 Aug 2023 18:19:47 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org AD6A13858002 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=1691605187; 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=/xzyAS5DHt5E8YsLAIP1xJwtU9CPgYxZOKNRYEwpyMg=; b=RDoV/8YclFvCumsdZdr1colet+H2vqBPn/WJ2OK1/tRrpakVWX9S9Zbwe3VZgTPg3dn8wv CRa8JkGPIoNK5m0fZcAWH38ZMe2vWdAxMNrg/xJHjDCiKj4rN0hMZ4YgE9wA7ywtzXynXT xo4FmGDYn4SO49R7dqmCr0QXMs1e5Ao= 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-540-C4xCWo6ZOgK5dF7ZNgIlUw-1; Wed, 09 Aug 2023 14:19:45 -0400 X-MC-Unique: C4xCWo6ZOgK5dF7ZNgIlUw-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 61EE3855712; Wed, 9 Aug 2023 18:19:45 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.45.224.18]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 23B40401E54; Wed, 9 Aug 2023 18:19:45 +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 379IJgCc2042932 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Wed, 9 Aug 2023 20:19:43 +0200 Received: (from jakub@localhost) by tucnak.zalov.cz (8.17.1/8.17.1/Submit) id 379IJgUw2042931; Wed, 9 Aug 2023 20:19:42 +0200 Date: Wed, 9 Aug 2023 20:19:41 +0200 From: Jakub Jelinek To: Uros Bizjak , hjl.tools@gmail.com Cc: gcc-patches@gcc.gnu.org Subject: [PATCH 6/12] i386: Enable _BitInt on x86-64 [PR102989] Message-ID: Reply-To: Jakub Jelinek MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 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.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,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! The following patch enables _BitInt support on x86-64, the only target which has _BitInt specified in psABI. 2023-08-09 Jakub Jelinek PR c/102989 * config/i386/i386.cc (classify_argument): Handle BITINT_TYPE. (ix86_bitint_type_info): New function. (TARGET_C_BITINT_TYPE_INFO): Redefine. --- gcc/config/i386/i386.cc.jj 2023-08-08 15:55:05.627176766 +0200 +++ gcc/config/i386/i386.cc 2023-08-08 16:12:02.308940091 +0200 @@ -2121,7 +2121,8 @@ classify_argument (machine_mode mode, co return 0; } - if (type && AGGREGATE_TYPE_P (type)) + if (type && (AGGREGATE_TYPE_P (type) + || (TREE_CODE (type) == BITINT_TYPE && words > 1))) { int i; tree field; @@ -2270,6 +2271,14 @@ classify_argument (machine_mode mode, co } break; + case BITINT_TYPE: + /* _BitInt(N) for N > 64 is passed as structure containing + (N + 63) / 64 64-bit elements. */ + if (words > 2) + return 0; + classes[0] = classes[1] = X86_64_INTEGER_CLASS; + return 2; + default: gcc_unreachable (); } @@ -24842,6 +24851,26 @@ ix86_get_excess_precision (enum excess_p return FLT_EVAL_METHOD_UNPREDICTABLE; } +/* Return true if _BitInt(N) is supported and fill details about it into + *INFO. */ +bool +ix86_bitint_type_info (int n, struct bitint_info *info) +{ + if (!TARGET_64BIT) + return false; + if (n <= 8) + info->limb_mode = QImode; + else if (n <= 16) + info->limb_mode = HImode; + else if (n <= 32) + info->limb_mode = SImode; + else + info->limb_mode = DImode; + info->big_endian = false; + info->extended = false; + return true; +} + /* Implement PUSH_ROUNDING. On 386, we have pushw instruction that decrements by exactly 2 no matter what the position was, there is no pushb. @@ -25446,6 +25475,8 @@ ix86_run_selftests (void) #undef TARGET_C_EXCESS_PRECISION #define TARGET_C_EXCESS_PRECISION ix86_get_excess_precision +#undef TARGET_C_BITINT_TYPE_INFO +#define TARGET_C_BITINT_TYPE_INFO ix86_bitint_type_info #undef TARGET_PROMOTE_PROTOTYPES #define TARGET_PROMOTE_PROTOTYPES hook_bool_const_tree_true #undef TARGET_PUSH_ARGUMENT Jakub