1
Fork 0

Move {widening, carrying}_mul to an intrinsic with fallback MIR

Including implementing it for `u128`, so it can be defined in `uint_impl!`.

This way it works for all backends, including CTFE.
This commit is contained in:
Scott McMurray 2024-11-29 21:32:03 -08:00
parent 78af7da26d
commit 2c0c9123fc
9 changed files with 322 additions and 135 deletions

View file

@ -94,6 +94,7 @@ pub fn intrinsic_operation_unsafety(tcx: TyCtxt<'_>, intrinsic_id: LocalDefId) -
| sym::add_with_overflow
| sym::sub_with_overflow
| sym::mul_with_overflow
| sym::carrying_mul_add
| sym::wrapping_add
| sym::wrapping_sub
| sym::wrapping_mul
@ -436,6 +437,10 @@ pub fn check_intrinsic_type(
(1, 0, vec![param(0), param(0)], Ty::new_tup(tcx, &[param(0), tcx.types.bool]))
}
sym::carrying_mul_add => {
(2, 0, vec![param(0); 4], Ty::new_tup(tcx, &[param(1), param(0)]))
}
sym::ptr_guaranteed_cmp => (
1,
0,