WARNING! Access to this system is limited to authorised users only.
Unauthorised users may be subject to prosecution.
Unauthorised access to this system is a criminal offence under Australian law (Federal Crimes Act 1914 Part VIA)
It is a criminal offence to:
(1) Obtain access to data without authority. -Penalty 2 years imprisonment.
(2) Damage, delete, alter or insert data without authority. -Penalty 10 years imprisonment.
User activity is monitored and recorded. Anyone using this system expressly consents to such monitoring and recording.

To protect your data, the CISO officer has suggested users to enable 2FA as soon as possible.
Currently 2.7% of users enabled 2FA.

Commit 00231b17 authored by qinsoon's avatar qinsoon
Browse files

API for binop with status (untested!)

parent 3f035045
......@@ -416,6 +416,10 @@ pub struct BinOpStatus {
}
impl BinOpStatus {
pub fn none() -> BinOpStatus {
BinOpStatus {flag_n: false, flag_z: false, flag_c: false, flag_v: false}
}
pub fn n() -> BinOpStatus {
BinOpStatus {flag_n: true, flag_z: false, flag_c: false, flag_v: false}
}
......
......@@ -1332,8 +1332,8 @@ impl<'lb, 'lvm> BundleLoader<'lb, 'lvm> {
let impl_inst = match **inst {
NodeInst::NodeBinOp {
id: _, result_id, status_result_ids: _,
optr, flags: _, ty, opnd1, opnd2,
id: _, result_id, ref status_result_ids,
optr, flags, ty, opnd1, opnd2,
exc_clause: _
} => {
let impl_optr = match optr {
......@@ -1361,12 +1361,67 @@ impl<'lb, 'lvm> BundleLoader<'lb, 'lvm> {
let impl_opnd1 = self.get_treenode(fcb, opnd1);
let impl_opnd2 = self.get_treenode(fcb, opnd2);
let impl_rv = self.new_ssa(fcb, result_id, impl_ty).clone_value();
if flags == 0 {
// binop
Instruction {
hdr: hdr,
value: Some(vec![impl_rv]),
ops: RwLock::new(vec![impl_opnd1, impl_opnd2]),
v: Instruction_::BinOp(impl_optr, 0, 1),
}
} else {
let mut values = vec![];
Instruction {
hdr: hdr,
value: Some(vec![impl_rv]),
ops: RwLock::new(vec![impl_opnd1, impl_opnd2]),
v: Instruction_::BinOp(impl_optr, 0, 1),
// result
values.push(impl_rv);
// status flags
let ty_i1 = self.ensure_i1();
let mut flags_count = 0;
let mut impl_flags = BinOpStatus::none();
if flags & CMU_BOS_N != 0 {
impl_flags.flag_n = true;
let flag_n = self.new_ssa(fcb, status_result_ids[flags_count], ty_i1.clone()).clone_value();
flags_count += 1;
values.push(flag_n);
}
if flags & CMU_BOS_Z != 0 {
impl_flags.flag_z = true;
let flag_z = self.new_ssa(fcb, status_result_ids[flags_count], ty_i1.clone()).clone_value();
flags_count += 1;
values.push(flag_z);
}
if flags & CMU_BOS_C != 0 {
impl_flags.flag_c = true;
let flag_c = self.new_ssa(fcb, status_result_ids[flags_count], ty_i1.clone()).clone_value();
flags_count += 1;
values.push(flag_c);
}
if flags & CMU_BOS_V != 0 {
impl_flags.flag_v = true;
let flag_v = self.new_ssa(fcb, status_result_ids[flags_count], ty_i1.clone()).clone_value();
values.push(flag_v);
}
Instruction {
hdr: hdr,
value: Some(values),
ops: RwLock::new(vec![impl_opnd1, impl_opnd2]),
v: Instruction_::BinOpWithStatus(impl_optr, impl_flags, 0, 1),
}
}
},
NodeInst::NodeCmp {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment