aboutsummaryrefslogtreecommitdiffstats
path: root/powerpc/Asmexpand.ml
diff options
context:
space:
mode:
authorMichael Schmidt <github@mschmidt.me>2015-12-15 16:47:31 +0100
committerMichael Schmidt <github@mschmidt.me>2015-12-15 16:47:31 +0100
commit8adc3425d9db30ba61815408548ec2bbb6a5afc6 (patch)
tree61d90948cf5037535044f09bfb83522b52001bc2 /powerpc/Asmexpand.ml
parent0e40a5b6ae0997b11469fdeea702db4c7f878c17 (diff)
downloadcompcert-kvx-8adc3425d9db30ba61815408548ec2bbb6a5afc6.tar.gz
compcert-kvx-8adc3425d9db30ba61815408548ec2bbb6a5afc6.zip
bug 17752, check target architecture for 64bit-builtins
Diffstat (limited to 'powerpc/Asmexpand.ml')
-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 *)