aboutsummaryrefslogtreecommitdiffstats
path: root/powerpc
diff options
context:
space:
mode:
authorBernhard Schommer <bernhardschommer@gmail.com>2020-07-01 15:16:55 +0200
committerBernhard Schommer <bschommer@users.noreply.github.com>2020-07-01 18:07:40 +0200
commitbb9fa5550d6145344c4ed296ed980cb419e4cb27 (patch)
tree2759172d23b022807a471cb10e4ae1b09908189e /powerpc
parentc94405f67ca18be997974f88ff91c072d8a5c0cb (diff)
downloadcompcert-kvx-bb9fa5550d6145344c4ed296ed980cb419e4cb27.tar.gz
compcert-kvx-bb9fa5550d6145344c4ed296ed980cb419e4cb27.zip
Added asserts for constraints of PowerPC builtins
Diffstat (limited to 'powerpc')
-rw-r--r--powerpc/Asmexpand.ml6
1 files changed, 6 insertions, 0 deletions
diff --git a/powerpc/Asmexpand.ml b/powerpc/Asmexpand.ml
index ce88778c..1854ec16 100644
--- a/powerpc/Asmexpand.ml
+++ b/powerpc/Asmexpand.ml
@@ -767,6 +767,8 @@ let expand_builtin_inline name args res =
emit (Pori (GPR0, GPR0, Cint _0))
(* atomic operations *)
| "__builtin_atomic_exchange", [BA (IR a1); BA (IR a2); BA (IR a3)],_ ->
+ (* Register constraints imposed by Machregs.v *)
+ assert(a1 = GPR3 && a2 = GPR4 && a3 = GPR5);
emit (Plwz (GPR10,Cint _0,a2));
emit (Psync);
let lbl = new_label() in
@@ -786,6 +788,8 @@ let expand_builtin_inline name args res =
emit (Pisync);
emit (Pstw (GPR0,Cint _0, a2))
| "__builtin_sync_fetch_and_add", [BA (IR a1); BA(IR a2)], BR (IR res) ->
+ (* Register constraints imposed by Machregs.v *)
+ assert (a1 = GPR4 && a2 = GPR5 && res = GPR3);
let lbl = new_label() in
emit (Psync);
emit (Plabel lbl);
@@ -795,6 +799,8 @@ let expand_builtin_inline name args res =
emit (Pbf (CRbit_2, lbl));
emit (Pisync);
| "__builtin_atomic_compare_exchange", [BA (IR dst); BA(IR exp); BA (IR des)], BR (IR res) ->
+ (* Register constraints imposed by Machregs.v *)
+ assert (dst = GPR4 && exp = GPR5 && des = GPR6 && res = GPR3);
let lbls = new_label ()
and lblneq = new_label ()
and lblsucc = new_label () in