Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Firefox/js/src/jit-test/tests/wasm/   (Firefox Browser Version 153.0.1©)  Datei vom 27.6.2026 mit Größe 1016 B image not shown  

Quelle  unroll4.js

  Sprache: JAVA
 

// |jit-test| test-also=--setpref=wasm_unroll_loops=true

// Loop unrolling test: 2 exiting values, 1 exit target => can be unrolled.
// `a` and `b` are swapped every iteration and correct unrolling depends on
// the phi nodes being treated as parallel assignments.

let t = `
(module
  (func (export "f1") (param $limit i32) (result i64)
    (local $a i64)
    (local $b i64)
    (local $tmp i64)
    (local $x i32)
    (local.set $a (i64.const 12345))
    (local.set $b (i64.const 67890))
    (loop $cont
       ;; swap a and b
       (local.set $tmp (local.get $a))
       (local.set $a (local.get $b))
       (local.set $b (local.get $tmp))
       ;; x = x + 1
       (local.set $x (i32.add (local.get $x) (i32.const 1)))
       ;;
       (br_if $cont (i32.lt_u (local.get $x) (local.get $limit)))
    )
    (i64.sub (local.get $a) (local.get $b))
  )
)`;

let i = new WebAssembly.Instance(new WebAssembly.Module(wasmTextToBinary(t)));

assertEq(i.exports.f1(100), -55545n);
assertEq(i.exports.f1(101), 55545n);

Messung V0.5 in Prozent
C=93 H=96 G=94

¤ Dauer der Verarbeitung: 0.3 Sekunden  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.