File tree Expand file tree Collapse file tree 1 file changed +24
-4
lines changed Expand file tree Collapse file tree 1 file changed +24
-4
lines changed Original file line number Diff line number Diff line change @@ -19,15 +19,35 @@ Require Import String Coqlib.
1919Require Import AST Integers Floats Values.
2020Require Import Builtins0.
2121
22- Inductive platform_builtin : Type := .
22+ Inductive platform_builtin : Type :=
23+ | BI_fmin
24+ | BI_fmax.
2325
2426Local Open Scope string_scope.
2527
2628Definition platform_builtin_table : list (string * platform_builtin) :=
27- nil.
29+ ("__builtin_fmin", BI_fmin)
30+ :: ("__builtin_fmax", BI_fmax)
31+ :: nil.
2832
2933Definition platform_builtin_sig (b: platform_builtin) : signature :=
30- match b with end .
34+ match b with
35+ | BI_fmin | BI_fmax =>
36+ mksignature (Tfloat :: Tfloat :: nil) Tfloat cc_default
37+ end .
3138
3239Definition platform_builtin_sem (b: platform_builtin) : builtin_sem (sig_res (platform_builtin_sig b)) :=
33- match b with end .
40+ match b with
41+ | BI_fmin =>
42+ mkbuiltin_n2t Tfloat Tfloat Tfloat
43+ (fun f1 f2 => match Float.compare f1 f2 with
44+ | Some Eq | Some Lt => f1
45+ | Some Gt | None => f2
46+ end )
47+ | BI_fmax =>
48+ mkbuiltin_n2t Tfloat Tfloat Tfloat
49+ (fun f1 f2 => match Float.compare f1 f2 with
50+ | Some Eq | Some Gt => f1
51+ | Some Lt | None => f2
52+ end )
53+ end .
You can’t perform that action at this time.
0 commit comments