From patchwork Fri Dec 15 20:52:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Martin_Storsj=C3=B6?= X-Patchwork-Id: 45169 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:1225:b0:181:818d:5e7f with SMTP id v37csp5935859pzf; Fri, 15 Dec 2023 12:53:03 -0800 (PST) X-Google-Smtp-Source: AGHT+IFBlO4iU7qXWLOrU4pu1HndX91vBDuQjAarnRcSvvxh/g4/d6w0ce0h3j0CKpMt7mtdCOBm X-Received: by 2002:a2e:82c7:0:b0:2ca:a51:e205 with SMTP id n7-20020a2e82c7000000b002ca0a51e205mr5355575ljh.79.1702673583685; Fri, 15 Dec 2023 12:53:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702673583; cv=none; d=google.com; s=arc-20160816; b=jxBDdnexjCY9KwMKQLw4FYxStqQe05QRfjtsKVwk+ZMp0NQ4ya1jjEUYjiXuSdpejf dwh2lhA3jkf6U+IsdQb2qksbh5RFyvjri+5zoG2KU19xiWI4Z49iRNxHjkHgRQV8fnru ngSnTUoKIQBj9oSN+UGigiF2ko9LmLUk+PMm2IOAA5HeXkhCyhJ3hdl+WD5pvCcID0xX RU7J8HQBcMQV9NXUKmpVWBjAnbnFh5JXrYvOXwndL41P6k2b51Xx3nhHAOuW/9r3EYv7 j89wR1vVRmBIk6GZTZywsX9UDjsprmDAw8rjbIDLVG88y5Wx8F+Kw9jlz6C/qxCJlEZJ UNtQ== 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 :dkim-signature:delivered-to; bh=98pBsgYAWa2SvaGQ2mC8ClgXnBnhLou1XpAyf+JF81o=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=fpUg+HcVmYFu1ksnfdMN3IA+/ioae/9K3MoPkLN5VJ7fTKq3lNluSgfgIYdgSWUU9w 6dIKAHp33jQ+EADmaLDr1cQT+0iZUtzQ2PW92fWHaXJBAoVli3v4v1VhUVf7ZpblmPB0 G27Cft5NFKFPQ+8w0Scj7ke4dfbwNCow1Dy4ogh/8N1qvN+onaGkr4tzVw01mRq3QbEy DpwoVjt7dMg9EUsNZGNipc/p7peMI+IG3uyMF8FsD9tbRsNoMwBym6Q1wFjsPRZ75i/j fMBfIurTk70ylY6KA3PltvIMbnqw9CeniV345H9rkjz0AuZXXj/2fDZ9XOdurdRX2/NE QRNw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@martin-st.20230601.gappssmtp.com header.s=20230601 header.b=xf8nTvSL; 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 gy5-20020a0564025bc500b005527ae447f1si1735452edb.112.2023.12.15.12.53.03; Fri, 15 Dec 2023 12:53:03 -0800 (PST) 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; dkim=neutral (body hash did not verify) header.i=@martin-st.20230601.gappssmtp.com header.s=20230601 header.b=xf8nTvSL; 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 9094D68D0D7; Fri, 15 Dec 2023 22:52:59 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-lf1-f50.google.com (mail-lf1-f50.google.com [209.85.167.50]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 46C9D68CFCB for ; Fri, 15 Dec 2023 22:52:53 +0200 (EET) Received: by mail-lf1-f50.google.com with SMTP id 2adb3069b0e04-50bfa7f7093so1361722e87.0 for ; Fri, 15 Dec 2023 12:52:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=martin-st.20230601.gappssmtp.com; s=20230601; t=1702673572; x=1703278372; darn=ffmpeg.org; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=7lRuyv4QaK4Jw+t433L7kGcfSFF4vHmtrEhCbnSCpwM=; b=xf8nTvSL4UDFwLpPsacBeHrIyW1YPoCPFMK9WNk8ptZCHnM1YcF0J8plLywNvgXFEh 3pHDzVuSAzKASDLkHlHnOOssy9H2BMHNvPV2Xeq0rYzRI2Xw1pBapF/nfSwQLfs1BLqX gC3Z7xDDmimnU+uocHdt9vCD+zZBFZCWhKBUVx7nvGsmzMCGiucJp/AuNlFjvC4YJ1wP 98DhJYiKmw/IS6VV3lNmVgKRymlhCs+/u3TQPvcecssGbSFUHUs8WfOXf4lFpm6IGpzh y2Zd2M2i9T1HZqHvZxGod+fxGmrv1neUEzXI3G5DDGvkalYcoBKjUlqoN4zX+lyCcDwS +Trw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702673572; x=1703278372; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=7lRuyv4QaK4Jw+t433L7kGcfSFF4vHmtrEhCbnSCpwM=; b=xCOAZqM4l7+TP/qOqj/57jkX3flOqsv6q6JBuj8GQTMzw3+1zKxyxgTdvkLMYFr1WC QkK+k97wFUSUlfLTZCBBCA+3UPshj5mv7XE2z0+dEcwnoN6W85P1xsKEcYrdBk0T/RzP 0eYPYR+Vsa+85QSQFqWMvQ8cdrnXJ8Pg+QgHoSKP9ze4andJVFpjlIDTGVYnJweNGf6q vOqTSEJ9RfowanTogpWNn1dvujWzJjibzNVYxP+cII39auDIjJytQ2O6V/0YzQBNPM96 aTOoRPUZ8yMFJRyEhOmQ6YouFdG7vb8CJ3w6qUyRZ943Uw61mYDuvVToCw8f/SPTdNYC Qdqg== X-Gm-Message-State: AOJu0YyvuFAmk5Cid2NRfpTQPgqbYbaZU+r9BdNpdKHEGTYe2b6ZepPc Etf9Rp54IGUGo62Be1Zh9oDytYiR6zlu3ZZQlZVI4A== X-Received: by 2002:a05:6512:3a92:b0:50c:de34:da09 with SMTP id q18-20020a0565123a9200b0050cde34da09mr7549364lfu.101.1702673572070; Fri, 15 Dec 2023 12:52:52 -0800 (PST) Received: from localhost (dsl-tkubng21-58c01c-243.dhcp.inet.fi. [88.192.28.243]) by smtp.gmail.com with ESMTPSA id f17-20020a05651232d100b0050bfc6dbb8asm2268631lfg.302.2023.12.15.12.52.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Dec 2023 12:52:51 -0800 (PST) From: =?utf-8?q?Martin_Storsj=C3=B6?= To: ffmpeg-devel@ffmpeg.org Date: Fri, 15 Dec 2023 22:52:51 +0200 Message-Id: <20231215205251.189618-1-martin@martin.st> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v2] riscv: Tweak names of cpu flags, print flags in libavutil/tests/cpu 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: EYaTxsRLn+tM The names of the cpu flags, when parsed from a string with av_parse_cpu_caps, are parsed by the libavutil eval functions. These interpret dashes as subtractions. Therefore, these previous cpu flag names haven't been possible to set. Use the official names for these extensions, as the previous ad-hoc names wasn't parseable. libavutil/tests/cpu tests that the cpu flags can be set, and prints the detected flags. --- libavutil/cpu.c | 12 ++++++------ libavutil/tests/cpu.c | 10 ++++++++++ 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/libavutil/cpu.c b/libavutil/cpu.c index 1e0607d581..f04068acda 100644 --- a/libavutil/cpu.c +++ b/libavutil/cpu.c @@ -186,12 +186,12 @@ int av_parse_cpu_caps(unsigned *flags, const char *s) { "rvi", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_RVI }, .unit = "flags" }, { "rvf", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_RVF }, .unit = "flags" }, { "rvd", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_RVD }, .unit = "flags" }, - { "rvv-i32", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_RVV_I32 }, .unit = "flags" }, - { "rvv-f32", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_RVV_F32 }, .unit = "flags" }, - { "rvv-i64", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_RVV_I64 }, .unit = "flags" }, - { "rvv", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_RVV_F64 }, .unit = "flags" }, - { "rvb-addr",NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_RVB_ADDR }, .unit = "flags" }, - { "rvb-basic",NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_RVB_BASIC }, .unit = "flags" }, + { "zve32x", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_RVV_I32 }, .unit = "flags" }, + { "zve32f", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_RVV_F32 }, .unit = "flags" }, + { "zve64x", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_RVV_I64 }, .unit = "flags" }, + { "zve64f", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_RVV_F64 }, .unit = "flags" }, + { "zba", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_RVB_ADDR }, .unit = "flags" }, + { "zbb", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_RVB_BASIC }, .unit = "flags" }, #endif { NULL }, }; diff --git a/libavutil/tests/cpu.c b/libavutil/tests/cpu.c index 200f20388a..6b27bcdbad 100644 --- a/libavutil/tests/cpu.c +++ b/libavutil/tests/cpu.c @@ -84,6 +84,16 @@ static const struct { #elif ARCH_LOONGARCH { AV_CPU_FLAG_LSX, "lsx" }, { AV_CPU_FLAG_LASX, "lasx" }, +#elif ARCH_RISCV + { AV_CPU_FLAG_RVI, "rvi" }, + { AV_CPU_FLAG_RVF, "rvf" }, + { AV_CPU_FLAG_RVD, "rvd" }, + { AV_CPU_FLAG_RVB_ADDR, "zba" }, + { AV_CPU_FLAG_RVB_BASIC, "zbb" }, + { AV_CPU_FLAG_RVV_I32, "zve32x" }, + { AV_CPU_FLAG_RVV_F32, "zve32f" }, + { AV_CPU_FLAG_RVV_I64, "zve64x" }, + { AV_CPU_FLAG_RVV_F64, "zve64f" }, #endif { 0 } };