From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pj1-x1032.google.com (mail-pj1-x1032.google.com [IPv6:2607:f8b0:4864:20::1032]) by sourceware.org (Postfix) with ESMTPS id D1F5F3858423 for ; Sun, 19 Sep 2021 17:06:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org D1F5F3858423 Received: by mail-pj1-x1032.google.com with SMTP id v19so10338855pjh.2 for ; Sun, 19 Sep 2021 10:06:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=FIxBhMVNqQr7v8rz5oJV29UGe1GRE08GxUI9ZTW40s0=; b=eSP3X9kRVRBuNR0AoXMx1P/5dmF2my2/qu+DW4v7NFn+iXMcS4hvEzlMTULAmyI/Up 8LTNihZOQ41JEPmHr+BD1u1RYd4K2TOyg5yWIWcFIiUlNSho8KFv5B4DP1fxorXd24gk 165GTzuxN9cRf/wiFTJTJ62ljUh2MXJfDdHdFLXjAo6LCMIY+heUZLK+XHaZZpoqFXhS EX5ZcKQ4AwvN5ZoxICkMq1iIos/SIfVngV056uSpxVdxWnPhkiq+8Lv9UA1d922A4O6h jE5mbTMycjFPj+n3v6FYEaV4cpqouZqSS3gH/VcrcUnEsEpwz9/0mpuWRk+rQh41wamf yymw== X-Gm-Message-State: AOAM532b4kXeCM1UaMP3KwFdzKOdU5D6CKuUzTw5cjRAyFrDla+LtFcL YIC2xd3sS4gIDHXmaUI+cNshOHIOIqk= X-Google-Smtp-Source: ABdhPJwg809y5nO00XgKhRQCqbVxmOAms5fbXkGy8BTXZLSjsbgZxZS+Q668bSbRUS6ObCgOk104rQ== X-Received: by 2002:a17:90a:ec12:: with SMTP id l18mr24587798pjy.213.1632071215483; Sun, 19 Sep 2021 10:06:55 -0700 (PDT) Received: from [172.31.0.175] (c-98-202-48-222.hsd1.ut.comcast.net. [98.202.48.222]) by smtp.gmail.com with ESMTPSA id x19sm12691541pgk.37.2021.09.19.10.06.54 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 19 Sep 2021 10:06:55 -0700 (PDT) Subject: Re: [PATCH] Recognize highpart multiplication during RTL expansion To: Roger Sayle , 'GCC Patches' References: <001b01d78c42$ed769220$c863b660$@nextmovesoftware.com> From: Jeff Law Message-ID: <1da7d5e0-c104-1cb1-2cdb-0d88e348497d@gmail.com> Date: Sun, 19 Sep 2021 11:06:54 -0600 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 MIME-Version: 1.0 In-Reply-To: <001b01d78c42$ed769220$c863b660$@nextmovesoftware.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, KAM_SHORT, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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-List-Received-Date: Sun, 19 Sep 2021 17:06:58 -0000 On 8/8/2021 4:48 AM, Roger Sayle wrote: > This middle-end patch teaches RTL expansion to recognize widening > multiplications followed by right shifts as highpart multiplications, > and attempt to emit them using the backends [su]mul_highpart optab > if possible. > > My first attempt at supporting this, from August 2020, is at: > https://gcc.gnu.org/pipermail/gcc-patches/2020-August/551316.html > and the nvptx portions were conditionally pre-approved here: > https://gcc.gnu.org/pipermail/gcc-patches/2020-August/551373.html > I completely agree with Richard's original review that it's best to > avoid any potential problems with MULT_HIGHPART_EXPR, which is poorly > supported by middle-end passes, by recognizing this later, during > expansion to RTL, which is the approach implemented in the patch. > https://gcc.gnu.org/pipermail/gcc-patches/2020-September/553055.html > > The following patch has been tested on nvptx-none with a > "make" and "make -k check", and on x86-pc-linux-gnu with a > "make bootstrap" and "make -k check" both with no new failures. > Future work may also support WIDEN_MULT_EXPR and larger shifts, > but the current matching is already complex enough for v1.0. > > Ok for mainline? > > > 2021-08-08 Roger Sayle > > gcc/ChangeLog > * expr.c (try_expand_mult_highpart): New function to recognize a > highpart multiplication and expand it using the appropriate optab. > (expand_expr_real_2) [RSHIFT_EXPR]: Attempt to expand right shifts > of widening multiplications using try_expand_mult_highpart. > * config/nvptx/nvptx.md (smuldi3_highpart): New define_insn. > (umuldi3_highpart): New define_insn. > > gcc/testsuite/ChangeLog > * gcc.target/nvptx/mul-hi64.c: New test case. > * gcc.target/nvptx/umul-hi64.c: New test case. ENOPATCH jeff