diff options
author | 2017-05-12 18:07:47 -0400 | |
---|---|---|
committer | 2017-05-17 17:16:47 -0400 | |
commit | be5f86b5483d2e00ec9002b8db00a1ff8ecb9cfe (patch) | |
tree | 46307ee43ca27edf483a9073938415dddc0a364f /src/Compilers/Z/ArithmeticSimplifier.v | |
parent | 7884130a89d07f4bbe1465126c06ca4c3927cb81 (diff) |
Add reflective machinery for adc, zselect
Diffstat (limited to 'src/Compilers/Z/ArithmeticSimplifier.v')
-rw-r--r-- | src/Compilers/Z/ArithmeticSimplifier.v | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/Compilers/Z/ArithmeticSimplifier.v b/src/Compilers/Z/ArithmeticSimplifier.v index b2621c625..f0d3e19ab 100644 --- a/src/Compilers/Z/ArithmeticSimplifier.v +++ b/src/Compilers/Z/ArithmeticSimplifier.v @@ -20,9 +20,18 @@ Section language. : option (interp_flat_type inverted_expr t) := match x in Syntax.exprf _ _ t return option (interp_flat_type _ t) with | Op t1 (Tbase _) opc args - => Some (match opc in op src dst return exprf dst -> exprf src -> inverted_expr match dst with Tbase t => t | _ => TZ end with + => Some (match opc in op src dst + return exprf dst + -> exprf src + -> match dst with + | Tbase t => inverted_expr t + | Prod _ _ => True + | _ => inverted_expr TZ + end + with | OpConst _ z => fun _ _ => const_of _ z | Opp TZ TZ => fun _ args => neg_expr _ args + | AddWithGetCarry _ _ _ _ _ _ => fun _ _ => I | _ => fun e _ => gen_expr _ e end (Op opc args) args) | TT => Some tt @@ -175,6 +184,9 @@ Section language. | Lor _ _ _ as opc | OpConst _ _ as opc | Opp _ _ as opc + | Zselect _ _ _ _ as opc + | AddWithCarry _ _ _ _ as opc + | AddWithGetCarry _ _ _ _ _ _ as opc => Op opc end. End with_var. |