i64cf.wast 1006 B

123456789101112131415161718192021222324252627
  1. ;;-------------------------------------------------------------------------------------------------------
  2. ;; Copyright (C) Microsoft Corporation and contributors. All rights reserved.
  3. ;; Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
  4. ;;-------------------------------------------------------------------------------------------------------
  5. (module
  6. (func (export "while") (result i32) (local i64 i64 i64 i64 i64)
  7. (set_local 0 (i64.const 5))
  8. (set_local 1 (i64.const 1))
  9. (set_local 2 (i64.const 3))
  10. (set_local 3 (i64.const 2))
  11. (set_local 4 (i64.const 7))
  12. (block
  13. (loop
  14. (br_if 1 (i64.eqz (get_local 0)))
  15. (set_local 3 (i64.mul (get_local 2) (get_local 4)))
  16. (set_local 1 (i64.mul (get_local 0) (get_local 1)))
  17. (set_local 1 (i64.mul (get_local 0) (get_local 3)))
  18. (set_local 0 (i64.sub (get_local 0) (i64.const 1)))
  19. (br 0)
  20. )
  21. )
  22. (i32.wrap/i64 (get_local 1))
  23. )
  24. )