diff options
Diffstat (limited to 'asmcomp')
-rw-r--r-- | asmcomp/amd64/CSE.ml | 2 | ||||
-rw-r--r-- | asmcomp/amd64/arch.ml | 5 | ||||
-rw-r--r-- | asmcomp/amd64/emit.mlp | 2 | ||||
-rw-r--r-- | asmcomp/amd64/proc.ml | 2 | ||||
-rw-r--r-- | asmcomp/amd64/selection.ml | 10 |
5 files changed, 19 insertions, 2 deletions
diff --git a/asmcomp/amd64/CSE.ml b/asmcomp/amd64/CSE.ml index 1c2ec7ee5a..60503d69ce 100644 --- a/asmcomp/amd64/CSE.ml +++ b/asmcomp/amd64/CSE.ml @@ -27,7 +27,7 @@ method! class_of_operation op = match op with | Ispecific spec -> begin match spec with - | Ilea _ | Isextend32 -> Op_pure + | Ilea _ | Isextend32 | Izextend32 -> Op_pure | Istore_int(_, _, is_asg) -> Op_store is_asg | Ioffset_loc(_, _) -> Op_store true | Ifloatarithmem _ | Ifloatsqrtf _ -> Op_load diff --git a/asmcomp/amd64/arch.ml b/asmcomp/amd64/arch.ml index 62ba88089a..effe32ed1a 100644 --- a/asmcomp/amd64/arch.ml +++ b/asmcomp/amd64/arch.ml @@ -44,6 +44,9 @@ type specific_operation = | Ifloatsqrtf of addressing_mode (* Float square root from memory *) | Isextend32 (* 32 to 64 bit conversion with sign extension *) + | Izextend32 (* 32 to 64 bit conversion with zero + extension *) + and float_operation = Ifloatadd | Ifloatsub | Ifloatmul | Ifloatdiv @@ -130,6 +133,8 @@ let print_specific_operation printreg op ppf arg = fprintf ppf "bswap_%i %a" i printreg arg.(0) | Isextend32 -> fprintf ppf "sextend32 %a" printreg arg.(0) + | Izextend32 -> + fprintf ppf "zextend32 %a" printreg arg.(0) let win64 = match Config.system with diff --git a/asmcomp/amd64/emit.mlp b/asmcomp/amd64/emit.mlp index 4fa182ac86..0bc8c65bfe 100644 --- a/asmcomp/amd64/emit.mlp +++ b/asmcomp/amd64/emit.mlp @@ -791,6 +791,8 @@ let emit_instr fallthrough i = I.sqrtsd (addressing addr REAL8 i 0) (res i 0) | Lop(Ispecific(Isextend32)) -> I.movsxd (arg32 i 0) (res i 0) + | Lop(Ispecific(Izextend32)) -> + I.mov (arg32 i 0) (res32 i 0) | Lop (Iname_for_debugger _) -> () | Lreloadretaddr -> () diff --git a/asmcomp/amd64/proc.ml b/asmcomp/amd64/proc.ml index cc07c8d54e..c64ad9a0e6 100644 --- a/asmcomp/amd64/proc.ml +++ b/asmcomp/amd64/proc.ml @@ -369,7 +369,7 @@ let op_is_pure = function | Icall_ind _ | Icall_imm _ | Itailcall_ind _ | Itailcall_imm _ | Iextcall _ | Istackoffset _ | Istore _ | Ialloc _ | Iintop(Icheckbound _) | Iintop_imm(Icheckbound _, _) -> false - | Ispecific(Ilea _|Isextend32) -> true + | Ispecific(Ilea _|Isextend32|Izextend32) -> true | Ispecific _ -> false | _ -> true diff --git a/asmcomp/amd64/selection.ml b/asmcomp/amd64/selection.ml index baef82cef4..bd7871cf6f 100644 --- a/asmcomp/amd64/selection.ml +++ b/asmcomp/amd64/selection.ml @@ -238,6 +238,16 @@ method! select_operation op args dbg = (Ispecific Isextend32, [k]) | _ -> super#select_operation op args dbg end + (* Recognize zero extension *) + | Cand -> + begin match args with + | [arg; Cconst_int (0xffff_ffff, _)] + | [arg; Cconst_natint (0xffff_ffffn, _)] + | [Cconst_int (0xffff_ffff, _); arg] + | [Cconst_natint (0xffff_ffffn, _); arg] -> + Ispecific Izextend32, [arg] + | _ -> super#select_operation op args dbg + end | _ -> super#select_operation op args dbg (* Recognize float arithmetic with mem *) |