github.com/bananabytelabs/wazero@v0.0.0-20240105073314-54b22a776da8/internal/integration_test/vs/testdata/fac.wat (about)

     1  ;; This file includes changes to test/core/fac.wast from the commit that added "multi-value" support.
     2  ;;
     3  ;; Compile like so, in order to not add any other post 1.0 features to the resulting wasm.
     4  ;;  wat2wasm \
     5  ;;      --disable-saturating-float-to-int \
     6  ;;      --disable-sign-extension \
     7  ;;      --disable-simd \
     8  ;;      --disable-bulk-memory  \
     9  ;;      --disable-reference-types  \
    10  ;;      fac.wat
    11  ;;
    12  ;; See https://github.com/WebAssembly/spec/commit/484180ba3d9d7638ba1cb400b699ffede796927c
    13  (module $fac.wast
    14    (func $pick0 (param i64) (result i64 i64)
    15      (local.get 0) (local.get 0)
    16    )
    17    (func $pick1 (param i64 i64) (result i64 i64 i64)
    18      (local.get 0) (local.get 1) (local.get 0)
    19    )
    20    (func (export "fac-ssa") (param i64) (result i64)
    21      (i64.const 1) (local.get 0)
    22      (loop $l (param i64 i64) (result i64)
    23        (call $pick1) (call $pick1) (i64.mul)
    24        (call $pick1) (i64.const 1) (i64.sub)
    25        (call $pick0) (i64.const 0) (i64.gt_u)
    26        (br_if $l)
    27        (drop) (return)
    28      )
    29    )
    30  )