Skip to content

Commit 4e30303

Browse files
authored
x64: Fix f64x2.splat without SSE3 (#13011)
Don't sink a load into `pshufd` which loads 16 bytes, instead force `put_in_xmm` to ensure only 8 bytes are loaded.
1 parent dd2dd8d commit 4e30303

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

cranelift/codegen/src/isa/x64/lower.isle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4903,7 +4903,7 @@
49034903
(rule 0 (lower (has_type $I64X2 (splat _ src)))
49044904
(x64_pshufd (bitcast_gpr_to_xmm 64 src) 0b01_00_01_00))
49054905
(rule 0 (lower (has_type $F64X2 (splat _ src)))
4906-
(x64_pshufd src 0b01_00_01_00))
4906+
(x64_pshufd (put_in_xmm src) 0b01_00_01_00))
49074907
(rule 6 (lower (has_type (multi_lane 64 2) (splat _ (sinkable_load addr))))
49084908
(if-let true (has_sse3))
49094909
(x64_movddup addr))

tests/misc_testsuite/simd/edge-of-memory.wast

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,3 +336,10 @@
336336
(assert_return (invoke "2-byte-from-end" (i32.const 65534)))
337337
(assert_return (invoke "4-byte-from-end" (i32.const 65532)))
338338
(assert_return (invoke "8-byte-from-end" (i32.const 65528)))
339+
340+
(module
341+
(memory 1)
342+
(func (export "test") (param i32) (result v128)
343+
(f64x2.splat (f64.load (local.get 0)))))
344+
345+
(assert_return (invoke "test" (i32.const 65528)) (v128.const f64x2 0 0))

0 commit comments

Comments
 (0)