Message ID | 20230712031935.3908564-1-yunqiang.su@cipunited.com |
---|---|
State | Accepted |
Headers |
Return-Path: <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a6b2:0:b0:3e4:2afc:c1 with SMTP id c18csp883069vqm; Tue, 11 Jul 2023 20:20:28 -0700 (PDT) X-Google-Smtp-Source: APBJJlG/xpEvtwr1xW9RmF3B8Yt35wHnrfmf73Khn8RR2ZvfUIOH6O0yToNZReFW4sL0kGurnGeS X-Received: by 2002:a17:906:83:b0:992:a2fe:757e with SMTP id 3-20020a170906008300b00992a2fe757emr18086638ejc.31.1689132028420; Tue, 11 Jul 2023 20:20:28 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1689132028; cv=pass; d=google.com; s=arc-20160816; b=DdcyFz6JsE35FUnnq5XNDYjde8hBNOEC0Kj47Cd3ne6CAZos7FVFYq0JOThim5XqD4 y18cQACfyTt9XZad95AwPLkPzG7zryuJDZSSDVuhI1wWN0O2j/HUwabmO1f54Z0lM4BF DUi+AWNpGZlIVsfTSupIrun/+gWNz2YA9UptMdozVyE6EdtNtj+093SKs89aVjP8JdE6 0Xyi5GcRbdfwY8/YpEKykrd2xM1Zb+EtDQv/1zE1u1WuwokCmHGoRGmNz5k53Sqeuq2E 9FF1XZEG7g5f2VZAShqQCVAqTIwyRP0gNy4oDWEAr3mzX+22oYA/Njfcs8wB689tEsx6 YSUQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:mime-version :content-transfer-encoding:message-id:date:subject:cc:to:from :dkim-signature:dmarc-filter:delivered-to; bh=8N/LmiSvtD7+VReeGVuljkA3r/7XLEuc7yug2Gw5Uk0=; fh=tPtKFwsNsLyfOdT1e0Di/DyoCiHaTkIwPp08Cqe3Q+I=; b=dmBozbiIdM0n0vwHieNg8xhRYbZaJY+BzxQSd7S5gckCuAk9ybwqS5Fn9NiUU5y8xW WJd/1Jjp5jG0LYNY4MwG4u9DIsQ87Py4vaPBKeztjM/fAKFYt3qdTTXg3HP1fpDuvK07 wBz/FMxsNyrwf/9f2BSerdyrgI/CwC4F6cC6xxJwyWidJwA0w5A9QQnvGoNtXH5MTRyh qFl7z8IET3OcPPWtzvz2J4SliLKLWTyxjShQs0/dTlgior+NOYkvH9TLdd+okF/Rg75Y D7TGJ5SjikL4QKmN8KvFondYOb381tVAOlWo14o6MvrTkW4Ol7Xq/opo4wNdAzw6i2Y9 bnAg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@cipunited.onmicrosoft.com header.s=selector1-cipunited-onmicrosoft-com header.b=YXgLbsdm; arc=pass (i=1 spf=pass spfdomain=cipunited.com dkim=pass dkdomain=cipunited.com dmarc=pass fromdomain=cipunited.com); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id q2-20020a1709060e4200b009823926ec36si3242845eji.931.2023.07.11.20.20.28 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Jul 2023 20:20:28 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@cipunited.onmicrosoft.com header.s=selector1-cipunited-onmicrosoft-com header.b=YXgLbsdm; arc=pass (i=1 spf=pass spfdomain=cipunited.com dkim=pass dkdomain=cipunited.com dmarc=pass fromdomain=cipunited.com); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 77ABA3857733 for <ouuuleilei@gmail.com>; Wed, 12 Jul 2023 03:20:22 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from APC01-PSA-obe.outbound.protection.outlook.com (mail-psaapc01on2090.outbound.protection.outlook.com [40.107.255.90]) by sourceware.org (Postfix) with ESMTPS id 6976A3858D20 for <gcc-patches@gcc.gnu.org>; Wed, 12 Jul 2023 03:19:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6976A3858D20 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=cipunited.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=cipunited.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=m6fcnF4sC/T75GA4gBG2Z/bid2EUHsu95qqtjo12WhOHhwcnHzJITsYQ3+ucGw1IRbH2uS5QQER+r6rYGWRDe215XypAhvCoccOYqT4ElQ9d/eqDVsAuHVFR3fV49FkmkcRD9cNAuqzriBDCSsRKSwrDCzJnk7o6G8cTKglzCHGYcK+m0YV5DERYM9lgZZgsryemNqzPzSlK9CoJBowwnzSOqi23KDnICRp2w6W4dCwohB3L6S2wsyHGYSoxq+X1nNQKofY+4W+KXvKEA6V0V0plHwO3HOEMSw22ZGnhmOfhKTl6ODhMzxvlb6VC1U63iJYU2jOrfaXu2xSyCVPEbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=8N/LmiSvtD7+VReeGVuljkA3r/7XLEuc7yug2Gw5Uk0=; b=nUKhHH37xY4X3DYbZqYG6jttT9F0Hmk8C8XvmgvOzLQ3tNk6DS63L0sbQJF3RKZMCkgdS52Os3JtHl4jeoVG/Rpp9paIym42OcQ8tue7jtTc6/N3hmyHV3YeJbt9tz/eRGzdaUwdD3yMxpMUV19xMPiJr3AE6h8XB6PbI0YeZUxZ3Im/oEbu4p2XrmInxZQYUFwN0wkJXN+VT82CWYGAgY4sGCq1GBkGpYeiSbQh276LTnH2o+Ae05iuzrtZLCHsZ6IyH63ZPN5QSk8nswneq26cqV5OibFCccI8Js2p8HCUNk1XcLerYF+fHEOMrlJVMYurNkmKrtdIITwG07GaIw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=cipunited.com; dmarc=pass action=none header.from=cipunited.com; dkim=pass header.d=cipunited.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cipunited.onmicrosoft.com; s=selector1-cipunited-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=8N/LmiSvtD7+VReeGVuljkA3r/7XLEuc7yug2Gw5Uk0=; b=YXgLbsdm/V4hmNynEEr9H8u4lN6HcA+PktB2NEGRmuGWi/kKQXhc8DeDxajgqKAplgwqEtUMX6XOK6wUMqKxOfNgxxxHZgo6ciTkjz0p0E/qFZAVWixuvEwxNdWvJGIYsmbRAHKfEdHv1c1KxLb3+7rJ9WSnfzyC4+ddu8uxVYU= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=cipunited.com; Received: from TYZPR04MB6117.apcprd04.prod.outlook.com (2603:1096:400:25a::9) by TYZPR04MB6473.apcprd04.prod.outlook.com (2603:1096:400:283::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6565.31; Wed, 12 Jul 2023 03:19:49 +0000 Received: from TYZPR04MB6117.apcprd04.prod.outlook.com ([fe80::ba6b:3ca:606f:ccce]) by TYZPR04MB6117.apcprd04.prod.outlook.com ([fe80::ba6b:3ca:606f:ccce%3]) with mapi id 15.20.6588.017; Wed, 12 Jul 2023 03:19:49 +0000 From: YunQiang Su <yunqiang.su@cipunited.com> To: gcc-patches@gcc.gnu.org Cc: pinskia@gmail.com, YunQiang Su <yunqiang.su@cipunited.com> Subject: [RFC] Store_bit_field_1: Use mode of SUBREG instead of REG Date: Wed, 12 Jul 2023 11:19:35 +0800 Message-Id: <20230712031935.3908564-1-yunqiang.su@cipunited.com> X-Mailer: git-send-email 2.30.2 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SI1PR02CA0059.apcprd02.prod.outlook.com (2603:1096:4:1f5::19) To TYZPR04MB6117.apcprd04.prod.outlook.com (2603:1096:400:25a::9) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYZPR04MB6117:EE_|TYZPR04MB6473:EE_ X-MS-Office365-Filtering-Correlation-Id: 1b53874f-fa4c-4edd-4ee0-08db8286d99b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: qRHHFDZMh/BKB/zza/+hhbHP/2Dyasnvo94kIC3d/1RvszT4RX15OCRQdKaUcIYG9VP/Ok/wCCm1DrJMcPgcF4Ux2i02mhP+S7SG9GWt3zRBBzX22ci1aYmUQ1l2mugN97pLFu2Ul+qT24tev5+wYZUSsVs98kJmsMK5BoQZnaE+AGiWVKIro34z6qms9P+CC5EwjR59YT7ipiTOjjwz/DUwfweljL6DkADnyGRHhGz6reokZE07Tv2MCIqxWRUt80vCDjXGhpLjMaQMGRoh9xWBTV3ZHMOZqS2LaUyujqESmUQcYLwhFu3ZukJfRCtpM1rl3TWeWjBni7cqg4TJYLAoMVjzTv7N5SeH1cF2ROjy1amtmr/R67YTqy5dXe0bUS3ob9R9hbj6mrsXpDaugNSYcPxe0o0RH/8IJQskzkqM7+s8RQLdv0A47kAC6nEdpGxRFf6vxNzLttqkCgJSlZgJehSU4nXDacLQlO6TAwE6OrdXF755CpURJWblMC2y1dwWKrJNRIJUudMeZ21sAYN6vVB10USH+3AOCsYFolwDLbSdQvupWZkOFQu2YWpJ3d2al1CUzryUDITsAXebObIRsxkgpSSzdEOMcAXTkZytqYtp1Y0wNL4qusoa7xdT X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:TYZPR04MB6117.apcprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(39830400003)(366004)(346002)(376002)(396003)(136003)(451199021)(38350700002)(6512007)(38100700002)(2616005)(26005)(83380400001)(186003)(107886003)(8936002)(2906002)(8676002)(5660300002)(1076003)(36756003)(66556008)(6666004)(478600001)(66476007)(6916009)(6486002)(52116002)(4326008)(66946007)(316002)(86362001)(6506007)(41300700001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: znKsRCeBGboG2C/rnEe2hVLl04RP9/6BFbZzCprFecLgX08f+QApFjXIYJDdQDJFAPOLCGx5n6m3QmLCNTFthuDhpGQZhYyL+3Ldxob1SoM2qYiJI1VLhzwwijEI4vrWVaU/itad77IzZ40lXTfVPJoZ/4GIi1GXT6WEwzF/dk6F5sv1d4528BMEiL4K6o0+/28sN/4q8sKNJnILwTtj2IE+yeXFX2wei+be9CAAvbwBv9R9coFRP6O7sRjZy+6O6PMwDVXXm2wWU70BgRQP58SKdV7B+C5BSDx1PT2tHFaIMJ0waUknpkRAK8JOW5p5hkysDlsD2nZL9EFRqNpZ5TqlVo6UrR/PS3AEln7KBw7cbOS63Mt2mAKkk/zJX3Ze+duSEUUr+ssJKl26oM/JeiWAaNE8KXjVfMhoDZqid1J2riYJzFxWPJizPELfUpwu9s/xhapJt6cz9UJecXLfgF7Ejod8q728lkrQleUFcI4n7viXqV4BEI4yxNYr1kAA852xRIrq5fz0PNpkqyrrN3LkXTeuCpzwnjEcBR+0uqUnoiomXI95fL1NpsCtRYKBZRov79Gj/4aL4nAWouZ3xSt8clJ6EGXoJMh6U2OYuHz3vOTwDBTpyLkFM8eWewuvZ2dE6WX4KdOS+SDeUNL0fqIgtUPF+2f5Gw+fg39FojHIoGguw54xsT19bxO/B+auofEhiPhIEr3acKpRVBZgezwDY56aXl5KdQPmaAQlHf/aOgGZG3CH5uv/mmBrrPqMm9ScwM3V9emd2MuFQ5FCzm88hrNDsyefwFJuXF4vzV6LJrL6W7fsKYOUA+lLd2yo6TjKSA28QEAhK0qmw+JFG+LzLRWMST4GgezFsOnwVyyk5uAraEXYgX3MfrjMVuw7icbqvFDRd6yYaVQUFgdaXV/IGkQqBJ3MqGf9Nw52aYkNizbimqUAF3aWeVbJvYaA4+xsP6RmBH6w9Fa1b6nNdR4Ngggu02RIkaWywZla7TjwVGRjCABe6fzQcoDnYD6UF/b4tj5Y170mMEh4IeiWzBI1O/9LFkqCfCQcg4Hzz2yla4/4NEo7eIoeGB1k6KcqpRyDta/ZJPUeJBRnd8neVcR6R7DUua9LSiWVySd1cZ04I3i3z7jg4HA1e+X++WKAacx3k6OuAlJYJOjPy0i9SDIX9T4G40J8n4LR0UNrBYIvyIOvKr8k2R83kKQzEno1tXThIc0Jh2W//Jx16DUW8osMhCeHYZOaF9C2bblmnuGnqnlmrvgASGhydpJbxCXHa/UUKdSw/mUuY9zHokyfyVg6Jalka4+nPTyshciKi2SlgrnmxRkJd/mh5MyLpjjQ1bfJ2nbR9PsmiX/Ue9TkLNnlRWFVp+z+1V7oVwwGL0k6LxTASQE8iqp+IcKLl5Guo5xZCN29XZXuS0fBAcom5AczejrBeOE1FNtPUqTzE/PS5lI1chRmWHqdHt7bkjx1e+CP5hiX7i9DqENM781sJvB6uSC5a7ot/HkoKjon6WkKUIs7e7YyW3qV7aASU52NEjxGri5uiMtLCyTpsdfdYYdJCAFIsOwMUGK6vuoH+lx0/9Wh3A8crtm0knzcXHDem5uQzn4K1s0dhBPspniMDQ== X-OriginatorOrg: cipunited.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1b53874f-fa4c-4edd-4ee0-08db8286d99b X-MS-Exchange-CrossTenant-AuthSource: TYZPR04MB6117.apcprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jul 2023 03:19:49.4080 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: e31cf5b5-ee69-4d5f-9c69-edeeda2458c0 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: gNnqMPqGp0wsrXz9fOTgGKQNNVAP+I0EcsIdcd+1exwW5fcuRfac+X2nGmynBGAg6OGMtpfl15rF6fAkxetOsuOwVc/E9U7cwpiNJMOFwgo= X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYZPR04MB6473 X-Spam-Status: No, score=-13.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE 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 <gcc-patches.gcc.gnu.org> List-Unsubscribe: <https://gcc.gnu.org/mailman/options/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe> List-Archive: <https://gcc.gnu.org/pipermail/gcc-patches/> List-Post: <mailto:gcc-patches@gcc.gnu.org> List-Help: <mailto:gcc-patches-request@gcc.gnu.org?subject=help> List-Subscribe: <https://gcc.gnu.org/mailman/listinfo/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe> Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771183305711616476 X-GMAIL-MSGID: 1771183305711616476 |
Series |
[RFC] Store_bit_field_1: Use mode of SUBREG instead of REG
|
|
Checks
Context | Check | Description |
---|---|---|
snail/gcc-patch-check | success | Github commit url |
Commit Message
YunQiang Su
July 12, 2023, 3:19 a.m. UTC
PR #104914 When work with int val; ((unsigned char*)&val)[0] = *buf; The RTX mode is obtained from REG instead of SUBREG, which make D<INS> is used instead of <INS>. Thus something wrong happens on sign-extend default architectures, like MIPS64. gcc/ChangeLog: PR: 104914. * expmed.cc(store_bit_field_1): Get mode from original str_rtx instead of op0. --- gcc/expmed.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Comments
On Wed, Jul 12, 2023 at 5:20 AM YunQiang Su <yunqiang.su@cipunited.com> wrote: > > PR #104914 > > When work with > int val; > ((unsigned char*)&val)[0] = *buf; > The RTX mode is obtained from REG instead of SUBREG, > which make D<INS> is used instead of <INS>. > Thus something wrong happens on sign-extend default architectures, > like MIPS64. > > gcc/ChangeLog: > PR: 104914. > * expmed.cc(store_bit_field_1): Get mode from original > str_rtx instead of op0. > --- > gcc/expmed.cc | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/gcc/expmed.cc b/gcc/expmed.cc > index fbd4ce2d42f..37f90912122 100644 > --- a/gcc/expmed.cc > +++ b/gcc/expmed.cc > @@ -849,7 +849,7 @@ store_bit_field_1 (rtx str_rtx, poly_uint64 bitsize, poly_uint64 bitnum, > if we aren't. This must come after the entire register case above, > since that case is valid for any mode. The following cases are only > valid for integral modes. */ > - opt_scalar_int_mode op0_mode = int_mode_for_mode (GET_MODE (op0)); > + opt_scalar_int_mode op0_mode = int_mode_for_mode (GET_MODE (str_rtx)); I don't think this is correct - op0_mode is used to store into op0, and we are just requiring that it is an integer mode and equal to the original mode. I suppose your patch makes us go to the fallback code instead, but it's surely for the wrong reason. I also wonder why we don't just check GET_MODE_CLASS (GET_MODE (op0)) == MODE_CLASS_INT ... > scalar_int_mode imode; > if (!op0_mode.exists (&imode) || imode != GET_MODE (op0)) > { > -- > 2.30.2 >
> 2023年7月12日 15:44,Richard Biener <richard.guenther@gmail.com> 写道: > > On Wed, Jul 12, 2023 at 5:20 AM YunQiang Su <yunqiang.su@cipunited.com> wrote: >> >> PR #104914 >> >> When work with >> int val; >> ((unsigned char*)&val)[0] = *buf; >> The RTX mode is obtained from REG instead of SUBREG, >> which make D<INS> is used instead of <INS>. >> Thus something wrong happens on sign-extend default architectures, >> like MIPS64. >> >> gcc/ChangeLog: >> PR: 104914. >> * expmed.cc(store_bit_field_1): Get mode from original >> str_rtx instead of op0. >> --- >> gcc/expmed.cc | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/gcc/expmed.cc b/gcc/expmed.cc >> index fbd4ce2d42f..37f90912122 100644 >> --- a/gcc/expmed.cc >> +++ b/gcc/expmed.cc >> @@ -849,7 +849,7 @@ store_bit_field_1 (rtx str_rtx, poly_uint64 bitsize, poly_uint64 bitnum, >> if we aren't. This must come after the entire register case above, >> since that case is valid for any mode. The following cases are only >> valid for integral modes. */ >> - opt_scalar_int_mode op0_mode = int_mode_for_mode (GET_MODE (op0)); >> + opt_scalar_int_mode op0_mode = int_mode_for_mode (GET_MODE (str_rtx)); > > I don't think this is correct - op0_mode is used to store into op0, and we are > just requiring that it is an integer mode and equal to the original > mode. I suppose > your patch makes us go to the fallback code instead, but it's surely > for the wrong diff --git a/gcc/expmed.cc b/gcc/expmed.cc index fbd4ce2d42f..feee8c82f59 100644 --- a/gcc/expmed.cc +++ b/gcc/expmed.cc @@ -850,6 +861,7 @@ store_bit_field_1 (rtx str_rtx, poly_uint64 bitsize, poly_uint64 bitnum, since that case is valid for any mode. The following cases are only valid for integral modes. */ opt_scalar_int_mode op0_mode = int_mode_for_mode (GET_MODE (op0)); + opt_scalar_int_mode str_mode = int_mode_for_mode (GET_MODE (str_rtx)); scalar_int_mode imode; if (!op0_mode.exists (&imode) || imode != GET_MODE (op0)) { @@ -881,8 +893,14 @@ store_bit_field_1 (rtx str_rtx, poly_uint64 bitsize, poly_uint64 bitnum, op0 = gen_lowpart (op0_mode.require (), op0); } - return store_integral_bit_field (op0, op0_mode, ibitsize, ibitnum, - bitregion_start, bitregion_end, + bool use_str_mode = false; + if (GET_MODE_CLASS(GET_MODE (str_rtx)) == MODE_INT + && GET_MODE_CLASS(GET_MODE (op0)) == MODE_INT + && known_gt (GET_MODE_SIZE(GET_MODE(op0)), GET_MODE_SIZE(GET_MODE(str_rtx)))) + use_str_mode = true; + return store_integral_bit_field (op0, + use_str_mode ? str_mode : op0_mode, + ibitsize, ibitnum, bitregion_start, bitregion_end, fieldmode, value, reverse, fallback_p); } > reason. I also wonder why we don't just check GET_MODE_CLASS > (GET_MODE (op0)) == MODE_CLASS_INT ... > In fact I have no idea. Maybe there are some other tricky cases. >> scalar_int_mode imode; >> if (!op0_mode.exists (&imode) || imode != GET_MODE (op0)) >> { >> -- >> 2.30.2
diff --git a/gcc/expmed.cc b/gcc/expmed.cc index fbd4ce2d42f..37f90912122 100644 --- a/gcc/expmed.cc +++ b/gcc/expmed.cc @@ -849,7 +849,7 @@ store_bit_field_1 (rtx str_rtx, poly_uint64 bitsize, poly_uint64 bitnum, if we aren't. This must come after the entire register case above, since that case is valid for any mode. The following cases are only valid for integral modes. */ - opt_scalar_int_mode op0_mode = int_mode_for_mode (GET_MODE (op0)); + opt_scalar_int_mode op0_mode = int_mode_for_mode (GET_MODE (str_rtx)); scalar_int_mode imode; if (!op0_mode.exists (&imode) || imode != GET_MODE (op0)) {