Skip to content

Commit b3c10d4

Browse files
committed
Fix 128-bit non-native integers negation
1 parent b3fecae commit b3c10d4

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

src/int.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> {
3636
self.cx.context.new_unary_op(None, operation, typ, a)
3737
}
3838
else {
39-
// TODO(antoyo): use __negdi2 and __negti2 instead?
4039
let element_type = typ.dyncast_array().expect("element type");
4140
let values = [
4241
self.cx.context.new_unary_op(None, UnaryOp::BitwiseNegate, element_type, self.low(a)),
@@ -52,9 +51,7 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> {
5251
self.cx.context.new_unary_op(None, UnaryOp::Minus, a.get_type(), a)
5352
}
5453
else {
55-
let param_a = self.context.new_parameter(None, a_type, "a");
56-
let func = self.context.new_function(None, FunctionType::Extern, a_type, &[param_a], "__negti2", false);
57-
self.context.new_call(None, func, &[a])
54+
self.gcc_add(self.gcc_not(a), self.gcc_int(a_type, 1))
5855
}
5956
}
6057

0 commit comments

Comments
 (0)