diff options
author | xleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e> | 2010-05-02 07:40:56 +0000 |
---|---|---|
committer | xleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e> | 2010-05-02 07:40:56 +0000 |
commit | 3fb4ee15ed74c55923fe702a130d77120a471ca3 (patch) | |
tree | d315dcd8e4338ee2dbc8643473021b6e38fb51c9 /cfrontend/Csem.v | |
parent | 551b52e3b0ddc7a06358f1246b448664a59c86b4 (diff) | |
download | compcert-kvx-3fb4ee15ed74c55923fe702a130d77120a471ca3.tar.gz compcert-kvx-3fb4ee15ed74c55923fe702a130d77120a471ca3.zip |
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
Diffstat (limited to 'cfrontend/Csem.v')
-rw-r--r-- | cfrontend/Csem.v | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/cfrontend/Csem.v b/cfrontend/Csem.v index bd26b0f9..6e35c2f0 100644 --- a/cfrontend/Csem.v +++ b/cfrontend/Csem.v @@ -117,6 +117,12 @@ Function sem_notbool (v: val) (ty: type) : option val := | _ => None end. +Function sem_fabs (v: val) : option val := + match v with + | Vfloat f => Some (Vfloat (Float.abs f)) + | _ => None + end. + Function sem_add (v1:val) (t1:type) (v2: val) (t2:type) : option val := match classify_add t1 t2 with | add_case_ii => (**r integer addition *) @@ -320,6 +326,7 @@ Definition sem_unary_operation | Onotbool => sem_notbool v ty | Onotint => sem_notint v | Oneg => sem_neg v ty + | Ofabs => sem_fabs v end. Definition sem_binary_operation |