From b3c10d4a7d01e46f609a1eb8b133d9985329a987 Mon Sep 17 00:00:00 2001 From: Antoni Boucher Date: Sat, 7 Oct 2023 15:15:02 -0400 Subject: [PATCH] Fix 128-bit non-native integers negation --- src/int.rs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/int.rs b/src/int.rs index 4422162828d..58e0dd56f38 100644 --- a/src/int.rs +++ b/src/int.rs @@ -36,7 +36,6 @@ pub fn gcc_not(&self, a: RValue<'gcc>) -> RValue<'gcc> { self.cx.context.new_unary_op(None, operation, typ, a) } else { - // TODO(antoyo): use __negdi2 and __negti2 instead? let element_type = typ.dyncast_array().expect("element type"); let values = [ self.cx.context.new_unary_op(None, UnaryOp::BitwiseNegate, element_type, self.low(a)), @@ -52,9 +51,7 @@ pub fn gcc_neg(&self, a: RValue<'gcc>) -> RValue<'gcc> { self.cx.context.new_unary_op(None, UnaryOp::Minus, a.get_type(), a) } else { - let param_a = self.context.new_parameter(None, a_type, "a"); - let func = self.context.new_function(None, FunctionType::Extern, a_type, &[param_a], "__negti2", false); - self.context.new_call(None, func, &[a]) + self.gcc_add(self.gcc_not(a), self.gcc_int(a_type, 1)) } }