From ea45404a7ad40e952e0e4c415bdd1b7670ee515a Mon Sep 17 00:00:00 2001 From: David Monniaux Date: Mon, 25 Mar 2019 07:36:46 +0100 Subject: progressing on select/selectl --- mppa_k1c/ValueAOp.v | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'mppa_k1c/ValueAOp.v') diff --git a/mppa_k1c/ValueAOp.v b/mppa_k1c/ValueAOp.v index fb1977ea..7f599840 100644 --- a/mppa_k1c/ValueAOp.v +++ b/mppa_k1c/ValueAOp.v @@ -41,6 +41,15 @@ Definition eval_static_addressing (addr: addressing) (vl: list aval): aval := | _, _ => Vbot end. +Definition select (v0 v1 vselect : aval) : aval := + match vselect with + | I iselect => + if Int.eq iselect Int.zero + then v0 + else v1 + | _ => Vbot + end. + Definition eval_static_operation (op: operation) (vl: list aval): aval := match op, vl with | Omove, v1::nil => v1 @@ -165,6 +174,8 @@ Definition eval_static_operation (op: operation) (vl: list aval): aval := | Osingleoflong, v1::nil => singleoflong v1 | Osingleoflongu, v1::nil => singleoflongu v1 | Ocmp c, _ => of_optbool (eval_static_condition c vl) + | Oselect, v0::v1::vselect::nil => select v0 v1 vselect + | Oselectl, v0::v1::vselect::nil => select v0 v1 vselect | _, _ => Vbot end. -- cgit