aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCyril SIX <cyril.six@kalray.eu>2019-02-12 17:05:04 +0100
committerCyril SIX <cyril.six@kalray.eu>2019-02-12 17:05:04 +0100
commitadfc93550f1e4948ed4f39d52a4f6eece9c8a35d (patch)
tree7f46e83f8828cd807319cca7ff461f99ebc2df0a
parent685c2f76b5f8b320495868cfdcadbf203f50a0bd (diff)
downloadcompcert-kvx-adfc93550f1e4948ed4f39d52a4f6eece9c8a35d.tar.gz
compcert-kvx-adfc93550f1e4948ed4f39d52a4f6eece9c8a35d.zip
Added Olongoffloat, Ofloatoflong and doubleconv test
-rw-r--r--mppa_k1c/Asm.v4
-rw-r--r--mppa_k1c/Asmblock.v4
-rw-r--r--mppa_k1c/Asmblockgen.v6
-rw-r--r--mppa_k1c/PostpassSchedulingOracle.ml10
-rw-r--r--mppa_k1c/TargetPrinter.ml4
-rw-r--r--test/mppa/instr/doubleconv.c9
6 files changed, 34 insertions, 3 deletions
diff --git a/mppa_k1c/Asm.v b/mppa_k1c/Asm.v
index 35e3710c..d7bfaffe 100644
--- a/mppa_k1c/Asm.v
+++ b/mppa_k1c/Asm.v
@@ -99,7 +99,9 @@ Inductive instruction : Type :=
| Psxwd (rd rs: ireg) (**r Sign Extend Word to Double Word *)
| Pzxwd (rd rs: ireg) (**r Zero Extend Word to Double Word *)
| Pfloatwrnsz (rd rs: ireg) (**r Floating Point Conversion from integer *)
+ | Pfloatdrnsz (rd rs: ireg) (**r Floating Point Conversion from integer (64 bits) *)
| Pfixedwrzz (rd rs: ireg) (**r Integer conversion from floating point *)
+ | Pfixeddrzz (rd rs: ireg) (**r Integer conversion from floating point (64 bits) *)
(** Arith RI32 *)
| Pmake (rd: ireg) (imm: int) (**r load immediate *)
@@ -197,7 +199,9 @@ Definition basic_to_instruction (b: basic) :=
| PArithRR Asmblock.Pzxwd rd rs => Pzxwd rd rs
| PArithRR Asmblock.Pfnegd rd rs => Pfnegd rd rs
| PArithRR Asmblock.Pfloatwrnsz rd rs => Pfloatwrnsz rd rs
+ | PArithRR Asmblock.Pfloatdrnsz rd rs => Pfloatdrnsz rd rs
| PArithRR Asmblock.Pfixedwrzz rd rs => Pfixedwrzz rd rs
+ | PArithRR Asmblock.Pfixeddrzz rd rs => Pfixeddrzz rd rs
(* RI32 *)
| PArithRI32 Asmblock.Pmake rd imm => Pmake rd imm
diff --git a/mppa_k1c/Asmblock.v b/mppa_k1c/Asmblock.v
index 643870ea..3cd300c9 100644
--- a/mppa_k1c/Asmblock.v
+++ b/mppa_k1c/Asmblock.v
@@ -284,7 +284,9 @@ Inductive arith_name_rr : Type :=
| Psxwd (**r Sign Extend Word to Double Word *)
| Pzxwd (**r Zero Extend Word to Double Word *)
| Pfloatwrnsz (**r Floating Point Conversion from integer (single -> int) *)
+ | Pfloatdrnsz (**r Floating Point Conversion from integer (float -> long) *)
| Pfixedwrzz (**r Integer conversion from floating point (int -> single) *)
+ | Pfixeddrzz (**r Integer conversion from floating point (long -> float) *)
.
Inductive arith_name_ri32 : Type :=
@@ -887,7 +889,9 @@ Definition exec_arith_instr (ai: ar_instruction) (rs: regset) (m: mem) : regset
| Psxwd => rs#d <- (Val.longofint rs#s)
| Pzxwd => rs#d <- (Val.longofintu rs#s)
| Pfloatwrnsz => rs#d <- (match Val.singleofint rs#s with Some f => f | _ => Vundef end)
+ | Pfloatdrnsz => rs#d <- (match Val.floatoflong rs#s with Some f => f | _ => Vundef end)
| Pfixedwrzz => rs#d <- (match Val.intofsingle rs#s with Some i => i | _ => Vundef end)
+ | Pfixeddrzz => rs#d <- (match Val.longoffloat rs#s with Some i => i | _ => Vundef end)
end
| PArithRI32 n d i =>
diff --git a/mppa_k1c/Asmblockgen.v b/mppa_k1c/Asmblockgen.v
index 80790465..e7fa8f6c 100644
--- a/mppa_k1c/Asmblockgen.v
+++ b/mppa_k1c/Asmblockgen.v
@@ -550,9 +550,15 @@ Definition transl_op
| Osingleofint, a1 :: nil =>
do rd <- freg_of res; do rs <- ireg_of a1;
OK (Pfloatwrnsz rd rs ::i k)
+ | Ofloatoflong, a1 :: nil =>
+ do rd <- freg_of res; do rs <- ireg_of a1;
+ OK (Pfloatdrnsz rd rs ::i k)
| Ointofsingle, a1 :: nil =>
do rd <- ireg_of res; do rs <- freg_of a1;
OK (Pfixedwrzz rd rs ::i k)
+ | Olongoffloat, a1 :: nil =>
+ do rd <- ireg_of res; do rs <- freg_of a1;
+ OK (Pfixeddrzz rd rs ::i k)
| Oabsf , _ => Error (msg "Asmblockgen.transl_op: Oabsf")
| Oaddf , _ => Error (msg "Asmblockgen.transl_op: Oaddf")
| Osubf , _ => Error (msg "Asmblockgen.transl_op: Osubf")
diff --git a/mppa_k1c/PostpassSchedulingOracle.ml b/mppa_k1c/PostpassSchedulingOracle.ml
index a09d696f..ddc31ebc 100644
--- a/mppa_k1c/PostpassSchedulingOracle.ml
+++ b/mppa_k1c/PostpassSchedulingOracle.ml
@@ -35,7 +35,9 @@ let arith_rr_str = function
| Psxwd -> "Psxwd"
| Pzxwd -> "Pzxwd"
| Pfloatwrnsz -> "Pfloatwrnsz"
+ | Pfloatdrnsz -> "Pfloatdrnsz"
| Pfixedwrzz -> "Pfixedwrzz"
+ | Pfixeddrzz -> "Pfixeddrzz"
let arith_rrr_str = function
| Pcompw it -> "Pcompw"
@@ -345,7 +347,7 @@ type real_instruction =
(* BCU *)
| Icall | Call | Cb | Igoto | Goto | Ret | Get | Set
(* FPU *)
- | Fnegd | Floatwz | Fixedwz
+ | Fnegd | Floatwz | Floatdz | Fixedwz | Fixeddz
let ab_inst_to_real = function
| "Paddw" | "Paddiw" | "Pcvtl2w" -> Addw
@@ -373,7 +375,9 @@ let ab_inst_to_real = function
| "Psxwd" -> Sxwd
| "Pzxwd" -> Zxwd
| "Pfloatwrnsz" -> Floatwz
+ | "Pfloatdrnsz" -> Floatdz
| "Pfixedwrzz" -> Fixedwz
+ | "Pfixeddrzz" -> Fixeddz
| "Plb" -> Lbs
| "Plbu" -> Lbz
@@ -435,7 +439,7 @@ let rec_to_usage r =
| Nop -> alu_nop
| Sraw | Srlw | Sllw | Srad | Srld | Slld -> (match encoding with None | Some U6 -> alu_tiny | _ -> raise InvalidEncoding)
| Sxwd | Zxwd -> (match encoding with None -> alu_lite | _ -> raise InvalidEncoding)
- | Fixedwz | Floatwz -> mau
+ | Fixedwz | Floatwz | Fixeddz | Floatdz -> mau
| Lbs | Lbz | Lhs | Lhz | Lws | Ld ->
(match encoding with None | Some U6 | Some S10 -> lsu_data
| Some U27L5 | Some U27L10 -> lsu_data_x
@@ -454,7 +458,7 @@ let real_inst_to_latency = function
| Addd | Andd | Compd | Ord | Sbfd | Srad | Srld | Slld | Xord | Make
| Sxwd | Zxwd
-> 1
- | Floatwz | Fixedwz -> 4
+ | Floatwz | Fixedwz | Floatdz | Fixeddz -> 4
| Mulw | Muld -> 2 (* FIXME - WORST CASE. If it's S10 then it's only 1 *)
| Lbs | Lbz | Lhs | Lhz | Lws | Ld
| Sb | Sh | Sw | Sd
diff --git a/mppa_k1c/TargetPrinter.ml b/mppa_k1c/TargetPrinter.ml
index 1a73ae7a..703863b7 100644
--- a/mppa_k1c/TargetPrinter.ml
+++ b/mppa_k1c/TargetPrinter.ml
@@ -296,8 +296,12 @@ module Target (*: TARGET*) =
fprintf oc " zxwd %a = %a\n" ireg rd ireg rs
| Pfloatwrnsz(rd, rs) ->
fprintf oc " floatw.rn.s %a = %a, 0\n" ireg rd ireg rs
+ | Pfloatdrnsz(rd, rs) ->
+ fprintf oc " floatd.rn.s %a = %a, 0\n" ireg rd ireg rs
| Pfixedwrzz(rd, rs) ->
fprintf oc " fixedw.rz %a = %a, 0\n" ireg rd ireg rs
+ | Pfixeddrzz(rd, rs) ->
+ fprintf oc " fixedd.rz %a = %a, 0\n" ireg rd ireg rs
(* Arith RI32 instructions *)
| Pmake (rd, imm) ->
diff --git a/test/mppa/instr/doubleconv.c b/test/mppa/instr/doubleconv.c
new file mode 100644
index 00000000..e40c65e5
--- /dev/null
+++ b/test/mppa/instr/doubleconv.c
@@ -0,0 +1,9 @@
+#include "framework.h"
+
+double long2double(long v){
+ return v;
+}
+
+BEGIN_TEST(long)
+ c = (long) long2double(a) + (long) long2double(b) + (long) long2double(42.3);
+END_TEST()