Path: blob/master/tools/testing/selftests/arm64/fp/fp-pidbench.S
26289 views
// SPDX-License-Identifier: GPL-2.0-only1// Copyright (C) 2021 ARM Limited.2// Original author: Mark Brown <broonie@kernel.org>3//4// Trivial syscall overhead benchmark.5//6// This is implemented in asm to ensure that we don't have any issues with7// system libraries using instructions that disrupt the test.89#include <asm/unistd.h>10#include "assembler.h"1112.arch_extension sve1314.macro test_loop per_loop15mov x10, x2016mov x8, #__NR_getpid17mrs x11, CNTVCT_EL0181:19\per_loop20svc #021sub x10, x10, #122cbnz x10, 1b2324mrs x12, CNTVCT_EL025sub x0, x12, x1126bl putdec27puts "\n"28.endm2930// Main program entry point31.globl _start32function _start33puts "Iterations per test: "34mov x20, #1000035lsl x20, x20, #836mov x0, x2037bl putdec38puts "\n"3940// Test having never used SVE41puts "No SVE: "42test_loop4344// Check for SVE support - should use hwcap but that's hard in asm45mrs x0, ID_AA64PFR0_EL146ubfx x0, x0, #32, #447cbnz x0, 1f48puts "System does not support SVE\n"49b out501:5152// Execute a SVE instruction53puts "SVE VL: "54rdvl x0, #855bl putdec56puts "\n"5758puts "SVE used once: "59test_loop6061// Use SVE per syscall62puts "SVE used per syscall: "63test_loop "rdvl x0, #8"6465// And we're done66out:67mov x0, #068mov x8, #__NR_exit69svc #0707172