aboutsummaryrefslogtreecommitdiffstats
path: root/kvx/SelectOp.vp
diff options
context:
space:
mode:
authorSylvain Boulmé <sylvain.boulme@univ-grenoble-alpes.fr>2020-10-21 09:15:40 +0200
committerSylvain Boulmé <sylvain.boulme@univ-grenoble-alpes.fr>2020-10-21 09:15:40 +0200
commit0f47c1dbf3cee6845df9c4c3da0924ed4e10a9c4 (patch)
treeb0799e5d8e4ae62a9ae47c5358a62630c7a4efc3 /kvx/SelectOp.vp
parent647471e5b084703d1c817c02ef4298c474d3d571 (diff)
parent3f99a42035389b1953030af8490a5ec18a64394f (diff)
downloadcompcert-kvx-0f47c1dbf3cee6845df9c4c3da0924ed4e10a9c4.tar.gz
compcert-kvx-0f47c1dbf3cee6845df9c4c3da0924ed4e10a9c4.zip
Merge branch 'kvx-work' into aarch64_block_bodystar
Diffstat (limited to 'kvx/SelectOp.vp')
-rw-r--r--kvx/SelectOp.vp14
1 files changed, 7 insertions, 7 deletions
diff --git a/kvx/SelectOp.vp b/kvx/SelectOp.vp
index 9e5d45a0..65dba3ac 100644
--- a/kvx/SelectOp.vp
+++ b/kvx/SelectOp.vp
@@ -103,8 +103,14 @@ Nondetfunction select0 (ty : typ) (cond0 : condition0) (e1 e2 e3: expr) :=
| _, _, _ => (Eop (Osel cond0 ty) (e1 ::: e2 ::: e3 ::: Enil))
end.
+Definition same_expr_pure (e1 e2: expr) :=
+ match e1, e2 with
+ | Evar v1, Evar v2 => if ident_eq v1 v2 then true else false
+ | _, _ => false
+ end.
+
Definition select (ty : typ) (cond : condition) (args : exprlist) (e1 e2: expr) : option expr :=
- Some(
+ Some (if same_expr_pure e1 e2 then e1 else
match cond_to_condition0 cond args with
| None => select0 ty (Ccomp0 Cne) e1 e2 (Eop (Ocmp cond) args)
| Some(cond0, ec) => select0 ty cond0 e1 e2 ec
@@ -356,12 +362,6 @@ Nondetfunction orimm (n1: int) (e2: expr) :=
| _ => Eop (Oorimm n1) (e2:::Enil)
end.
-Definition same_expr_pure (e1 e2: expr) :=
- match e1, e2 with
- | Evar v1, Evar v2 => if ident_eq v1 v2 then true else false
- | _, _ => false
- end.
-
Nondetfunction or (e1: expr) (e2: expr) :=
match e1, e2 with
| Eop (Ointconst n1) Enil, t2 => orimm n1 t2