Skip to content
This repository was archived by the owner on Nov 1, 2021. It is now read-only.

Commit aca4258

Browse files
committed
Merge pull request #117 from juj/float64x2_working_in_simd_polyfill
Float64x2 working in simd polyfill
2 parents 54af6b2 + 1083d95 commit aca4258

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

lib/Target/JSBackend/CallHandlers.h

+33
Original file line numberDiff line numberDiff line change
@@ -807,12 +807,45 @@ DEF_BUILTIN_HANDLER(emscripten_float64x2_fromInt32x4Bits, SIMD_Float64x2_fromInt
807807
DEF_BUILTIN_HANDLER(emscripten_float64x2_fromInt32x4, SIMD_Float64x2_fromInt32x4);
808808
DEF_BUILTIN_HANDLER(emscripten_float64x2_fromFloat32x4Bits, SIMD_Float64x2_fromFloat32x4Bits);
809809
DEF_BUILTIN_HANDLER(emscripten_float64x2_fromFloat32x4, SIMD_Float64x2_fromFloat32x4);
810+
811+
static std::string castBool64x2ToInt32x4(const std::string &valueStr) {
812+
return std::string("SIMD_Int32x4_fromBool64x2Bits(") + valueStr + ')';
813+
}
814+
815+
DEF_CALL_HANDLER(emscripten_float64x2_equal, {
816+
return getAssign(CI) + castBool64x2ToInt32x4("SIMD_Float64x2_equal(" + getValueAsStr(CI->getOperand(0)) + ", " + getValueAsStr(CI->getOperand(1)) + ")");
817+
})
818+
819+
DEF_CALL_HANDLER(emscripten_float64x2_notEqual, {
820+
return getAssign(CI) + castBool64x2ToInt32x4("SIMD_Float64x2_notEqual(" + getValueAsStr(CI->getOperand(0)) + ", " + getValueAsStr(CI->getOperand(1)) + ")");
821+
})
822+
823+
DEF_CALL_HANDLER(emscripten_float64x2_lessThan, {
824+
return getAssign(CI) + castBool64x2ToInt32x4("SIMD_Float64x2_lessThan(" + getValueAsStr(CI->getOperand(0)) + ", " + getValueAsStr(CI->getOperand(1)) + ")");
825+
})
826+
827+
DEF_CALL_HANDLER(emscripten_float64x2_lessThanOrEqual, {
828+
return getAssign(CI) + castBool64x2ToInt32x4("SIMD_Float64x2_lessThanOrEqual(" + getValueAsStr(CI->getOperand(0)) + ", " + getValueAsStr(CI->getOperand(1)) + ")");
829+
})
830+
831+
DEF_CALL_HANDLER(emscripten_float64x2_greaterThan, {
832+
return getAssign(CI) + castBool64x2ToInt32x4("SIMD_Float64x2_greaterThan(" + getValueAsStr(CI->getOperand(0)) + ", " + getValueAsStr(CI->getOperand(1)) + ")");
833+
})
834+
835+
DEF_CALL_HANDLER(emscripten_float64x2_greaterThanOrEqual, {
836+
return getAssign(CI) + castBool64x2ToInt32x4("SIMD_Float64x2_greaterThanOrEqual(" + getValueAsStr(CI->getOperand(0)) + ", " + getValueAsStr(CI->getOperand(1)) + ")");
837+
})
838+
839+
// The above code to handle Float64x2 comparisons to a booleans is temporary. Once Bool64x2 is in the spec and SpiderMonkey has the type, revert to the code below.
840+
#if 0
810841
DEF_BUILTIN_HANDLER(emscripten_float64x2_equal, SIMD_Float64x2_equal);
811842
DEF_BUILTIN_HANDLER(emscripten_float64x2_notEqual, SIMD_Float64x2_notEqual);
812843
DEF_BUILTIN_HANDLER(emscripten_float64x2_lessThan, SIMD_Float64x2_lessThan);
813844
DEF_BUILTIN_HANDLER(emscripten_float64x2_lessThanOrEqual, SIMD_Float64x2_lessThanOrEqual);
814845
DEF_BUILTIN_HANDLER(emscripten_float64x2_greaterThan, SIMD_Float64x2_greaterThan);
815846
DEF_BUILTIN_HANDLER(emscripten_float64x2_greaterThanOrEqual, SIMD_Float64x2_greaterThanOrEqual);
847+
#endif
848+
816849
DEF_BUILTIN_HANDLER(emscripten_float64x2_and, SIMD_Float64x2_and);
817850
DEF_BUILTIN_HANDLER(emscripten_float64x2_or, SIMD_Float64x2_or);
818851
DEF_BUILTIN_HANDLER(emscripten_float64x2_xor, SIMD_Float64x2_xor);

0 commit comments

Comments
 (0)