summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
authorOliver Stannard <oliver.stannard@arm.com>2018-09-26 14:42:59 +0000
committerOliver Stannard <oliver.stannard@arm.com>2018-09-26 14:42:59 +0000
commitc5d192b611d5da18b8a23078c1bdecbd97219489 (patch)
tree256b6be22e5c59f338515505e46b6647759c7fe9 /llvm
parent03ad8812f5f590545e1b91939214f1a67f2b8017 (diff)
downloadbcm5719-llvm-c5d192b611d5da18b8a23078c1bdecbd97219489.tar.gz
bcm5719-llvm-c5d192b611d5da18b8a23078c1bdecbd97219489.zip
[AArch64] Refactor instructions that write PSTATE (NFCI)
Reuse some code in preparation for the v8.5A XAFlag/AXFlag instructions, which shares part of the encoding of the MSR-immediate. Patch by Pablo Barrio! Differential revision: https://reviews.llvm.org/D52472 llvm-svn: 343113
Diffstat (limited to 'llvm')
-rw-r--r--llvm/lib/Target/AArch64/AArch64InstrFormats.td24
1 files changed, 15 insertions, 9 deletions
diff --git a/llvm/lib/Target/AArch64/AArch64InstrFormats.td b/llvm/lib/Target/AArch64/AArch64InstrFormats.td
index 4e935bdc1ad..df6a63ba6fa 100644
--- a/llvm/lib/Target/AArch64/AArch64InstrFormats.td
+++ b/llvm/lib/Target/AArch64/AArch64InstrFormats.td
@@ -1173,16 +1173,23 @@ def pstatefield4_op : Operand<i32> {
let PrintMethod = "printSystemPStateField";
}
+// Instructions to modify PSTATE, no input reg
let Defs = [NZCV] in
+class PstateWriteSimple<dag iops, string asm, string operands>
+ : SimpleSystemI<0, iops, asm, operands> {
+
+ let Inst{20-19} = 0b00;
+ let Inst{15-12} = 0b0100;
+}
+
class MSRpstateImm0_15
- : SimpleSystemI<0, (ins pstatefield4_op:$pstatefield, imm0_15:$imm),
- "msr", "\t$pstatefield, $imm">,
+ : PstateWriteSimple<(ins pstatefield4_op:$pstatefield, imm0_15:$imm), "msr",
+ "\t$pstatefield, $imm">,
Sched<[WriteSys]> {
+
bits<6> pstatefield;
bits<4> imm;
- let Inst{20-19} = 0b00;
let Inst{18-16} = pstatefield{5-3};
- let Inst{15-12} = 0b0100;
let Inst{11-8} = imm;
let Inst{7-5} = pstatefield{2-0};
@@ -1201,16 +1208,15 @@ def pstatefield1_op : Operand<i32> {
let PrintMethod = "printSystemPStateField";
}
-let Defs = [NZCV] in
class MSRpstateImm0_1
- : SimpleSystemI<0, (ins pstatefield1_op:$pstatefield, imm0_1:$imm),
- "msr", "\t$pstatefield, $imm">,
+ : PstateWriteSimple<(ins pstatefield1_op:$pstatefield, imm0_1:$imm), "msr",
+ "\t$pstatefield, $imm">,
Sched<[WriteSys]> {
+
bits<6> pstatefield;
bit imm;
- let Inst{20-19} = 0b00;
let Inst{18-16} = pstatefield{5-3};
- let Inst{15-9} = 0b0100000;
+ let Inst{11-9} = 0b000;
let Inst{8} = imm;
let Inst{7-5} = pstatefield{2-0};
OpenPOWER on IntegriCloud