From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ed1-x52a.google.com (mail-ed1-x52a.google.com [IPv6:2a00:1450:4864:20::52a]) by sourceware.org (Postfix) with ESMTPS id E1BB53858401 for ; Wed, 23 Aug 2023 15:06:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E1BB53858401 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ed1-x52a.google.com with SMTP id 4fb4d7f45d1cf-523bf06f7f8so7049929a12.1 for ; Wed, 23 Aug 2023 08:06:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1692803211; x=1693408011; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=m6Tjx7EYO70pdcKx08Or2ucKb4ZAG6LRL15Je5Nlx8g=; b=kd0iJWQRi02gKJ7AqjynW48yvIzpsQ7OTA5QcFjf9O4GClgfiMAPbK+fbp/JGe++wl G2R/DeNy7BYhrDmFMblrIvS+wVNzw0AmgYLcYqIep1Ij27HFgvkR7LaWQ2XwVZK1jLVd yGuvyIq7uQPYA6QEzicIS1Cy/urkCjXLQIO0u2s4G+IutOeUza+5gxy5eHJ0f3AlSkAN NSnqFxXCW6YO5iKHMqvChpaWG2IMu8MF0fkNofdMXNd+sBnJt1jES1qcrSlIOiKkV6ei mQgTtzEHsnSP1rKd40s3sZu1qEPWkDRUU3JCzDltmCPltFH2qhjP+U+sf2CadZgkeJVq S4hQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692803211; x=1693408011; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=m6Tjx7EYO70pdcKx08Or2ucKb4ZAG6LRL15Je5Nlx8g=; b=CKK6n6h93TTZBW6zfgANKEPb33QQ6MDocSKmmeUqgTrbJn2gPNGDUhIOJHmC+f2Tr4 vL/u4PSx+81bWmIumYyEJCGgxvqZC24bRO45q4XBo7nyzgDqWreXEurlXlnvDYdq9+ZD YGTjKQCsJnmiI4eG3ZVB6Qhu+v4+0JrBtNGmKWblzWg/2Rg/XnpQ92GhYOqhSBFvrHai KOkfPcT4sVbGqiL3tjUdC3Theh5lu1wHvJKi+uYZT9TS3Tt3mqhlTXCdqarzt7QY+bS/ Rf5tKrhy1PxQzoIKzs7a0/zfAWXTckD4NCbtLrC+kjL+HC+yJVCV6hsmSftPXMa/wwol jaUQ== X-Gm-Message-State: AOJu0YzdPTojgHyb7VqzCgILvhFQWBx/YjniB4/MStGi+La4428AyrYy 01qMGm0Nk0+8lWONHcH0voeEabUDu+9jwpNrWKt019f3kLo= X-Google-Smtp-Source: AGHT+IEB5hwXnhE3yV6Fwmz0slsRYS3aSagBDEH3Gg1TXSfX4yftnmADiv8tU59r+eBcIuDxpmx/4lxpj6ptttC9uKM= X-Received: by 2002:a05:6402:510:b0:522:2111:1063 with SMTP id m16-20020a056402051000b0052221111063mr9781949edv.18.1692803211256; Wed, 23 Aug 2023 08:06:51 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Uros Bizjak Date: Wed, 23 Aug 2023 17:06:40 +0200 Message-ID: Subject: Re: [PATCH 6/12] i386: Enable _BitInt on x86-64 [PR102989] To: Jakub Jelinek Cc: hjl.tools@gmail.com, gcc-patches@gcc.gnu.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.4 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,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: On Wed, Aug 9, 2023 at 8:19=E2=80=AFPM Jakub Jelinek wro= te: > > 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. LGTM, with a nit. Thanks, Uros. > > --- 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) =3D=3D 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] =3D classes[1] =3D 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. */ The above comment should fit into one line. > +bool > +ix86_bitint_type_info (int n, struct bitint_info *info) > +{ > + if (!TARGET_64BIT) > + return false; > + if (n <=3D 8) > + info->limb_mode =3D QImode; > + else if (n <=3D 16) > + info->limb_mode =3D HImode; > + else if (n <=3D 32) > + info->limb_mode =3D SImode; > + else > + info->limb_mode =3D DImode; > + info->big_endian =3D false; > + info->extended =3D 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 >