From patchwork Wed Aug 9 18:19:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 133408 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c44e:0:b0:3f2:4152:657d with SMTP id w14csp2990268vqr; Wed, 9 Aug 2023 11:20:37 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG9nV68L31+6OHJ/sRdfNy9c7wMLtHB7tajJZ12oPHdnIYkB9w67kl+jZ3zC8IFZnJiX+iI X-Received: by 2002:a17:907:75f6:b0:994:539d:f97f with SMTP id jz22-20020a17090775f600b00994539df97fmr2692877ejc.37.1691605237261; Wed, 09 Aug 2023 11:20:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691605237; cv=none; d=google.com; s=arc-20160816; b=OHIzeKnXPpTi4tloY5+aga1OoRdKyefWzc84NVUNQZ76dbl/7RZ2pwc0B4wIB+q9kw 4OtkQi1p8hLqH+Hy7HSlLP1tnYpN22CLaOrPLo5/EAWNRIXiPcc+2torrIbQPDh6UO2E sHhRJZwBL3ztHEwIx2Td3ya1qNN7e1nt+1l8y5zU8qKHFidwUfWpLLqJ77ncF0lgJTr7 jKkO8lY4XB298l5YQSeDMj5g6eDD1a2dG5omV+0ylfsG6LMBFSar4bP0majAKFR4P2YS 9RQBBtejrkoBOHuFonDdtvqWup/72/fZJrq3C1lAyBKTb4bInKRQ6lnjLCorAsivcaGw ybGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-disposition:mime-version:message-id:subject:cc:to:date :dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=/xzyAS5DHt5E8YsLAIP1xJwtU9CPgYxZOKNRYEwpyMg=; fh=BQfkErFzAsSsbjkTCyRX/B4NTVcq/Q0FVa8n2KPtmMA=; b=zFuJ1ynGJCwpUnR8B2LmH463n8coYm2oB5f3RZlFTpK037xxwvoQU4yuqTpap/fS2J CnAc010Adf9HanJYVM8pmBtL3sfPUNRtqUqzriX1+j0FITu7Ym+Sh0bSxWU4g7eEgDUM G6v6SO1p7RnV7APDigpmxBXXF4WMGYHfPJdTntaoKcGYJ8/VhQct4PDAkV3E4BK6DZGr 1i+1fmwvU7ne5TTjWadeTuH2+8Ny3GBNT/DYR1J6Lqq1ZssEg+723pCnwaA1j4AMKfLq wiBIIg/TaSagOzz6/UVBSGvDjjZtG8oj1kt+WRkZ3ECyhHyaNAxglmLadEAz9INzLz2k bHPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=ROUypjbT; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id c16-20020a170906d19000b0098dfb10f3a6si8840449ejz.107.2023.08.09.11.20.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Aug 2023 11:20:37 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=ROUypjbT; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 11F153857700 for ; Wed, 9 Aug 2023 18:20:30 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 11F153857700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1691605230; bh=/xzyAS5DHt5E8YsLAIP1xJwtU9CPgYxZOKNRYEwpyMg=; h=Date:To:Cc:Subject:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=ROUypjbThOnIxoW1uX64EEuu28MZNthwWI3M5gUCNlyPwR/3mCsv//F4xpXGdEw5B +6lI+QNYCS8AEZ/N6Y4bTPcgHLgpMsgjuzDhtgeBA+y1T1sAg5UAlvSTaSYlvS4IOQ /dos4IFNmk3r/asmMXZqaeTUrj+Zv4SDbgJdBv9s= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org 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 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 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: 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-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 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: Jakub Jelinek via Gcc-patches From: Jakub Jelinek Reply-To: Jakub Jelinek Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1773776652925559768 X-GMAIL-MSGID: 1773776652925559768 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. Jakub --- 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