summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXavier Leroy <xavier.leroy@inria.fr>2003-04-25 13:26:55 +0000
committerXavier Leroy <xavier.leroy@inria.fr>2003-04-25 13:26:55 +0000
commitc20b79b68da84a19e400a44c6d20e1b716dd8b16 (patch)
treed39659b4b56a185dd547013e3db018b5cf9c104f
parent7abcc8799e5b726f0469512d888fa2f8d11b95c0 (diff)
Bug dans Int32.shift_right_unsigned sur archi 64 bits
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@5511 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
-rw-r--r--asmcomp/cmmgen.ml21
1 files changed, 5 insertions, 16 deletions
diff --git a/asmcomp/cmmgen.ml b/asmcomp/cmmgen.ml
index d4ba9df7d..b3bd4278b 100644
--- a/asmcomp/cmmgen.ml
+++ b/asmcomp/cmmgen.ml
@@ -457,21 +457,10 @@ let unbox_int bi arg =
Cop(Cload(if bi = Pint32 then Thirtytwo_signed else Word),
[Cop(Cadda, [arg; Cconst_int size_addr])])
-let unbox_unsigned_int bi arg =
- match arg with
- Cop(Calloc, [hdr; ops; Cop(Clsl, [contents; Cconst_int 32])])
- when bi = Pint32 && size_int = 8 && big_endian ->
- (* Force zero-extension of low 32 bits *)
- Cop(Clsr, [Cop(Clsl, [contents; Cconst_int 32]); Cconst_int 32])
- | Cop(Calloc, [hdr; ops; contents])
- when bi = Pint32 && size_int = 8 && not big_endian ->
- (* Force zero-extension of low 32 bits *)
- Cop(Clsr, [Cop(Clsl, [contents; Cconst_int 32]); Cconst_int 32])
- | Cop(Calloc, [hdr; ops; contents]) ->
- contents
- | _ ->
- Cop(Cload(if bi = Pint32 then Thirtytwo_unsigned else Word),
- [Cop(Cadda, [arg; Cconst_int size_addr])])
+let make_unsigned_int bi arg =
+ if bi = Pint32 && size_int = 8
+ then Cop(Cand, [arg; Cconst_natint 0xFFFFFFFFn])
+ else arg
(* Big arrays *)
@@ -1235,7 +1224,7 @@ and transl_prim_2 p arg1 arg2 =
[transl_unbox_int bi arg1; untag_int(transl arg2)]))
| Plsrbint bi ->
box_int bi (Cop(Clsr,
- [unbox_unsigned_int bi (transl arg1);
+ [make_unsigned_int bi (transl_unbox_int bi arg1);
untag_int(transl arg2)]))
| Pasrbint bi ->
box_int bi (Cop(Casr,