From patchwork Sat May 20 01:56:49 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: 41735 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:ba91:b0:105:feb:71f2 with SMTP id fb17csp232432pzb; Fri, 19 May 2023 18:58:14 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4K7EaxluCZclzv5urSM2Mko84t3MKn7hh6SUq6ayrOzsyLc8uxy+FP9uMc9dQryWDkOolZ X-Received: by 2002:a17:907:5c7:b0:96a:ed6e:7d58 with SMTP id wg7-20020a17090705c700b0096aed6e7d58mr3538566ejb.7.1684547893958; Fri, 19 May 2023 18:58:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684547893; cv=none; d=google.com; s=arc-20160816; b=cwfju9oEO7zOdTSXCZhpNvAQnNqHb+zPTVRW6ik6+tcsh/SxwOAtIXQcoGKFgk2LoT BdaW3fJbplSI2pHMcFbw90wDvyymgUvy1f/g+U0n/OH3j2GVl60N6DTy6CToNIhqZWY0 6hzEvYDCUEpbQif+edj5B4nAaMEHihRN8Zej/v4kKWBv0W61cbxIFNlPtOu+ilMV3wvc I/KER8eTqJ6gGgWzMqKY2RRviuKpdTvvQyyKgBbtEGknmHaV3/xlBZIhhnLURIz9k87v vdbyzht0Zuxc9j5u2YuZEI0P9ln93gk9W7EI5gsyCep9qMEW0xgMQV3JQKoa9dM2BMVf 3kSA== 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=RVwD67bP7Lw96fXhFhtpNP2L/uXLRgfI5mu4074Pvif+sZ6oVn0PiiqM2eEvTXHB2C XuGnpPnHdCqlHWO9vihkbBG7OGEWPTzGrZhOtTqODRYBCcPVyX+VGPYIYo3rrYUkkmkv tUF8B5LcRddZQIJ3OCXmqatzIB/IuG5INBeL3AkzLJpvomHB6QsDOD8wZ/nMdQ4daWA8 BPq3d3bw1bgs5VQxnQ3NrRgRu3i6tHhN0p0fM7qEeBHbOuXe9KPo3XyP/5VibzvjkKE5 qRB8Bc+FwaRTFDnUlLpdLGDHLwDMvr+X+jlESefhott8QV7ew74An7/UKpDbiquStpa9 xXyw== 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 m11-20020a50ef0b000000b0050bc40776dcsi522976eds.501.2023.05.19.18.58.13; Fri, 19 May 2023 18:58:13 -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 628DA68C1A8; Sat, 20 May 2023 04:57:10 +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 3DCC168C18B for ; Sat, 20 May 2023 04:56:59 +0300 (EEST) Received: from loongson.cn (unknown [36.33.26.144]) by gateway (Coremail) with SMTP id _____8AxX+vqKGhkmlQKAA--.18249S3; Sat, 20 May 2023 09:56:58 +0800 (CST) Received: from localhost (unknown [36.33.26.144]) by localhost.localdomain (Coremail) with SMTP id AQAAf8CxorTpKGhkFwFrAA--.50243S3; Sat, 20 May 2023 09:56:58 +0800 (CST) From: Hao Chen To: ffmpeg-devel@ffmpeg.org Date: Sat, 20 May 2023 09:56:49 +0800 Message-Id: <20230520015649.8325-8-chenhao@loongson.cn> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20230520015649.8325-1-chenhao@loongson.cn> References: <20230520015649.8325-1-chenhao@loongson.cn> MIME-Version: 1.0 X-CM-TRANSID: AQAAf8CxorTpKGhkFwFrAA--.50243S3 X-CM-SenderInfo: hfkh0xtdr6z05rqj20fqof0/ X-Coremail-Antispam: 1Uk129KBjvJXoW7Kr4rWrWfAF1fAw4UuF18uFg_yoW8Kw1xpF Z7Cr43Gw18Ka4akF93XF1kAr15A3WfWFnagFy7ZF4UZrnxG345Xws7tF98WFWxX3Wfu3y7 Zr48ur43CF1xXw7anT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUj1kv1TuYvTs0mT0YCTnIWj qI5I8CrVACY4xI64kE6c02F40Ex7xfYxn0WfASr-VFAUDa7-sFnT9fnUUIcSsGvfJTRUUU b7xYFVCjjxCrM7AC8VAFwI0_Jr0_Gr1l1xkIjI8I6I8E6xAIw20EY4v20xvaj40_Wr0E3s 1l1IIY67AEw4v_Jr0_Jr4l8cAvFVAK0II2c7xJM28CjxkF64kEwVA0rcxSw2x7M28EF7xv wVC0I7IYx2IY67AKxVWUCVW8JwA2z4x0Y4vE2Ix0cI8IcVCY1x0267AKxVWUJVW8JwA2z4 x0Y4vEx4A2jsIE14v26F4j6r4UJwA2z4x0Y4vEx4A2jsIEc7CjxVAFwI0_Gr0_Gr1UM2AI xVAIcxkEcVAq07x20xvEncxIr21l57IF6xkI12xvs2x26I8E6xACxx1l5I8CrVACY4xI64 kE6c02F40Ex7xfMcIj6xIIjxv20xvE14v26r1q6rW5McIj6I8E87Iv67AKxVW8JVWxJwAm 72CE4IkC6x0Yz7v_Jr0_Gr1lF7xvr2IYc2Ij64vIr41l42xK82IYc2Ij64vIr41l4I8I3I 0E4IkC6x0Yz7v_Jr0_Gr1lx2IqxVAqx4xG67AKxVWUJVWUGwC20s026x8GjcxK67AKxVWU GVWUWwC2zVAF1VAY17CE14v26r1Y6r17MIIYrxkI7VAKI48JMIIF0xvE2Ix0cI8IcVAFwI 0_JFI_Gr1lIxAIcVC0I7IYx2IY6xkF7I0E14v26r1j6r4UMIIF0xvE42xK8VAvwI8IcIk0 rVWUJVWUCwCI42IY6I8E87Iv67AKxVWUJVW8JwCI42IY6I8E87Iv6xkF7I0E14v26r1j6r 4UYxBIdaVFxhVjvjDU0xZFpf9x07j8CztUUUUU= 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: sCiJI17kBLvx 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)