diff --git a/testsuite/tests/cmm/opt/T25771.cmm b/testsuite/tests/cmm/opt/T25771.cmm new file mode 100644 index 0000000000000000000000000000000000000000..a2935adbe5064c00d6655a4af68fbe933d01e983 --- /dev/null +++ b/testsuite/tests/cmm/opt/T25771.cmm @@ -0,0 +1,8 @@ +// The point of this test is that the bitcast operations +// should be successfully constant-folded, without panicking. + +func (float64 x) { + x = %fadd(x, %w2f_bitcast(0x4028b0a3d70a3d71 :: bits64)); + x = %fadd(x, %f2f64(%w2f_bitcast(0x3f2a0000 :: bits32))); + return (x); +} diff --git a/testsuite/tests/cmm/opt/T25771.stderr b/testsuite/tests/cmm/opt/T25771.stderr new file mode 100644 index 0000000000000000000000000000000000000000..ee9ff4129dd19eaf6371f43004f7dc138843b03c --- /dev/null +++ b/testsuite/tests/cmm/opt/T25771.stderr @@ -0,0 +1,20 @@ + +==================== Output Cmm ==================== +[func() { // [D1] + { info_tbls: [] + stack_info: arg_space: 8 + } + {offset + c2: // global + //tick src<T25771.cmm:(4,18)-(8,1)> + //tick src<T25771.cmm:5:5-59> + //tick src<T25771.cmm:6:5-59> + _c1::F64 = D1; // CmmAssign + _c1::F64 = %MO_F_Add_W64(D1, 12.345 :: W64); // CmmAssign + D1 = %MO_F_Add_W64(_c1::F64, + %MO_FF_Conv_W32_W64(0.6640625 :: W32)); // CmmAssign + call (P64[Sp])(D1) args: 8, res: 0, upd: 8; // CmmCall + } + }] + + diff --git a/testsuite/tests/cmm/opt/all.T b/testsuite/tests/cmm/opt/all.T index d78991cda929e1375743aecf86a54e9fb2b4e531..95effd2504a0c6cd6782ce0cbf206f1ee729d73b 100644 --- a/testsuite/tests/cmm/opt/all.T +++ b/testsuite/tests/cmm/opt/all.T @@ -8,3 +8,7 @@ test('T20142', normal, compile, ['']) # We check this by telling the assembler to exit on warnings. test('T24556', [only_ways('optasm'), cmm_src], compile, ['-O -opta -Xassembler -opta --fatal-warnings']) +test('T25771', [cmm_src, only_ways(['optasm']), + grep_errmsg(r'(12\.345|0\.6640625)',[1]), + ], + compile, ['-ddump-cmm']) diff --git a/testsuite/tests/codeGen/should_run/all.T b/testsuite/tests/codeGen/should_run/all.T index f83184426279cf92c69de83fd7cb633db221c8aa..8a5a1976443387319b3b6336ff4412d837de6d82 100644 --- a/testsuite/tests/codeGen/should_run/all.T +++ b/testsuite/tests/codeGen/should_run/all.T @@ -210,7 +210,9 @@ test('T16846', [only_ways(['optasm']), exit_code(1)], compile_and_run, ['']) test('T17920', [cmm_src], compile_and_run, ['']) test('T18527', req_c, compile_and_run, ['T18527FFI.c']) test('T19149', [req_c,only_ways('sanity')], compile_and_run, ['T19149_c.c']) -test('T20275', normal, compile_and_run, ['']) +test('T20275', [unless(js_arch(),extra_ways(['optasm']))], compile_and_run, ['']) + # Also tested with optimizations because + # that's the original reproducer for #25771 test('CallConv', [when(unregisterised(), skip), unless(arch('x86_64') or arch('aarch64'), skip),