From patchwork Sun Nov 19 05:42:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Maciej W. Rozycki" X-Patchwork-Id: 1865651 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=embecosm.com header.i=@embecosm.com header.a=rsa-sha256 header.s=google header.b=Ror//xOd; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4SY00715YKz1yRg for ; Sun, 19 Nov 2023 16:42:31 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D5CD53858418 for ; Sun, 19 Nov 2023 05:42:27 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org 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 99A7838582AC for ; Sun, 19 Nov 2023 05:42:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 99A7838582AC Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=embecosm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=embecosm.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 99A7838582AC Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::631 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700372538; cv=none; b=I02z3Y4RxVyW2/+xO2kpzrhp4honGxnjq0SRLOAQUR0lTuRKsNMY5WR+H+8qRn19kutYi4bqEQ9KCWW1e0uzqRcKTr/qhkaQlcOHhlN7e4Ad2CG/tYz/6KmWBiZtESA/oiNqWR3RyvssH/E2YXZmG7NFipFj7MKLejWt51MHzOQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700372538; c=relaxed/simple; bh=0oeAcOqmZ1DV2kcVPHOg0SvA13KaFlu7BpqcuMkGiYA=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=NUcx9Rifjsx5cSbTkGRdbKiuR0QSBWPb8c+oI/5N56FgcGImLZekPLcJYMy+jJ1x0ftIhIWVc4YD/uRgtuVLaEWbCMyLPCZSfsNLwhtIP2zVSHlJpIb98D9r2eQKybnvZpbh0qG2QXMpSgE8x1Nvpxfq0s6/ckFFwh/l6kpY5mo= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-ej1-x631.google.com with SMTP id a640c23a62f3a-9db6cf8309cso435863966b.0 for ; Sat, 18 Nov 2023 21:42:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; t=1700372535; x=1700977335; darn=gcc.gnu.org; h=mime-version:user-agent:references:message-id:in-reply-to:subject :cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=C3UwKJkUEpp5yGdGyQXasV6+qCwwP6V4FEWcQO9m2bA=; b=Ror//xOdnWABmtUqTF3uH4WWl/5CezpAgw8+JHTWqqt5WZiJ4MN+iJm/fl28zWaMyp Yz+R+LtjiS4CSOqRUhziSxrRJI/Q59VrAR8vVbZ2azyyV01iRdogmvEjZuj7iGfXZn2F LNn90xOE5KW5sFO12lfGUDjTM7sYFaf/P77I/9EK1mDQmlnVM62mgacw6nTBhUsU6CUF mQhzj70d4hTu+ZPWqLZyGVBtblrNxZM0I/VF+5w1nfrlGaaSsVH6xf41iBcKrPi6ZqB4 IU/xW5rhyKwdKIM7velSTnmQdMBzVd5eq9L/2v6ep2DSDoLCrdR78PtwhAllWmWFGErw fQgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700372535; x=1700977335; h=mime-version:user-agent:references:message-id:in-reply-to:subject :cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=C3UwKJkUEpp5yGdGyQXasV6+qCwwP6V4FEWcQO9m2bA=; b=cDJwKvJWL7EB4JogG9aWXc1sT4mDf5NjVL0GHpkhMZ1YzGk8Ag3uZzDcmmc62kAAnr ZT+00rzn6RF4oIXjujJt+VnqWmq+ehLe+3tPt7V03S+ccfwLb9MiUhxIvo1cs7oPRZ/B Y06csMVG091Cxahl5ZEMS1dz6Ao1iulkq1A9Xd36XZN/ozkZrcEIZSKIoLGAJDdhrPva KKOYx+ZGJS1fhKHCI/XewG3KLNarEmb9ZmpDLaztWMtfgn5knwS5atAZkaAwVY9cPren nae1fqrdNK4tPUNZL4P6SduG4xnkJqPxrTPynLpH3T1JRAK865LdfkJZynHybQV6YS+S 6bRw== X-Gm-Message-State: AOJu0Yx0c3VhgKNbs9VxsNg7Azt79399RcVGYf70DGkbHD88ix4SdKkC mdY45zwoyDccrEW4nEo4T7zpqgXTDYLIJJ5Q/sBOLg== X-Google-Smtp-Source: AGHT+IHciQenAdylQrwUDFefi+zktXIvZzfdre+QnfwG/YympczxHGFDAJKEvEQPiLe5oJPSm3XbPQ== X-Received: by 2002:a17:906:170c:b0:9a5:9f3c:9615 with SMTP id c12-20020a170906170c00b009a59f3c9615mr2926873eje.63.1700372535456; Sat, 18 Nov 2023 21:42:15 -0800 (PST) Received: from [192.168.219.3] ([78.8.192.131]) by smtp.gmail.com with ESMTPSA id g15-20020a170906538f00b0099ce025f8ccsm2528674ejo.186.2023.11.18.21.42.14 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 18 Nov 2023 21:42:15 -0800 (PST) Date: Sun, 19 Nov 2023 05:42:13 +0000 (GMT) From: "Maciej W. Rozycki" To: gcc-patches@gcc.gnu.org cc: Andrew Waterman , Jim Wilson , Kito Cheng , Palmer Dabbelt Subject: [PATCH 33/44] RISC-V: Also allow FP conditions in `riscv_expand_conditional_move' In-Reply-To: Message-ID: References: User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE, URIBL_BLACK autolearn=no 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.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org In `riscv_expand_conditional_move' we only let integer conditions through at the moment, even though code has already been prepared to handle floating-point conditions as well. Lift this restriction and only bail out if a non-word-mode integer condition has been requested, as we cannot handle this specific case owing to machine instruction set restriction. We already take care of the non-integer, non-floating-point case later on. gcc/ * config/riscv/riscv.cc (riscv_expand_conditional_move): Don't bail out in floating-point conditions. --- gcc/config/riscv/riscv.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) gcc-riscv-expand-conditional-move-fp.diff Index: gcc/gcc/config/riscv/riscv.cc =================================================================== --- gcc.orig/gcc/config/riscv/riscv.cc +++ gcc/gcc/config/riscv/riscv.cc @@ -4109,12 +4109,12 @@ riscv_expand_conditional_move (rtx dest, machine_mode mode0 = GET_MODE (op0); machine_mode mode1 = GET_MODE (op1); - /* The comparison must be comparing WORD_MODE objects. We must - enforce that so that we don't strip away a sign_extension + /* An integer comparison must be comparing WORD_MODE objects. We + must enforce that so that we don't strip away a sign_extension thinking it is unnecessary. We might consider using riscv_extend_operands if they are not already properly extended. */ - if ((mode0 != word_mode && mode0 != VOIDmode) - || (mode1 != word_mode && mode1 != VOIDmode)) + if ((INTEGRAL_MODE_P (mode0) && mode0 != word_mode) + || (INTEGRAL_MODE_P (mode1) && mode1 != word_mode)) return false; /* In the fallback generic case use MODE rather than WORD_MODE for