aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Monniaux <David.Monniaux@univ-grenoble-alpes.fr>2021-12-12 17:31:41 +0100
committerDavid Monniaux <David.Monniaux@univ-grenoble-alpes.fr>2021-12-12 17:31:41 +0100
commit4f7d6d6a081de52fe1151a29d44221f4fc35f7be (patch)
treedc5cd69f25cb0b42ef906aed1848b1b0bc9fbd5c
parent1ecddb62bc5aa8e6a1f6c1a1a2da2e2a8e2b100f (diff)
downloadcompcert-kvx-4f7d6d6a081de52fe1151a29d44221f4fc35f7be.tar.gz
compcert-kvx-4f7d6d6a081de52fe1151a29d44221f4fc35f7be.zip
Asm level
-rw-r--r--kvx/Asm.v12
-rw-r--r--kvx/Asmvliw.v9
-rw-r--r--kvx/TargetPrinter.ml8
3 files changed, 28 insertions, 1 deletions
diff --git a/kvx/Asm.v b/kvx/Asm.v
index fd20316c..333854cf 100644
--- a/kvx/Asm.v
+++ b/kvx/Asm.v
@@ -163,6 +163,8 @@ Inductive instruction : Type :=
| Pfloatuwrnsz (rd rs: ireg) (**r Floating Point Conversion from integer (u32 -> 32) *)
| Pfloatudrnsz (rd rs: ireg) (**r Floating Point Conversion from unsigned integer (64 bits) *)
| Pfloatdrnsz (rd rs: ireg) (**r Floating Point Conversion from integer (64 bits) *)
+
+ (* round to zero *)
| Pfixedwrzz (rd rs: ireg) (**r Integer conversion from floating point *)
| Pfixeduwrzz (rd rs: ireg) (**r Integer conversion from floating point (f32 -> 32 bits unsigned *)
| Pfixeddrzz (rd rs: ireg) (**r Integer conversion from floating point (i64 -> 64 bits) *)
@@ -170,6 +172,12 @@ Inductive instruction : Type :=
| Pfixedudrzz (rd rs: ireg) (**r unsigned Integer conversion from floating point (u64 -> 64 bits) *)
| Pfixedudrzz_i32 (rd rs: ireg) (**r unsigned Integer conversion from floating point (u32 -> 64 bits) *)
+ (* round to nearest, prefer even numbers *)
+ | Pfixedwrne (rd rs: ireg) (**r Integer conversion from floating point *)
+ | Pfixeduwrne (rd rs: ireg) (**r Integer conversion from floating point (f32 -> 32 bits unsigned *)
+ | Pfixeddrne (rd rs: ireg) (**r Integer conversion from floating point (i64 -> 64 bits) *)
+ | Pfixedudrne (rd rs: ireg) (**r unsigned Integer conversion from floating point (u64 -> 64 bits) *)
+
(** Arith RI32 *)
| Pmake (rd: ireg) (imm: int) (**r load immediate *)
@@ -352,6 +360,10 @@ Definition basic_to_instruction (b: basic) :=
| PArithRR Asmvliw.Pfixedudrzz rd rs => Pfixedudrzz rd rs
| PArithRR Asmvliw.Pfixeddrzz_i32 rd rs => Pfixeddrzz_i32 rd rs
| PArithRR Asmvliw.Pfixedudrzz_i32 rd rs => Pfixedudrzz_i32 rd rs
+ | PArithRR Asmvliw.Pfixedwrne rd rs => Pfixedwrne rd rs
+ | PArithRR Asmvliw.Pfixeduwrne rd rs => Pfixeduwrne rd rs
+ | PArithRR Asmvliw.Pfixeddrne rd rs => Pfixeddrne rd rs
+ | PArithRR Asmvliw.Pfixedudrne rd rs => Pfixedudrne rd rs
(* RI32 *)
| PArithRI32 Asmvliw.Pmake rd imm => Pmake rd imm
diff --git a/kvx/Asmvliw.v b/kvx/Asmvliw.v
index 45b230e6..b3c0c8fa 100644
--- a/kvx/Asmvliw.v
+++ b/kvx/Asmvliw.v
@@ -402,7 +402,10 @@ Inductive arith_name_rr : Type :=
| Pfixedudrzz (**r Integer conversion from floating point (float -> unsigned long) *)
| Pfixeddrzz_i32 (**r Integer conversion from floating point (float -> int) *)
| Pfixedudrzz_i32 (**r Integer conversion from floating point (float -> unsigned int) *)
-.
+ | Pfixedwrne (**r Integer conversion from floating point *)
+ | Pfixeduwrne (**r Integer conversion from floating point (f32 -> 32 bits unsigned *)
+ | Pfixeddrne (**r Integer conversion from floating point (i64 -> 64 bits) *)
+ | Pfixedudrne. (**r unsigned Integer conversion from floating point (u64 -> 64 bits) *)
Inductive arith_name_ri32 : Type :=
| Pmake (**r load immediate *)
@@ -955,6 +958,10 @@ Definition arith_eval_rr n v :=
| Pfixedudrzz => Val.maketotal (Val.longuoffloat v)
| Pfixeddrzz_i32 => Val.maketotal (Val.intoffloat v)
| Pfixedudrzz_i32 => Val.maketotal (Val.intuoffloat v)
+ | Pfixedudrne => Val.maketotal (Val.longuoffloat_ne v)
+ | Pfixeddrne => Val.maketotal (Val.longoffloat_ne v)
+ | Pfixeduwrne => Val.maketotal (Val.intuoffloat_ne v)
+ | Pfixedwrne => Val.maketotal (Val.intoffloat_ne v)
end.
Definition arith_eval_ri32 n i :=
diff --git a/kvx/TargetPrinter.ml b/kvx/TargetPrinter.ml
index 9e2e3776..40e2be55 100644
--- a/kvx/TargetPrinter.ml
+++ b/kvx/TargetPrinter.ml
@@ -586,6 +586,14 @@ module Target (*: TARGET*) =
fprintf oc " fixedd.rz %a = %a, 0\n" ireg rd ireg rs
| Pfixedudrzz(rd, rs) | Pfixedudrzz_i32(rd, rs) ->
fprintf oc " fixedud.rz %a = %a, 0\n" ireg rd ireg rs
+ | Pfixedudrne(rd, rs) ->
+ fprintf oc " fixedud.ne %a = %a, 0\n" ireg rd ireg rs
+ | Pfixeddrne(rd, rs) ->
+ fprintf oc " fixedd.ne %a = %a, 0\n" ireg rd ireg rs
+ | Pfixeduwrne(rd, rs) ->
+ fprintf oc " fixeduw.ne %a = %a, 0\n" ireg rd ireg rs
+ | Pfixedwrne(rd, rs) ->
+ fprintf oc " fixedw.ne %a = %a, 0\n" ireg rd ireg rs
(* Arith RI32 instructions *)
| Pmake (rd, imm) ->