Skip to content

Commit 9f6dec9

Browse files
committed
Always bounce mul/div/mod ops. Closes #131 harder.
1 parent 5b5bcf9 commit 9f6dec9

File tree

4 files changed

+7
-37
lines changed

4 files changed

+7
-37
lines changed

src/Makefile

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -385,11 +385,7 @@ TASK_XFAILS := test/run-pass/acyclic-unwind.rs \
385385
test/run-pass/threads.rs \
386386
test/run-pass/yield.rs
387387

388-
TEST_XFAILS := test/run-pass/arith-0.rs
389-
390388
TEST_XFAILS_X86 := $(TASK_XFAILS) \
391-
$(TEST_XFAILS) \
392-
test/run-pass/arithmetic-interference.rs \
393389
test/run-pass/bind-obj-ctor.rs \
394390
test/run-pass/child-outlives-parent.rs \
395391
test/run-pass/clone-with-exterior.rs \
@@ -419,13 +415,11 @@ TEST_XFAILS_X86 := $(TASK_XFAILS) \
419415
test/compile-fail/writing-through-read-alias.rs
420416

421417
TEST_XFAILS_LLVM := $(TASK_XFAILS) \
422-
$(TEST_XFAILS) \
423418
$(addprefix test/run-pass/, \
424419
arith-1.rs \
425420
acyclic-unwind.rs \
426421
alt-pattern-simple.rs \
427422
alt-tag.rs \
428-
arithmetic-interference.rs \
429423
argv.rs \
430424
autoderef-full-lval.rs \
431425
autoderef-objfn.rs \

src/boot/be/x86.ml

Lines changed: 6 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -303,48 +303,31 @@ let emit_target_specific
303303
let dst_eax = hr_like_cell eax dst in
304304
let lhs_eax = hr_like_op eax lhs in
305305
let rhs_ecx = hr_like_op ecx rhs in
306-
(* Horrible: we bounce complex mul inputs off spill slots
306+
(* Horrible: we bounce mul/div/mod inputs off spill slots
307307
* to ensure non-interference between the temporaries used
308308
* during mem-base-reg reloads and the registers we're
309309
* preparing. *)
310310
let next_spill_like op =
311311
Il.Mem (Il.next_spill_slot e
312312
(Il.ScalarTy (Il.operand_scalar_ty op)))
313313
in
314-
let is_mem op =
315-
match op with
316-
Il.Cell (Il.Mem _) -> true
317-
| _ -> false
318-
in
319-
let bounce_lhs = is_mem lhs in
320-
let bounce_rhs = is_mem rhs in
321314
let lhs_spill = next_spill_like lhs in
322315
let rhs_spill = next_spill_like rhs in
323316

324-
if bounce_lhs
325-
then mov lhs_spill lhs;
326-
327-
if bounce_rhs
328-
then mov rhs_spill rhs;
317+
mov lhs_spill lhs;
318+
mov rhs_spill rhs;
329319

330-
mov lhs_eax
331-
(if bounce_lhs
332-
then (Il.Cell lhs_spill)
333-
else lhs);
320+
mov lhs_eax (Il.Cell lhs_spill);
321+
mov rhs_ecx (Il.Cell rhs_spill);
334322

335-
mov rhs_ecx
336-
(if bounce_rhs
337-
then (Il.Cell rhs_spill)
338-
else rhs);
339-
340323
put (Il.Binary
341324
{ b with
342325
Il.binary_lhs = (Il.Cell lhs_eax);
343326
Il.binary_rhs = (Il.Cell rhs_ecx);
344327
Il.binary_dst = dst_eax; });
345328
if dst <> dst_eax
346329
then mov dst (Il.Cell dst_eax);
347-
330+
348331
| _ when (Il.Cell dst) <> lhs ->
349332
mov dst lhs;
350333
put (Il.Binary

src/boot/me/trans.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ let trans_visitor
181181
match q with
182182
Il.Jmp _ -> flush_emitter_size_cache();
183183
| _ -> ()
184-
end;
184+
end;
185185
Il.emit (emitter()) q
186186
in
187187

src/test/run-pass/arithmetic-interference.rs

Lines changed: 0 additions & 7 deletions
This file was deleted.

0 commit comments

Comments
 (0)