-
Notifications
You must be signed in to change notification settings - Fork 732
Implement the first few SIMD opcodes for fast interpreter (v128.const, v128.any_true) #3818
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -37,6 +37,10 @@ extern "C" { | |
| do { \ | ||
| *(int64 *)(addr) = (int64)(value); \ | ||
| } while (0) | ||
| #define PUT_V128_TO_ADDR(addr, value) \ | ||
| do { \ | ||
| *(V128 *)(addr) = (value); \ | ||
| } while (0) | ||
| #define PUT_F64_TO_ADDR(addr, value) \ | ||
| do { \ | ||
| *(float64 *)(addr) = (float64)(value); \ | ||
|
|
@@ -49,6 +53,7 @@ extern "C" { | |
| #define GET_I64_FROM_ADDR(addr) (*(int64 *)(addr)) | ||
| #define GET_F64_FROM_ADDR(addr) (*(float64 *)(addr)) | ||
| #define GET_REF_FROM_ADDR(addr) (*(void **)(addr)) | ||
| #define GET_V128_FROM_ADDR(addr) (*(V128 *)(addr)) | ||
|
|
||
| /* For STORE opcodes */ | ||
| #define STORE_I64 PUT_I64_TO_ADDR | ||
|
|
@@ -83,6 +88,15 @@ STORE_U8(void *addr, uint8_t value) | |
|
|
||
| #else /* WASM_CPU_SUPPORTS_UNALIGNED_ADDR_ACCESS != 0 */ | ||
|
|
||
| #define PUT_V128_TO_ADDR(addr, value) \ | ||
| do { \ | ||
| uint32 *addr_u32 = (uint32 *)(addr); \ | ||
| addr_u32[0] = (value).i32x4[0]; \ | ||
| addr_u32[1] = (value).i32x4[1]; \ | ||
| addr_u32[2] = (value).i32x4[2]; \ | ||
| addr_u32[3] = (value).i32x4[3]; \ | ||
| } while (0) | ||
|
|
||
| #define PUT_I64_TO_ADDR(addr, value) \ | ||
| do { \ | ||
| uint32 *addr_u32 = (uint32 *)(addr); \ | ||
|
|
@@ -124,6 +138,17 @@ STORE_U8(void *addr, uint8_t value) | |
| } while (0) | ||
| #endif | ||
|
|
||
| static inline V128 | ||
| GET_V128_FROM_ADDR(uint32 *addr) | ||
| { | ||
| V128 ret; | ||
| ret.i32x4[0] = addr[0]; | ||
| ret.i32x4[1] = addr[1]; | ||
| ret.i32x4[2] = addr[2]; | ||
| ret.i32x4[3] = addr[3]; | ||
| return ret; | ||
| } | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not very sure why the CIs can run successfully, but I think that V128 may be undeclared in many targets/platforms when WASM_CPU_SUPPORTS_UNALIGNED_ADDR_ACCESS is 0, and compilation error may be reported, so here how about wrapping this function with
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm, got it, I wrongly thought that it is the type |
||
|
|
||
| static inline int64 | ||
| GET_I64_FROM_ADDR(uint32 *addr) | ||
| { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.