Add shl and shr missing casts

This commit is contained in:
Guillaume Gomez 2024-05-21 16:30:55 +02:00 committed by Antoni Boucher
parent 684a69b4e6
commit 30ee7ba862
2 changed files with 23 additions and 3 deletions

View File

@ -613,7 +613,7 @@ pub fn generate_local_symbol_name(&self, prefix: &str) -> String {
// user defined names // user defined names
let mut name = String::with_capacity(prefix.len() + 6); let mut name = String::with_capacity(prefix.len() + 6);
name.push_str(prefix); name.push_str(prefix);
name.push_str("."); name.push('.');
name.push_str(&(idx as u64).to_base(ALPHANUMERIC_ONLY)); name.push_str(&(idx as u64).to_base(ALPHANUMERIC_ONLY));
name name
} }

View File

@ -83,7 +83,17 @@ pub fn gcc_lshr(&mut self, a: RValue<'gcc>, b: RValue<'gcc>) -> RValue<'gcc> {
let b = self.context.new_cast(self.location, b, a_type); let b = self.context.new_cast(self.location, b, a_type);
a >> b a >> b
} else { } else {
a >> b let a_size = a_type.get_size();
let b_size = b_type.get_size();
if a_size > b_size {
let b = self.context.new_cast(self.location, b, a_type);
a >> b
} else if a_size < b_size {
let a = self.context.new_cast(self.location, a, b_type);
a >> b
} else {
a >> b
}
} }
} else if a_type.is_vector() && a_type.is_vector() { } else if a_type.is_vector() && a_type.is_vector() {
a >> b a >> b
@ -635,7 +645,17 @@ pub fn gcc_shl(&mut self, a: RValue<'gcc>, b: RValue<'gcc>) -> RValue<'gcc> {
let b = self.context.new_cast(self.location, b, a_type); let b = self.context.new_cast(self.location, b, a_type);
a << b a << b
} else { } else {
a << b let a_size = a_type.get_size();
let b_size = b_type.get_size();
if a_size > b_size {
let b = self.context.new_cast(self.location, b, a_type);
a << b
} else if a_size < b_size {
let a = self.context.new_cast(self.location, a, b_type);
a << b
} else {
a << b
}
} }
} else if a_type.is_vector() && a_type.is_vector() { } else if a_type.is_vector() && a_type.is_vector() {
a << b a << b