From patchwork Mon Jul 22 19:38:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?R=C3=A9mi_Denis-Courmont?= X-Patchwork-Id: 50692 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a59:a742:0:b0:482:c625:d099 with SMTP id f2csp2222360vqm; Mon, 22 Jul 2024 12:38:40 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXQWHAus8uGaSnCFEmug6ANmb1D4D1A/3xkKSsm48Oc9MY/PN3MeM2Qk0Z4dc4K06bTZ2aPvKOvv1hiY53zqxS+lV0+xUKB50AH4w== X-Google-Smtp-Source: AGHT+IGwaCOb130nzSDhIfY32pY/NA3PGkSPYh02baFLtWrDn8EyaHi1XE3Y5CG/A5cUTeVAJZ0M X-Received: by 2002:a05:6512:10c2:b0:52c:e3ad:3fbf with SMTP id 2adb3069b0e04-52efb7c8891mr5472498e87.42.1721677120592; Mon, 22 Jul 2024 12:38:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1721677120; cv=none; d=google.com; s=arc-20160816; b=zeRcKzBsYQXeyGuE0mw+bZkTi6AhrsdfJC5oEQ1aGSFzPZIJzLT1XreJCUJmOl8m8z t29bRgzhGQBJ1+TJlgt61ypvXh04pITRAPSI4GD+3fuSVFEHjC4Y5BwjFiBI5yrhmuI7 +QG1QV9Jt5MzGaHl9L5EdTztczGSNVigI9t5U/XpCeH5U7czvfFoLjvpdQsND0x8/x0R Pe8Fx4ayknmOfTEt9ikXqtdurhTEr2ITlNiP06z4w1Z5/Q7eqnI4ygi0t77ilMowD38j dINRIEQkoXKKGZLYpel6SnJfqlKMA1uA3tO8P/f0OG8lhcPoMiNgWYos60ay6nNtx6c7 l+4Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:delivered-to; bh=aaq9fUHT5DXfyFBOZw+5u/K/rd+A7eXp6VmU78Fi2iQ=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=I7wbjpT1uK2rqwMGSVPgv/evbmw35GAOWfzRS63FkvhZJAOQsfoeYx7kZP5QazsiN8 kKPw4oz1MA2CNCU6nV3XpooqUbl/TWvaLiYi+gt297aBmrbD/A25+5Els1cIcBJ5VoKX 3QNu8LgM2xgCB5Mq4df+MMq/ew1nduI+tL9NHsEyQwmaayYjfhXe0fR5NPztsmWFH71t Ubux/DSqW4k3gfZIdgtZezl4PSsaAlaxIdEnPi5gUjRhvCAeVNF5SEgS20DGTUiyFpSk 2KFJoVHsU5jfoK/MaOgc9ljGAPUdmTAD9l3OxPKYpoVcaLLUGZrcdBhOXlSG49wn1RZY iN/w==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id 2adb3069b0e04-52fc5f0e81csi5073e87.535.2024.07.22.12.38.40; Mon, 22 Jul 2024 12:38:40 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 186F868D692; Mon, 22 Jul 2024 22:38:27 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from ursule.remlab.net (vps-a2bccee9.vps.ovh.net [51.75.19.47]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id F305168D4C1 for ; Mon, 22 Jul 2024 22:38:18 +0300 (EEST) Received: from basile.remlab.net (localhost [IPv6:::1]) by ursule.remlab.net (Postfix) with ESMTP id 906E3C0186 for ; Mon, 22 Jul 2024 22:38:18 +0300 (EEST) From: =?utf-8?q?R=C3=A9mi_Denis-Courmont?= To: ffmpeg-devel@ffmpeg.org Date: Mon, 22 Jul 2024 22:38:14 +0300 Message-ID: <20240722193818.50824-2-remi@remlab.net> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240722193818.50824-1-remi@remlab.net> References: <20240722193818.50824-1-remi@remlab.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 2/6] lavu/riscv: add forward-edge CFI landing pads X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: dIh/8LAJGVvp --- libavutil/riscv/fixed_dsp_rvv.S | 6 ++++++ libavutil/riscv/float_dsp_rvv.S | 12 ++++++++++++ libavutil/riscv/lls_rvv.S | 1 + 3 files changed, 19 insertions(+) diff --git a/libavutil/riscv/fixed_dsp_rvv.S b/libavutil/riscv/fixed_dsp_rvv.S index 6bac5813b8..7a872f7763 100644 --- a/libavutil/riscv/fixed_dsp_rvv.S +++ b/libavutil/riscv/fixed_dsp_rvv.S @@ -21,6 +21,7 @@ #include "asm.S" func ff_vector_fmul_window_scaled_rvv, zve64x + lpad 0 csrwi vxrm, 0 vsetvli t0, zero, e16, m1, ta, ma sh2add a2, a4, a2 @@ -69,6 +70,7 @@ func ff_vector_fmul_window_scaled_rvv, zve64x endfunc func ff_vector_fmul_window_fixed_rvv, zve64x + lpad 0 csrwi vxrm, 0 vsetvli t0, zero, e16, m1, ta, ma sh2add a2, a4, a2 @@ -113,6 +115,7 @@ func ff_vector_fmul_window_fixed_rvv, zve64x endfunc func ff_vector_fmul_fixed_rvv, zve32x + lpad 0 csrwi vxrm, 0 1: vsetvli t0, a3, e32, m4, ta, ma @@ -156,6 +159,7 @@ func ff_vector_fmul_reverse_fixed_rvv, zve32x endfunc func ff_vector_fmul_add_fixed_rvv, zve32x + lpad 0 csrwi vxrm, 0 1: vsetvli t0, a4, e32, m8, ta, ma @@ -176,6 +180,7 @@ func ff_vector_fmul_add_fixed_rvv, zve32x endfunc func ff_scalarproduct_fixed_rvv, zve64x + lpad 0 li t1, 1 << 30 vsetvli t0, zero, e64, m8, ta, ma vmv.v.x v8, zero @@ -199,6 +204,7 @@ endfunc // (a0) = (a0) + (a1), (a1) = (a0) - (a1) [0..a2-1] func ff_butterflies_fixed_rvv, zve32x + lpad 0 1: vsetvli t0, a2, e32, m4, ta, ma vle32.v v16, (a0) diff --git a/libavutil/riscv/float_dsp_rvv.S b/libavutil/riscv/float_dsp_rvv.S index 2f0ade6db6..e738268549 100644 --- a/libavutil/riscv/float_dsp_rvv.S +++ b/libavutil/riscv/float_dsp_rvv.S @@ -22,6 +22,7 @@ // (a0) = (a1) * (a2) [0..a3-1] func ff_vector_fmul_rvv, zve32f + lpad 0 1: vsetvli t0, a3, e32, m8, ta, ma vle32.v v16, (a1) @@ -39,6 +40,7 @@ endfunc // (a0) += (a1) * fa0 [0..a2-1] func ff_vector_fmac_scalar_rvv, zve32f + lpad 0 NOHWF fmv.w.x fa0, a2 NOHWF mv a2, a3 1: @@ -58,6 +60,7 @@ endfunc // (a0) = (a1) * fa0 [0..a2-1] func ff_vector_fmul_scalar_rvv, zve32f + lpad 0 NOHWF fmv.w.x fa0, a2 NOHWF mv a2, a3 1: @@ -74,6 +77,7 @@ NOHWF mv a2, a3 endfunc func ff_vector_fmul_window_rvv, zve32f + lpad 0 // a0: dst, a1: src0, a2: src1, a3: window, a4: length // e16/m2 and e32/m4 are possible but slower due to gather. vsetvli t0, zero, e16, m1, ta, ma @@ -114,6 +118,7 @@ endfunc // (a0) = (a1) * (a2) + (a3) [0..a4-1] func ff_vector_fmul_add_rvv, zve32f + lpad 0 1: vsetvli t0, a4, e32, m8, ta, ma vle32.v v8, (a1) @@ -134,6 +139,7 @@ endfunc // TODO factor vrsub, separate last iteration? // (a0) = (a1) * reverse(a2) [0..a3-1] func ff_vector_fmul_reverse_rvv, zve32f + lpad 0 // e16/m4 and e32/m8 are possible but slower due to gather. vsetvli t0, zero, e16, m1, ta, ma sh2add a2, a3, a2 @@ -160,6 +166,7 @@ endfunc // (a0) = (a0) + (a1), (a1) = (a0) - (a1) [0..a2-1] func ff_butterflies_float_rvv, zve32f + lpad 0 1: vsetvli t0, a2, e32, m8, ta, ma vle32.v v16, (a0) @@ -178,6 +185,7 @@ endfunc // a0 = (a0).(a1) [0..a2-1] func ff_scalarproduct_float_rvv, zve32f + lpad 0 vsetvli t0, zero, e32, m8, ta, ma vmv.v.x v8, zero vmv.s.x v0, zero @@ -200,6 +208,7 @@ endfunc // (a0) = (a1) * (a2) [0..a3-1] func ff_vector_dmul_rvv, zve64d + lpad 0 1: vsetvli t0, a3, e64, m8, ta, ma vle64.v v16, (a1) @@ -217,6 +226,7 @@ endfunc // (a0) += (a1) * fa0 [0..a2-1] func ff_vector_dmac_scalar_rvv, zve64d + lpad 0 NOHWD fmv.d.x fa0, a2 NOHWD mv a2, a3 1: @@ -235,6 +245,7 @@ endfunc // (a0) = (a1) * fa0 [0..a2-1] func ff_vector_dmul_scalar_rvv, zve64d + lpad 0 NOHWD fmv.d.x fa0, a2 NOHWD mv a2, a3 1: @@ -251,6 +262,7 @@ NOHWD mv a2, a3 endfunc func ff_scalarproduct_double_rvv, zve64f + lpad 0 vsetvli t0, zero, e64, m8, ta, ma vmv.v.x v8, zero vmv.s.x v0, zero diff --git a/libavutil/riscv/lls_rvv.S b/libavutil/riscv/lls_rvv.S index a36055bd7a..bd9f74ee5f 100644 --- a/libavutil/riscv/lls_rvv.S +++ b/libavutil/riscv/lls_rvv.S @@ -21,6 +21,7 @@ #include "asm.S" func ff_lls_update_covariance_rvv, zve64d, zbb + lpad 0 vtype_vli t0, a2, t1, e64, ta, ma vsetvl zero, a2, t0 vle64.v v8, (a1)