From patchwork Mon Oct 3 15:06:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?R=C3=A9mi_Denis-Courmont?= X-Patchwork-Id: 38540 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:3b1c:b0:96:9ee8:5cfd with SMTP id c28csp1376432pzh; Mon, 3 Oct 2022 08:06:56 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4F0MF4JqokLATF/o99GaKAujK9Y5ckSLtezsE75Evn8FHCom1rZBE/GLJ25MpCf/qjsj7A X-Received: by 2002:a17:907:847:b0:77f:f489:cc25 with SMTP id ww7-20020a170907084700b0077ff489cc25mr15250682ejb.80.1664809616189; Mon, 03 Oct 2022 08:06:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664809616; cv=none; d=google.com; s=arc-20160816; b=wtpDahqzskAJQbOELcjZuF3TJ4s07FL8pv/OV4HLOzqTgCOq4VP0vH0yIt9jpQdPS4 4t3/Rcu76Qc3sny75ickArHWPZbr19WaZoV+AWWThBDJ0EP51sGg2/a9xomgFNHuAH2/ ryNPnDH8qhMxgcBhATO/kH/TMv0ADfbgW8SAnerpY+XNhHDJw0gNnu3x4DStwvWD5TdB NkBU9tMdviWr7gzz/ceODz8qa+WtZawwIufLWQiD1ftdLairxnuwcUMbgoWvHMypOHxv 5yYx6aiSHrEE461zwpu64PrpuGWb6q42bmoDfTDyW2Qn0LLMcXw2oA7CUBy8pL9gR0U/ u5AA== 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:message-id:date:to:from :delivered-to; bh=ENHrOddzIE0yUvmJQ9f5oV9vsgQ2FKAfjMHtMdIQLdU=; b=VAPkFHUxVgu8TqX9A7pJfZV+xvZdLloaLaGzBwTMhp+hP2huQkZqHypfIv3Ii7YFzk 8Kor78ei7SGj2++P8426S3ZClJ5fsVKjcw/SozWDx1VSvS+1ntl0slrBg4zT+DJOoZW/ h/PpN7APxmJ3oimRZP4lZI4R9mJ4bkjmjlj3qjCktrarTdUlcp3n48wCzr9Aj546cczG Q7qtyjz8tgP/8/zKYfErWV+5RIUM8XP4XZgWtfxtPYa2ir1geT8g/pcAUJcVujs2GKQI NFUnusixYywEgqCdOdQw5xH8ZnTMSpGGN0u+hkh8eALnMI0RvIzgREoPytQASHjMXb3y KFjA== 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 sg36-20020a170907a42400b00781d984d289si8894340ejc.495.2022.10.03.08.06.52; Mon, 03 Oct 2022 08:06:56 -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 B38C768BB94; Mon, 3 Oct 2022 18:06:49 +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 4650F68BAE5 for ; Mon, 3 Oct 2022 18:06:43 +0300 (EEST) Received: from basile.remlab.net (localhost [IPv6:::1]) by ursule.remlab.net (Postfix) with ESMTP id B7135C0088 for ; Mon, 3 Oct 2022 18:06:42 +0300 (EEST) From: remi@remlab.net To: ffmpeg-devel@ffmpeg.org Date: Mon, 3 Oct 2022 18:06:42 +0300 Message-Id: <20221003150642.5411-1-remi@remlab.net> X-Mailer: git-send-email 2.37.2 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] riscv: fix scalar product initialisation 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: fBT2mCLT12JZ From: RĂ©mi Denis-Courmont VSETVLI xd, x0, ...' has rather nonobvious semantics: - If xd is x0, then it preserves the current vector length. - If xd is not x0, it sets the vector length to the supported maximum. Also somewhat confusingly, while VMV.X.S always does its thing regardless of the selected vector length, VMV.S.X does _nothing_ if the selected vector length is zero. So the current code breaks fails to initialise the accumulator if we are unlucky to have a selected vector length of zero on entry. Fix it by forcing the vector length to one. --- libavcodec/riscv/audiodsp_rvv.S | 2 +- libavutil/riscv/float_dsp_rvv.S | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/riscv/audiodsp_rvv.S b/libavcodec/riscv/audiodsp_rvv.S index f4308f27c5..8e8bbd2058 100644 --- a/libavcodec/riscv/audiodsp_rvv.S +++ b/libavcodec/riscv/audiodsp_rvv.S @@ -21,7 +21,7 @@ #include "libavutil/riscv/asm.S" func ff_scalarproduct_int16_rvv, zve32x - vsetvli zero, zero, e16, m1, ta, ma + vsetivli zero, 1, e16, m1, ta, ma vmv.s.x v8, zero 1: vsetvli t0, a2, e16, m1, ta, ma diff --git a/libavutil/riscv/float_dsp_rvv.S b/libavutil/riscv/float_dsp_rvv.S index ab2e0c42d7..e105f2d574 100644 --- a/libavutil/riscv/float_dsp_rvv.S +++ b/libavutil/riscv/float_dsp_rvv.S @@ -167,7 +167,7 @@ endfunc // a0 = (a0).(a1) [0..a2-1] func ff_scalarproduct_float_rvv, zve32f - vsetvli zero, zero, e32, m1, ta, ma + vsetivli zero, 1, e32, m1, ta, ma vmv.s.x v8, zero 1: vsetvli t0, a2, e32, m1, ta, ma