GitLab will continue to be upgraded from 11.4.5-ce.0 on November 25th 2019 at 4.00pm (AEDT) to 5.00pm (AEDT) due to Critical Security Patch Availability. During the update, GitLab and Mattermost services will not be available.

Commit d1a1434e authored by qinsoon's avatar qinsoon

correct logic on deciding whether a const is x86 immediate

parent e31c8105
Pipeline #612 passed with stages
in 42 minutes and 40 seconds
......@@ -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