From patchwork Wed May 17 07:09:51 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: 41654 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:ba91:b0:105:feb:71f2 with SMTP id fb17csp981166pzb; Wed, 17 May 2023 00:10:11 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7oDv8HYhhQXv+YMYoz4/1aRZg03FaSDMRE10aOlbHvdKIHX11xL19/f581eCJ5hLXms6tQ X-Received: by 2002:a17:907:1614:b0:8a5:8620:575 with SMTP id hb20-20020a170907161400b008a586200575mr37920514ejc.3.1684307411462; Wed, 17 May 2023 00:10:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684307411; cv=none; d=google.com; s=arc-20160816; b=v6F6NgKnUGgD5Lev1zYF4dmtKmHEyDxzNFhx/0K81EpZaBIytJbP5l2D8fRSWPrP+2 Z10NoTM4IQo70YpeaFYPsCxb9lSn9IsS2ngeIcSYgUco8445eNueOgSQ+UjIw0EOXNFW HsqAMviiCa8JQ/BpOBuCXEbjfg5KSbSzv2VgriOP/+f/hlsymPyVxbbInuGU2KaP4sGh iSTRAlDdFEMElIPfHwjuZ51K4qZJ0HCfCuSSnzyuq9IhJYQkxjGsdUHhyp09eve4i7F+ RhDF8Pk7641Yp1BiMKQssseI9T3EG7a4GlDJ6bYmAhs1mMsnT5/FofVu+X+x3B1h2Gc3 gLjQ== 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:message-id:date:to:from :delivered-to; bh=he1pO9JTEqfp3ZxQdlZfluA3eCWU5NHhW5FN+CU52Bo=; b=mKgFMHcUQTlCN/XOnPVXW+8cKQSzM7hI7L1NnV03EF/hcQSUIu9Ap8ApW8k7TM/cca sEAAx2SOt1Ylq1HGwyQ7YB58Ag9Y7JELCxtn1tzAPvLppanfmsWJGEOvkSPKerioXfVw yVZvUlAXnvh5DN5QVC74RJYRyxdiExx3PilAfMZ3+UEnv9dAwYD+0/TxJXMmr2/rv/lW 1CfQodK2/z2VcfvCsnHFdcg/c9uHKy7ZuSqJrq21bKSQyJ1iUV8jRQl9iGvnavi5//c3 0oSUddgF3WAOn68/2UPNkX7Ygx3vsx+U6F4KREj3hQ6IEe3QBKf6Vbjug0RJX8SMdilV OQpQ== 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 sa31-20020a1709076d1f00b0096a15c38597si16230115ejc.560.2023.05.17.00.10.07; Wed, 17 May 2023 00:10:11 -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 14E3168C116; Wed, 17 May 2023 10:10:04 +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 AE3CB68BF17 for ; Wed, 17 May 2023 10:09:57 +0300 (EEST) Received: from loongson.cn (unknown [36.33.26.144]) by gateway (Coremail) with SMTP id _____8CxNunCfWRkNmkJAA--.16620S3; Wed, 17 May 2023 15:09:56 +0800 (CST) Received: from localhost (unknown [36.33.26.144]) by localhost.localdomain (Coremail) with SMTP id AQAAf8Dx87DAfWRkdVJlAA--.42504S3; Wed, 17 May 2023 15:09:53 +0800 (CST) From: Hao Chen To: ffmpeg-devel@ffmpeg.org Date: Wed, 17 May 2023 15:09:51 +0800 Message-Id: <20230517070951.5590-1-chenhao@loongson.cn> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-CM-TRANSID: AQAAf8Dx87DAfWRkdVJlAA--.42504S3 X-CM-SenderInfo: hfkh0xtdr6z05rqj20fqof0/ X-Coremail-Antispam: 1Uk129KBjvJXoW7Kr4rWrWfAF1fAw4UuF18uFg_yoW8Kw1xpF Z7Cr43Gw18Ka4akF93XF1kAr15A3WfWFnagFy7ZF4UZrnxG345Xws7tF98WFWxX3Wfu3y7 Zr48ur43CF1xXw7anT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUj1kv1TuYvTs0mT0YCTnIWj qI5I8CrVACY4xI64kE6c02F40Ex7xfYxn0WfASr-VFAUDa7-sFnT9fnUUIcSsGvfJTRUUU b7AYFVCjjxCrM7AC8VAFwI0_Jr0_Gr1l1xkIjI8I6I8E6xAIw20EY4v20xvaj40_Wr0E3s 1l1IIY67AEw4v_Jr0_Jr4l8cAvFVAK0II2c7xJM28CjxkF64kEwVA0rcxSw2x7M28EF7xv wVC0I7IYx2IY67AKxVW8JVW5JwA2z4x0Y4vE2Ix0cI8IcVCY1x0267AKxVW8JVWxJwA2z4 x0Y4vEx4A2jsIE14v26r4UJVWxJr1l84ACjcxK6I8E87Iv6xkF7I0E14v26r4UJVWxJr1l e2I262IYc4CY6c8Ij28IcVAaY2xG8wAqjxCEc2xF0cIa020Ex4CE44I27wAqx4xG64xvF2 IEw4CE5I8CrVC2j2WlYx0E2Ix0cI8IcVAFwI0_JF0_Jw1lYx0Ex4A2jsIE14v26r4j6F4U McvjeVCFs4IE7xkEbVWUJVW8JwACjcxG0xvY0x0EwIxGrwCF04k20xvY0x0EwIxGrwCFx2 IqxVCFs4IE7xkEbVWUJVW8JwC20s026c02F40E14v26r1j6r18MI8I3I0E7480Y4vE14v2 6r106r1rMI8E67AF67kF1VAFwI0_Jrv_JF1lIxkGc2Ij64vIr41lIxAIcVC0I7IYx2IY67 AKxVWUCVW8JwCI42IY6xIIjxv20xvEc7CjxVAFwI0_Jr0_Gr1lIxAIcVCF04k26cxKx2IY s7xG6r1j6r1xMIIF0xvEx4A2jsIE14v26r1j6r4UMIIF0xvEx4A2jsIEc7CjxVAFwI0_Jr 0_GrUvcSsGvfC2KfnxnUUI43ZEXa7IU8w0eJUUUUU== Subject: [FFmpeg-devel] [PATCH v2] 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: jMJqFSs+20g6 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)