From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 1BB293858D32; Tue, 5 Dec 2023 18:54:25 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1BB293858D32 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1701802465; bh=54pfAbAkydkVmqO0qD+Rm9wIYmL0vFHYxDhze8Pv6e8=; h=From:To:Subject:Date:In-Reply-To:References:From; b=yrZ0wjhgoPeR/JsYTsyWk98AcZkSdO+hmTpELn/8InHgpWId5WJ55SEJ8iGLJ9TRj yff1gxM7vRK5x08pJfn5ihefxoFg8aTD0nqVbLQVOo/KT3sWpKS4IELWKZ9Z20fHG6 3bHDUVRffIwqZtF2FkoKbK7DTN+NMU34YIDBjiVk= From: "patrick at rivosinc dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/112855] [14] RISC-V vector: vsetivli clobbers variable value Date: Tue, 05 Dec 2023 18:54:24 +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: patrick at rivosinc 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: short_desc 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=3D112855 Patrick O'Neill changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|[14] RISC-V vector: Appears |[14] RISC-V vector: |to be overwriting stack arg |vsetivli clobbers variable | |value --- Comment #1 from Patrick O'Neill --- lw a5,%lo(b)(a3) load the value of b (100) into a5 vsetivli a5,5,e32,m1,ta,ma clobbers the a5 regsiter which previously held b addiw a1,a5,1 a5 is treated as b (this is the b++ statement) sw a1,%lo(b)(a3) and a1 (a5+1) is stored to b. It appears like the compiler doesn't realize that vsetivli clobbers a5.=