From 25b9b003178002360d666919f2e49e7f5f4a36e2 Mon Sep 17 00:00:00 2001 From: xleroy Date: Sat, 4 Feb 2012 19:14:14 +0000 Subject: Merge of the "volatile" branch: - native treatment of volatile accesses in CompCert C's semantics - translation of volatile accesses to built-ins in SimplExpr - native treatment of struct assignment and passing struct parameter by value - only passing struct result by value remains emulated - in cparser, remove emulations that are no longer used - added C99's type _Bool and used it to express || and && more efficiently. git-svn-id: https://yquem.inria.fr/compcert/svn/compcert/trunk@1814 fca1b0fc-160b-0410-b1d3-a4f43f01ea2e --- powerpc/SelectOp.vp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'powerpc/SelectOp.vp') diff --git a/powerpc/SelectOp.vp b/powerpc/SelectOp.vp index 3bb55449..08968f7c 100644 --- a/powerpc/SelectOp.vp +++ b/powerpc/SelectOp.vp @@ -69,7 +69,20 @@ Nondetfunction notint (e: expr) := | _ => Elet e (Eop Onor (Eletvar O ::: Eletvar O ::: Enil)) end. -(** ** Boolean negation *) +(** ** Boolean value and boolean negation *) + +Fixpoint boolval (e: expr) {struct e} : expr := + let default := Eop (Ocmp (Ccompuimm Cne Int.zero)) (e ::: Enil) in + match e with + | Eop (Ointconst n) Enil => + Eop (Ointconst (if Int.eq n Int.zero then Int.zero else Int.one)) Enil + | Eop (Ocmp cond) args => + Eop (Ocmp cond) args + | Econdition e1 e2 e3 => + Econdition e1 (boolval e2) (boolval e3) + | _ => + default + end. Fixpoint notbool (e: expr) {struct e} : expr := let default := Eop (Ocmp (Ccompuimm Ceq Int.zero)) (e ::: Enil) in -- cgit