Bug 248995

Summary: [WebAssembly SIMD] Emulate 8-bit shift instructions and i8x16.popcnt on Intel
Product: WebKit Reporter: David Degazio <d_degazio>
Component: WebAssemblyAssignee: David Degazio <d_degazio>
Status: RESOLVED FIXED    
Severity: Normal CC: webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=248639
Bug Depends on:    
Bug Blocks: 246345    

Description David Degazio 2022-12-08 16:59:10 PST
While most other SIMD bitwise operations are tracked in https://bugs.webkit.org/show_bug.cgi?id=248639, I'm splitting off the following instructions:

 - i8x16.shl, i8x16.shr_s, i8x16.shr_u
 - i8x16.popcnt

into this bug so they don't hold up the other patch. None of these instructions are supported natively on Intel, at least without AVX-512, and they also
aren't easy to emulate. So they require some additional effort to implement necessary supporting instructions and figure out the best isel.
Comment 1 David Degazio 2022-12-08 17:03:14 PST
rdar://103159176
Comment 2 David Degazio 2022-12-12 10:36:08 PST
Looks like despite logical right-shift being supported for 64-bit elements, arithmetic right-shift is only supported with AVX-512 (which we really can't assume will be present). So we also need to emulate i64x2.shr_s.
Comment 3 David Degazio 2022-12-16 13:44:25 PST
Pull request: https://github.com/WebKit/WebKit/pull/7777
Comment 4 EWS 2022-12-19 12:45:57 PST
Committed 258089@main (7d8a35c36444): <https://commits.webkit.org/258089@main>

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