summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacques Garrigue <garrigue at math.nagoya-u.ac.jp>2003-12-08 12:24:56 +0000
committerJacques Garrigue <garrigue at math.nagoya-u.ac.jp>2003-12-08 12:24:56 +0000
commit3837108f4ff8e951a2f46f650dc3d2c844b63a7b (patch)
tree2f348bb5d14fefda9c180ef55efe0a8d460d8b2a
parent5245c20ea6ab0f7d90113f6aa9a8da3f707fb92e (diff)
downloadocaml-newoolabmult.tar.gz
avoid one shiftnewoolabmult
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/newoolabmult@6010 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
-rw-r--r--asmcomp/cmmgen.ml17
1 files changed, 8 insertions, 9 deletions
diff --git a/asmcomp/cmmgen.ml b/asmcomp/cmmgen.ml
index 2c342b556f..53de3544ea 100644
--- a/asmcomp/cmmgen.ml
+++ b/asmcomp/cmmgen.ml
@@ -321,8 +321,11 @@ let lookup_tag obj tag =
bind "tag" tag (fun tag ->
let table = Ident.create "table" in
let m = untag_int (Cop(Cload Word, [Cvar table])) in
- let c = untag_uint31
- (Cop(Cload Word, [Cop(Cadda, [Cvar table; Cconst_int size_addr])])) in
+ let c =
+ Cop(Csubi,
+ [Cop(Cload Word, [Cop(Cadda, [Cvar table; Cconst_int size_addr])]);
+ Cconst_int 1])
+ in
let tag =
match tag with
Cconst_int tag ->
@@ -334,13 +337,9 @@ let lookup_tag obj tag =
| _ ->
untag_uint31 tag
in
- let mul =
- match tag with
- Cconst_natint n when n < 0x40000000n && size_addr = 4 ->
- Cop(Cmuli, [Cconst_natint (Nativeint.shift_left n 1); c])
- | _ ->
- Cop(Clsl, [Cop(Cmuli, [tag; c]); Cconst_int(size_addr*8 - 31)])
- in
+ let ofs = size_addr*8 - 32
+ and mul = Cop(Cmuli, [tag; c]) in
+ let mul = if ofs = 0 then mul else Cop(Clsl, [mul; Cconst_int ofs]) in
let lab = Cop(Cadda, [Cop(Clsr, [mul; m]); Cconst_int 2]) in
Clet(table, Cop (Cload Word, [obj]),
Cop(Cload Word,