From 8adc3425d9db30ba61815408548ec2bbb6a5afc6 Mon Sep 17 00:00:00 2001 From: Michael Schmidt Date: Tue, 15 Dec 2015 16:47:31 +0100 Subject: bug 17752, check target architecture for 64bit-builtins --- powerpc/Asmexpand.ml | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'powerpc/Asmexpand.ml') 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 *) -- cgit