[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor-browser] 305/311: Bug 1762899 - Fix {f32, f64}.copysign for Aarch64. r=lth a=dmeehan



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

pierov pushed a commit to branch geckoview-99.0.1-11.0-1
in repository tor-browser.

commit 2b2dfc0508b4d3b50be089c58d9623e4678d2426
Author: Yury Delendik <ydelendik@xxxxxxxxxxx>
AuthorDate: Wed Apr 6 18:42:42 2022 +0000

    Bug 1762899 - Fix {f32,f64}.copysign for Aarch64. r=lth a=dmeehan
    
    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 02157780d1128..be240f7173608 100644
--- a/js/src/jit/arm64/Lowering-arm64.cpp
+++ b/js/src/jit/arm64/Lowering-arm64.cpp
@@ -984,7 +984,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.
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits