From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oi1-x22a.google.com (mail-oi1-x22a.google.com [IPv6:2607:f8b0:4864:20::22a]) by sourceware.org (Postfix) with ESMTPS id 2F50A3858D28 for ; Wed, 20 Mar 2024 18:57:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 2F50A3858D28 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 2F50A3858D28 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::22a ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1710961031; cv=none; b=fNnJfc03yIzV6sBLmGbrEdNaW+5XhXOUUPWyu59Ky1oeBjtuuike9mS5HsiTPfbSX/GoB6TmcWxrgDnYPeexXbi8B2dHQ/81fhfV8fYEW8O4dHva4I98xYWrT4zJ8LBn5yesNbEH4QPHbHJwcKMnt9UmKaep7/ThGXpj9CGeqYs= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1710961031; c=relaxed/simple; bh=PLGNzJle1cBW8Dq+PC3a1Ky9qiyYZdL+a8jImorMOE4=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=xyz3m6jmi6ulceBj60G6W8PB+7FvCKvp1Hojl5GwgViSXTxMmGKcTqIlSwWx/52bD1v404wb5Hp/XFJ3sWusfnzjGB+hs1eF/AuXkn2+TG7Qh98CVDsnwxoFyNDCl7P4SM7UiL6ul1dFekH5vH+yxnhUuj5MVwtP5o6zhUa3e7U= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-oi1-x22a.google.com with SMTP id 5614622812f47-3c3915a7afaso162684b6e.2 for ; Wed, 20 Mar 2024 11:57:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710961029; x=1711565829; darn=gcc.gnu.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=JtGK0IT0yeyOVECkfQimwFz1BDq5vDqJYfuomdCRn0s=; b=bor6ohIE8T4RqO0YMy9KzwiRCmD680HECoiNZ8z1uVytZOGKfTfIADfFie9kNDX1W3 ZYKzUovpWzZNUXIU//7hz3VY/Ec8jUi+QUApoa6iFZ0h/hWlGC42KDoYcnCu4uV65QD1 UTreY8Djxo51coZUomLlycuk2mw4ISFrxwh/mhl4QpB8HH16KOIy7Y/6XWxtEisemgYu 4cXZSlD9TLdFWvGMFMwcgma7C+nn7aBF0PifOccmyB6XqPVbECbaIYThW5PqKpdk8dN2 WE0naNuEktQF1sb4QD5YCy/956T1LQtJIcLNDtlRhVzCc1dcH6IP4vG0sKtEPZ4EuBWN CVxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710961029; x=1711565829; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=JtGK0IT0yeyOVECkfQimwFz1BDq5vDqJYfuomdCRn0s=; b=VYSc0ELpPuwW+/AqDI4uUOiq6PfphgAHC2nrTutqE9bYbsi5bsxpc+Lq8OSk2anjhG r1h1LLimFXqQU0LguiyTXR28yh+14THH9rYDzG1Ir6F31430b6NTK1aomw6ojsMg3b5o zwfS0nF8zvjiEl2flpR1QheVZoBMs9sp9/dI8NgFuCY/dgH9S2A/Am/d6gl8LsCk64x1 laDqnKZSCAx+UicKwSMY7MEJadDIBzPHVJQk3HyjF18/HrrJ0PQZ8U2QZ9DCGX8KSL11 0QvDFouOgKhghrLalyP9rnkjm34ltKmIuqQjqFK/4u3V3ZADSUkrrLB1E0R75oqUz+fr O2ig== X-Gm-Message-State: AOJu0YzjkbQ72pos9YPBAvUgpX1DCUwO7ah0Bm/UxSiG8zXNXkJxYz3X f60+bxllCX5a0h4B2hygCZUm0+Vag8PUnrQm/HUGm4Sd3E8iEx8s7Wtlv8ley8M= X-Google-Smtp-Source: AGHT+IFl8m1Oom0KFvS1v3HyZs9TMLjhXkBxTNc+XEQGb4Y4A/X4SXNU9CcdJ7vzXRNYIbB0weQpxA== X-Received: by 2002:a05:6808:170e:b0:3c2:5517:f3b3 with SMTP id bc14-20020a056808170e00b003c25517f3b3mr21403491oib.22.1710961029497; Wed, 20 Mar 2024 11:57:09 -0700 (PDT) Received: from [172.31.0.109] ([136.36.72.243]) by smtp.gmail.com with ESMTPSA id n6-20020aca2406000000b003c217ca1cdfsm2414470oic.47.2024.03.20.11.57.08 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 20 Mar 2024 11:57:09 -0700 (PDT) Message-ID: Date: Wed, 20 Mar 2024 12:57:07 -0600 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Beta Subject: Re: [gcc-15 2/3] RISC-V: avoid LUI based const mat: keep stack offsets aligned Content-Language: en-US To: Vineet Gupta , Andrew Waterman Cc: gcc-patches@gcc.gnu.org, kito.cheng@gmail.com, Palmer Dabbelt , gnu-toolchain@rivosinc.com, Robin Dapp References: <20240316173524.1147760-1-vineetg@rivosinc.com> <20240316173524.1147760-3-vineetg@rivosinc.com> <78474b71-f605-490d-95d5-9c6a7a162f75@rivosinc.com> <9d5ce8dd-26c3-4bcd-ba35-a44546b64db4@rivosinc.com> From: Jeff Law In-Reply-To: <9d5ce8dd-26c3-4bcd-ba35-a44546b64db4@rivosinc.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.4 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 List-Id: On 3/19/24 2:05 PM, Vineet Gupta wrote: >> Just to be clear, the changes don't misalign the stack pointer at all. >> They merely have the potential to create *another* pointer into the >> stack which may or may not be aligned. Which is totally normal, it's no >> different than taking the address of a char on the stack. > > Right I never saw any sp,sp,2047 getting generated - not even in the > first version of patch which lacked any filtering of stack regs via > riscv_reg_frame_related () and obviously didn't have the stack variant > of splitter. I don't know if that is just being lucky and not enough > testing exposure (I only spot checked buildroot libc, vmlinux) or > something somewhere enforces that. > > However given that misaligned pointer off of stack is a non-issue, I > think we can do the following: > > 1. keep just one splitter with 2047 based predicates and constraint (and > not 2032) for both stack-related and general regs. > 2. gate the splitter on only operands[0] being not stack related > (currently it checks for either [0] or [1]) - this allows the prominent > case where SP is simply a src, and avoids when any potential shenanigans > to SP itself. Works for me. Jeff