aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--powerpc/Asmexpand.ml20
1 files changed, 13 insertions, 7 deletions
diff --git a/powerpc/Asmexpand.ml b/powerpc/Asmexpand.ml
index b50065f7..ba63bb13 100644
--- a/powerpc/Asmexpand.ml
+++ b/powerpc/Asmexpand.ml
@@ -507,16 +507,22 @@ let expand_builtin_inline name args res =
raise (Error "the first argument of __builtin_set_spr must be a constant")
(* Special registers in 32bit hybrid mode *)
| "__builtin_get_spr64", [BA_int n], BR_splitlong(BR(IR rh), BR(IR rl)) ->
- emit (Pmfspr(rl, n));
- emit (Prldicl(rh, rl, _32, _32));
- emit (Prldicl(rl, rl, _0, _32))
+ if Archi.ppc64 then begin
+ emit (Pmfspr(rl, n));
+ emit (Prldicl(rh, rl, _32, _32));
+ emit (Prldicl(rl, rl, _0, _32))
+ end else
+ raise (Error "__builtin_get_spr64 is only supported for PPC64 targets")
| "__builtin_get_spr64", _, _ ->
raise (Error "the argument of __builtin_get_spr64 must be a constant")
| "__builtin_set_spr64", [BA_int n; BA_splitlong(BA(IR ah), BA(IR al))], _ ->
- emit (Prldicr(GPR10, ah, _32, _31));
- emit (Prldicl(al, al, _0, _32));
- emit (Pori(GPR10, al, Cint _0));
- emit (Pmtspr(n, GPR10))
+ if Archi.ppc64 then begin
+ emit (Prldicr(GPR10, ah, _32, _31));
+ emit (Prldicl(al, al, _0, _32));
+ emit (Pori(GPR10, al, Cint _0));
+ emit (Pmtspr(n, GPR10))
+ end else
+ raise (Error "__builtin_set_spr64 is only supported for PPC64 targets")
| "__builtin_set_spr64", _, _ ->
raise (Error "the first argument of __builtin_set_spr64 must be a constant")
(* Move registers *)