perf: bitvector literals in match patterns (#3485)
This commit is contained in:
parent
3ead33bd13
commit
d179d6c8d7
2 changed files with 23 additions and 0 deletions
|
|
@ -450,6 +450,7 @@ def canUnfoldAtMatcher (cfg : Config) (info : ConstantInfo) : CoreM Bool := do
|
|||
|| info.name == ``Char.ofNat || info.name == ``Char.ofNatAux
|
||||
|| info.name == ``String.decEq || info.name == ``List.hasDecEq
|
||||
|| info.name == ``Fin.ofNat
|
||||
|| info.name == ``Fin.ofNat' -- It is used to define `BitVec` literals
|
||||
|| info.name == ``UInt8.ofNat || info.name == ``UInt8.decEq
|
||||
|| info.name == ``UInt16.ofNat || info.name == ``UInt16.decEq
|
||||
|| info.name == ``UInt32.ofNat || info.name == ``UInt32.decEq
|
||||
|
|
|
|||
22
tests/lean/run/bv_math_lit_perf.lean
Normal file
22
tests/lean/run/bv_math_lit_perf.lean
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
open BitVec
|
||||
|
||||
def f (x : BitVec 32) : Nat :=
|
||||
match x with
|
||||
| 10#32 => 0
|
||||
| 100#32 => 2
|
||||
| 200#32 => 3
|
||||
| 300#32 => 4
|
||||
| 400#32 => 5
|
||||
| 500#32 => 6
|
||||
| 600#32 => 7
|
||||
| 700#32 => 8
|
||||
| 800#32 => 9
|
||||
| 900#32 => 10
|
||||
| 910#32 => 11
|
||||
| 920#32 => 12
|
||||
| _ => 1000
|
||||
|
||||
set_option maxHeartbeats 500
|
||||
example : f 500#32 = x := by
|
||||
simp [f]
|
||||
sorry
|
||||
Loading…
Add table
Reference in a new issue