Skip to content

Commit c770672

Browse files
bschommerxavierleroy
authored andcommitted
Added semantic for AArch64 built-in function fmin/fmax.
The semantic is defined similar to the one from x86. Bug 30035
1 parent 4011a08 commit c770672

File tree

1 file changed

+24
-4
lines changed

1 file changed

+24
-4
lines changed

aarch64/Builtins1.v

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,35 @@ Require Import String Coqlib.
1919
Require Import AST Integers Floats Values.
2020
Require Import Builtins0.
2121

22-
Inductive platform_builtin : Type := .
22+
Inductive platform_builtin : Type :=
23+
| BI_fmin
24+
| BI_fmax.
2325

2426
Local Open Scope string_scope.
2527

2628
Definition platform_builtin_table : list (string * platform_builtin) :=
27-
nil.
29+
("__builtin_fmin", BI_fmin)
30+
:: ("__builtin_fmax", BI_fmax)
31+
:: nil.
2832

2933
Definition 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

3239
Definition 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.

0 commit comments

Comments
 (0)