aboutsummaryrefslogtreecommitdiffstats
path: root/aarch64
diff options
context:
space:
mode:
authorJustus Fasse <justus.fasse@etu.univ-grenoble-alpes.fr>2020-07-13 17:43:22 +0200
committerJustus Fasse <justus.fasse@etu.univ-grenoble-alpes.fr>2020-07-13 17:43:22 +0200
commitc48fd3f91f6dc9a35c7c9cb4a4b21d0598d91930 (patch)
tree2822f759f10a1173329f255ad80a8208084ecb93 /aarch64
parent45049f8a085bb916009ee9154d7218a1a287c0da (diff)
downloadcompcert-kvx-c48fd3f91f6dc9a35c7c9cb4a4b21d0598d91930.tar.gz
compcert-kvx-c48fd3f91f6dc9a35c7c9cb4a4b21d0598d91930.zip
Generate both Pcsel and Pfsel
In Asmblock, Pcsel is used for both integer and floating-point conditional selection. A previous commit (c764ff84) had incorrectly reverted the merging of Pfsel into Pcsel.
Diffstat (limited to 'aarch64')
-rw-r--r--aarch64/Asmblock.v2
-rw-r--r--aarch64/Asmgen.v13
2 files changed, 13 insertions, 2 deletions
diff --git a/aarch64/Asmblock.v b/aarch64/Asmblock.v
index e362753b..ba6a64fa 100644
--- a/aarch64/Asmblock.v
+++ b/aarch64/Asmblock.v
@@ -445,7 +445,7 @@ Inductive ar_instruction : Type :=
(* PArithFR0 *)
| Pfmovi (fsz : fsize) (rd : freg) (r1 : ireg0) (**r copy int reg to FP reg *)
(* PArithCPPP *)
- | Pcsel (rd r1 r2 : ireg) (c : testcond) (**r int/float conditional move *)
+ | Pcsel (rd r1 r2 : preg) (c : testcond) (**r int/float conditional move *)
(* PArithAFFF *)
| Pfnmul (fsz : fsize) (rd r1 r2 : freg) (**r multiply-negate *)
.
diff --git a/aarch64/Asmgen.v b/aarch64/Asmgen.v
index dae9004d..ec680478 100644
--- a/aarch64/Asmgen.v
+++ b/aarch64/Asmgen.v
@@ -217,7 +217,18 @@ Definition basic_to_instruction (b: basic) : res Asm.instruction :=
| PArith (Pcset rd c) => OK (Asm.Pcset rd c)
| PArith (Pfmovi fsz rd r1) => OK (Asm.Pfmovi fsz rd r1)
- | PArith (Pcsel rd r1 r2 c) => OK (Asm.Pcsel rd r1 r2 c)
+ | PArith (Pcsel rd r1 r2 c) =>
+ match r1, r2 with
+ | IR r1', IR r2' => do rd' <- ireg_of_preg rd;
+ do r1'' <- ireg_of_preg r1';
+ do r2'' <- ireg_of_preg r2';
+ OK (Asm.Pcsel rd' r1'' r2'' c)
+ | FR r1', IR r2' => do rd' <- freg_of_preg rd;
+ do r1'' <- freg_of_preg r1';
+ do r2'' <- freg_of_preg r2';
+ OK (Asm.Pfsel rd' r1'' r2'' c)
+ | _, _ => Error (msg "Asmgen.basic_to_instruction: Pcsel is only defind on iregs and fregs.")
+ end
| PArith (Pfnmul fsz rd r1 r2) => OK (Asm.Pfnmul fsz rd r1 r2)
| PLoad Pldrw rd a => do rd' <- ireg_of_preg rd; OK (Asm.Pldrw rd' a)