From patchwork Sat May 20 07:27:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?6ZmI5piK?= X-Patchwork-Id: 41742 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:ba91:b0:105:feb:71f2 with SMTP id fb17csp365347pzb; Sat, 20 May 2023 00:28:38 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7/aldWEF7RdBd+iCP5Fvf8ZaOZqwf/wBAH9kcE5XpLIvtoYfi+aJsIHgLkNkfCzVpvzx8v X-Received: by 2002:a17:907:868a:b0:96a:8e03:35b3 with SMTP id qa10-20020a170907868a00b0096a8e0335b3mr4735146ejc.63.1684567718696; Sat, 20 May 2023 00:28:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684567718; cv=none; d=google.com; s=arc-20160816; b=cB0PaTU9E93qPc9GnZZSOY1hjgTWkSW8TCcz2mlbWjNChKXiR13PtGuWIf1jjgg2rZ OuzNUvkgTQ1CnP/qv5pvGwjHiIxCFDEYLgIljD7lJP9IvpNXZsAmxkc/FqNL+YNHEXAw 8WHpz1oOec0aXHEVQxMt+4CWNbv8mFv9XTss96BBGocGWJA+LjvaS6VhCuTeowpp4DdY UEtJcqYIEWS/YRgpnd6nA2ACQOiWzfgJ4fxWuwwpCxfOrTu9Gdv7TAOrUyBH2ZKHJMmw 8hM5St7/btamwVpmrVL++ta21yx9EcWNHZJc5vUpAHEum8un+3gLYKCJ1UzcwXglhJaA Clcw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc: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=he1pO9JTEqfp3ZxQdlZfluA3eCWU5NHhW5FN+CU52Bo=; b=pB2ATbnIY+VHeXEshneV+85eDCCjH4zxYnwU0N6CsTywn+pdsjud3SVDGhYTljH573 uWF9AmAJHnXAthh3KxcKbKM2BBo/mj8pt7s2VjfDIvpyHfrEQWN+3YQBUo252i8rWfdz +F3erHIPZkR2a51QKr82WCyJGg4+H86iJvn3fsZ/6OczEejjs8I+qhd2L1WdoihrwM6r SFURyQe8I2fDhuzen48KcL0+Ttzjgwtkf/JjJfX7+TDAHTAf8AseixKpWIM7xlkKujQf sCYyWHxjLFIeESIUbZfIXRQ4h2T6NMbfC1o3QDNRIwPc171Sy1fqnlSOr9CaSj96kqbx rdxA== 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 gt10-20020a170906f20a00b0096f8206f8c2si532504ejb.196.2023.05.20.00.28.38; Sat, 20 May 2023 00:28:38 -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 CC80368BF9B; Sat, 20 May 2023 10:27:42 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from loongson.cn (mail.loongson.cn [114.242.206.163]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id A70E368C14A for ; Sat, 20 May 2023 10:27:30 +0300 (EEST) Received: from loongson.cn (unknown [36.33.26.144]) by gateway (Coremail) with SMTP id _____8AxnOphdmhk52AKAA--.17951S3; Sat, 20 May 2023 15:27:29 +0800 (CST) Received: from localhost (unknown [36.33.26.144]) by localhost.localdomain (Coremail) with SMTP id AQAAf8DxfTthdmhkdGZrAA--.50613S3; Sat, 20 May 2023 15:27:29 +0800 (CST) From: Hao Chen To: ffmpeg-devel@ffmpeg.org Date: Sat, 20 May 2023 15:27:19 +0800 Message-Id: <20230520072719.27986-8-chenhao@loongson.cn> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20230520072719.27986-1-chenhao@loongson.cn> References: <20230520072719.27986-1-chenhao@loongson.cn> MIME-Version: 1.0 X-CM-TRANSID: AQAAf8DxfTthdmhkdGZrAA--.50613S3 X-CM-SenderInfo: hfkh0xtdr6z05rqj20fqof0/ X-Coremail-Antispam: 1Uk129KBjvJXoW7Kr4rWrWfAF1fAw4UuF18uFg_yoW8Kw1xpF Z7Cr43Gw18Ka4akF93XF1kAr15A3WfWFnagFy7ZF4UZrnxG345Xws7tF98WFWxX3Wfu3y7 Zr48ur43CF1xXw7anT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUj1kv1TuYvTs0mT0YCTnIWj qI5I8CrVACY4xI64kE6c02F40Ex7xfYxn0WfASr-VFAUDa7-sFnT9fnUUIcSsGvfJTRUUU b28YFVCjjxCrM7AC8VAFwI0_Jr0_Gr1l1xkIjI8I6I8E6xAIw20EY4v20xvaj40_Wr0E3s 1l1IIY67AEw4v_Jrv_JF1l8cAvFVAK0II2c7xJM28CjxkF64kEwVA0rcxSw2x7M28EF7xv wVC0I7IYx2IY67AKxVWUCVW8JwA2z4x0Y4vE2Ix0cI8IcVCY1x0267AKxVWUJVW8JwA2z4 x0Y4vEx4A2jsIE14v26r4UJVWxJr1l84ACjcxK6I8E87Iv6xkF7I0E14v26r4UJVWxJr1l e2I262IYc4CY6c8Ij28IcVAaY2xG8wAqjxCEc2xF0cIa020Ex4CE44I27wAqx4xG64xvF2 IEw4CE5I8CrVC2j2WlYx0E2Ix0cI8IcVAFwI0_JF0_Jw1lYx0Ex4A2jsIE14v26r4j6F4U McvjeVCFs4IE7xkEbVWUJVW8JwACjcxG0xvY0x0EwIxGrwCF04k20xvY0x0EwIxGrwCFx2 IqxVCFs4IE7xkEbVWUJVW8JwC20s026c02F40E14v26r1j6r18MI8I3I0E7480Y4vE14v2 6r106r1rMI8E67AF67kF1VAFwI0_Jrv_JF1lIxkGc2Ij64vIr41lIxAIcVC0I7IYx2IY67 AKxVWUCVW8JwCI42IY6xIIjxv20xvEc7CjxVAFwI0_Jr0_Gr1lIxAIcVCF04k26cxKx2IY s7xG6r1j6r1xMIIF0xvEx4A2jsIE14v26r4j6F4UMIIF0xvEx4A2jsIEc7CjxVAFwI0_Gr 0_Gr1UYxBIdaVFxhVjvjDU0xZFpf9x07jOb18UUUUU= Subject: [FFmpeg-devel] [PATCH v3 7/7] avutil/la: Add function performance testing 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 Cc: yuanhecai Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: Hlo8sFsgmYVQ From: yuanhecai This patch supports the use of the "checkasm --bench" testing feature on loongarch platform. Change-Id: I42790388d057c9ade0dfa38a19d9c1fd44ca0bc3 --- libavutil/loongarch/timer.h | 48 +++++++++++++++++++++++++++++++++++++ libavutil/timer.h | 2 ++ 2 files changed, 50 insertions(+) create mode 100644 libavutil/loongarch/timer.h diff --git a/libavutil/loongarch/timer.h b/libavutil/loongarch/timer.h new file mode 100644 index 0000000000..44ed786409 --- /dev/null +++ b/libavutil/loongarch/timer.h @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2023 Loongson Technology Corporation Limited + * Contributed by Hecai Yuan + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_LOONGARCH_TIMER_H +#define AVUTIL_LOONGARCH_TIMER_H + +#include +#include "config.h" + +#if HAVE_INLINE_ASM + +#define AV_READ_TIME read_time + +static inline uint64_t read_time(void) +{ + +#if ARCH_LOONGARCH64 + uint64_t a, id = 0; + __asm__ volatile ( "rdtime.d %0, %1" : "=r"(a), "=r"(id) :: "memory" ); + return a; +#else + uint32_t a, id = 0; + __asm__ volatile ( "rdtimel.w %0, %1" : "=r"(a), "=r"(id) :: "memory" ); + return (uint64_t)a; +#endif +} + +#endif /* HAVE_INLINE_ASM */ + +#endif /* AVUTIL_LOONGARCH_TIMER_H */ diff --git a/libavutil/timer.h b/libavutil/timer.h index d3db5a27ef..861ba7e9d7 100644 --- a/libavutil/timer.h +++ b/libavutil/timer.h @@ -61,6 +61,8 @@ # include "riscv/timer.h" #elif ARCH_X86 # include "x86/timer.h" +#elif ARCH_LOONGARCH +# include "loongarch/timer.h" #endif #if !defined(AV_READ_TIME)