diff options
author | David Monniaux <david.monniaux@univ-grenoble-alpes.fr> | 2020-03-17 08:10:26 +0100 |
---|---|---|
committer | David Monniaux <david.monniaux@univ-grenoble-alpes.fr> | 2020-03-17 08:10:26 +0100 |
commit | aa2e3d776cb82ce01c4afdbacc52951e60ff2104 (patch) | |
tree | 2f3ab07c29f8478981ea61456d74cf444fa907e6 /x86 | |
parent | 0eb778a85b5b76ab6c7fd914ffaff1affcbde7bb (diff) | |
download | compcert-kvx-aa2e3d776cb82ce01c4afdbacc52951e60ff2104.tar.gz compcert-kvx-aa2e3d776cb82ce01c4afdbacc52951e60ff2104.zip |
DuplicateOpcodeHeuristic x86
Diffstat (limited to 'x86')
-rw-r--r-- | x86/DuplicateOpcodeHeuristic.ml | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/x86/DuplicateOpcodeHeuristic.ml b/x86/DuplicateOpcodeHeuristic.ml index 85505245..2ec314c1 100644 --- a/x86/DuplicateOpcodeHeuristic.ml +++ b/x86/DuplicateOpcodeHeuristic.ml @@ -1,3 +1,27 @@ -exception HeuristicSucceeded - -let opcode_heuristic code cond ifso ifnot preferred = () +(* open Camlcoq *) +open Op +open Integers + +let opcode_heuristic code cond ifso ifnot is_loop_header = + match cond with + | Ccompimm (c, n) | Ccompuimm (c, n) -> if n == Integers.Int.zero then (match c with + | Clt | Cle -> Some false + | Cgt | Cge -> Some true + | _ -> None + ) else None + | Ccomplimm (c, n) | Ccompluimm (c, n) -> if n == Integers.Int64.zero then (match c with + | Clt | Cle -> Some false + | Cgt | Cge -> Some true + | _ -> None + ) else None + | Ccompf c | Ccompfs c -> (match c with + | Ceq -> Some false + | Cne -> Some true + | _ -> None + ) + | Cnotcompf c | Cnotcompfs c -> (match c with + | Ceq -> Some true + | Cne -> Some false + | _ -> None + ) + | _ -> None |