implement add saturated for the dev backend

This commit is contained in:
Folkert 2023-05-07 20:59:32 +02:00
parent 736b7c6a83
commit 8770668688
No known key found for this signature in database
GPG key ID: 1F17F6FFD112B97C
2 changed files with 44 additions and 0 deletions

View file

@ -860,6 +860,9 @@ trait Backend<'a> {
);
self.build_num_add(sym, &args[0], &args[1], ret_layout)
}
LowLevel::NumAddSaturated => {
self.build_num_add_saturated(*sym, args[0], args[1], *ret_layout);
}
LowLevel::NumAddWrap => {
debug_assert_eq!(
2,
@ -1856,6 +1859,15 @@ trait Backend<'a> {
/// build_num_add stores the sum of src1 and src2 into dst.
fn build_num_add(&mut self, dst: &Symbol, src1: &Symbol, src2: &Symbol, layout: &InLayout<'a>);
/// build_num_add_saturated stores the sum of src1 and src2 into dst.
fn build_num_add_saturated(
&mut self,
dst: Symbol,
src1: Symbol,
src2: Symbol,
layout: InLayout<'a>,
);
/// build_num_add_checked stores the sum of src1 and src2 into dst.
fn build_num_add_checked(
&mut self,