Merge pull request #3384 from waywardmonkeys/excise-the-imprecise
Remove PRECISE_I32_MUL option.
This commit is contained in:
Коммит
d4ea1ef2b2
|
@ -1360,7 +1360,6 @@ Module['writeAsciiToMemory'] = writeAsciiToMemory;
|
|||
{{{ unSign }}}
|
||||
{{{ reSign }}}
|
||||
|
||||
#if PRECISE_I32_MUL
|
||||
// check for imul support, and also for correctness ( https://bugs.webkit.org/show_bug.cgi?id=126345 )
|
||||
if (!Math['imul'] || Math['imul'](0xffffffff, 5) !== -5) Math['imul'] = function imul(a, b) {
|
||||
var ah = a >>> 16;
|
||||
|
@ -1369,11 +1368,6 @@ if (!Math['imul'] || Math['imul'](0xffffffff, 5) !== -5) Math['imul'] = function
|
|||
var bl = b & 0xffff;
|
||||
return (al*bl + ((ah*bl + al*bh) << 16))|0;
|
||||
};
|
||||
#else
|
||||
Math['imul'] = function imul(a, b) {
|
||||
return (a*b)|0; // fast but imprecise
|
||||
};
|
||||
#endif
|
||||
Math.imul = Math['imul'];
|
||||
|
||||
#if PRECISE_F32
|
||||
|
|
|
@ -100,16 +100,10 @@ var WARN_UNALIGNED = 0; // Warn at compile time about instructions that LLVM tel
|
|||
// alignment. (this option is fastcomp-only)
|
||||
var PRECISE_I64_MATH = 1; // If enabled, i64 addition etc. is emulated - which is slow but precise. If disabled,
|
||||
// we use the 'double trick' which is fast but incurs rounding at high values.
|
||||
// Note that we do not catch 32-bit multiplication by default (which must be done in
|
||||
// 64 bits for high values for full precision) - you must manually set PRECISE_I32_MUL
|
||||
// for that.
|
||||
// If set to 2, we always include the i64 math code, which is necessary in the case
|
||||
// that we can't know at compile time that 64-bit math is needed. For example, if you
|
||||
// print 64-bit values with printf, but never add them, we can't know at compile time
|
||||
// and you need to set this to 2.
|
||||
var PRECISE_I32_MUL = 1; // If enabled, i32 multiplication is done with full precision, which means it is
|
||||
// correct even if the value exceeds the JS double-integer limit of ~52 bits (otherwise,
|
||||
// rounding will occur above that range).
|
||||
var PRECISE_F32 = 0; // 0: Use JS numbers for floating-point values. These are 64-bit and do not model C++
|
||||
// floats exactly, which are 32-bit.
|
||||
// 1: Model C++ floats precisely, using Math.fround, polyfilling when necessary. This
|
||||
|
|
|
@ -1,26 +0,0 @@
|
|||
#include <stdio.h>
|
||||
|
||||
typedef unsigned int uint;
|
||||
|
||||
// from cube2, zlib licensed
|
||||
|
||||
#define N (624)
|
||||
#define M (397)
|
||||
#define K (0x9908B0DFU)
|
||||
|
||||
static uint state[N];
|
||||
static int next = N;
|
||||
|
||||
void seedMT(uint seed) {
|
||||
state[0] = seed;
|
||||
for (uint i = 1; i < N; i++) // if we do not do this precisely, at least we
|
||||
// should coerce to int immediately, not wait
|
||||
state[i] = seed = 1812433253U * (seed ^ (seed >> 30)) + i;
|
||||
next = 0;
|
||||
}
|
||||
|
||||
int main() {
|
||||
seedMT(5497);
|
||||
for (int i = 0; i < 10; i++) printf("%d: %u\n", i, state[i]);
|
||||
return 0;
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
0: 5497
|
||||
1: 2916432318
|
||||
2: 2502517762
|
||||
3: 3151524867
|
||||
4: 2323729668
|
||||
5: 2053478917
|
||||
6: 2409490438
|
||||
7: 848473607
|
||||
8: 691103752
|
||||
9: 3915535113
|
|
@ -14,8 +14,7 @@ import shared, jsrun
|
|||
# configuration options will have to be hardcoded.
|
||||
CSMITH_CFLAGS = ['-I', os.path.join(os.environ['CSMITH_PATH'], 'runtime')]
|
||||
ENGINE = shared.JS_ENGINES[0]
|
||||
EMCC_ARGS = ['-O2', '-s', 'ASM_JS=1', '-s', 'PRECISE_I64_MATH=1', '-s',
|
||||
'PRECISE_I32_MUL=1']
|
||||
EMCC_ARGS = ['-O2', '-s', 'ASM_JS=1', '-s', 'PRECISE_I64_MATH=1']
|
||||
|
||||
filename = sys.argv[1]
|
||||
obj_filename = os.path.splitext(filename)[0]
|
||||
|
|
|
@ -425,16 +425,6 @@ class T(RunnerCore): # Short name, to make it more fun to use manually on the co
|
|||
|
||||
self.do_run_from_file(src, output)
|
||||
|
||||
def test_i32_mul_semiprecise(self):
|
||||
if Settings.ASM_JS: return self.skip('asm is always fully precise')
|
||||
|
||||
Settings.PRECISE_I32_MUL = 0 # we want semiprecise here
|
||||
|
||||
test_path = path_from_root('tests', 'core', 'test_i32_mul_semiprecise')
|
||||
src, output = (test_path + s for s in ('.in', '.out'))
|
||||
|
||||
self.do_run_from_file(src, output)
|
||||
|
||||
def test_i16_emcc_intrinsic(self):
|
||||
Settings.CORRECT_SIGNS = 1 # Relevant to this test
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче