Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Sint32 & Sint64 types & libfuncs #383

Merged
merged 33 commits into from
Dec 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
e8b478d
Push progress
fmoletta Dec 12, 2023
a74eb7f
Parse Sint8 result value
fmoletta Dec 12, 2023
c2589dc
Improve sub test + fix how signed values are compared against vm values
fmoletta Dec 12, 2023
a8832de
Clippy
fmoletta Dec 12, 2023
ebe8ad3
Improve testing
fmoletta Dec 12, 2023
9fc2934
Fix
fmoletta Dec 12, 2023
35fd300
Try stuff
fmoletta Dec 13, 2023
1521aa4
Fix typos
fmoletta Dec 13, 2023
2e1608e
Fix test values
fmoletta Dec 13, 2023
99d63ab
Add test & fix wide_mul
fmoletta Dec 13, 2023
1ea8ce1
First draft of diff libfunc
fmoletta Dec 13, 2023
9e3704d
Improve test
fmoletta Dec 13, 2023
17d8d7a
Remove old code
fmoletta Dec 13, 2023
616b1af
Add test
fmoletta Dec 13, 2023
7056d54
Merge remote-tracking branch 'origin/main' into i_diff
fmoletta Dec 13, 2023
fdae270
Add Sint16 type + libfuncs
fmoletta Dec 13, 2023
d5fc8e3
fmt
fmoletta Dec 13, 2023
34a1727
Push progress
fmoletta Dec 13, 2023
7c488dc
Remove uneeded intermidiate variables
fmoletta Dec 14, 2023
1d0c424
Merge branch 'i_diff' into sint16
fmoletta Dec 14, 2023
88099c1
Update code
fmoletta Dec 14, 2023
cfd2af2
Merge branch 'sint16' into sint3264
fmoletta Dec 14, 2023
3173ebf
Update code
fmoletta Dec 14, 2023
4920310
Add tests for i64 libfuncs
fmoletta Dec 14, 2023
f67b472
Adjust test values
fmoletta Dec 14, 2023
4c7412e
Fix cairo programs
fmoletta Dec 14, 2023
f00f0ec
fmt
fmoletta Dec 14, 2023
8b49acb
Remove old file
fmoletta Dec 14, 2023
7f10b44
Fix comment
fmoletta Dec 14, 2023
7b738e5
Merge remote-tracking branch 'origin/main' into sint3264
fmoletta Dec 14, 2023
2bd55e6
Fix comments
fmoletta Dec 14, 2023
1d58c9c
Merge remote-tracking branch 'origin/main' into sint3264
fmoletta Dec 14, 2023
72f9dff
Update code
fmoletta Dec 14, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 33 additions & 3 deletions src/jit_runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -226,9 +226,39 @@ pub fn execute(

params_ptrs.push(next.to_jit(&arena, registry, param_type_id)?);
}
CoreTypeConcrete::Sint32(_) => todo!(),
CoreTypeConcrete::Sint64(_) => todo!(),
CoreTypeConcrete::Sint128(_) => todo!(),
CoreTypeConcrete::Sint32(_) => {
let next = params_it
.next()
.ok_or_else(|| make_missing_parameter(param_type_id))?;

if !matches!(next, JITValue::Sint32(_)) {
Err(make_unexpected_value_error("JITValue::Sint32".to_string()))?;
}

params_ptrs.push(next.to_jit(&arena, registry, param_type_id)?);
}
CoreTypeConcrete::Sint64(_) => {
let next = params_it
.next()
.ok_or_else(|| make_missing_parameter(param_type_id))?;

if !matches!(next, JITValue::Sint64(_)) {
Err(make_unexpected_value_error("JITValue::Sint64".to_string()))?;
}

params_ptrs.push(next.to_jit(&arena, registry, param_type_id)?);
}
CoreTypeConcrete::Sint128(_) => {
let next = params_it
.next()
.ok_or_else(|| make_missing_parameter(param_type_id))?;

if !matches!(next, JITValue::Sint128(_)) {
Err(make_unexpected_value_error("JITValue::Sint128".to_string()))?;
}

params_ptrs.push(next.to_jit(&arena, registry, param_type_id)?);
}
CoreTypeConcrete::NonZero(info) => {
let next = params_it
.next()
Expand Down
10 changes: 8 additions & 2 deletions src/libfuncs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ pub mod nullable;
pub mod pedersen;
pub mod poseidon;
pub mod sint16;
pub mod sint32;
pub mod sint64;
pub mod sint8;
pub mod snapshot_take;
pub mod stark_net;
Expand Down Expand Up @@ -207,8 +209,12 @@ where
CoreConcreteLibfunc::Sint16(info) => {
self::sint16::build(context, registry, entry, location, helper, metadata, info)
}
CoreConcreteLibfunc::Sint32(_) => todo!(),
CoreConcreteLibfunc::Sint64(_) => todo!(),
CoreConcreteLibfunc::Sint32(info) => {
self::sint32::build(context, registry, entry, location, helper, metadata, info)
}
CoreConcreteLibfunc::Sint64(info) => {
self::sint64::build(context, registry, entry, location, helper, metadata, info)
}
CoreConcreteLibfunc::Sint128(_) => todo!(),
CoreConcreteLibfunc::Bytes31(_) => todo!(),
}
Expand Down
4 changes: 2 additions & 2 deletions src/libfuncs/sint16.rs
Original file line number Diff line number Diff line change
Expand Up @@ -547,11 +547,11 @@ mod test {
fn i16_const_min() {
let program = load_cairo!(
fn run_test() -> i16 {
0_i16
-32768_i16
}
);

run_program_assert_output(&program, "run_test", &[], &[0i16.into()]);
run_program_assert_output(&program, "run_test", &[], &[i16::MIN.into()]);
}

#[test]
Expand Down
Loading