Skip to content

Commit 769fb75

Browse files
committed
Fix exactudiv and exactsdiv for gcc without 128-bit integers
1 parent 99780df commit 769fb75

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/builder.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -700,7 +700,7 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
700700
let a = self.gcc_int_cast(a, a_type);
701701
let b_type = b.get_type().to_unsigned(self);
702702
let b = self.gcc_int_cast(b, b_type);
703-
a / b
703+
self.gcc_udiv(a, b)
704704
}
705705

706706
fn sdiv(&mut self, a: RValue<'gcc>, b: RValue<'gcc>) -> RValue<'gcc> {
@@ -712,8 +712,8 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
712712
// FIXME(antoyo): rustc_codegen_ssa::mir::intrinsic uses different types for a and b but they
713713
// should be the same.
714714
let typ = a.get_type().to_signed(self);
715-
let b = self.context.new_cast(self.location, b, typ);
716-
a / b
715+
let b = self.gcc_int_cast(b, typ);
716+
self.gcc_sdiv(a, b)
717717
}
718718

719719
fn fdiv(&mut self, a: RValue<'gcc>, b: RValue<'gcc>) -> RValue<'gcc> {

0 commit comments

Comments
 (0)