From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ej1-x631.google.com (mail-ej1-x631.google.com [IPv6:2a00:1450:4864:20::631]) by sourceware.org (Postfix) with ESMTPS id 3B27C385AE68 for ; Thu, 9 Jun 2022 14:55:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 3B27C385AE68 Received: by mail-ej1-x631.google.com with SMTP id fu3so46498428ejc.7 for ; Thu, 09 Jun 2022 07:55:41 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=SoSzkBmKYYFTihkRA2U7V7in4IROIwQi9ke1HW+KWng=; b=c53+xYBJ7NEWTTYfo0SWQo0W480k8cQOLSGQmBdaVw0dNMJnvpyjOUkhLuR0kEIzSo tg0TOKKee5fdQv9IKZtwXfC4aklHfsiCzbtOdvCasuqXoSZVmzKiOI1vNcHmoAS9Qkw8 L7PFsISzIM5jo2RMApEzeDp+ZLVYITQUe59kR+6Kirm55szoNiemqEFMtzDgJ/PQagdQ uQuWZoggzS7mYQa7qCmTPW2FRLxhNa3qUbPKkiOzL5kAAiWqAUDhy9sQ5TQsCcurNCTz 14JTUwTrvMHLl4l+AmsohdWC6V088dmaudnF6lciu2K50TJfrXYZXAjCMX3t13UyA/ox 55uQ== X-Gm-Message-State: AOAM5310lFZtBUTy9e3tmgYUJQKdSRctO5pT12Gt4fRtFeeD3aT4F50+ cAp/ldU55fOkol7D314EV6C+lRC73s67vnEyk4o= X-Google-Smtp-Source: ABdhPJwLZYD+vPnkEnKcXOsSWxxuPoNIaczGPq5OouYyXK9KiOPAo6ke+FCeC9iKDUZ/8x/03686uzI32gkX0SEc8RE= X-Received: by 2002:a17:906:c156:b0:6ff:2415:fc18 with SMTP id dp22-20020a170906c15600b006ff2415fc18mr36175357ejc.94.1654786539528; Thu, 09 Jun 2022 07:55:39 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Kito Cheng Date: Thu, 9 Jun 2022 22:55:27 +0800 Message-ID: Subject: Re: [PATCH] RISC-V: Reset the length to the default of 4 for FP comparisons To: "Maciej W. Rozycki" Cc: GCC Patches , Andrew Waterman Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.6 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, 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Jun 2022 14:55:43 -0000 LGTM, *f_quiet4_default and *f_quiet4_snan has set their own length and the only user of this setting is *cstore4, but apparently the length if 4 for that not 8. Thanks! On Thu, Jun 9, 2022 at 9:36 PM Maciej W. Rozycki wrote: > > The default length for floating-point compare operations is overridden > to 8, however the FEQ.fmt, FLT.fmt, FLE.fmt machine instructions and > FGE.fmt, FGT.fmt assembly idioms the relevant RTL insns produce are all > 4 bytes long each. And all the floating-point compare RTL insns that > produce multiple machine instructions explicitly set their lengths. > > Remove the override then, letting the default of 4 apply for the single > instruction case. > > gcc/ > * config/riscv/riscv.md (length): Remove the explicit setting > for "fcmp". > --- > Hi, > > So for: > > int > feq (float x, float y) > { > return x == y; > } > > we get: > > .globl feq > .type feq, @function > feq: > feq.s a0,fa0,fa1 # 15 [c=4 l=8] *cstoresfdi4 > ret # 24 [c=0 l=4] simple_return > .size feq, .-feq > > which is obviously wrong given: > > Disassembly of section .text: > > 0000000000000000 : > 0: a0b52553 feq.s a0,fa0,fa1 > 4: 8082 ret > > (hmm tabs are odd here too, but that's a binutils issue). I note that the > override has always been there since the RISC-V port landed, so I take it > it's a missed leftover from an earlier situation. > > With the change in place we instead get: > > .globl feq > .type feq, @function > feq: > feq.s a0,fa0,fa1 # 15 [c=4 l=4] *cstoresfdi4 > ret # 24 [c=0 l=4] simple_return > .size feq, .-feq > > which I find so relieving. > > No regressions in the testsuite (and I haven't checked how it affects > instruction scheduling, especially with `-Os', but I think it's obviously > correct really). OK to apply? > > Maciej > --- > gcc/config/riscv/riscv.md | 2 -- > 1 file changed, 2 deletions(-) > > gcc-riscv-fcmp-length.diff > Index: gcc/gcc/config/riscv/riscv.md > =================================================================== > --- gcc.orig/gcc/config/riscv/riscv.md > +++ gcc/gcc/config/riscv/riscv.md > @@ -231,8 +231,6 @@ > > (eq_attr "got" "load") (const_int 8) > > - (eq_attr "type" "fcmp") (const_int 8) > - > ;; SHIFT_SHIFTs are decomposed into two separate instructions. > (eq_attr "move_type" "shift_shift") > (const_int 8)