8300253: Introduce AArch64 nzcv accessors
Reviewed-by: aph, smonteith
This commit is contained in:
parent
c6b3f2dd10
commit
6e4710bc83
@ -581,6 +581,14 @@ public:
|
||||
mrs(0b011, 0b0000, 0b0000, 0b001, reg);
|
||||
}
|
||||
|
||||
inline void get_nzcv(Register reg) {
|
||||
mrs(0b011, 0b0100, 0b0010, 0b000, reg);
|
||||
}
|
||||
|
||||
inline void set_nzcv(Register reg) {
|
||||
msr(0b011, 0b0100, 0b0010, 0b000, reg);
|
||||
}
|
||||
|
||||
// idiv variant which deals with MINLONG as dividend and -1 as divisor
|
||||
int corrected_idivl(Register result, Register ra, Register rb,
|
||||
bool want_remainder, Register tmp = rscratch1);
|
||||
|
@ -350,6 +350,67 @@ class OneRegOp(Instruction):
|
||||
return (super(OneRegOp, self).astr()
|
||||
+ '%s' % self.reg.astr(self.asmRegPrefix))
|
||||
|
||||
class SystemRegOp(Instruction):
|
||||
def __init__(self, args):
|
||||
name, self.system_reg = args
|
||||
Instruction.__init__(self, name)
|
||||
if self.system_reg == 'fpsr':
|
||||
self.op1 = 0b011
|
||||
self.CRn = 0b0100
|
||||
self.CRm = 0b0100
|
||||
self.op2 = 0b001
|
||||
elif self.system_reg == 'dczid_el0':
|
||||
self.op1 = 0b011
|
||||
self.CRn = 0b0000
|
||||
self.CRm = 0b0000
|
||||
self.op2 = 0b111
|
||||
elif self.system_reg == 'ctr_el0':
|
||||
self.op1 = 0b011
|
||||
self.CRn = 0b0000
|
||||
self.CRm = 0b0000
|
||||
self.op2 = 0b001
|
||||
elif self.system_reg == 'nzcv':
|
||||
self.op1 = 0b011
|
||||
self.CRn = 0b0100
|
||||
self.CRm = 0b0010
|
||||
self.op2 = 0b000
|
||||
|
||||
def generate(self):
|
||||
self.reg = [GeneralRegister().generate()]
|
||||
return self
|
||||
|
||||
class SystemOneRegOp(SystemRegOp):
|
||||
|
||||
def cstr(self):
|
||||
return (super(SystemOneRegOp, self).cstr()
|
||||
+ '%s' % self.op1
|
||||
+ ', %s' % self.CRn
|
||||
+ ', %s' % self.CRm
|
||||
+ ', %s' % self.op2
|
||||
+ ', %s);' % self.reg[0])
|
||||
|
||||
def astr(self):
|
||||
prefix = self.asmRegPrefix
|
||||
return (super(SystemOneRegOp, self).astr()
|
||||
+ '%s' % self.system_reg
|
||||
+ ', %s' % self.reg[0].astr(prefix))
|
||||
|
||||
class OneRegSystemOp(SystemRegOp):
|
||||
|
||||
def cstr(self):
|
||||
return (super(OneRegSystemOp, self).cstr()
|
||||
+ '%s' % self.op1
|
||||
+ ', %s' % self.CRn
|
||||
+ ', %s' % self.CRm
|
||||
+ ', %s' % self.op2
|
||||
+ ', %s);' % self.reg[0])
|
||||
|
||||
def astr(self):
|
||||
prefix = self.asmRegPrefix
|
||||
return (super(OneRegSystemOp, self).astr()
|
||||
+ '%s' % self.reg[0].astr(prefix)
|
||||
+ ', %s' % self.system_reg)
|
||||
|
||||
class PostfixExceptionOneRegOp(OneRegOp):
|
||||
|
||||
def __init__(self, op):
|
||||
@ -1396,6 +1457,12 @@ generate (OneRegOp, ["br", "blr",
|
||||
"autiza", "autizb", "autdza", "autdzb", "xpacd",
|
||||
"braaz", "brabz", "blraaz", "blrabz"])
|
||||
|
||||
for system_reg in ["fpsr", "nzcv"]:
|
||||
generate (SystemOneRegOp, [ ["msr", system_reg] ])
|
||||
|
||||
for system_reg in ["fpsr", "nzcv", "dczid_el0", "ctr_el0"]:
|
||||
generate (OneRegSystemOp, [ ["mrs", system_reg] ])
|
||||
|
||||
# Ensure the "i" is not stripped off the end of the instruction
|
||||
generate (PostfixExceptionOneRegOp, ["xpaci"])
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user