aboutsummaryrefslogtreecommitdiffstats
path: root/mppa_k1c/Asmblockgen.v
diff options
context:
space:
mode:
authorCyril SIX <cyril.six@kalray.eu>2019-04-08 11:38:52 +0200
committerCyril SIX <cyril.six@kalray.eu>2019-04-08 11:38:52 +0200
commitf28f05a915a0e9f3258a0e1a9fbbf5a1942f5ca4 (patch)
tree88240089620463c22469fe1fd648afc57d5fec24 /mppa_k1c/Asmblockgen.v
parent5cb91df0e3faaca529798e14edb9c39046b27767 (diff)
parentb75f59eeee0e8b73a7116fd49f08810e7d4382fe (diff)
downloadcompcert-kvx-f28f05a915a0e9f3258a0e1a9fbbf5a1942f5ca4.tar.gz
compcert-kvx-f28f05a915a0e9f3258a0e1a9fbbf5a1942f5ca4.zip
Merge remote-tracking branch 'origin/mppa-work' into mppa-refactor
Conflicts: mppa_k1c/Asm.v mppa_k1c/Asmblock.v
Diffstat (limited to 'mppa_k1c/Asmblockgen.v')
-rw-r--r--mppa_k1c/Asmblockgen.v43
1 files changed, 43 insertions, 0 deletions
diff --git a/mppa_k1c/Asmblockgen.v b/mppa_k1c/Asmblockgen.v
index 7cd02540..bf466c4e 100644
--- a/mppa_k1c/Asmblockgen.v
+++ b/mppa_k1c/Asmblockgen.v
@@ -367,6 +367,28 @@ Definition transl_cond_op
Error(msg "Asmblockgen.transl_cond_op")
end.
+(* CoMPare Unsigned Words to Zero *)
+Definition btest_for_cmpuwz (c: comparison) :=
+ match c with
+ | Cne => OK BTwnez
+ | Ceq => OK BTweqz
+ | Clt => Error (msg "btest_for_compuwz: Clt")
+ | Cge => Error (msg "btest_for_compuwz: Cge")
+ | Cle => Error (msg "btest_for_compuwz: Cle")
+ | Cgt => Error (msg "btest_for_compuwz: Cgt")
+ end.
+
+(* CoMPare Unsigned Words to Zero *)
+Definition btest_for_cmpudz (c: comparison) :=
+ match c with
+ | Cne => OK BTdnez
+ | Ceq => OK BTdeqz
+ | Clt => Error (msg "btest_for_compudz: Clt")
+ | Cge => Error (msg "btest_for_compudz: Cge")
+ | Cle => Error (msg "btest_for_compudz: Cle")
+ | Cgt => Error (msg "btest_for_compudz: Cgt")
+ end.
+
(** Translation of the arithmetic operation [r <- op(args)].
The corresponding instructions are prepended to [k]. *)
@@ -729,6 +751,27 @@ Definition transl_op
do rd <- ireg_of res;
transl_cond_op cmp rd args k
+ | Oselect cond, a0 :: a1 :: aS :: nil
+ | Oselectl cond, a0 :: a1 :: aS :: nil
+ | Oselectf cond, a0 :: a1 :: aS :: nil
+ | Oselectfs cond, a0 :: a1 :: aS :: nil =>
+ assertion (mreg_eq a0 res);
+ do r0 <- ireg_of a0;
+ do r1 <- ireg_of a1;
+ do rS <- ireg_of aS;
+ (match cond with
+ | Ccomp0 cmp =>
+ OK (Pcmove (btest_for_cmpswz cmp) r0 rS r1 ::i k)
+ | Ccompu0 cmp =>
+ do bt <- btest_for_cmpuwz cmp;
+ OK (Pcmoveu bt r0 rS r1 ::i k)
+ | Ccompl0 cmp =>
+ OK (Pcmove (btest_for_cmpsdz cmp) r0 rS r1 ::i k)
+ | Ccomplu0 cmp =>
+ do bt <- btest_for_cmpudz cmp;
+ OK (Pcmoveu bt r0 rS r1 ::i k)
+ end)
+
| _, _ =>
Error(msg "Asmgenblock.transl_op")
end.