[tbb-commits] [tor-browser] 09/34: Bug 1762899 - Fix {f32, f64}.copysign for Aarch64. r=lth, a=RyanVM

gitolite role git at cupani.torproject.org
Wed Apr 27 16:04:50 UTC 2022


This is an automated email from the git hooks/post-receive script.

richard pushed a commit to branch tor-browser-91.9esr-11.0-1
in repository tor-browser.

commit aeb147b24efe70cc53eceec2b2ca96e9d7db7d78
Author: Yury Delendik <ydelendik at mozilla.com>
AuthorDate: Wed Apr 6 18:42:42 2022 +0000

    Bug 1762899 - Fix {f32,f64}.copysign for Aarch64. r=lth, a=RyanVM
    
    Using defineReuseInput in LIRGenerator to prevents rhs == output && lhs != output,
    which is the case that would clobber the rhs in copySignDouble().
    
    Differential Revision: https://phabricator.services.mozilla.com/D142994
---
 js/src/jit-test/tests/wasm/regress/bug1762899.js | 19 +++++++++++++++++++
 js/src/jit/arm64/Lowering-arm64.cpp              |  4 +++-
 2 files changed, 22 insertions(+), 1 deletion(-)

diff --git a/js/src/jit-test/tests/wasm/regress/bug1762899.js b/js/src/jit-test/tests/wasm/regress/bug1762899.js
new file mode 100644
index 0000000000000..5df2a53404fcd
--- /dev/null
+++ b/js/src/jit-test/tests/wasm/regress/bug1762899.js
@@ -0,0 +1,19 @@
+var ins = wasmEvalText(`
+(module
+  (func (export "copysign_f64") (param f64 f64) (result f64)
+    f64.const 0x1.921fb54442d18p+0 (;=1.5708;)
+    local.get 0
+    f64.copysign
+  )
+  (func (export "copysign_f32") (param f32 f32) (result f32)
+    f32.const 0x1.921fb54442d18p+0 (;=1.5708;)
+    local.get 0
+    f32.copysign
+  )
+)
+`);
+
+assertEq(ins.exports.copysign_f64(1, 0), 1.5707963267948966);
+assertEq(ins.exports.copysign_f64(-1, 0), -1.5707963267948966);
+assertEq(ins.exports.copysign_f32(1, 0), 1.5707963705062866);
+assertEq(ins.exports.copysign_f32(-1, 0), -1.5707963705062866);
diff --git a/js/src/jit/arm64/Lowering-arm64.cpp b/js/src/jit/arm64/Lowering-arm64.cpp
index 5ad0f60e35b28..1e1a4d78e6369 100644
--- a/js/src/jit/arm64/Lowering-arm64.cpp
+++ b/js/src/jit/arm64/Lowering-arm64.cpp
@@ -961,7 +961,9 @@ void LIRGenerator::visitCopySign(MCopySign* ins) {
 
   lir->setOperand(0, useRegisterAtStart(lhs));
   lir->setOperand(1, useRegisterAtStart(rhs));
-  define(lir, ins);
+  // The copySignDouble and copySignFloat32 are optimized for lhs == output.
+  // It also prevents rhs == output when lhs != output, avoids clobbering.
+  defineReuseInput(lir, ins, 0);
 }
 
 void LIRGenerator::visitExtendInt32ToInt64(MExtendInt32ToInt64* ins) {

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the tbb-commits mailing list