Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SIMD] Intel support for swizzle and shuffle and fix extract_lane and replace_lane #7125

Merged

Conversation

hyjorc1
Copy link
Contributor

@hyjorc1 hyjorc1 commented Dec 4, 2022

cef394f

[SIMD] Intel support for swizzle and shuffle and fix extract_lane and replace_lane
https://bugs.webkit.org/show_bug.cgi?id=248728
rdar://102942396

Reviewed by Yusuke Suzuki.

This patch aims for three tasks:

    1. Add WASM SIMD operations `swizzle` and `shuffle`.
    https://github.com/WebAssembly/simd/blob/main/proposals/simd/SIMD.md#shuffling-using-immediate-indices

    2. Refactor MacroAssemblerX86_64.h and X86Assembler.h for `pinsr` and `pextr`,
    where X86Assembler should do simple instruction emission only. And MacroAssemblerX86
    should select the instruction.

    3. Fix WASM SIMD operation `replace_lane`. Previously, the operation is
    implemented with instruction `pinsr` in AVX format but only passing three parameters
    which is wrong.
        https://www.felixcloutier.com/x86/pinsrb:pinsrd:pinsrq
        https://www.felixcloutier.com/x86/pinsrw
        https://www.officedaytime.com/simd512e/simdimg/si.php?f=pinsrb
        https://www.officedaytime.com/simd512e/simdimg/si.php?f=pinsrw
        https://www.officedaytime.com/simd512e/simdimg/si.php?f=pinsrd
        https://www.officedaytime.com/simd512e/simdimg/si.php?f=pinsrq

* Source/JavaScriptCore/assembler/MacroAssemblerX86_64.h:
(JSC::MacroAssemblerX86_64::vectorReplaceLane):
(JSC::MacroAssemblerX86_64::vectorExtractLane):
(JSC::MacroAssemblerX86_64::vectorSwizzle):
* Source/JavaScriptCore/assembler/X86Assembler.h:
(JSC::X86Assembler::pinsrb):
(JSC::X86Assembler::pinsrw):
(JSC::X86Assembler::pinsrd):
(JSC::X86Assembler::pinsrq):
(JSC::X86Assembler::insertps):
(JSC::X86Assembler::unpcklpd):
(JSC::X86Assembler::vpextrb):
(JSC::X86Assembler::vpextrw):
(JSC::X86Assembler::vpextrd):
(JSC::X86Assembler::vpextrq):
(JSC::X86Assembler::X86InstructionFormatter::SingleInstructionBufferWriter::memoryModRM):
(JSC::X86Assembler::pinsr): Deleted.
(JSC::X86Assembler::pextr): Deleted.
(JSC::X86Assembler::vextractps): Deleted.
* Source/JavaScriptCore/b3/air/AirOpcode.opcodes:
* Source/JavaScriptCore/wasm/WasmAirIRGenerator.cpp:
(JSC::Wasm::AirIRGenerator::addReplaceLane):

Canonical link: https://commits.webkit.org/257400@main

dea943f

Misc iOS, tvOS & watchOS macOS Linux Windows
❌ πŸ§ͺ style βœ… πŸ›  ios βœ… πŸ›  mac βœ… πŸ›  wpe βœ… πŸ›  πŸ§ͺ win
βœ… πŸ›  ios-sim βœ… πŸ›  mac-AS-debug βœ… πŸ›  gtk βœ… πŸ›  wincairo
βœ… πŸ§ͺ webkitperl   πŸ§ͺ ios-wk2 βœ… πŸ§ͺ api-mac   πŸ§ͺ gtk-wk2
  πŸ§ͺ api-ios   πŸ§ͺ mac-wk1   πŸ§ͺ api-gtk
βœ… πŸ›  πŸ§ͺ jsc βœ… πŸ›  tv   πŸ§ͺ mac-wk2 βœ… πŸ›  jsc-armv7
βœ… πŸ›  tv-sim   πŸ§ͺ mac-AS-debug-wk2   πŸ§ͺ jsc-armv7-tests
βœ… πŸ›  πŸ§ͺ merge βœ… πŸ›  watch βœ… πŸ§ͺ mac-wk2-stress βœ… πŸ›  jsc-mips
βœ… πŸ›  watch-sim βœ… πŸ§ͺ jsc-mips-tests

@hyjorc1 hyjorc1 self-assigned this Dec 4, 2022
@hyjorc1 hyjorc1 added the JavaScriptCore For bugs in JavaScriptCore, the JS engine used by WebKit, other than kxmlcore issues. label Dec 4, 2022
@hyjorc1 hyjorc1 marked this pull request as ready for review December 4, 2022 03:00
@hyjorc1 hyjorc1 requested a review from a team as a code owner December 4, 2022 03:00
Source/JavaScriptCore/assembler/MacroAssemblerX86_64.h Outdated Show resolved Hide resolved
Source/JavaScriptCore/assembler/MacroAssemblerX86_64.h Outdated Show resolved Hide resolved
Source/JavaScriptCore/assembler/MacroAssemblerX86_64.h Outdated Show resolved Hide resolved
Source/JavaScriptCore/assembler/X86Assembler.h Outdated Show resolved Hide resolved
Source/JavaScriptCore/assembler/X86Assembler.h Outdated Show resolved Hide resolved
Source/JavaScriptCore/assembler/X86Assembler.h Outdated Show resolved Hide resolved
Source/JavaScriptCore/assembler/X86Assembler.h Outdated Show resolved Hide resolved
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Dec 4, 2022
@hyjorc1 hyjorc1 removed the merging-blocked Applied to prevent a change from being merged label Dec 5, 2022
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Dec 5, 2022
@hyjorc1 hyjorc1 removed the merging-blocked Applied to prevent a change from being merged label Dec 6, 2022
@webkit-early-warning-system
Copy link
Collaborator

Starting EWS tests for 2e2be09. Live statuses available at the PR page, #7125

@hyjorc1 hyjorc1 changed the title [SIMD] Intel support for swizzle and fix extract_plane and replace_lane [SIMD] Intel support for swizzle and shuffle and fix extract_plane and replace_lane Dec 6, 2022
@hyjorc1 hyjorc1 changed the title [SIMD] Intel support for swizzle and shuffle and fix extract_plane and replace_lane [SIMD] Intel support for swizzle and shuffle and fix extract_lane and replace_lane Dec 6, 2022
Copy link
Member

@Constellation Constellation left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

r=me

Source/JavaScriptCore/assembler/MacroAssemblerX86_64.h Outdated Show resolved Hide resolved
Source/JavaScriptCore/assembler/MacroAssemblerX86_64.h Outdated Show resolved Hide resolved
Source/JavaScriptCore/wasm/WasmAirIRGenerator.cpp Outdated Show resolved Hide resolved
@hyjorc1 hyjorc1 added the merge-queue Applied to send a pull request to merge-queue label Dec 6, 2022
@hyjorc1 hyjorc1 removed the merge-queue Applied to send a pull request to merge-queue label Dec 6, 2022
@webkit-early-warning-system
Copy link
Collaborator

Starting EWS tests for dea943f. Live statuses available at the PR page, #7125

@hyjorc1 hyjorc1 added the merge-queue Applied to send a pull request to merge-queue label Dec 6, 2022
… replace_lane

https://bugs.webkit.org/show_bug.cgi?id=248728
rdar://102942396

Reviewed by Yusuke Suzuki.

This patch aims for three tasks:

    1. Add WASM SIMD operations `swizzle` and `shuffle`.
    https://github.com/WebAssembly/simd/blob/main/proposals/simd/SIMD.md#shuffling-using-immediate-indices

    2. Refactor MacroAssemblerX86_64.h and X86Assembler.h for `pinsr` and `pextr`,
    where X86Assembler should do simple instruction emission only. And MacroAssemblerX86
    should select the instruction.

    3. Fix WASM SIMD operation `replace_lane`. Previously, the operation is
    implemented with instruction `pinsr` in AVX format but only passing three parameters
    which is wrong.
        https://www.felixcloutier.com/x86/pinsrb:pinsrd:pinsrq
        https://www.felixcloutier.com/x86/pinsrw
        https://www.officedaytime.com/simd512e/simdimg/si.php?f=pinsrb
        https://www.officedaytime.com/simd512e/simdimg/si.php?f=pinsrw
        https://www.officedaytime.com/simd512e/simdimg/si.php?f=pinsrd
        https://www.officedaytime.com/simd512e/simdimg/si.php?f=pinsrq

* Source/JavaScriptCore/assembler/MacroAssemblerX86_64.h:
(JSC::MacroAssemblerX86_64::vectorReplaceLane):
(JSC::MacroAssemblerX86_64::vectorExtractLane):
(JSC::MacroAssemblerX86_64::vectorSwizzle):
* Source/JavaScriptCore/assembler/X86Assembler.h:
(JSC::X86Assembler::pinsrb):
(JSC::X86Assembler::pinsrw):
(JSC::X86Assembler::pinsrd):
(JSC::X86Assembler::pinsrq):
(JSC::X86Assembler::insertps):
(JSC::X86Assembler::unpcklpd):
(JSC::X86Assembler::vpextrb):
(JSC::X86Assembler::vpextrw):
(JSC::X86Assembler::vpextrd):
(JSC::X86Assembler::vpextrq):
(JSC::X86Assembler::X86InstructionFormatter::SingleInstructionBufferWriter::memoryModRM):
(JSC::X86Assembler::pinsr): Deleted.
(JSC::X86Assembler::pextr): Deleted.
(JSC::X86Assembler::vextractps): Deleted.
* Source/JavaScriptCore/b3/air/AirOpcode.opcodes:
* Source/JavaScriptCore/wasm/WasmAirIRGenerator.cpp:
(JSC::Wasm::AirIRGenerator::addReplaceLane):

Canonical link: https://commits.webkit.org/257400@main
@webkit-commit-queue
Copy link
Collaborator

Committed 257400@main (cef394f): https://commits.webkit.org/257400@main

Reviewed commits have been landed. Closing PR #7125 and removing active labels.

@webkit-commit-queue webkit-commit-queue removed the merge-queue Applied to send a pull request to merge-queue label Dec 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
JavaScriptCore For bugs in JavaScriptCore, the JS engine used by WebKit, other than kxmlcore issues.
Projects
None yet
5 participants