Bugs dans intop_imm(Idiv | Imod)
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@5635 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02master
parent
bc33391898
commit
de53ed7fb7
|
@ -436,7 +436,7 @@ let emit_instr fallthrough i =
|
|||
(* Note: i.arg.(0) = i.res.(0) = rdx (cf. selection.ml) *)
|
||||
let l = Misc.log2 n in
|
||||
` movq {emit_reg i.arg.(0)}, %rax\n`;
|
||||
` addq {emit_int(n-1)}, {emit_reg i.arg.(0)}\n`;
|
||||
` addq ${emit_int(n-1)}, {emit_reg i.arg.(0)}\n`;
|
||||
` testq %rax, %rax\n`;
|
||||
` cmovns %rax, {emit_reg i.arg.(0)}\n`;
|
||||
` sarq ${emit_int l}, {emit_reg i.res.(0)}\n`
|
||||
|
@ -447,7 +447,7 @@ let emit_instr fallthrough i =
|
|||
` testq %rax, %rax\n`;
|
||||
` leaq {emit_int(n-1)}(%rax), %rax\n`;
|
||||
` cmovns {emit_reg i.arg.(0)}, %rax\n`;
|
||||
` andq ${emit_int (n-1)}, %rax\n`;
|
||||
` andq ${emit_int (-n)}, %rax\n`;
|
||||
` subq %rax, {emit_reg i.res.(0)}\n`
|
||||
| Lop(Iintop_imm(op, n)) ->
|
||||
(* We have i.arg.(0) = i.res.(0) *)
|
||||
|
|
|
@ -87,7 +87,7 @@ let pseudoregs_for_operation op arg res =
|
|||
Iintop(Iadd|Isub|Imul|Iand|Ior|Ixor) | Iaddf|Isubf|Imulf|Idivf ->
|
||||
([|res.(0); arg.(1)|], res)
|
||||
(* One-address unary operations: arg.(0) and res.(0) must be the same *)
|
||||
| Iintop_imm((Iadd|Isub|Imul|Idiv|Iand|Ior|Ixor|Ilsl|Ilsr|Iasr), _)
|
||||
| Iintop_imm((Iadd|Isub|Imul|Iand|Ior|Ixor|Ilsl|Ilsr|Iasr), _)
|
||||
| Iabsf | Inegf ->
|
||||
(res, res)
|
||||
| Ispecific(Ifloatarithmem(_,_)) ->
|
||||
|
@ -104,9 +104,9 @@ let pseudoregs_for_operation op arg res =
|
|||
([| rax; rcx |], [| rax |])
|
||||
| Iintop(Imod) ->
|
||||
([| rax; rcx |], [| rdx |])
|
||||
(* For mod with immediate operand, arg must not be in rax.
|
||||
(* For div and mod with immediate operand, arg must not be in rax.
|
||||
Keep it simple, force it in rdx. *)
|
||||
| Iintop_imm(Imod, _) ->
|
||||
| Iintop_imm((Idiv|Imod), _) ->
|
||||
([| rdx |], [| rdx |])
|
||||
(* Other instructions are regular *)
|
||||
| _ -> raise Use_default
|
||||
|
|
Loading…
Reference in New Issue