1 ; RUN: llc < %s -mtriple=aarch64-none-eabi -mcpu=cortex-a57 2>&1 | FileCheck %s 2 3 define i64 @read_encoded_register() nounwind { 4 entry: 5 ; CHECK-LABEL: read_encoded_register: 6 ; CHECK: mrs x0, S1_2_C3_C4_5 7 %reg = call i64 @llvm.read_register.i64(metadata !0) 8 ret i64 %reg 9 } 10 11 define i64 @read_daif() nounwind { 12 entry: 13 ; CHECK-LABEL: read_daif: 14 ; CHECK: mrs x0, DAIF 15 %reg = call i64 @llvm.read_register.i64(metadata !1) 16 ret i64 %reg 17 } 18 19 define void @write_encoded_register(i64 %x) nounwind { 20 entry: 21 ; CHECK-LABEL: write_encoded_register: 22 ; CHECK: msr S1_2_C3_C4_5, x0 23 call void @llvm.write_register.i64(metadata !0, i64 %x) 24 ret void 25 } 26 27 define void @write_daif(i64 %x) nounwind { 28 entry: 29 ; CHECK-LABEL: write_daif: 30 ; CHECK: msr DAIF, x0 31 call void @llvm.write_register.i64(metadata !1, i64 %x) 32 ret void 33 } 34 35 define void @write_daifset() nounwind { 36 entry: 37 ; CHECK-LABEL: write_daifset: 38 ; CHECK: msr DAIFSet, #2 39 call void @llvm.write_register.i64(metadata !2, i64 2) 40 ret void 41 } 42 43 declare i64 @llvm.read_register.i64(metadata) nounwind 44 declare void @llvm.write_register.i64(metadata, i64) nounwind 45 46 !0 = !{!"1:2:3:4:5"} 47 !1 = !{!"daif"} 48 !2 = !{!"daifset"} 49