basic.wast 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. ;;-------------------------------------------------------------------------------------------------------
  2. ;; Copyright (C) Microsoft. 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. (type $t1 (func (result i32)))
  7. (type $t2 (func (param i32) (result i32)))
  8. (import "test" "foo" (func $foo (type $t2)))
  9. (memory (export "memory") 5000 5000)
  10. (func $f1 (type $t1)
  11. (return (i32.const 2))
  12. )
  13. (func $f2 (export "a") (type $t2) (local f32)
  14. (if (i32.ge_s (i32.const 26) (i32.const 25))
  15. (set_local 0 (i32.add (get_local 0) (i32.const 4)))
  16. )
  17. (set_local 0 (i32.add (get_local 0) (call_indirect $t1 (i32.const 0))))
  18. (if_else (i32.ge_s (i32.const 22) (i32.const 25))
  19. (set_local 0 (i32.add (get_local 0) (i32.const 4)))
  20. (set_local 0 (i32.sub (get_local 0) (i32.const 5)))
  21. )
  22. (block
  23. (set_local 0 (i32.add (get_local 0) (i32.const 4)))
  24. (set_local 0 (i32.add (get_local 0) (i32.clz (get_local 0))))
  25. (set_local 0 (i32.add (get_local 0) (call $f1)))
  26. (br_if 0 (select (f32.ne (get_local 1) (get_local 1)) (i32.const 0) (i32.const 1)))
  27. (set_local 0 (i32.add (get_local 0) (i32.const 4)))
  28. )
  29. (call $foo (get_local 0))
  30. (i32.store (get_local 0) (i32.add (get_local 0) (i32.const 7)))
  31. (set_local 0 (i32.load (get_local 0)))
  32. (set_local 1 (f32.convert_s/i32 (get_local 0)))
  33. (set_local 1 (f32.add (get_local 1) (get_local 1)))
  34. (set_local 0 (i32.reinterpret/f32 (get_local 1)))
  35. (set_local 0 (i32.add (get_local 0) (call $foo (get_local 0))))
  36. (return (i32.add (get_local 0) (i32.const 42)))
  37. )
  38. (table anyfunc (elem $f1 $f2))
  39. )