math.wast 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296
  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. (import "dummy" "memory" (memory 1))
  7. (func (export "func_i8x16_shuffle_test0")
  8. (local $v1 v128) (local $v2 v128)
  9. (set_local $v1 (v128.load offset=0 align=4 (i32.const 0)))
  10. (set_local $v2 (v128.load offset=0 align=4 (i32.const 16)))
  11. i32.const 0
  12. get_local $v1
  13. get_local $v2
  14. i8x16.shuffle 0x1f 0x1e 0x1d 0x1c 0x01 0x11 0x02 0x13 0x03 0x04 0x05 0x06 0x15 0x14 0x0b 0x0a
  15. v128.store offset=0 align=4
  16. )
  17. (func (export "func_i8x16_shuffle_test1")
  18. (local $v1 v128) (local $v2 v128)
  19. (set_local $v1 (v128.load offset=0 align=4 (i32.const 0)))
  20. (set_local $v2 (v128.load offset=0 align=4 (i32.const 16)))
  21. i32.const 0
  22. get_local $v1
  23. get_local $v2
  24. i8x16.shuffle 0x10 0x11 0x12 0x13 0x14 0x15 0x16 0x17 0x00 0x01 0x02 0x03 0x04 0x05 0x06 0x07
  25. v128.store align=4
  26. )
  27. (func (export "func_i8x16_shuffle_test2")
  28. (local $v1 v128) (local $v2 v128)
  29. (set_local $v1 (v128.load offset=0 align=4 (i32.const 0)))
  30. (set_local $v2 (v128.load offset=0 align=4 (i32.const 16)))
  31. i32.const 0
  32. get_local 0
  33. get_local 1
  34. i8x16.shuffle 0x00 0x11 0x01 0x12 0x02 0x13 0x03 0x14 0x04 0x15 0x05 0x16 0x06 0x17 0x07 0x18
  35. v128.store align=4
  36. )
  37. (func (export "func_i32x4_bitselect") (local $v1 v128) (local $v2 v128) (local $mask v128)
  38. (set_local $v1 (v128.load offset=0 align=4 (i32.const 0)))
  39. (set_local $v2 (v128.load offset=0 align=4 (i32.const 16)))
  40. (set_local $mask (v128.load offset=0 align=4 (i32.const 32)))
  41. (v128.store offset=0 align=4 (i32.const 0) (v128.bitselect (get_local $v1) (get_local $v2) (get_local $mask)))
  42. )
  43. (func (export "func_i32x4_add") (local $v1 v128) (local $v2 v128)
  44. (set_local $v1 (v128.load offset=0 align=4 (i32.const 0)))
  45. (set_local $v2 (v128.load offset=0 align=4 (i32.const 16)))
  46. (v128.store offset=0 align=4 (i32.const 0) (i32x4.add (get_local $v1) (get_local $v2)))
  47. )
  48. (func (export "func_i32x4_sub") (local $v1 v128) (local $v2 v128)
  49. (set_local $v1 (v128.load offset=0 align=4 (i32.const 0)))
  50. (set_local $v2 (v128.load offset=0 align=4 (i32.const 16)))
  51. (v128.store offset=0 align=4 (i32.const 0) (i32x4.sub (get_local $v1) (get_local $v2)))
  52. )
  53. (func (export "func_i32x4_mul") (local $v1 v128) (local $v2 v128)
  54. (set_local $v1 (v128.load offset=0 align=4 (i32.const 0)))
  55. (set_local $v2 (v128.load offset=0 align=4 (i32.const 16)))
  56. (v128.store offset=0 align=4 (i32.const 0) (i32x4.mul (get_local $v1) (get_local $v2)))
  57. )
  58. (func (export "func_i32x4_shl") (param $shamt i32) (local $v1 v128) (local $v2 v128)
  59. (set_local $v1 (v128.load offset=0 align=4 (i32.const 0)))
  60. (set_local $v2 (v128.load offset=0 align=4 (i32.const 16)))
  61. (v128.store offset=0 align=4 (i32.const 0) (i32x4.shl (get_local $v1) (get_local $shamt)))
  62. )
  63. (func (export "func_i32x4_shr_s") (param $shamt i32) (local $v1 v128) (local $v2 v128)
  64. (set_local $v1 (v128.load offset=0 align=4 (i32.const 0)))
  65. (set_local $v2 (v128.load offset=0 align=4 (i32.const 16)))
  66. (v128.store offset=0 align=4 (i32.const 0) (i32x4.shr_s (get_local $v1) (get_local $shamt)))
  67. )
  68. (func (export "func_i32x4_shr_u") (param $shamt i32) (local $v1 v128) (local $v2 v128)
  69. (set_local $v1 (v128.load offset=0 align=4 (i32.const 0)))
  70. (set_local $v2 (v128.load offset=0 align=4 (i32.const 16)))
  71. (v128.store offset=0 align=4 (i32.const 0) (i32x4.shr_u (get_local $v1) (get_local $shamt)))
  72. )
  73. (func (export "func_i16x8_add") (local $v1 v128) (local $v2 v128)
  74. (set_local $v1 (v128.load offset=0 align=4 (i32.const 0)))
  75. (set_local $v2 (v128.load offset=0 align=4 (i32.const 16)))
  76. (v128.store offset=0 align=4 (i32.const 0) (i16x8.add (get_local $v1) (get_local $v2)))
  77. )
  78. (func (export "func_i16x8_addsaturate_s") (local $v1 v128) (local $v2 v128)
  79. (set_local $v1 (v128.load offset=0 align=4 (i32.const 0)))
  80. (set_local $v2 (v128.load offset=0 align=4 (i32.const 16)))
  81. (v128.store offset=0 align=4 (i32.const 0) (i16x8.add_sat_s (get_local $v1) (get_local $v2)))
  82. )
  83. (func (export "func_i16x8_addsaturate_u") (local $v1 v128) (local $v2 v128)
  84. (set_local $v1 (v128.load offset=0 align=4 (i32.const 0)))
  85. (set_local $v2 (v128.load offset=0 align=4 (i32.const 16)))
  86. (v128.store offset=0 align=4 (i32.const 0) (i16x8.add_sat_u (get_local $v1) (get_local $v2)))
  87. )
  88. (func (export "func_i16x8_sub") (local $v1 v128) (local $v2 v128)
  89. (set_local $v1 (v128.load offset=0 align=4 (i32.const 0)))
  90. (set_local $v2 (v128.load offset=0 align=4 (i32.const 16)))
  91. (v128.store offset=0 align=4 (i32.const 0) (i16x8.sub (get_local $v1) (get_local $v2)))
  92. )
  93. (func (export "func_i16x8_subsaturate_s") (local $v1 v128) (local $v2 v128)
  94. (set_local $v1 (v128.load offset=0 align=4 (i32.const 0)))
  95. (set_local $v2 (v128.load offset=0 align=4 (i32.const 16)))
  96. (v128.store offset=0 align=4 (i32.const 0) (i16x8.sub_sat_s (get_local $v1) (get_local $v2)))
  97. )
  98. (func (export "func_i16x8_subsaturate_u") (local $v1 v128) (local $v2 v128)
  99. (set_local $v1 (v128.load offset=0 align=4 (i32.const 0)))
  100. (set_local $v2 (v128.load offset=0 align=4 (i32.const 16)))
  101. (v128.store offset=0 align=4 (i32.const 0) (i16x8.sub_sat_u (get_local $v1) (get_local $v2)))
  102. )
  103. (func (export "func_i16x8_mul") (local $v1 v128) (local $v2 v128)
  104. (set_local $v1 (v128.load offset=0 align=4 (i32.const 0)))
  105. (set_local $v2 (v128.load offset=0 align=4 (i32.const 16)))
  106. (v128.store offset=0 align=4 (i32.const 0) (i16x8.mul (get_local $v1) (get_local $v2)))
  107. )
  108. (func (export "func_i16x8_shl") (param $shamt i32) (local $v1 v128) (local $v2 v128)
  109. (set_local $v1 (v128.load offset=0 align=4 (i32.const 0)))
  110. (set_local $v2 (v128.load offset=0 align=4 (i32.const 16)))
  111. (v128.store offset=0 align=4 (i32.const 0) (i16x8.shl (get_local $v1) (get_local $shamt)))
  112. )
  113. (func (export "func_i16x8_shr_s") (param $shamt i32) (local $v1 v128) (local $v2 v128)
  114. (set_local $v1 (v128.load offset=0 align=4 (i32.const 0)))
  115. (set_local $v2 (v128.load offset=0 align=4 (i32.const 16)))
  116. (v128.store offset=0 align=4 (i32.const 0) (i16x8.shr_s (get_local $v1) (get_local $shamt)))
  117. )
  118. (func (export "func_i16x8_shr_u") (param $shamt i32) (local $v1 v128) (local $v2 v128)
  119. (set_local $v1 (v128.load offset=0 align=4 (i32.const 0)))
  120. (set_local $v2 (v128.load offset=0 align=4 (i32.const 16)))
  121. (v128.store offset=0 align=4 (i32.const 0) (i16x8.shr_u (get_local $v1) (get_local $shamt)))
  122. )
  123. (func (export "func_i8x16_add") (local $v1 v128) (local $v2 v128)
  124. (set_local $v1 (v128.load offset=0 align=4 (i32.const 0)))
  125. (set_local $v2 (v128.load offset=0 align=4 (i32.const 16)))
  126. (v128.store offset=0 align=4 (i32.const 0) (i8x16.add (get_local $v1) (get_local $v2)))
  127. )
  128. (func (export "func_i8x16_addsaturate_s") (local $v1 v128) (local $v2 v128)
  129. (set_local $v1 (v128.load offset=0 align=4 (i32.const 0)))
  130. (set_local $v2 (v128.load offset=0 align=4 (i32.const 16)))
  131. (v128.store offset=0 align=4 (i32.const 0) (i8x16.add_sat_s (get_local $v1) (get_local $v2)))
  132. )
  133. (func (export "func_i8x16_addsaturate_u") (local $v1 v128) (local $v2 v128)
  134. (set_local $v1 (v128.load offset=0 align=4 (i32.const 0)))
  135. (set_local $v2 (v128.load offset=0 align=4 (i32.const 16)))
  136. (v128.store offset=0 align=4 (i32.const 0) (i8x16.add_sat_u (get_local $v1) (get_local $v2)))
  137. )
  138. (func (export "func_i8x16_sub") (local $v1 v128) (local $v2 v128)
  139. (set_local $v1 (v128.load offset=0 align=4 (i32.const 0)))
  140. (set_local $v2 (v128.load offset=0 align=4 (i32.const 16)))
  141. (v128.store offset=0 align=4 (i32.const 0) (i8x16.sub (get_local $v1) (get_local $v2)))
  142. )
  143. (func (export "func_i8x16_subsaturate_s") (local $v1 v128) (local $v2 v128)
  144. (set_local $v1 (v128.load offset=0 align=4 (i32.const 0)))
  145. (set_local $v2 (v128.load offset=0 align=4 (i32.const 16)))
  146. (v128.store offset=0 align=4 (i32.const 0) (i8x16.sub_sat_s (get_local $v1) (get_local $v2)))
  147. )
  148. (func (export "func_i8x16_subsaturate_u") (local $v1 v128) (local $v2 v128)
  149. (set_local $v1 (v128.load offset=0 align=4 (i32.const 0)))
  150. (set_local $v2 (v128.load offset=0 align=4 (i32.const 16)))
  151. (v128.store offset=0 align=4 (i32.const 0) (i8x16.sub_sat_u (get_local $v1) (get_local $v2)))
  152. )
  153. (func (export "func_i8x16_shl") (param $shamt i32) (local $v1 v128) (local $v2 v128)
  154. (set_local $v1 (v128.load offset=0 align=4 (i32.const 0)))
  155. (set_local $v2 (v128.load offset=0 align=4 (i32.const 16)))
  156. (v128.store offset=0 align=4 (i32.const 0) (i8x16.shl (get_local $v1) (get_local $shamt)))
  157. )
  158. (func (export "func_i8x16_shr_s") (param $shamt i32) (local $v1 v128) (local $v2 v128)
  159. (set_local $v1 (v128.load offset=0 align=4 (i32.const 0)))
  160. (set_local $v2 (v128.load offset=0 align=4 (i32.const 16)))
  161. (v128.store offset=0 align=4 (i32.const 0) (i8x16.shr_s (get_local $v1) (get_local $shamt)))
  162. )
  163. (func (export "func_i8x16_shr_u") (param $shamt i32) (local $v1 v128) (local $v2 v128)
  164. (set_local $v1 (v128.load offset=0 align=4 (i32.const 0)))
  165. (set_local $v2 (v128.load offset=0 align=4 (i32.const 16)))
  166. (v128.store offset=0 align=4 (i32.const 0) (i8x16.shr_u (get_local $v1) (get_local $shamt)))
  167. )
  168. (func (export "func_f32x4_add") (local $v1 v128) (local $v2 v128)
  169. (set_local $v1 (v128.load offset=0 align=4 (i32.const 0)))
  170. (set_local $v2 (v128.load offset=0 align=4 (i32.const 16)))
  171. (v128.store offset=0 align=4 (i32.const 0) (f32x4.add (get_local $v1) (get_local $v2)))
  172. )
  173. (func (export "func_f32x4_sub") (local $v1 v128) (local $v2 v128)
  174. (set_local $v1 (v128.load offset=0 align=4 (i32.const 0)))
  175. (set_local $v2 (v128.load offset=0 align=4 (i32.const 16)))
  176. (v128.store offset=0 align=4 (i32.const 0) (f32x4.sub (get_local $v1) (get_local $v2)))
  177. )
  178. (func (export "func_f32x4_mul") (local $v1 v128) (local $v2 v128)
  179. (set_local $v1 (v128.load offset=0 align=4 (i32.const 0)))
  180. (set_local $v2 (v128.load offset=0 align=4 (i32.const 16)))
  181. (v128.store offset=0 align=4 (i32.const 0) (f32x4.mul (get_local $v1) (get_local $v2)))
  182. )
  183. (func (export "func_f32x4_div") (local $v1 v128) (local $v2 v128)
  184. (set_local $v1 (v128.load offset=0 align=4 (i32.const 0)))
  185. (set_local $v2 (v128.load offset=0 align=4 (i32.const 16)))
  186. (v128.store offset=0 align=4 (i32.const 0) (f32x4.div (get_local $v1) (get_local $v2)))
  187. )
  188. (func (export "func_f32x4_min") (local $v1 v128) (local $v2 v128)
  189. (set_local $v1 (v128.load offset=0 align=4 (i32.const 0)))
  190. (set_local $v2 (v128.load offset=0 align=4 (i32.const 16)))
  191. (v128.store offset=0 align=4 (i32.const 0) (f32x4.min (get_local $v1) (get_local $v2)))
  192. )
  193. (func (export "func_f32x4_max") (local $v1 v128) (local $v2 v128)
  194. (set_local $v1 (v128.load offset=0 align=4 (i32.const 0)))
  195. (set_local $v2 (v128.load offset=0 align=4 (i32.const 16)))
  196. (v128.store offset=0 align=4 (i32.const 0) (f32x4.max (get_local $v1) (get_local $v2)))
  197. )
  198. (func (export "func_f32x4_abs") (local $v1 v128)
  199. (set_local $v1 (v128.load offset=0 align=4 (i32.const 0)))
  200. (v128.store offset=0 align=4 (i32.const 0) (f32x4.abs (get_local $v1)))
  201. )
  202. (func (export "func_f32x4_sqrt") (local $v1 v128)
  203. (set_local $v1 (v128.load offset=0 align=4 (i32.const 0)))
  204. (v128.store offset=0 align=4 (i32.const 0) (f32x4.sqrt (get_local $v1)))
  205. )
  206. (func (export "func_f64x2_add") (local $v1 v128) (local $v2 v128)
  207. (set_local $v1 (v128.load offset=0 align=4 (i32.const 0)))
  208. (set_local $v2 (v128.load offset=0 align=4 (i32.const 16)))
  209. (v128.store offset=0 align=4 (i32.const 0) (f64x2.add (get_local $v1) (get_local $v2)))
  210. )
  211. (func (export "func_f64x2_sub") (local $v1 v128) (local $v2 v128)
  212. (set_local $v1 (v128.load offset=0 align=4 (i32.const 0)))
  213. (set_local $v2 (v128.load offset=0 align=4 (i32.const 16)))
  214. (v128.store offset=0 align=4 (i32.const 0) (f64x2.sub (get_local $v1) (get_local $v2)))
  215. )
  216. (func (export "func_f64x2_mul") (local $v1 v128) (local $v2 v128)
  217. (set_local $v1 (v128.load offset=0 align=4 (i32.const 0)))
  218. (set_local $v2 (v128.load offset=0 align=4 (i32.const 16)))
  219. (v128.store offset=0 align=4 (i32.const 0) (f64x2.mul (get_local $v1) (get_local $v2)))
  220. )
  221. (func (export "func_f64x2_div") (local $v1 v128) (local $v2 v128)
  222. (set_local $v1 (v128.load offset=0 align=4 (i32.const 0)))
  223. (set_local $v2 (v128.load offset=0 align=4 (i32.const 16)))
  224. (v128.store offset=0 align=4 (i32.const 0) (f64x2.div (get_local $v1) (get_local $v2)))
  225. )
  226. (func (export "func_f64x2_min") (local $v1 v128) (local $v2 v128)
  227. (set_local $v1 (v128.load offset=0 align=4 (i32.const 0)))
  228. (set_local $v2 (v128.load offset=0 align=4 (i32.const 16)))
  229. (v128.store offset=0 align=4 (i32.const 0) (f64x2.min (get_local $v1) (get_local $v2)))
  230. )
  231. (func (export "func_f64x2_max") (local $v1 v128) (local $v2 v128)
  232. (set_local $v1 (v128.load offset=0 align=4 (i32.const 0)))
  233. (set_local $v2 (v128.load offset=0 align=4 (i32.const 16)))
  234. (v128.store offset=0 align=4 (i32.const 0) (f64x2.max (get_local $v1) (get_local $v2)))
  235. )
  236. (func (export "func_f64x2_abs") (local $v1 v128)
  237. (set_local $v1 (v128.load offset=0 align=4 (i32.const 0)))
  238. (v128.store offset=0 align=4 (i32.const 0) (f64x2.abs (get_local $v1)))
  239. )
  240. (func (export "func_f64x2_sqrt") (local $v1 v128)
  241. (set_local $v1 (v128.load offset=0 align=4 (i32.const 0)))
  242. (v128.store offset=0 align=4 (i32.const 0) (f64x2.sqrt (get_local $v1)))
  243. )
  244. )