Skip to content

Commit 45d3f10

Browse files
authored
Remove fastcomp-only DOUBLE_MODE setting (#11862)
After removing it, things are always in DOUBLE_MODE == 1 basically (that is, doubles are normal doubles, no asm.js weirdness). See #11860
1 parent c0470c7 commit 45d3f10

File tree

3 files changed

+2
-30
lines changed

3 files changed

+2
-30
lines changed

src/parseTools.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -844,8 +844,7 @@ function makeGetValue(ptr, pos, type, noNeedFirst, unsigned, ignore, align, noSa
844844
return '{ ' + ret.join(', ') + ' }';
845845
}
846846

847-
// In double mode 1, in asmjs-unknown-emscripten we need this code path if we are not fully aligned.
848-
if (DOUBLE_MODE == 1 && type == 'double' && (align < 8)) {
847+
if (type == 'double' && (align < 8)) {
849848
return '(' + makeSetTempDouble(0, 'i32', makeGetValue(ptr, pos, 'i32', noNeedFirst, unsigned, ignore, align, noSafe)) + ',' +
850849
makeSetTempDouble(1, 'i32', makeGetValue(ptr, getFastValue(pos, '+', Runtime.getNativeTypeSize('i32')), 'i32', noNeedFirst, unsigned, ignore, align, noSafe)) + ',' +
851850
makeGetTempDouble(0, 'double') + ')';
@@ -854,7 +853,6 @@ function makeGetValue(ptr, pos, type, noNeedFirst, unsigned, ignore, align, noSa
854853
if (align) {
855854
// Alignment is important here. May need to split this up
856855
var bytes = Runtime.getNativeTypeSize(type);
857-
if (DOUBLE_MODE == 0 && type == 'double') bytes = 4; // we will really only read 4 bytes here
858856
if (bytes > align) {
859857
var ret = '(';
860858
if (isIntImplemented(type)) {
@@ -928,7 +926,7 @@ function makeSetValue(ptr, pos, value, type, noNeedFirst, ignore, align, noSafe,
928926
return ret.join('; ');
929927
}
930928

931-
if (DOUBLE_MODE == 1 && type == 'double' && (align < 8)) {
929+
if (type == 'double' && (align < 8)) {
932930
return '(' + makeSetTempDouble(0, 'double', value) + ',' +
933931
makeSetValue(ptr, pos, makeGetTempDouble(0, 'i32'), 'i32', noNeedFirst, ignore, align, noSafe, ',') + ',' +
934932
makeSetValue(ptr, getFastValue(pos, '+', Runtime.getNativeTypeSize('i32')), makeGetTempDouble(1, 'i32'), 'i32', noNeedFirst, ignore, align, noSafe, ',') + ')';
@@ -943,7 +941,6 @@ function makeSetValue(ptr, pos, value, type, noNeedFirst, ignore, align, noSafe,
943941
if (align || needSplitting) {
944942
// Alignment is important here, or we need to split this up for other reasons.
945943
var bytes = Runtime.getNativeTypeSize(type);
946-
if (DOUBLE_MODE == 0 && type == 'double') bytes = 4; // we will really only read 4 bytes here
947944
if (bytes > align || needSplitting) {
948945
var ret = '';
949946
if (isIntImplemented(type)) {

src/settings.js

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -238,27 +238,6 @@ var ALLOW_TABLE_GROWTH = 0;
238238
// default, any other value will be used as an override
239239
var GLOBAL_BASE = -1;
240240

241-
// where the stack will begin. -1 means use the default. if the stack cannot
242-
// start at the value specified here, it may start at a higher location.
243-
// this is useful when debugging two builds that may differ in their static
244-
// allocations, by forcing the stack to start in the same place their
245-
// memory usage patterns would be the same.
246-
247-
// How to load and store 64-bit doubles. A potential risk is that doubles may
248-
// be only 32-bit aligned. Forcing 64-bit alignment in Clang itself should be
249-
// able to solve that, or as a workaround in DOUBLE_MODE 1 we will carefully
250-
// load in parts, in a way that requires only 32-bit alignment. In DOUBLE_MODE 0
251-
// we will simply store and load doubles as 32-bit floats, so when they are
252-
// stored/loaded they will truncate from 64 to 32 bits, and lose precision. This
253-
// is faster, and might work for some code (but probably that code should just
254-
// use floats and not doubles anyhow). Note that a downside of DOUBLE_MODE 1 is
255-
// that we currently store the double in parts, then load it aligned, and that
256-
// load-store will make JS engines alter it if it is being stored to a typed
257-
// array for security reasons. That will 'fix' the number from being a NaN or an
258-
// infinite number.
259-
// [fastcomp-only]
260-
var DOUBLE_MODE = 1;
261-
262241
// Warn at compile time about instructions that LLVM tells us are not fully
263242
// aligned. This is useful to find places in your code where you might refactor
264243
// to ensure proper alignment. This is currently only supported in asm.js, not

tests/test_benchmark.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -829,10 +829,6 @@ def test_fasta_float(self):
829829
def test_fasta_double(self):
830830
self.fasta('fasta_double', 'double')
831831

832-
@non_core
833-
def test_fasta_double_full(self):
834-
self.fasta('fasta_double_full', 'double', emcc_args=['-s', 'DOUBLE_MODE=1'])
835-
836832
def test_skinning(self):
837833
src = open(path_from_root('tests', 'skinning_test_no_simd.cpp'), 'r').read()
838834
self.do_benchmark('skinning', src, 'blah=0.000000')

0 commit comments

Comments
 (0)