aboutsummaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/powerpc/pmu/loop.S
diff options
context:
space:
mode:
authorMichael Ellerman <michael@ellerman.id.au>2013-08-06 17:42:37 +1000
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2013-08-14 14:57:10 +1000
commitcb96143defbd5516c351595d56b608ed915b525e (patch)
tree427dc6a4231f1c3b1ed9f7a327676223487d2b07 /tools/testing/selftests/powerpc/pmu/loop.S
parentselftests: Add support files for powerpc tests (diff)
downloadlinux-dev-cb96143defbd5516c351595d56b608ed915b525e.tar.xz
linux-dev-cb96143defbd5516c351595d56b608ed915b525e.zip
selftests: Add test of PMU instruction counting on powerpc
This commit adds a test of instruction counting using the PMU on powerpc. Although the bulk of the code is architecture agnostic, the code needs to run a precisely sized loop which is implemented in assembler. Signed-off-by: Michael Ellerman <michael@ellerman.id.au> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'tools/testing/selftests/powerpc/pmu/loop.S')
-rw-r--r--tools/testing/selftests/powerpc/pmu/loop.S46
1 files changed, 46 insertions, 0 deletions
diff --git a/tools/testing/selftests/powerpc/pmu/loop.S b/tools/testing/selftests/powerpc/pmu/loop.S
new file mode 100644
index 000000000000..8820e3df1444
--- /dev/null
+++ b/tools/testing/selftests/powerpc/pmu/loop.S
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2013, Michael Ellerman, IBM Corp.
+ * Licensed under GPLv2.
+ */
+
+ .text
+
+ .global thirty_two_instruction_loop
+ .type .thirty_two_instruction_loop,@function
+ .section ".opd","aw",@progbits
+thirty_two_instruction_loop:
+ .quad .thirty_two_instruction_loop, .TOC.@tocbase, 0
+ .previous
+.thirty_two_instruction_loop:
+ cmpwi %r3,0
+ beqlr
+ addi %r4,%r3,1
+ addi %r4,%r4,1
+ addi %r4,%r4,1
+ addi %r4,%r4,1
+ addi %r4,%r4,1
+ addi %r4,%r4,1
+ addi %r4,%r4,1
+ addi %r4,%r4,1
+ addi %r4,%r4,1
+ addi %r4,%r4,1
+ addi %r4,%r4,1
+ addi %r4,%r4,1
+ addi %r4,%r4,1
+ addi %r4,%r4,1
+ addi %r4,%r4,1
+ addi %r4,%r4,1
+ addi %r4,%r4,1
+ addi %r4,%r4,1
+ addi %r4,%r4,1
+ addi %r4,%r4,1
+ addi %r4,%r4,1
+ addi %r4,%r4,1
+ addi %r4,%r4,1
+ addi %r4,%r4,1
+ addi %r4,%r4,1
+ addi %r4,%r4,1
+ addi %r4,%r4,1
+ addi %r4,%r4,1 # 28 addi's
+ subi %r3,%r3,1
+ b .thirty_two_instruction_loop