1 ; RUN: llc < %s -mtriple=arm-none-eabi -mcpu=cortex-a8 2>&1 | FileCheck %s --check-prefix=ARM --check-prefix=ACORE
2 ; RUN: llc < %s -mtriple=thumb-none-eabi -mcpu=cortex-m4 2>&1 | FileCheck %s --check-prefix=ARM --check-prefix=MCORE
4 define i32 @read_i32_encoded_register() nounwind {
6 ; ARM-LABEL: read_i32_encoded_register:
7 ; ARM: mrc p1, #2, r0, c3, c4, #5
8 %reg = call i32 @llvm.read_register.i32(metadata !0)
12 define i64 @read_i64_encoded_register() nounwind {
14 ; ARM-LABEL: read_i64_encoded_register:
15 ; ARM: mrrc p1, #2, r0, r1, c3
16 %reg = call i64 @llvm.read_register.i64(metadata !1)
20 define i32 @read_apsr() nounwind {
22 ; ARM-LABEL: read_apsr:
24 %reg = call i32 @llvm.read_register.i32(metadata !2)
28 define i32 @read_fpscr() nounwind {
30 ; ARM-LABEL: read_fpscr:
32 %reg = call i32 @llvm.read_register.i32(metadata !3)
36 define void @write_i32_encoded_register(i32 %x) nounwind {
38 ; ARM-LABEL: write_i32_encoded_register:
39 ; ARM: mcr p1, #2, r0, c3, c4, #5
40 call void @llvm.write_register.i32(metadata !0, i32 %x)
44 define void @write_i64_encoded_register(i64 %x) nounwind {
46 ; ARM-LABEL: write_i64_encoded_register:
47 ; ARM: mcrr p1, #2, r0, r1, c3
48 call void @llvm.write_register.i64(metadata !1, i64 %x)
52 define void @write_apsr(i32 %x) nounwind {
54 ; ARM-LABEL: write_apsr:
55 ; ACORE: msr APSR_nzcvq, r0
56 ; MCORE: msr apsr_nzcvq, r0
57 call void @llvm.write_register.i32(metadata !4, i32 %x)
61 define void @write_fpscr(i32 %x) nounwind {
63 ; ARM-LABEL: write_fpscr:
65 call void @llvm.write_register.i32(metadata !3, i32 %x)
69 declare i32 @llvm.read_register.i32(metadata) nounwind
70 declare i64 @llvm.read_register.i64(metadata) nounwind
71 declare void @llvm.write_register.i32(metadata, i32) nounwind
72 declare void @llvm.write_register.i64(metadata, i64) nounwind
74 !0 = !{!"cp1:2:c3:c4:5"}