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 @@ impl<'b, 'tcx> CodegenCx<'b, 'tcx> {
// user defined names
let mut name = String::with_capacity(prefix.len() + 6);
name.push_str(prefix);
name.push_str(".");
name.push('.');
name.push_str(&(idx as u64).to_base(ALPHANUMERIC_ONLY));
name
}

View File

@ -83,7 +83,17 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> {
let b = self.context.new_cast(self.location, b, a_type);
a >> b
} else {
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() {
a >> b
@ -635,7 +645,17 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> {
let b = self.context.new_cast(self.location, b, a_type);
a << b
} else {
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() {
a << b