Skip to content

Commit

Permalink
FIX LZCNT semantics to handle the size parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
basavesh committed Jul 12, 2023
1 parent a675aed commit 5f1e07b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@

## Bug fixes

- Handle the size parameter in LZCNT semantic
([PR #516](https://github.com/jasmin-lang/jasmin/pull/516);
fixes [#515](https://github.com/jasmin-lang/jasmin/issues/515)).

- Type-checking rejects wrongly casted primitive operators
([PR #489](https://github.com/jasmin-lang/jasmin/pull/488);
fixes [#69](https://github.com/jasmin-lang/jasmin/issues/69)).
Expand Down
6 changes: 3 additions & 3 deletions proofs/compiler/x86_instr_decl.v
Original file line number Diff line number Diff line change
Expand Up @@ -500,15 +500,15 @@ Definition x86_DEC sz (w: word sz) : ex_tpl (b4w_ty sz) :=
(wsigned w - 1)%Z).


Fixpoint leading_zero_aux (n: Z) (k : nat) :=
Fixpoint leading_zero_aux (n: Z) (k : nat) (sz : nat) :=
if (n <? 2^(64 - k))%Z then k
else match k with
| 0 => 0
| S k' => leading_zero_aux n k'
| S k' => leading_zero_aux n k' sz
end.

Definition leading_zero sz (w: word sz) : word sz :=
wrepr sz (leading_zero_aux (wunsigned w) sz).
wrepr sz (leading_zero_aux (wunsigned w) sz sz).

Definition x86_LZCNT sz (w: word sz) : ex_tpl (b5w_ty sz) :=
Let _ := check_size_16_64 sz in
Expand Down

0 comments on commit 5f1e07b

Please sign in to comment.