Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/mono/mono/mini/interp/interp-nosimd.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

gboolean interp_simd_enabled = FALSE;

#ifdef HOST_BROWSER
#if HOST_BROWSER || HOST_WASI

int interp_simd_p_p_wasm_opcode_table [] = {
};
Expand All @@ -17,7 +17,7 @@ int interp_simd_p_pp_wasm_opcode_table [] = {
int interp_simd_p_ppp_wasm_opcode_table [] = {
};

#endif // HOST_BROWSER
#endif // HOST_BROWSER || HOST_WASI

PP_SIMD_Method interp_simd_p_p_table [] = {
};
Expand Down
10 changes: 8 additions & 2 deletions src/mono/mono/mini/interp/interp-simd.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include "interp-internals.h"
#include "interp-simd.h"

#if HOST_BROWSER
#if HOST_BROWSER || HOST_WASI
#include <wasm_simd128.h>
#endif

Expand Down Expand Up @@ -611,6 +611,12 @@ interp_v128_i8_shuffle (gpointer res, gpointer v1, gpointer v2)
// https://github.com/llvm/llvm-project/blob/main/clang/lib/Headers/wasm_simd128.h
// In this context V means Vector128 and P means void* pointer.
#ifdef HOST_BROWSER
#define HOST_WASM_SIMD 1
#elif defined(HOST_WASI)
#define HOST_WASM_SIMD 1
#endif

#if HOST_WASM_SIMD

static v128_t
_interp_wasm_simd_assert_not_reached (v128_t lhs, v128_t rhs) {
Expand Down Expand Up @@ -931,7 +937,7 @@ int interp_simd_p_ppp_wasm_opcode_table [] = {
#undef INTERP_SIMD_INTRINSIC_P_PPP
#define INTERP_SIMD_INTRINSIC_P_PPP(a,b,c)

#endif // HOST_BROWSER
#endif // HOST_WASM_SIMD

#undef INTERP_SIMD_INTRINSIC_P_P
#define INTERP_SIMD_INTRINSIC_P_P(a,b,c) b,
Expand Down
2 changes: 1 addition & 1 deletion src/mono/mono/mini/interp/interp-simd.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ extern PP_SIMD_Method interp_simd_p_p_table [];
extern PPP_SIMD_Method interp_simd_p_pp_table [];
extern PPPP_SIMD_Method interp_simd_p_ppp_table [];

#if HOST_BROWSER
#if HOST_BROWSER || HOST_WASI
extern int interp_simd_p_p_wasm_opcode_table [];
extern int interp_simd_p_pp_wasm_opcode_table [];
extern int interp_simd_p_ppp_wasm_opcode_table [];
Expand Down
16 changes: 8 additions & 8 deletions src/mono/mono/mini/interp/transform-simd.c
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,7 @@ emit_sri_vector128 (TransformData *td, MonoMethod *cmethod, MonoMethodSignature
if (csignature->hasthis)
return FALSE;

#ifdef HOST_BROWSER
#if defined(HOST_BROWSER) || defined(HOST_WASI)
if (emit_sri_packedsimd (td, cmethod, csignature))
return TRUE;
#endif
Expand Down Expand Up @@ -731,7 +731,7 @@ emit_sri_vector128 (TransformData *td, MonoMethod *cmethod, MonoMethodSignature
static gboolean
emit_sri_vector128_t (TransformData *td, MonoMethod *cmethod, MonoMethodSignature *csignature)
{
#ifdef HOST_BROWSER
#if defined(HOST_BROWSER) || defined(HOST_WASI)
if (emit_sri_packedsimd (td, cmethod, csignature))
return TRUE;
#endif
Expand Down Expand Up @@ -775,7 +775,7 @@ emit_sri_vector128_t (TransformData *td, MonoMethod *cmethod, MonoMethodSignatur
static gboolean
emit_sn_vector_t (TransformData *td, MonoMethod *cmethod, MonoMethodSignature *csignature, gboolean newobj)
{
#ifdef HOST_BROWSER
#if defined(HOST_BROWSER) || defined(HOST_WASI)
if (emit_sri_packedsimd (td, cmethod, csignature))
return TRUE;
#endif
Expand Down Expand Up @@ -876,7 +876,7 @@ emit_sn_vector4 (TransformData *td, MonoMethod *cmethod, MonoMethodSignature *cs
return TRUE;
}

#if HOST_BROWSER
#if defined(HOST_BROWSER) || defined(HOST_WASI)

#define PSIMD_ARGTYPE_I1 MONO_TYPE_I1
#define PSIMD_ARGTYPE_I2 MONO_TYPE_I2
Expand Down Expand Up @@ -1122,7 +1122,7 @@ emit_sri_packedsimd (TransformData *td, MonoMethod *cmethod, MonoMethodSignature
// We don't want to emit the IsSupported or IsHardwareAccelerated methods for Vector* here
return FALSE;
}
#if HOST_BROWSER
#if defined(HOST_BROWSER) || defined(HOST_WASI)
interp_add_ins (td, MINT_LDC_I4_1);
#else
interp_add_ins (td, MINT_LDC_I4_0);
Expand All @@ -1133,7 +1133,7 @@ emit_sri_packedsimd (TransformData *td, MonoMethod *cmethod, MonoMethodSignature
if (!get_common_simd_info (vector_klass, csignature, &atype, &vector_size, &arg_size, &scalar_arg))
return FALSE;

#if HOST_BROWSER
#if defined(HOST_BROWSER) || defined(HOST_WASI)
if (!is_packedsimd) {
// transform the method name from the Vector(128|) name to the packed simd name
// FIXME: This is a hack, but it works for now.
Expand Down Expand Up @@ -1311,9 +1311,9 @@ emit_sri_packedsimd (TransformData *td, MonoMethod *cmethod, MonoMethodSignature

interp_add_ins (td, simd_opcode);
td->last_ins->data [0] = simd_intrins;
#else // HOST_BROWSER
#else // defined(HOST_BROWSER) || defined(HOST_WASI)
return FALSE;
#endif // HOST_BROWSER
#endif // defined(HOST_BROWSER) || defined(HOST_WASI)

opcode_added:
emit_common_simd_epilogue (td, vector_klass, csignature, vector_size, TRUE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
<PackageFile Include="$(WasiProjectRoot)build\WasiApp.props" TargetPath="Sdk" />
<PackageFile Include="$(WasiProjectRoot)build\WasiApp.targets" TargetPath="Sdk" />

<PackageFile Include="$(BrowserProjectRoot)build\ILLink.Substitutions.WasmIntrinsics.xml" TargetPath="Sdk" />
<PackageFile Include="$(BrowserProjectRoot)build\ILLink.Substitutions.NoWasmIntrinsics.xml" TargetPath="Sdk" />

<PackageFile Include="$(WasmProjectRoot)build\WasmApp.Common.props" TargetPath="Sdk" />
<PackageFile Include="$(WasmProjectRoot)build\WasmApp.Common.targets" TargetPath="Sdk" />

Expand Down
5 changes: 4 additions & 1 deletion src/mono/wasi/build/WasiApp.targets
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@
<WasmEmitSymbolMap Condition="'$(WasmEmitSymbolMap)' == '' and '$(RunAOTCompilation)' != 'true'">false</WasmEmitSymbolMap>
<TrimMode Condition="'$(TrimMode)' == ''">full</TrimMode>

<_ExtraTrimmerArgs Condition="'$(WasmEnableSIMD)' != 'false'">$(_ExtraTrimmerArgs) --substitutions "$(MSBuildThisFileDirectory)ILLink.Substitutions.WasmIntrinsics.xml"</_ExtraTrimmerArgs>
<_ExtraTrimmerArgs Condition="'$(WasmEnableSIMD)' == 'false'">$(_ExtraTrimmerArgs) --substitutions "$(MSBuildThisFileDirectory)ILLink.Substitutions.NoWasmIntrinsics.xml"</_ExtraTrimmerArgs>
Comment thread
lewing marked this conversation as resolved.

<WasmRunWasmOpt Condition="'$(WasmRunWasmOpt)' == ''">false</WasmRunWasmOpt>

<!--<WasiBundleAssemblies Condition="'$(WasiBundleAssemblies)' == ''">true</WasiBundleAssemblies>-->
Expand Down Expand Up @@ -245,7 +248,7 @@
<_WasiClangCommonFlags Include="-v" Condition="'$(WasiClangVerbose)' != 'false'" />
<!--<_WasiClangCommonFlags Include="-s DISABLE_EXCEPTION_CATCHING=0" Condition="'$(WasmEnableExceptionHandling)' == 'false'" />-->
<!--<_WasiClangCommonFlags Include="-fwasm-exceptions" Condition="'$(WasmEnableExceptionHandling)' == 'true'" />-->
<!--<_WasiClangCommonFlags Include="-msimd128" Condition="'$(WasmEnableSIMD)' == 'true'" />-->
<_WasiClangCommonFlags Include="-msimd128" Condition="'$(WasmEnableSIMD)' == 'true'" />

<_WasmCommonCFlags Include="-DGEN_PINVOKE=1" />
<_WasmCommonCFlags Condition="'$(_WasmShouldAOT)' == 'true'" Include="-DENABLE_AOT=1" />
Expand Down
Loading