From patchwork Thu Mar 19 08:53:27 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arjun Salunkhe X-Patchwork-Id: 131944 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from vm01.sourceware.org (localhost [127.0.0.1]) by sourceware.org (Postfix) with ESMTP id A05B74BC89BB for ; Thu, 19 Mar 2026 08:54:37 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A05B74BC89BB Authentication-Results: sourceware.org; dkim=pass (2048-bit key, secure) header.d=proton.me header.i=@proton.me header.a=rsa-sha256 header.s=vpxpj2tqmje2fgccglekjvliiq.protonmail header.b=LvSqQKwX X-Original-To: newlib@sourceware.org Delivered-To: newlib@sourceware.org Received: from mail-24430.protonmail.ch (mail-24430.protonmail.ch [109.224.244.30]) by sourceware.org (Postfix) with ESMTPS id 385034BB5895 for ; Thu, 19 Mar 2026 08:53:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 385034BB5895 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=proton.me Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=proton.me ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 385034BB5895 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=109.224.244.30 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1773910418; cv=none; b=oeKvjItO7ZMAbF/iSbr3Yx/DC0Xto9I5WLQij98U9x7IxDcEkT0xj0rTdYx0ODeDY38yqpXTVVeXS2RrwcuOCnjEt1S1lM3CIVLDlBTtl+7Ranm2j5WLLcUSJZEybwY3gmmxiZoak/F28HnGNdRIUj2dZpwBPhi4mIH/+tfOi2c= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1773910418; c=relaxed/simple; bh=gnRavjgmAD93itGaUXzQnHyZVvfSntDLd8b9hq1J1eM=; h=DKIM-Signature:Date:To:From:Subject:Message-ID:MIME-Version; b=EDu2gLdgd52g9d8zce31REzh4wK+ZmwTlmKXRHJ7zvzV4N3O3K+cMNtWG7bY+IT9hgmhdZAZTyWyHraViVaZKB5J6upJCW8Uaja17wPj7EgPZGgSsOCAxpfdjJT6TmV9zbwPUPeMFotfAKtVxkQH6yvlnb90RUhdRJ9KXqrLw2k= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 385034BB5895 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=proton.me; s=vpxpj2tqmje2fgccglekjvliiq.protonmail; t=1773910410; x=1774169610; bh=ElSYokfiNwmN1pa/cd6MO8foxxwP+RW7WcfDjgAdo5s=; h=Date:To:From:Subject:Message-ID:Feedback-ID:From:To:Cc:Date: Subject:Reply-To:Feedback-ID:Message-ID:BIMI-Selector; b=LvSqQKwX6zjPUYWNnFGiDG3BR4sgpY9AJgDhuD1eUSiqDde69DbyyP2cmJHEh9xZh tMAqZzAVZMsNyzI4WM5rf/ZUZZ4x2lHFQ4cBvkDsh4kP4DAlZYMC3QZSE+v0ql0ilO wVLFV4FXuJ7j9PtiFr0Vj53o5v8R7DkFm6rcZsGazEYeftDy4P330QWUjESLMNVjrl EV7TBS5Sxqf1u7D1fpgd+lXCEDwNbryA9OqNjwMoepnThbVA6alY9vrOc4sayWxw3S EelXKRmVI3LKdPJClpt4aJaW4r4cYEVlbb3xu7sGZzIrW4kjLWyCz9AnXnI6ot168v z3SkGitB0B/jQ== Date: Thu, 19 Mar 2026 08:53:27 +0000 To: "newlib@sourceware.org" From: ethycS Subject: [PATCH] newlib: riscv: Add Zicfilp lpads to asm functions Message-ID: Feedback-ID: 101350064:user:proton X-Pm-Message-ID: 3097719baa9a8040537d30f6d4a4727549a30ab5 MIME-Version: 1.0 X-Spam-Status: No, score=-12.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, KAM_INFOUSMEBIZ, RCVD_IN_DNSWL_BLOCKED, RCVD_IN_HOSTKARMA_W, RCVD_IN_MSPIKE_H5, RCVD_IN_MSPIKE_WL, RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED, SPF_HELO_PASS, SPF_PASS, TXREP, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on sourceware.org X-BeenThere: newlib@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Newlib mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: newlib-bounces~patchwork=sourceware.org@sourceware.org From 8ed7d5f2ad33de425a83eff6b1ad4d8c1a0a1108 Mon Sep 17 00:00:00 2001 From: Arjun Salunkhe Date: Thu, 19 Mar 2026 13:50:54 +0530 Subject: [PATCH] newlib: riscv: Add Zicfilp lpads to asm functions Adds `lpad 0` instructions, guarded by `#if __riscv_zicfilp`, to the RISC-V assembly memory, setjmp and string functions. Signed-off-by: Arjun Salunkhe Signed-off-by: Arjun Salunkhe --- newlib/libc/machine/riscv/memcpy-asm.S | 4 ++++ newlib/libc/machine/riscv/memmove-asm.S | 4 ++++ newlib/libc/machine/riscv/memset.S | 4 ++++ newlib/libc/machine/riscv/setjmp.S | 6 ++++++ newlib/libc/machine/riscv/strcmp.S | 4 ++++ 5 files changed, 22 insertions(+) diff --git a/newlib/libc/machine/riscv/memcpy-asm.S b/newlib/libc/machine/riscv/memcpy-asm.S index 2771285f9..c3d12fca7 100644 --- a/newlib/libc/machine/riscv/memcpy-asm.S +++ b/newlib/libc/machine/riscv/memcpy-asm.S @@ -14,6 +14,10 @@ .global memcpy .type memcpy, @function memcpy: +#if __riscv_zicfilp + lpad 0 +#endif + mv a3, a0 beqz a2, 2f diff --git a/newlib/libc/machine/riscv/memmove-asm.S b/newlib/libc/machine/riscv/memmove-asm.S index 061472ca2..6fb6f6e91 100644 --- a/newlib/libc/machine/riscv/memmove-asm.S +++ b/newlib/libc/machine/riscv/memmove-asm.S @@ -14,6 +14,10 @@ .global memmove .type memmove, @function memmove: +#if __riscv_zicfilp + lpad 0 +#endif + beqz a2, .Ldone /* in case there are 0 bytes to be copied, return immediately */ mv a4, a0 /* copy the destination address over to a4, since memmove should return that address in a0 at the end */ diff --git a/newlib/libc/machine/riscv/memset.S b/newlib/libc/machine/riscv/memset.S index 533f66758..b922c7b6e 100644 --- a/newlib/libc/machine/riscv/memset.S +++ b/newlib/libc/machine/riscv/memset.S @@ -50,6 +50,10 @@ memset: +#if __riscv_zicfilp + lpad 0 +#endif + #if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__) mv a3, a0 beqz a2, .Ldone diff --git a/newlib/libc/machine/riscv/setjmp.S b/newlib/libc/machine/riscv/setjmp.S index f2b50537e..170928a63 100644 --- a/newlib/libc/machine/riscv/setjmp.S +++ b/newlib/libc/machine/riscv/setjmp.S @@ -15,6 +15,9 @@ .globl setjmp .type setjmp, @function setjmp: +#if __riscv_zicfilp + lpad 0 +#endif REG_S ra, 0*SZREG(a0) #if __riscv_xlen == 32 && (__riscv_zilsd) && (__riscv_misaligned_fast) sd s0, 1*SZREG(a0) @@ -70,6 +73,9 @@ setjmp: .globl longjmp .type longjmp, @function longjmp: +#if __riscv_zicfilp + lpad 0 +#endif REG_L ra, 0*SZREG(a0) #if __riscv_xlen == 32 && (__riscv_zilsd) && (__riscv_misaligned_fast) ld s0, 1*SZREG(a0) diff --git a/newlib/libc/machine/riscv/strcmp.S b/newlib/libc/machine/riscv/strcmp.S index 0b1dfc4b1..e5d75abe9 100644 --- a/newlib/libc/machine/riscv/strcmp.S +++ b/newlib/libc/machine/riscv/strcmp.S @@ -15,6 +15,10 @@ .globl strcmp .type strcmp, @function strcmp: +#if __riscv_zicfilp + lpad 0 +#endif + #if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__) .Lcompare: lbu a2, 0(a0)