Skip to content

Commit a718f36

Browse files
committed
Force to not inline asm.js div for double on x86 to force to use sse2
1 parent 178da23 commit a718f36

1 file changed

Lines changed: 14 additions & 9 deletions

File tree

lib/Runtime/Math/AsmJsMath.cpp

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,21 @@
77
namespace Js
88
{
99
// These implementations need to be compiled with /arch:sse2
10-
#define DivImpl(type) template<> type AsmJsMath::Div(type aLeft, type aRight) { return aLeft / aRight; }
11-
#define MulImpl(type) template<> type AsmJsMath::Mul(type aLeft, type aRight) { return aLeft * aRight; }
12-
#define DivMulImpl(type) DivImpl(type) MulImpl(type)
10+
#define DivImpl(type, noinline) template<> noinline type AsmJsMath::Div(type aLeft, type aRight) { return aLeft / aRight; }
11+
#define MulImpl(type, noinline) template<> noinline type AsmJsMath::Mul(type aLeft, type aRight) { return aLeft * aRight; }
12+
#define DivMulImpl(type, noinline) DivImpl(type, noinline) MulImpl(type, noinline)
1313

14-
DivMulImpl(float)
15-
DivMulImpl(double)
16-
DivMulImpl(int64)
17-
DivMulImpl(uint64)
18-
MulImpl(int32)
19-
MulImpl(uint32)
14+
#if _M_IX86
15+
#define DB_NOINLINE _NOINLINE
16+
#else
17+
#define DB_NOINLINE
18+
#endif
19+
DivMulImpl(double, DB_NOINLINE)
20+
DivMulImpl(float,)
21+
DivMulImpl(int64,)
22+
DivMulImpl(uint64,)
23+
MulImpl(int32,)
24+
MulImpl(uint32,)
2025

2126
template<>
2227
int32 AsmJsMath::Div<int32>(int32 aLeft, int32 aRight)

0 commit comments

Comments
 (0)