fp-pidbench.S 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. // Copyright (C) 2021 ARM Limited.
  3. // Original author: Mark Brown <[email protected]>
  4. //
  5. // Trivial syscall overhead benchmark.
  6. //
  7. // This is implemented in asm to ensure that we don't have any issues with
  8. // system libraries using instructions that disrupt the test.
  9. #include <asm/unistd.h>
  10. #include "assembler.h"
  11. .arch_extension sve
  12. .macro test_loop per_loop
  13. mov x10, x20
  14. mov x8, #__NR_getpid
  15. mrs x11, CNTVCT_EL0
  16. 1:
  17. \per_loop
  18. svc #0
  19. sub x10, x10, #1
  20. cbnz x10, 1b
  21. mrs x12, CNTVCT_EL0
  22. sub x0, x12, x11
  23. bl putdec
  24. puts "\n"
  25. .endm
  26. // Main program entry point
  27. .globl _start
  28. function _start
  29. _start:
  30. puts "Iterations per test: "
  31. mov x20, #10000
  32. lsl x20, x20, #8
  33. mov x0, x20
  34. bl putdec
  35. puts "\n"
  36. // Test having never used SVE
  37. puts "No SVE: "
  38. test_loop
  39. // Check for SVE support - should use hwcap but that's hard in asm
  40. mrs x0, ID_AA64PFR0_EL1
  41. ubfx x0, x0, #32, #4
  42. cbnz x0, 1f
  43. puts "System does not support SVE\n"
  44. b out
  45. 1:
  46. // Execute a SVE instruction
  47. puts "SVE VL: "
  48. rdvl x0, #8
  49. bl putdec
  50. puts "\n"
  51. puts "SVE used once: "
  52. test_loop
  53. // Use SVE per syscall
  54. puts "SVE used per syscall: "
  55. test_loop "rdvl x0, #8"
  56. // And we're done
  57. out:
  58. mov x0, #0
  59. mov x8, #__NR_exit
  60. svc #0