From patchwork Sun Nov 19 05:42:01 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: 166706 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9910:0:b0:403:3b70:6f57 with SMTP id i16csp1506507vqn; Sat, 18 Nov 2023 21:43:36 -0800 (PST) X-Google-Smtp-Source: AGHT+IEa0mTx79Y1A91ixBXsb31ONfR2tIWu5oZkpyoPLUUy+W+GOZ3FQvGTYIQDSHvKlPHSUfXI X-Received: by 2002:a05:620a:1113:b0:775:73f6:1b39 with SMTP id o19-20020a05620a111300b0077573f61b39mr3774581qkk.25.1700372616008; Sat, 18 Nov 2023 21:43:36 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1700372615; cv=pass; d=google.com; s=arc-20160816; b=SbhVtmrSXyJqMegx9PnxuF4I6YjR/G2VvSdv27HogN0mirfHwQLZIB4zfaoFCxgPCE tWoUjTt9ihWXghLwgsF9BN40fCGRYse3iwwcbkDy4xJWh8k4jm3aiHdp8/W5ZAcuL1Sp UCfND7519npS+NcR6HehBEN9HiQppH+pinDNoa7NAdWQGj46epieetjMD/GkaN/p+Mmw VSDwe7v2HXEVRs6jJYge/xpcf3lx08VmusqZDb6ucAuQvpMSzNzDeQBBW4rs6fagRnEv y4FvxivuLQ6LzB2iQgB7czvL7fDxb8ZCdFV2mUBZ4UBe4Bguf7/K3Ti3d+t/ccFcF4xr 0v/A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:mime-version:user-agent :references:message-id:in-reply-to:subject:cc:to:from:date :dkim-signature:arc-filter:dmarc-filter:delivered-to; bh=IHiDSe6k13+UCxLMdZ2AUiFd5tNFwlo8zmS6YX7mjFg=; fh=dp1z4I3tVhinwswv7IAFxpunWK+Ws/fGQfmox9vHv3I=; b=DPZ6FmC2Nich/Jq5bM7Lq/9tJ6NvK9NxJS6PLVxRaiUiF7uMKC9cEqHGFakK9kzOmv KUrwdadZDxkKcFiW+9/zJl6AOb1+pTe4oFqCAEckVgtdrmDumEbCzk1KH2vrP7nZdA5b Tyu7F9s81d1zCXq5Vciz8B/o95xjiaiF7jY/C1kvM6dZQFPh+wp1iXDdCm/Q0S8V3fhI e2vu7yjzGjajXY14tW0sWKpftsXDWElhDkrvC1v/m4aDHohHroHVvreJiBA0fuQaw6p/ /C9664k2YzCdahoawxISfCx8KyHhA3TwvjjtGzQbJ4TN7c1NoSieZ+MfAExCuz4OcmaY EFnQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@embecosm.com header.s=google header.b=cI15e8ow; arc=pass (i=1); 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 (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id bj7-20020a05620a190700b00774184acfeesi5018591qkb.297.2023.11.18.21.43.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Nov 2023 21:43:35 -0800 (PST) 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=@embecosm.com header.s=google header.b=cI15e8ow; arc=pass (i=1); 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 8B568385C33F for ; Sun, 19 Nov 2023 05:43:26 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-ed1-x533.google.com (mail-ed1-x533.google.com [IPv6:2a00:1450:4864:20::533]) by sourceware.org (Postfix) with ESMTPS id 0298F3858D37 for ; Sun, 19 Nov 2023 05:42:05 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0298F3858D37 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 0298F3858D37 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::533 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700372527; cv=none; b=DogebzXnXS3b/CzbVBkzfRa6RDp67djeYZIffNW4kmq1QSjGG8amQWZIE5AE3oy/fNGEeomSpMM18D64y+n+GbGOYykGC2Vv3Ms3B35eRkv7faoqVjAMks27uq/RSTmr277T3LJwSYNt5uPsaHG+YPnNn3JSG7scg/vgzY+L1AM= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700372527; c=relaxed/simple; bh=TVcG3RrVfixIqzsRW/TQoCyzXOC4oT5U7gRnW4leEZo=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=Qhiz8rOa+mBmGvBqzOZJLOeb6jJ926EDKTu7AiyGiwCsJu1VGnfwb7TQE1/iPX0GVW19H0Tkmys4pgoKAy/FSeMIHd8XnwYY1GRPmCxYYhxBsJeHMc/R9IZozmUFdkeqpjpuCN8sriHvNrplMoQHS36UuP3U4OR3ewcHM8ffwfY= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-ed1-x533.google.com with SMTP id 4fb4d7f45d1cf-5437d60fb7aso4828351a12.3 for ; Sat, 18 Nov 2023 21:42:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; t=1700372524; x=1700977324; 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=IHiDSe6k13+UCxLMdZ2AUiFd5tNFwlo8zmS6YX7mjFg=; b=cI15e8owzuXPsq0c9pddEGe0+vKqkz8MTi+UECJZBqMYG2FuTgNifMDSX63/uDaNii BCGzzmfKYZMtI1J2e17b3jBanL0mgdxGLNsxo6jTtmXueaGyv8JP46ntXWKievT5FddC sAjVs1FUXhc+x9EdeDu/1HlJul0kJscyYn0FomtQ5TgGQJXV16V8CjgzUOiinYtnO8UA QJx6Mvx0B2v3XA3xOC00+03amoCHjPAxsEoEYbhO71NXcYQntL851COVaQG1dnM+C5wt XGczsaEFgJ3rhiCylbhHlVOFN58L/nuEY2k5GQVwSMvUxwxCdktgW4mbD78r8/yMtd1K iCnw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700372524; x=1700977324; 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=IHiDSe6k13+UCxLMdZ2AUiFd5tNFwlo8zmS6YX7mjFg=; b=Cx33Z98XB9SOsOaM2g49uFouXTeN48Tigtyw6GUJ9pT3EwvfCp5UObGOy64OFWsen+ 3yiQ3xAAlPc/B/S2WzwUPHKP28iXiePXqW8wvv+uSZ+2q8fkXw2FnHEvYki4IeL/PC5v w5wsP9g7twr97SnsbKLgn6ZB+T6PH3kbO20vCcQEs1OFlyN5gOf46Uxyih2cPJsjvNXr McMHJNkPS5nppt8xanADcrHjZ9dyB9/UrF+hXTr5AA8CB4urzaZV7U99oj8UCREBUtHL 1tYjAfaLJa2pZ/IPRWIBtjPlYVrFO6bL6jGdfuilDKBUrzpVuZhLHDhCM4KQRNgjQ1/o ANrQ== X-Gm-Message-State: AOJu0YxyC5sssAwiKlmP/cPmy3fFM9CwlscDlTfXZf8jh55XunEh7rKG 05A0zFxTSszzHsz4guHGLhnBX7xnAhpoYaPZ5EAFhQ== X-Received: by 2002:a17:906:738d:b0:9c7:5186:de1a with SMTP id f13-20020a170906738d00b009c75186de1amr3163869ejl.8.1700372523871; Sat, 18 Nov 2023 21:42:03 -0800 (PST) Received: from [192.168.219.3] ([78.8.192.131]) by smtp.gmail.com with ESMTPSA id c5-20020a170906694500b009e6624afecbsm2545629ejs.63.2023.11.18.21.42.02 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 18 Nov 2023 21:42:03 -0800 (PST) Date: Sun, 19 Nov 2023 05:42:01 +0000 (GMT) From: "Maciej W. Rozycki" To: gcc-patches@gcc.gnu.org cc: Andrew Waterman , Jim Wilson , Kito Cheng , Palmer Dabbelt Subject: [PATCH 32/44] RISC-V: Only use SUBREG if applicable in `riscv_expand_float_scc' 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+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782969916190529304 X-GMAIL-MSGID: 1782969916190529304 A subsequent change to enable the processing of conditional moves on a floating-point condition by `riscv_expand_conditional_move' will cause `riscv_expand_float_scc' to be called for word-mode target RTX with RV64 targets. In that case an invalid insn such as: (insn 25 24 0 (set (reg:DI 141) (subreg:SI (reg:DI 143) 0)) -1 (nil)) would be produced, which would crash the compiler later on. Since the output operand of the SET operation to be produced already has the same mode as the input operand does, just omit the use of SUBREG and assign directly. gcc/ * config/riscv/riscv.cc (riscv_expand_float_scc): Suppress the use of SUBREG if the conditional-set target is word-mode. --- gcc/config/riscv/riscv.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) gcc-riscv-expand-float-scc-subreg.diff Index: gcc/gcc/config/riscv/riscv.cc =================================================================== --- gcc.orig/gcc/config/riscv/riscv.cc +++ gcc/gcc/config/riscv/riscv.cc @@ -4071,7 +4071,9 @@ riscv_expand_float_scc (rtx target, enum riscv_emit_float_compare (&code, &op0, &op1); rtx cmp = riscv_force_binary (word_mode, code, op0, op1); - riscv_emit_set (target, lowpart_subreg (SImode, cmp, word_mode)); + if (GET_MODE (target) != word_mode) + cmp = lowpart_subreg (GET_MODE (target), cmp, word_mode); + riscv_emit_set (target, cmp); } /* Jump to LABEL if (CODE OP0 OP1) holds. */