summaryrefslogtreecommitdiffstats
path: root/llvm/test/CodeGen/ARM/readcyclecounter.ll
diff options
context:
space:
mode:
authorTim Northover <t.p.northover@gmail.com>2013-05-23 19:11:20 +0000
committerTim Northover <t.p.northover@gmail.com>2013-05-23 19:11:20 +0000
commitbc93308489b5513ef3d4e56bad28b7ab4bce7303 (patch)
treec621435d3ed3f79b5c2fbe0d638b8bb20b61feda /llvm/test/CodeGen/ARM/readcyclecounter.ll
parentcedd48183fed7e1fc7f660d49a048df1a0a2d538 (diff)
downloadbcm5719-llvm-bc93308489b5513ef3d4e56bad28b7ab4bce7303.tar.gz
bcm5719-llvm-bc93308489b5513ef3d4e56bad28b7ab4bce7303.zip
ARM: implement @llvm.readcyclecounter intrinsic
This implements the @llvm.readcyclecounter intrinsic as the specific MRC instruction specified in the ARM manuals for CPUs with the Power Management extensions. Older CPUs had slightly different methods which may also have to be implemented eventually, but this should cover all v7 cases. rdar://problem/13939186 llvm-svn: 182603
Diffstat (limited to 'llvm/test/CodeGen/ARM/readcyclecounter.ll')
-rw-r--r--llvm/test/CodeGen/ARM/readcyclecounter.ll24
1 files changed, 24 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/ARM/readcyclecounter.ll b/llvm/test/CodeGen/ARM/readcyclecounter.ll
new file mode 100644
index 00000000000..db47ad355d0
--- /dev/null
+++ b/llvm/test/CodeGen/ARM/readcyclecounter.ll
@@ -0,0 +1,24 @@
+; RUN: llc -mtriple=armv7-none-linux-gnueabi < %s | FileCheck %s
+; RUN: llc -mtriple=thumbv7-none-linux-gnueabi < %s | FileCheck %s
+; RUN: llc -mtriple=armv7-none-linux-gnueabi -mattr=-perfmon < %s | FileCheck %s --check-prefix=CHECK-NO-PERFMON
+; RUN: llc -mtriple=armv6-none-linux-gnueabi < %s | FileCheck %s --check-prefix=CHECK-NO-PERFMON
+
+; The performance monitor we're looking for is an ARMv7 extension. It should be
+; possible to disable it, but realistically present on at least every v7-A
+; processor (but not on v6, at least by default).
+
+declare i64 @llvm.readcyclecounter()
+
+define i64 @get_count() {
+ %val = call i64 @llvm.readcyclecounter()
+ ret i64 %val
+
+ ; As usual, exact registers only sort of matter but the cycle-count had better
+ ; end up in r0 in the end.
+
+; CHECK: mrc p15, #0, r0, c9, c13, #0
+; CHECK: {{movs?}} r1, #0
+
+; CHECK-NO-PERFMON: {{movs?}} r0, #0
+; CHECK-NO-PERFMON: {{movs?}} r1, #0
+}
OpenPOWER on IntegriCloud