mirror of
https://github.com/RPCSX/llvm.git
synced 2024-11-27 13:40:30 +00:00
b0221e3835
In the encoding of system registers in the M-class MSR instruction the mask bits should be 2 for registers that don't take a _<bits> qualifier (the instruction is unpredictable otherwise), and should also be 2 if the register takes a _<bits> qualifier but it's not present as no _<bits> is an alias for _nzcvq. Differential Revision: https://reviews.llvm.org/D29828 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@294762 91177308-0d34-0410-b5e6-96231b3b80d8
56 lines
1.6 KiB
LLVM
56 lines
1.6 KiB
LLVM
; RUN: llc < %s -mtriple=thumbv6m-none-eabi | FileCheck %s --check-prefix=V6M --check-prefix=CHECK
|
|
; RUN: llc < %s -mtriple=thumbv7m-none-eabi | FileCheck %s --check-prefix=V7M --check-prefix=CHECK
|
|
; RUN: llc < %s -mtriple=thumbv7a-none-eabi | FileCheck %s --check-prefix=V7A --check-prefix=CHECK
|
|
; RUN: llc < %s -mtriple=armv7a-none-eabi | FileCheck %s --check-prefix=V7A --check-prefix=CHECK
|
|
|
|
|
|
target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64"
|
|
target triple = "armv7a-arm-none-eabi"
|
|
|
|
define void @test_const(i32 %val) {
|
|
; CHECK-LABEL: test_const:
|
|
entry:
|
|
%cmp = icmp eq i32 %val, 0
|
|
br i1 %cmp, label %write_reg, label %exit
|
|
|
|
write_reg:
|
|
tail call void @llvm.write_register.i32(metadata !0, i32 0)
|
|
tail call void @llvm.write_register.i32(metadata !0, i32 0)
|
|
; V6M: msr apsr, {{r[0-9]+}}
|
|
; V6M: msr apsr, {{r[0-9]+}}
|
|
; V7M: msr apsr_nzcvq, {{r[0-9]+}}
|
|
; V7M: msr apsr_nzcvq, {{r[0-9]+}}
|
|
; V7A: msr APSR_nzcvq, {{r[0-9]+}}
|
|
; V7A: msr APSR_nzcvq, {{r[0-9]+}}
|
|
br label %exit
|
|
|
|
exit:
|
|
ret void
|
|
}
|
|
|
|
define void @test_var(i32 %val, i32 %apsr) {
|
|
; CHECK-LABEL: test_var:
|
|
entry:
|
|
%cmp = icmp eq i32 %val, 0
|
|
br i1 %cmp, label %write_reg, label %exit
|
|
|
|
write_reg:
|
|
tail call void @llvm.write_register.i32(metadata !0, i32 %apsr)
|
|
tail call void @llvm.write_register.i32(metadata !0, i32 %apsr)
|
|
; V6M: msr apsr, {{r[0-9]+}}
|
|
; V6M: msr apsr, {{r[0-9]+}}
|
|
; V7M: msr apsr_nzcvq, {{r[0-9]+}}
|
|
; V7M: msr apsr_nzcvq, {{r[0-9]+}}
|
|
; V7A: msr APSR_nzcvq, {{r[0-9]+}}
|
|
; V7A: msr APSR_nzcvq, {{r[0-9]+}}
|
|
br label %exit
|
|
|
|
exit:
|
|
ret void
|
|
}
|
|
|
|
|
|
declare void @llvm.write_register.i32(metadata, i32)
|
|
|
|
!0 = !{!"apsr"}
|