From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pg1-x530.google.com (mail-pg1-x530.google.com [IPv6:2607:f8b0:4864:20::530]) by sourceware.org (Postfix) with ESMTPS id 74B66385840C for ; Mon, 11 Apr 2022 03:06:25 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 74B66385840C Received: by mail-pg1-x530.google.com with SMTP id s137so10275376pgs.5 for ; Sun, 10 Apr 2022 20:06:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent :content-language:to:from:subject; bh=Aj6lDYB1B0tEcuN/EqJP6pwN9gy63yidbAo3jRCpUYQ=; b=sQ2xwH9y/2Af8lxuFa5dwloRMLHv12bf705aw4WSwMs8yaJtk3VDuOimg4+jzt9aPG XUTl5u3Z9a3uPUxCehxG5dBA6Ua+9mvPoQjt+RZcNvp4REZ/Se6qrmHLfaD1uK21JEXW BKBZ3Ce7eVfWqIo2aHIBbi+T8RNPMsXhTugLLfZx2EPnZNzNDjRN+IJk11JRvMuYpoWO ZdIOK0nDn6CWm06hp8hAEln7p8jN3yHIwyhPvqeC80IGkw5Kmg5PTd2eth497EI/4P/B opP1CouHXRZXK87+scmOTNwLzTwYmfluZTMwc1BOYwtdpfJyHEkpz80+cmKQlg4bUXDO 29tA== X-Gm-Message-State: AOAM530Muhc5LDhBdBGCvE3QdJ4GJ3BFb2LB+BUeCcjmD716dR4tbSJZ c0e0mxavvQrIAuRlX1w7TIyP9PLXX6NQ7Q== X-Google-Smtp-Source: ABdhPJzH7pFABAi7gAvfi+QC+C3zpdxQEArkfITVpR8HEWkYq9cVeb88iH/SkZGXzARLr6nJH5avmg== X-Received: by 2002:a05:6a00:1252:b0:4fa:afcc:7d24 with SMTP id u18-20020a056a00125200b004faafcc7d24mr30494247pfi.85.1649646383870; Sun, 10 Apr 2022 20:06:23 -0700 (PDT) Received: from [172.31.0.204] (c-73-63-24-84.hsd1.ut.comcast.net. [73.63.24.84]) by smtp.gmail.com with ESMTPSA id j24-20020aa78d18000000b0050564584660sm12731191pfe.32.2022.04.10.20.06.23 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 10 Apr 2022 20:06:23 -0700 (PDT) Content-Type: multipart/mixed; boundary="------------IiqzTUFtd5RYCuG9NsHfSHKq" Message-ID: <4387ce74-8d8c-9716-b489-e5d2ceace268@gmail.com> Date: Sun, 10 Apr 2022 21:06:22 -0600 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 Content-Language: en-US To: 'GCC Patches' From: Jeff Law Subject: [committed] Minor bfin codegen bugfix X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00, BODY_8BITS, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE 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: Mon, 11 Apr 2022 03:06:27 -0000 This is a multi-part message in MIME format. --------------IiqzTUFtd5RYCuG9NsHfSHKq Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit builtin-arith-overflow-3 has been failing on bfin-elf for a while. I've had a workaround installed on the tester for a few months and I finally got some time to dig into it over the weekend. Ultimately I was able to nail the problem down to the representation of the rotate left by one position instruction.  I'm actually quite happy with that result as I was briefly worried it was a deeper problem in combine. Essentially we're trying to synthesize a DImode shift using an SImode rotates through CC.  The key backend insn looks like: > (define_insn "rol_one" >   [(set (match_operand:SI 0 "register_operand" "+d") >         (ior:SI (ashift:SI (match_operand:SI 1 "register_operand" "d") > (const_int 1)) >                 (zero_extend:SI (reg:BI REG_CC)))) >    (set (reg:BI REG_CC) >         (zero_extract:BI (match_dup 1) (const_int 31) (const_int 0)))] >   "" >   "%0 = ROT %1 BY 1%!" >   [(set_attr "type" "dsp32shiftimm")]) What the 2nd set in the pattern wants to do is indicate that CC is set to the high bit from operand 1.  But the RTL pattern is completely bogus as it's asking for a 31 bit wide field starting at offset 0, which is just silly for BImode.  That bogus representation led combine to do some "unexpected" transformations. The obvious fix is to use (const_int 1) (const_int 31) in the 2nd set.  That indicates we want one bit starting at position 31. With that pattern fixed, bfin returns to a normal state without needing my workaround. Installed on the trunk, Jeff --------------IiqzTUFtd5RYCuG9NsHfSHKq Content-Type: text/plain; charset=UTF-8; name="J" Content-Disposition: attachment; filename="J" Content-Transfer-Encoding: base64 Y29tbWl0IDhkMzMxYWFiNjU0ODhiMzk5OGJkMTA2MjA1YmJlNmNhYjVkZjMxYjUKQXV0aG9y OiBKZWZmIExhdyA8amVmZnJleWFsYXdAZ21haWwuY29tPgpEYXRlOiAgIFN1biBBcHIgMTAg MjM6MDI6NDggMjAyMiAtMDQwMAoKICAgIFtjb21taXR0ZWRdIE1pbm9yIGJmaW4gY29kZWdl biBidWdmaXgKICAgIAogICAgZ2NjLwogICAgICAgICAgICAqIGNvbmZpZy9iZmluL2JmaW4u bWQgKHJvbF9vbmUpOiBGaXggcGF0dGVybiB0byBpbmRpY2F0ZSB0aGUKICAgICAgICAgICAg c2lnbiBiaXQgb2YgdGhlIHNvdXJjZSBlbmRzIHVwIGluIENDLgoKZGlmZiAtLWdpdCBhL2dj Yy9jb25maWcvYmZpbi9iZmluLm1kIGIvZ2NjL2NvbmZpZy9iZmluL2JmaW4ubWQKaW5kZXgg MGU0NDY1M2Q3Y2IuLjU2YjI0NzI2YmMyIDEwMDY0NAotLS0gYS9nY2Mv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