+ added the WebAssembly saturating truncation instructions to the internal assembler

This commit is contained in:
Nikolay Nikolov 2022-05-28 17:41:28 +03:00
parent 0ba7ef98b3
commit d378240134
4 changed files with 75 additions and 0 deletions

View File

@ -539,6 +539,14 @@ uses
a_end_try,
a_catch_all:
result:=1;
a_i32_trunc_sat_f32_s,
a_i32_trunc_sat_f32_u,
a_i32_trunc_sat_f64_s,
a_i32_trunc_sat_f64_u,
a_i64_trunc_sat_f32_s,
a_i64_trunc_sat_f32_u,
a_i64_trunc_sat_f64_s,
a_i64_trunc_sat_f64_u,
a_memory_size,
a_memory_grow:
result:=2;
@ -1910,6 +1918,46 @@ uses
internalerror(2022052809);
end;
end;
a_i32_trunc_sat_f32_s:
begin
WriteByte($FC);
WriteByte($00);
end;
a_i32_trunc_sat_f32_u:
begin
WriteByte($FC);
WriteByte($01);
end;
a_i32_trunc_sat_f64_s:
begin
WriteByte($FC);
WriteByte($02);
end;
a_i32_trunc_sat_f64_u:
begin
WriteByte($FC);
WriteByte($03);
end;
a_i64_trunc_sat_f32_s:
begin
WriteByte($FC);
WriteByte($04);
end;
a_i64_trunc_sat_f32_u:
begin
WriteByte($FC);
WriteByte($05);
end;
a_i64_trunc_sat_f64_s:
begin
WriteByte($FC);
WriteByte($06);
end;
a_i64_trunc_sat_f64_u:
begin
WriteByte($FC);
WriteByte($07);
end;
else
internalerror(2021092624);
end;

View File

@ -90,6 +90,15 @@ uses
a_ref_null, a_ref_is_null, a_ref_func,
// table instructions
a_table_get, a_table_set, a_table_size, a_table_grow, a_table_fill, a_table_copy, a_table_init, a_elem_drop,
// saturating truncation instructions
a_i32_trunc_sat_f32_s,
a_i32_trunc_sat_f32_u,
a_i32_trunc_sat_f64_s,
a_i32_trunc_sat_f64_u,
a_i64_trunc_sat_f32_s,
a_i64_trunc_sat_f32_u,
a_i64_trunc_sat_f64_s,
a_i64_trunc_sat_f64_u,
// exceptions
a_try,a_catch,a_catch_all,a_delegate,a_throw,a_rethrow,a_end_try,
// atomic memory accesses - load/store

View File

@ -89,6 +89,15 @@ interface
'ref.null', 'ref.is_null', 'ref.func',
// table instructions
'table.get', 'table.set', 'table.size', 'table.grow', 'table.fill', 'table.copy', 'table.init', 'elem.drop',
// saturating truncation instructions
'i32.trunc_sat_f32_s',
'i32.trunc_sat_f32_u',
'i32.trunc_sat_f64_s',
'i32.trunc_sat_f64_u',
'i64.trunc_sat_f32_s',
'i64.trunc_sat_f32_u',
'i64.trunc_sat_f64_s',
'i64.trunc_sat_f64_u',
// exceptions
'try','catch','catch_all','delegate','throw','rethrow','end_try',
// atomic memory accesses - load/store

View File

@ -73,6 +73,15 @@
'ref.null', 'ref.is_null', 'ref.func',
// table instructions
'table.get', 'table.set', 'table.size', 'table.grow', 'table.fill', 'table.copy', 'table.init', 'elem.drop',
// saturating truncation instructions
'i32.trunc_sat_f32_s',
'i32.trunc_sat_f32_u',
'i32.trunc_sat_f64_s',
'i32.trunc_sat_f64_u',
'i64.trunc_sat_f32_s',
'i64.trunc_sat_f32_u',
'i64.trunc_sat_f64_s',
'i64.trunc_sat_f64_u',
// exceptions
'try','catch','catch_all','delegate','throw','rethrow','end',
// atomic memory accesses - load/store