diff --git a/basis/compiler/cfg/instructions/instructions.factor b/basis/compiler/cfg/instructions/instructions.factor index 4fa8145c4c..cc02edc315 100644 --- a/basis/compiler/cfg/instructions/instructions.factor +++ b/basis/compiler/cfg/instructions/instructions.factor @@ -298,6 +298,11 @@ def: dst use: src shuffle literal: rep ; +PURE-INSN: ##shuffle-vector-halves-imm +def: dst +use: src1 src2 +literal: shuffle rep ; + PURE-INSN: ##shuffle-vector-imm def: dst use: src diff --git a/basis/compiler/codegen/codegen.factor b/basis/compiler/codegen/codegen.factor index a927fa8ace..32c5181150 100755 --- a/basis/compiler/codegen/codegen.factor +++ b/basis/compiler/codegen/codegen.factor @@ -182,6 +182,7 @@ CODEGEN: ##fill-vector %fill-vector CODEGEN: ##gather-vector-2 %gather-vector-2 CODEGEN: ##gather-vector-4 %gather-vector-4 CODEGEN: ##shuffle-vector-imm %shuffle-vector-imm +CODEGEN: ##shuffle-vector-halves-imm %shuffle-vector-halves-imm CODEGEN: ##shuffle-vector %shuffle-vector CODEGEN: ##tail>head-vector %tail>head-vector CODEGEN: ##merge-vector-head %merge-vector-head diff --git a/basis/cpu/architecture/architecture.factor b/basis/cpu/architecture/architecture.factor index b97c45253b..f04737a9df 100644 --- a/basis/cpu/architecture/architecture.factor +++ b/basis/cpu/architecture/architecture.factor @@ -301,6 +301,7 @@ HOOK: %gather-vector-2 cpu ( dst src1 src2 rep -- ) HOOK: %gather-vector-4 cpu ( dst src1 src2 src3 src4 rep -- ) HOOK: %shuffle-vector cpu ( dst src shuffle rep -- ) HOOK: %shuffle-vector-imm cpu ( dst src shuffle rep -- ) +HOOK: %shuffle-vector-halves-imm cpu ( dst src1 src2 shuffle rep -- ) HOOK: %tail>head-vector cpu ( dst src rep -- ) HOOK: %merge-vector-head cpu ( dst src1 src2 rep -- ) HOOK: %merge-vector-tail cpu ( dst src1 src2 rep -- ) @@ -356,6 +357,7 @@ HOOK: %gather-vector-4-reps cpu ( -- reps ) HOOK: %alien-vector-reps cpu ( -- reps ) HOOK: %shuffle-vector-reps cpu ( -- reps ) HOOK: %shuffle-vector-imm-reps cpu ( -- reps ) +HOOK: %shuffle-vector-halves-imm-reps cpu ( -- reps ) HOOK: %merge-vector-reps cpu ( -- reps ) HOOK: %signed-pack-vector-reps cpu ( -- reps ) HOOK: %unsigned-pack-vector-reps cpu ( -- reps ) @@ -404,6 +406,7 @@ M: object %gather-vector-4-reps { } ; M: object %alien-vector-reps { } ; M: object %shuffle-vector-reps { } ; M: object %shuffle-vector-imm-reps { } ; +M: object %shuffle-vector-halves-imm-reps { } ; M: object %merge-vector-reps { } ; M: object %signed-pack-vector-reps { } ; M: object %unsigned-pack-vector-reps { } ; diff --git a/basis/cpu/x86/x86.factor b/basis/cpu/x86/x86.factor index 0ee427510c..6b8447eb95 100644 --- a/basis/cpu/x86/x86.factor +++ b/basis/cpu/x86/x86.factor @@ -798,6 +798,19 @@ M: x86 %shuffle-vector-imm-reps { sse2? { double-2-rep int-4-rep uint-4-rep longlong-2-rep ulonglong-2-rep } } } available-reps ; +M:: x86 %shuffle-vector-halves-imm ( dst src1 src2 shuffle rep -- ) + dst src1 src2 rep two-operand + shuffle rep { + { double-2-rep [ >float-4-shuffle SHUFPS ] } + { float-4-rep [ SHUFPS ] } + } case ; + +M: x86 %shuffle-vector-halves-imm-reps + { + { sse? { float-4-rep } } + { sse2? { double-2-rep } } + } available-reps ; + M: x86 %shuffle-vector ( dst src shuffle rep -- ) two-operand PSHUFB ;