From 3fb4ee15ed74c55923fe702a130d77120a471ca3 Mon Sep 17 00:00:00 2001 From: xleroy Date: Sun, 2 May 2010 07:40:56 +0000 Subject: Add "fabs" (floating-point absolute value) as a unary operator in Clight and C#minor. Recognize __builtin_fabs and turn it into this operator. git-svn-id: https://yquem.inria.fr/compcert/svn/compcert/trunk@1329 fca1b0fc-160b-0410-b1d3-a4f43f01ea2e --- cfrontend/Cshmgen.v | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'cfrontend/Cshmgen.v') diff --git a/cfrontend/Cshmgen.v b/cfrontend/Cshmgen.v index 548c8df8..cc81d0f4 100644 --- a/cfrontend/Cshmgen.v +++ b/cfrontend/Cshmgen.v @@ -120,6 +120,9 @@ Definition make_notbool (e: expr) (ty: type) := Definition make_notint (e: expr) (ty: type) := Eunop Onotint e. +Definition make_fabs (e: expr) (ty: type) := + Eunop Oabsf e. + Definition make_add (e1: expr) (ty1: type) (e2: expr) (ty2: type) := match classify_add ty1 ty2 with | add_case_ii => OK (Ebinop Oadd e1 e2) @@ -317,6 +320,7 @@ Definition transl_unop (op: Csyntax.unary_operation) (a: expr) (ta: type) : res | Csyntax.Onotbool => OK(make_notbool a ta) | Csyntax.Onotint => OK(make_notint a ta) | Csyntax.Oneg => make_neg a ta + | Csyntax.Ofabs => OK(make_fabs a ta) end. Definition transl_binop (op: Csyntax.binary_operation) -- cgit