aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--backend/Selection.v5
-rw-r--r--mppa_k1c/SelectOp.vp5
2 files changed, 6 insertions, 4 deletions
diff --git a/backend/Selection.v b/backend/Selection.v
index ec4a7b38..7191d5cb 100644
--- a/backend/Selection.v
+++ b/backend/Selection.v
@@ -283,10 +283,7 @@ Definition sel_builtin optid ef args :=
| Some id =>
match args with
| a1::a2::a3::nil =>
- OK (Sassign id (Eop (Oselect (Ccomp0 Ceq))
- ((sel_expr a3):::
- (sel_expr a2):::
- (sel_expr a1):::Enil)))
+ OK (Sassign id (select (sel_expr a3) (sel_expr a2) (sel_expr a1)))
| _ => Error (msg "__builtin_ternary_(u)int: arguments")
end
end
diff --git a/mppa_k1c/SelectOp.vp b/mppa_k1c/SelectOp.vp
index 31e81093..10c91bba 100644
--- a/mppa_k1c/SelectOp.vp
+++ b/mppa_k1c/SelectOp.vp
@@ -61,6 +61,11 @@ Section SELECT.
Context {hf: helper_functions}.
+(** Ternary operator *)
+Definition select o0 o1 oselect :=
+ Eop (Oselect (Ccomp0 Ceq))
+ (o0:::o1:::oselect:::Enil).
+
(** ** Constants **)
Definition addrsymbol (id: ident) (ofs: ptrofs) :=