From 1d96053e3b1796ff48cdc308f65ce448d0381051 Mon Sep 17 00:00:00 2001 From: ptitSeb Date: Thu, 5 Jan 2023 17:06:45 +0100 Subject: [PATCH] [SINGLEPASS] Added a special case on SSE4.2 backend when dst == src1 (for #3461) --- lib/compiler-singlepass/src/emitter_x64.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/compiler-singlepass/src/emitter_x64.rs b/lib/compiler-singlepass/src/emitter_x64.rs index 7bea7166432..38a91689f1c 100644 --- a/lib/compiler-singlepass/src/emitter_x64.rs +++ b/lib/compiler-singlepass/src/emitter_x64.rs @@ -739,9 +739,12 @@ macro_rules! sse_fn { |emitter: &mut AssemblerX64, precision: Precision, src1: XMM, src2: XMMOrMemory, dst: XMM| { match src2 { XMMOrMemory::XMM(x) => { - assert_ne!(x, dst); - move_src_to_dst(emitter, precision, src1, dst); - dynasm!(emitter ; $ins Rx((dst as u8)), Rx((x as u8))) + if x == dst { + dynasm!(emitter ; $ins Rx((dst as u8)), Rx((src1 as u8))) + } else { + move_src_to_dst(emitter, precision, src1, dst); + dynasm!(emitter ; $ins Rx((dst as u8)), Rx((x as u8))) + } } XMMOrMemory::Memory(base, disp) => { move_src_to_dst(emitter, precision, src1, dst);