| 1 |
(** * Push-Button Synthesis Examples *) |
| 2 |
From Coq Require Import String. |
| 3 |
From Coq Require Import ZArith. |
| 4 |
From Coq Require Import List. |
| 5 |
Require Import Crypto.Util.ZRange. |
| 6 |
Require Import Rewriter.Language.Language. |
| 7 |
Require Import Crypto.Language.API. |
| 8 |
Require Import Crypto.Stringification.C. |
| 9 |
Require Import Crypto.Arithmetic.Core. |
| 10 |
Require Import Crypto.Arithmetic.ModOps. |
| 11 |
Require Import Crypto.Arithmetic.Primitives. |
| 12 |
Require Import Crypto.BoundsPipeline. |
| 13 |
Import ListNotations. |
| 14 |
Local Open Scope Z_scope. Local Open Scope list_scope. |
| 15 |
|
| 16 |
Import |
| 17 |
Language.Compilers |
| 18 |
Stringification.C.Compilers. |
| 19 |
Import Compilers.API. |
| 20 |
|
| 21 |
Import Associational Positional. |
| 22 |
|
| 23 |
Local Existing Instance Pipeline.default_BoundsPipelineOptions. |
| 24 |
|
| 25 |
Time Redirect "log" Compute |
| 26 |
(Pipeline.BoundsPipeline |
| 27 |
true [64; 128] |
| 28 |
ltac:(let r := Reify (fun f g => mulmod (weight 51 1) (2^255) [(1,19)] 5 f g) in |
| 29 |
exact r) |
| 30 |
(Some (repeat (@None _) 5), ((Some (repeat (@None _) 5), tt))) |
| 31 |
ZRange.type.base.option.None). |
| 32 |
|
| 33 |
Time Redirect "log" Compute |
| 34 |
(Pipeline.BoundsPipeline |
| 35 |
true [64; 128] |
| 36 |
ltac:(let r := Reify (fun f g => mulmod (weight 51 2) (2^255) [(1,19)] 10 f g) in |
| 37 |
exact r) |
| 38 |
(Some (repeat (@None _) 10), ((Some (repeat (@None _) 10), tt))) |
| 39 |
ZRange.type.base.option.None). |
| 40 |
|
| 41 |
Time Redirect "log" Compute |
| 42 |
(Pipeline.BoundsPipeline |
| 43 |
true [64; 128] |
| 44 |
ltac:(let r := Reify (to_associational (weight 51 1) 5) in |
| 45 |
exact r) |
| 46 |
(Some (repeat (@None _) 5), tt) |
| 47 |
ZRange.type.base.option.None). |
| 48 |
|
| 49 |
Time Redirect "log" Compute |
| 50 |
(Pipeline.BoundsPipeline |
| 51 |
true [64; 128] |
| 52 |
ltac:(let r := Reify (scmul (weight 51 1) 5) in |
| 53 |
exact r) |
| 54 |
(None, (Some (repeat (@None _) 5), tt)) |
| 55 |
ZRange.type.base.option.None). |
| 56 |
|
| 57 |
Time Redirect "log" Compute |
| 58 |
(Pipeline.BoundsPipeline |
| 59 |
true [64; 128] |
| 60 |
ltac:(let r := Reify (fun f => carry_mulmod 51 1 (2^255) [(1,19)] 5 (seq 0 5 ++ [0; 1])%list%nat f f) in |
| 61 |
exact r) |
| 62 |
(Some (repeat (@None _) 5), tt) |
| 63 |
ZRange.type.base.option.None). |
| 64 |
|
| 65 |
Local Existing Instance ToString.C.OutputCAPI. |
| 66 |
Local Existing Instance default_language_naming_conventions. |
| 67 |
Local Existing Instance default_documentation_options. |
| 68 |
Local Existing Instance default_output_options. |
| 69 |
Local Existing Instance AbstractInterpretation.default_Options. |
| 70 |
Local Instance : package_name_opt := None. |
| 71 |
Local Instance : class_name_opt := None. |
| 72 |
Local Instance : static_opt := true. |
| 73 |
Local Instance : internal_static_opt := true. |
| 74 |
Local Instance : inline_opt := true. |
| 75 |
Local Instance : inline_internal_opt := true. |
| 76 |
Local Instance : emit_primitives_opt := true. |
| 77 |
|
| 78 |
Time Redirect "log" Compute |
| 79 |
(Pipeline.BoundsPipelineToString |
| 80 |
"fiat_" "fiat_mulx_u64" |
| 81 |
true true [64; 128] 64 |
| 82 |
ltac:(let r := Reify (mulx 64) in |
| 83 |
exact r) |
| 84 |
(fun _ _ => []) |
| 85 |
(Some r[0~>2^64-1], (Some r[0~>2^64-1], tt))%zrange |
| 86 |
(Some r[0~>2^64-1], Some r[0~>2^64-1])%zrange |
| 87 |
(None, (None, tt)) |
| 88 |
(None, None) |
| 89 |
: Pipeline.ErrorT _). |
| 90 |
|
| 91 |
Time Redirect "log" Compute |
| 92 |
(Pipeline.BoundsPipelineToString |
| 93 |
"fiat_" "fiat_addcarryx_u64" |
| 94 |
true true [1; 64; 128] 64 |
| 95 |
ltac:(let r := Reify (addcarryx 64) in |
| 96 |
exact r) |
| 97 |
(fun _ _ => []) |
| 98 |
(Some r[0~>1], (Some r[0~>2^64-1], (Some r[0~>2^64-1], tt)))%zrange |
| 99 |
(Some r[0~>2^64-1], Some r[0~>1])%zrange |
| 100 |
(None, (None, (None, tt))) |
| 101 |
(None, None) |
| 102 |
: Pipeline.ErrorT _). |
| 103 |
|
| 104 |
Time Redirect "log" Compute |
| 105 |
(Pipeline.BoundsPipelineToString |
| 106 |
"fiat_" "fiat_addcarryx_u51" |
| 107 |
true true [1; 64; 128] 64 |
| 108 |
ltac:(let r := Reify (addcarryx 51) in |
| 109 |
exact r) |
| 110 |
(fun _ _ => []) |
| 111 |
(Some r[0~>1], (Some r[0~>2^51-1], (Some r[0~>2^51-1], tt)))%zrange |
| 112 |
(Some r[0~>2^51-1], Some r[0~>1])%zrange |
| 113 |
(None, (None, (None, tt))) |
| 114 |
(None, None) |
| 115 |
: Pipeline.ErrorT _). |
| 116 |
|
| 117 |
Time Redirect "log" Compute |
| 118 |
(Pipeline.BoundsPipelineToString |
| 119 |
"fiat_" "fiat_subborrowx_u64" |
| 120 |
true true [1; 64; 128] 64 |
| 121 |
ltac:(let r := Reify (subborrowx 64) in |
| 122 |
exact r) |
| 123 |
(fun _ _ => []) |
| 124 |
(Some r[0~>1], (Some r[0~>2^64-1], (Some r[0~>2^64-1], tt)))%zrange |
| 125 |
(Some r[0~>2^64-1], Some r[0~>1])%zrange |
| 126 |
(None, (None, (None, tt))) |
| 127 |
(None, None) |
| 128 |
: Pipeline.ErrorT _). |
| 129 |
Time Redirect "log" Compute |
| 130 |
(Pipeline.BoundsPipelineToString |
| 131 |
"fiat_" "fiat_subborrowx_u51" |
| 132 |
true true [1; 64; 128] 64 |
| 133 |
ltac:(let r := Reify (subborrowx 51) in |
| 134 |
exact r) |
| 135 |
(fun _ _ => []) |
| 136 |
(Some r[0~>1], (Some r[0~>2^51-1], (Some r[0~>2^51-1], tt)))%zrange |
| 137 |
(Some r[0~>2^51-1], Some r[0~>1])%zrange |
| 138 |
(None, (None, (None, tt))) |
| 139 |
(None, None) |
| 140 |
: Pipeline.ErrorT _). |
| 141 |
|
| 142 |
Time Redirect "log" Compute |
| 143 |
(Pipeline.BoundsPipelineToString |
| 144 |
"fiat_" "fiat_cmovznz64" |
| 145 |
true true [1; 64; 128] 64 |
| 146 |
ltac:(let r := Reify (cmovznz 64) in |
| 147 |
exact r) |
| 148 |
(fun _ _ => []) |
| 149 |
(Some r[0~>1], (Some r[0~>2^64-1], (Some r[0~>2^64-1], tt)))%zrange |
| 150 |
(Some r[0~>2^64-1])%zrange |
| 151 |
(None, (None, (None, tt))) |
| 152 |
None |
| 153 |
: Pipeline.ErrorT _). |