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 d1a1434e authored by qinsoon's avatar qinsoon
Browse files

correct logic on deciding whether a const is x86 immediate

parent e31c8105
......@@ -3934,6 +3934,8 @@ impl <'a> InstructionSelection {
debug!("tmp's ty: {}", tmp.ty);
self.backend.emit_mov_r_imm(&tmp, val)
} else {
assert!(tmp.ty.get_int_length().is_some());
assert!(tmp.ty.get_int_length().unwrap() == 64);
self.backend.emit_mov_r64_imm64(&tmp, val as i64);
}
},
......
......@@ -518,12 +518,17 @@ pub fn is_callee_saved(reg_id: MuID) -> bool {
}
pub fn is_valid_x86_imm(op: &P<Value>) -> bool {
use std::u32;
match op.v {
Value_::Constant(Constant::Int(val)) if val <= u32::MAX as u64 => {
true
},
_ => false
use std::i32;
if op.ty.get_int_length().is_some() && op.ty.get_int_length().unwrap() <= 32 {
match op.v {
Value_::Constant(Constant::Int(val)) if val as i32 >= i32::MIN && val as i32 <= i32::MAX => {
true
},
_ => false
}
} else {
false
}
}
......
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