aboutsummaryrefslogtreecommitdiffstats
path: root/x86
diff options
context:
space:
mode:
authorDavid Monniaux <david.monniaux@univ-grenoble-alpes.fr>2019-09-23 19:48:20 +0200
committerDavid Monniaux <david.monniaux@univ-grenoble-alpes.fr>2019-09-23 19:48:20 +0200
commitc7156a4fd9c449c7610942a2fbf1e0908459b7f6 (patch)
tree50460a87be5baffd5aa8e32c71d4be3ccb980c8d /x86
parenta8e2039a772da0fcfd484b7445de8cc093be5d2b (diff)
downloadcompcert-kvx-c7156a4fd9c449c7610942a2fbf1e0908459b7f6.tar.gz
compcert-kvx-c7156a4fd9c449c7610942a2fbf1e0908459b7f6.zip
add: non trapping ops
Diffstat (limited to 'x86')
-rw-r--r--x86/Op.v31
1 files changed, 31 insertions, 0 deletions
diff --git a/x86/Op.v b/x86/Op.v
index a7176ce4..15672bbe 100644
--- a/x86/Op.v
+++ b/x86/Op.v
@@ -742,6 +742,37 @@ Proof with (try exact I; try reflexivity).
unfold Val.select. destruct (eval_condition c vl m). apply Val.normalize_type. exact I.
Qed.
+
+Definition is_trapping_op (op : operation) :=
+ match op with
+ | Odiv | Odivl | Odivu | Odivlu
+ | Omod | Omodl | Omodu | Omodlu
+ | Oshrximm _ | Oshrxlimm _
+ | Ointoffloat
+ | Ointofsingle
+ | Olongoffloat
+ | Olongofsingle
+ | Osingleofint
+ | Osingleoflong
+ | Ofloatofint
+ | Ofloatoflong
+ | Olea _ | Oleal _ (* TODO this is suboptimal *) => true
+ | _ => false
+ end.
+
+Lemma is_trapping_op_sound:
+ forall op vl sp m,
+ op <> Omove ->
+ is_trapping_op op = false ->
+ (List.length vl) = (List.length (fst (type_of_operation op))) ->
+ eval_operation genv sp op vl m <> None.
+Proof.
+ destruct op; intros; simpl in *; try congruence.
+ all: try (destruct vl as [ | vh1 vl1]; try discriminate).
+ all: try (destruct vl1 as [ | vh2 vl2]; try discriminate).
+ all: try (destruct vl2 as [ | vh3 vl3]; try discriminate).
+ all: try (destruct vl3 as [ | vh4 vl4]; try discriminate).
+Qed.
End SOUNDNESS.
(** * Manipulating and transforming operations *)