From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 7F7473858CD1; Thu, 22 Feb 2024 07:43:07 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7F7473858CD1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1708587787; bh=Zr2wkld2Y50F4bY5XpQ5axr+Ek7uE+L0Fo7ZIDey3Io=; h=From:To:Subject:Date:In-Reply-To:References:From; b=UbLlWCwswiDL8xJGCZmwU5jJDTBbiWlcMDJHKOo09X2HNFhPnke3MTFXOPYbPEXKz pgnEnh9cjUtiivtpebVSx73XeNx6y0czVR8w3YxWA1tLDPJBo/9Rpx1hRqbBZgYMu+ OUPCiht3V8ER6wzfP2JyK1gpf8JJOAdC7vJTPkJg= From: "pan2.li at intel dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/114027] [14] RISC-V vector: miscompile at -O3 Date: Thu, 22 Feb 2024 07:43:07 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: pan2.li at intel dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D114027 --- Comment #4 from Li Pan --- Just did some hacks from the riscv backend, which is to replace the expandi= ng code of reduc_smax_scal_ to the reduc_xor_scal_. diff --git a/gcc/config/riscv/autovec.md b/gcc/config/riscv/autovec.md index 3b32369f68c..58424baabd7 100644 --- a/gcc/config/riscv/autovec.md +++ b/gcc/config/riscv/autovec.md @@ -2107,10 +2107,8 @@ (define_expand "reduc_smax_scal_" (match_operand:V_VLSI 1 "register_operand")] "TARGET_VECTOR" { - int prec =3D GET_MODE_PRECISION (mode); - rtx min =3D immed_wide_int_const (wi::min_value (prec, SIGNED), mod= e); - riscv_vector::expand_reduction (UNSPEC_REDUC_MAX, riscv_vector::REDUCE_O= P, - operands, min); + riscv_vector::expand_reduction (UNSPEC_REDUC_XOR, riscv_vector::REDUCE_O= P, + operands, CONST0_RTX (mode)); DONE; }) My idea would like to prove that the last standard name should be .REDUC_XO= R. Then the test (include the narrowed and the original one) can pass. That may indicates we take .REDUC_MAX by mistake in somewhere. let me try to figure = it out.=