From 376afd45fcf687e1e57e697b9ef38727d40dfc73 Mon Sep 17 00:00:00 2001 From: Max Graey Date: Fri, 26 Oct 2018 01:10:17 +0300 Subject: [PATCH] Improve Math routines; Add Mathf-specific prng (#297) --- package-lock.json | 1011 +++-- std/assembly/math.ts | 550 ++- tests/compiler/binary.optimized.wat | 355 +- tests/compiler/binary.untouched.wat | 1407 +++--- tests/compiler/std/array.optimized.wat | 285 +- tests/compiler/std/array.untouched.wat | 346 +- tests/compiler/std/libm.optimized.wat | 1600 +++---- tests/compiler/std/libm.untouched.wat | 1702 +++---- tests/compiler/std/math.optimized.wat | 3896 +++++++--------- tests/compiler/std/math.untouched.wat | 3998 +++++++---------- tests/compiler/std/mod.optimized.wat | 490 +- tests/compiler/std/mod.untouched.wat | 516 +-- .../std/operator-overloading.optimized.wat | 383 +- .../std/operator-overloading.untouched.wat | 819 ++-- 14 files changed, 7725 insertions(+), 9633 deletions(-) diff --git a/package-lock.json b/package-lock.json index f4e896da..ed01cd91 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,23 +11,23 @@ }, "@types/events": { "version": "1.2.0", - "resolved": "http://registry.npmjs.org/@types/events/-/events-1.2.0.tgz", + "resolved": "https://registry.npmjs.org/@types/events/-/events-1.2.0.tgz", "integrity": "sha512-KEIlhXnIutzKwRbQkGWb/I4HFqBuUykAdHgDED6xqwXJfONCjF5VoE0cXEiurh3XauygxzeDzgtXUqvLkxFzzA==", "dev": true }, "@types/fs-extra": { - "version": "5.0.4", - "resolved": "https://registry.npmjs.org/@types/fs-extra/-/fs-extra-5.0.4.tgz", - "integrity": "sha512-DsknoBvD8s+RFfSGjmERJ7ZOP1HI0UZRA3FSI+Zakhrc/Gy26YQsLI+m5V5DHxroHRJqCDLKJp7Hixn8zyaF7g==", + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/@types/fs-extra/-/fs-extra-5.0.1.tgz", + "integrity": "sha512-h3wnflb+jMTipvbbZnClgA2BexrT4w0GcfoCz5qyxd0IRsbqhLSyesM6mqZTAnhbVmhyTm5tuxfRu9R+8l+lGw==", "dev": true, "requires": { "@types/node": "*" } }, "@types/glob": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/@types/glob/-/glob-7.1.1.tgz", - "integrity": "sha512-1Bh06cbWJUHMC97acuD6UMG29nMt0Aqz1vF3guLfG+kHHJhy3AyohZFFxYk2f7Q1SQIrNwvncxAE0N/9s70F2w==", + "version": "5.0.35", + "resolved": "https://registry.npmjs.org/@types/glob/-/glob-5.0.35.tgz", + "integrity": "sha512-wc+VveszMLyMWFvXLkloixT4n0harUIVZjnpzztaZ0nKLuul7Z32iMt2fUFGAaZ4y1XWjFRMtCI5ewvyh4aIeg==", "dev": true, "requires": { "@types/events": "*", @@ -36,27 +36,27 @@ } }, "@types/handlebars": { - "version": "4.0.39", - "resolved": "https://registry.npmjs.org/@types/handlebars/-/handlebars-4.0.39.tgz", - "integrity": "sha512-vjaS7Q0dVqFp85QhyPSZqDKnTTCemcSHNHFvDdalO1s0Ifz5KuE64jQD5xoUkfdWwF4WpqdJEl7LsWH8rzhKJA==", + "version": "4.0.36", + "resolved": "https://registry.npmjs.org/@types/handlebars/-/handlebars-4.0.36.tgz", + "integrity": "sha512-LjNiTX7TY7wtuC6y3QwC93hKMuqYhgV9A1uXBKNvZtVC8ZvyWAjZkJ5BvT0K7RKqORRYRLMrqCxpw5RgS+MdrQ==", "dev": true }, "@types/highlight.js": { - "version": "9.12.3", - "resolved": "https://registry.npmjs.org/@types/highlight.js/-/highlight.js-9.12.3.tgz", - "integrity": "sha512-pGF/zvYOACZ/gLGWdQH8zSwteQS1epp68yRcVLJMgUck/MjEn/FBYmPub9pXT8C1e4a8YZfHo1CKyV8q1vKUnQ==", + "version": "9.12.2", + "resolved": "https://registry.npmjs.org/@types/highlight.js/-/highlight.js-9.12.2.tgz", + "integrity": "sha512-y5x0XD/WXDaGSyiTaTcKS4FurULJtSiYbGTeQd0m2LYZGBcZZ/7fM6t5H/DzeUF+kv8y6UfmF6yJABQsHcp9VQ==", "dev": true }, "@types/lodash": { - "version": "4.14.117", - "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.117.tgz", - "integrity": "sha512-xyf2m6tRbz8qQKcxYZa7PA4SllYcay+eh25DN3jmNYY6gSTL7Htc/bttVdkqj2wfJGbeWlQiX8pIyJpKU+tubw==", + "version": "4.14.104", + "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.104.tgz", + "integrity": "sha512-ufQcVg4daO8xQ5kopxRHanqFdL4AI7ondQkV+2f+7mz3gvp0LkBx2zBRC6hfs3T87mzQFmf5Fck7Fi145Ul6NQ==", "dev": true }, "@types/marked": { - "version": "0.4.2", - "resolved": "https://registry.npmjs.org/@types/marked/-/marked-0.4.2.tgz", - "integrity": "sha512-cDB930/7MbzaGF6U3IwSQp6XBru8xWajF5PV2YZZeV8DyiliTuld11afVztGI9+yJZ29il5E+NpGA6ooV/Cjkg==", + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/@types/marked/-/marked-0.3.0.tgz", + "integrity": "sha512-CSf9YWJdX1DkTNu9zcNtdCcn6hkRtB5ILjbhRId4ZOQqx30fXmdecuaXhugQL6eyrhuXtaHJ7PHI+Vm7k9ZJjg==", "dev": true }, "@types/minimatch": { @@ -66,15 +66,15 @@ "dev": true }, "@types/node": { - "version": "10.11.7", - "resolved": "https://registry.npmjs.org/@types/node/-/node-10.11.7.tgz", - "integrity": "sha512-yOxFfkN9xUFLyvWaeYj90mlqTJ41CsQzWKS3gXdOMOyPVacUsymejKxJ4/pMW7exouubuEeZLJawGgcNGYlTeg==", + "version": "10.9.4", + "resolved": "https://registry.npmjs.org/@types/node/-/node-10.9.4.tgz", + "integrity": "sha512-fCHV45gS+m3hH17zgkgADUSi2RR1Vht6wOZ0jyHP8rjiQra9f+mIcgwPQHllmDocYOstIEbKlxbFDYlgrTPYqw==", "dev": true }, "@types/shelljs": { - "version": "0.8.0", - "resolved": "https://registry.npmjs.org/@types/shelljs/-/shelljs-0.8.0.tgz", - "integrity": "sha512-vs1hCC8RxLHRu2bwumNyYRNrU3o8BtZhLysH5A4I98iYmA2APl6R3uNQb5ihl+WiwH0xdC9LLO+vRrXLs/Kyxg==", + "version": "0.7.8", + "resolved": "https://registry.npmjs.org/@types/shelljs/-/shelljs-0.7.8.tgz", + "integrity": "sha512-M2giRw93PxKS7YjU6GZjtdV9HASdB7TWqizBXe4Ju7AqbKlWvTr0gNO92XH56D/gMxqD/jNHLNfC5hA34yGqrQ==", "dev": true, "requires": { "@types/glob": "*", @@ -82,174 +82,179 @@ } }, "@webassemblyjs/ast": { - "version": "1.7.8", - "resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.7.8.tgz", - "integrity": "sha512-dOrtdtEyB8sInpl75yLPNksY4sRl0j/+t6aHyB/YA+ab9hV3Fo7FmG12FHzP+2MvWVAJtDb+6eXR5EZbZJ+uVg==", + "version": "1.7.6", + "resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.7.6.tgz", + "integrity": "sha512-8nkZS48EVsMUU0v6F1LCIOw4RYWLm2plMtbhFTjNgeXmsTNLuU3xTRtnljt9BFQB+iPbLRobkNrCWftWnNC7wQ==", "dev": true, "requires": { - "@webassemblyjs/helper-module-context": "1.7.8", - "@webassemblyjs/helper-wasm-bytecode": "1.7.8", - "@webassemblyjs/wast-parser": "1.7.8" + "@webassemblyjs/helper-module-context": "1.7.6", + "@webassemblyjs/helper-wasm-bytecode": "1.7.6", + "@webassemblyjs/wast-parser": "1.7.6", + "mamacro": "^0.0.3" } }, "@webassemblyjs/floating-point-hex-parser": { - "version": "1.7.8", - "resolved": "https://registry.npmjs.org/@webassemblyjs/floating-point-hex-parser/-/floating-point-hex-parser-1.7.8.tgz", - "integrity": "sha512-kn2zNKGsbql5i56VAgRYkpG+VazqHhQQZQycT2uXAazrAEDs23gy+Odkh5VblybjnwX2/BITkDtNmSO76hdIvQ==", + "version": "1.7.6", + "resolved": "https://registry.npmjs.org/@webassemblyjs/floating-point-hex-parser/-/floating-point-hex-parser-1.7.6.tgz", + "integrity": "sha512-VBOZvaOyBSkPZdIt5VBMg3vPWxouuM13dPXGWI1cBh3oFLNcFJ8s9YA7S9l4mPI7+Q950QqOmqj06oa83hNWBA==", "dev": true }, "@webassemblyjs/helper-api-error": { - "version": "1.7.8", - "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-api-error/-/helper-api-error-1.7.8.tgz", - "integrity": "sha512-xUwxDXsd1dUKArJEP5wWM5zxgCSwZApSOJyP1XO7M8rNUChUDblcLQ4FpzTpWG2YeylMwMl1MlP5Ztryiz1x4g==", + "version": "1.7.6", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-api-error/-/helper-api-error-1.7.6.tgz", + "integrity": "sha512-SCzhcQWHXfrfMSKcj8zHg1/kL9kb3aa5TN4plc/EREOs5Xop0ci5bdVBApbk2yfVi8aL+Ly4Qpp3/TRAUInjrg==", "dev": true }, "@webassemblyjs/helper-buffer": { - "version": "1.7.8", - "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-buffer/-/helper-buffer-1.7.8.tgz", - "integrity": "sha512-WXiIMnuvuwlhWvVOm8xEXU9DnHaa3AgAU0ZPfvY8vO1cSsmYb2WbGbHnMLgs43vXnA7XAob9b56zuZaMkxpCBg==", + "version": "1.7.6", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-buffer/-/helper-buffer-1.7.6.tgz", + "integrity": "sha512-1/gW5NaGsEOZ02fjnFiU8/OEEXU1uVbv2um0pQ9YVL3IHSkyk6xOwokzyqqO1qDZQUAllb+V8irtClPWntbVqw==", "dev": true }, "@webassemblyjs/helper-code-frame": { - "version": "1.7.8", - "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-code-frame/-/helper-code-frame-1.7.8.tgz", - "integrity": "sha512-TLQxyD9qGOIdX5LPQOPo0Ernd88U5rHkFb8WAjeMIeA0sPjCHeVPaGqUGGIXjUcblUkjuDAc07bruCcNHUrHDA==", + "version": "1.7.6", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-code-frame/-/helper-code-frame-1.7.6.tgz", + "integrity": "sha512-+suMJOkSn9+vEvDvgyWyrJo5vJsWSDXZmJAjtoUq4zS4eqHyXImpktvHOZwXp1XQjO5H+YQwsBgqTQEc0J/5zg==", "dev": true, "requires": { - "@webassemblyjs/wast-printer": "1.7.8" + "@webassemblyjs/wast-printer": "1.7.6" } }, "@webassemblyjs/helper-fsm": { - "version": "1.7.8", - "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-fsm/-/helper-fsm-1.7.8.tgz", - "integrity": "sha512-TjK0CnD8hAPkV5mbSp5aWl6SO1+H3WFcjWtixWoy8EMA99YnNzYhpc/WSYWhf7yrhpzkq5tZB0tvLK3Svr3IXA==", + "version": "1.7.6", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-fsm/-/helper-fsm-1.7.6.tgz", + "integrity": "sha512-HCS6KN3wgxUihGBW7WFzEC/o8Eyvk0d56uazusnxXthDPnkWiMv+kGi9xXswL2cvfYfeK5yiM17z2K5BVlwypw==", "dev": true }, "@webassemblyjs/helper-module-context": { - "version": "1.7.8", - "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-module-context/-/helper-module-context-1.7.8.tgz", - "integrity": "sha512-uCutAKR7Nm0VsFixcvnB4HhAyHouNbj0Dx1p7eRjFjXGGZ+N7ftTaG1ZbWCasAEbtwGj54LP8+lkBZdTCPmLGg==", - "dev": true + "version": "1.7.6", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-module-context/-/helper-module-context-1.7.6.tgz", + "integrity": "sha512-e8/6GbY7OjLM+6OsN7f2krC2qYVNaSr0B0oe4lWdmq5sL++8dYDD1TFbD1TdAdWMRTYNr/Qq7ovXWzia2EbSjw==", + "dev": true, + "requires": { + "mamacro": "^0.0.3" + } }, "@webassemblyjs/helper-wasm-bytecode": { - "version": "1.7.8", - "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-bytecode/-/helper-wasm-bytecode-1.7.8.tgz", - "integrity": "sha512-AdCCE3BMW6V34WYaKUmPgVHa88t2Z14P4/0LjLwuGkI0X6pf7nzp0CehzVVk51cKm2ymVXjl9dCG+gR1yhITIQ==", + "version": "1.7.6", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-bytecode/-/helper-wasm-bytecode-1.7.6.tgz", + "integrity": "sha512-PzYFCb7RjjSdAOljyvLWVqd6adAOabJW+8yRT+NWhXuf1nNZWH+igFZCUK9k7Cx7CsBbzIfXjJc7u56zZgFj9Q==", "dev": true }, "@webassemblyjs/helper-wasm-section": { - "version": "1.7.8", - "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-section/-/helper-wasm-section-1.7.8.tgz", - "integrity": "sha512-BkBhYQuzyl4hgTGOKo87Vdw6f9nj8HhI7WYpI0MCC5qFa5ahrAPOGgyETVdnRbv+Rjukl9MxxfDmVcVC435lDg==", + "version": "1.7.6", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-section/-/helper-wasm-section-1.7.6.tgz", + "integrity": "sha512-3GS628ppDPSuwcYlQ7cDCGr4W2n9c4hLzvnRKeuz+lGsJSmc/ADVoYpm1ts2vlB1tGHkjtQMni+yu8mHoMlKlA==", "dev": true, "requires": { - "@webassemblyjs/ast": "1.7.8", - "@webassemblyjs/helper-buffer": "1.7.8", - "@webassemblyjs/helper-wasm-bytecode": "1.7.8", - "@webassemblyjs/wasm-gen": "1.7.8" + "@webassemblyjs/ast": "1.7.6", + "@webassemblyjs/helper-buffer": "1.7.6", + "@webassemblyjs/helper-wasm-bytecode": "1.7.6", + "@webassemblyjs/wasm-gen": "1.7.6" } }, "@webassemblyjs/ieee754": { - "version": "1.7.8", - "resolved": "https://registry.npmjs.org/@webassemblyjs/ieee754/-/ieee754-1.7.8.tgz", - "integrity": "sha512-tOarWChdG1a3y1yqCX0JMDKzrat5tQe4pV6K/TX19BcXsBLYxFQOL1DEDa5KG9syeyvCrvZ+i1+Mv1ExngvktQ==", + "version": "1.7.6", + "resolved": "https://registry.npmjs.org/@webassemblyjs/ieee754/-/ieee754-1.7.6.tgz", + "integrity": "sha512-V4cIp0ruyw+hawUHwQLn6o2mFEw4t50tk530oKsYXQhEzKR+xNGDxs/SFFuyTO7X3NzEu4usA3w5jzhl2RYyzQ==", "dev": true, "requires": { "@xtuc/ieee754": "^1.2.0" } }, "@webassemblyjs/leb128": { - "version": "1.7.8", - "resolved": "https://registry.npmjs.org/@webassemblyjs/leb128/-/leb128-1.7.8.tgz", - "integrity": "sha512-GCYeGPgUFWJiZuP4NICbcyUQNxNLJIf476Ei+K+jVuuebtLpfvwkvYT6iTUE7oZYehhkor4Zz2g7SJ/iZaPudQ==", + "version": "1.7.6", + "resolved": "https://registry.npmjs.org/@webassemblyjs/leb128/-/leb128-1.7.6.tgz", + "integrity": "sha512-ojdlG8WpM394lBow4ncTGJoIVZ4aAtNOWHhfAM7m7zprmkVcKK+2kK5YJ9Bmj6/ketTtOn7wGSHCtMt+LzqgYQ==", "dev": true, "requires": { "@xtuc/long": "4.2.1" } }, "@webassemblyjs/utf8": { - "version": "1.7.8", - "resolved": "https://registry.npmjs.org/@webassemblyjs/utf8/-/utf8-1.7.8.tgz", - "integrity": "sha512-9X+f0VV+xNXW2ujfIRSXBJENGE6Qh7bNVKqu3yDjTFB3ar3nsThsGBBKdTG58aXOm2iUH6v28VIf88ymPXODHA==", + "version": "1.7.6", + "resolved": "https://registry.npmjs.org/@webassemblyjs/utf8/-/utf8-1.7.6.tgz", + "integrity": "sha512-oId+tLxQ+AeDC34ELRYNSqJRaScB0TClUU6KQfpB8rNT6oelYlz8axsPhf6yPTg7PBJ/Z5WcXmUYiHEWgbbHJw==", "dev": true }, "@webassemblyjs/wasm-edit": { - "version": "1.7.8", - "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-edit/-/wasm-edit-1.7.8.tgz", - "integrity": "sha512-6D3Hm2gFixrfyx9XjSON4ml1FZTugqpkIz5Awvrou8fnpyprVzcm4X8pyGRtA2Piixjl3DqmX/HB1xdWyE097A==", + "version": "1.7.6", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-edit/-/wasm-edit-1.7.6.tgz", + "integrity": "sha512-pTNjLO3o41v/Vz9VFLl+I3YLImpCSpodFW77pNoH4agn5I6GgSxXHXtvWDTvYJFty0jSeXZWLEmbaSIRUDlekg==", "dev": true, "requires": { - "@webassemblyjs/ast": "1.7.8", - "@webassemblyjs/helper-buffer": "1.7.8", - "@webassemblyjs/helper-wasm-bytecode": "1.7.8", - "@webassemblyjs/helper-wasm-section": "1.7.8", - "@webassemblyjs/wasm-gen": "1.7.8", - "@webassemblyjs/wasm-opt": "1.7.8", - "@webassemblyjs/wasm-parser": "1.7.8", - "@webassemblyjs/wast-printer": "1.7.8" + "@webassemblyjs/ast": "1.7.6", + "@webassemblyjs/helper-buffer": "1.7.6", + "@webassemblyjs/helper-wasm-bytecode": "1.7.6", + "@webassemblyjs/helper-wasm-section": "1.7.6", + "@webassemblyjs/wasm-gen": "1.7.6", + "@webassemblyjs/wasm-opt": "1.7.6", + "@webassemblyjs/wasm-parser": "1.7.6", + "@webassemblyjs/wast-printer": "1.7.6" } }, "@webassemblyjs/wasm-gen": { - "version": "1.7.8", - "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-gen/-/wasm-gen-1.7.8.tgz", - "integrity": "sha512-a7O/wE6eBeVKKUYgpMK7NOHmMADD85rSXLe3CqrWRDwWff5y3cSVbzpN6Qv3z6C4hdkpq9qyij1Ga1kemOZGvQ==", + "version": "1.7.6", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-gen/-/wasm-gen-1.7.6.tgz", + "integrity": "sha512-mQvFJVumtmRKEUXMohwn8nSrtjJJl6oXwF3FotC5t6e2hlKMh8sIaW03Sck2MDzw9xPogZD7tdP5kjPlbH9EcQ==", "dev": true, "requires": { - "@webassemblyjs/ast": "1.7.8", - "@webassemblyjs/helper-wasm-bytecode": "1.7.8", - "@webassemblyjs/ieee754": "1.7.8", - "@webassemblyjs/leb128": "1.7.8", - "@webassemblyjs/utf8": "1.7.8" + "@webassemblyjs/ast": "1.7.6", + "@webassemblyjs/helper-wasm-bytecode": "1.7.6", + "@webassemblyjs/ieee754": "1.7.6", + "@webassemblyjs/leb128": "1.7.6", + "@webassemblyjs/utf8": "1.7.6" } }, "@webassemblyjs/wasm-opt": { - "version": "1.7.8", - "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-opt/-/wasm-opt-1.7.8.tgz", - "integrity": "sha512-3lbQ0PT81NHCdi1sR/7+SNpZadM4qYcTSr62nFFAA7e5lFwJr14M1Gi+A/Y3PgcDWOHYjsaNGPpPU0H03N6Blg==", + "version": "1.7.6", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-opt/-/wasm-opt-1.7.6.tgz", + "integrity": "sha512-go44K90fSIsDwRgtHhX14VtbdDPdK2sZQtZqUcMRvTojdozj5tLI0VVJAzLCfz51NOkFXezPeVTAYFqrZ6rI8Q==", "dev": true, "requires": { - "@webassemblyjs/ast": "1.7.8", - "@webassemblyjs/helper-buffer": "1.7.8", - "@webassemblyjs/wasm-gen": "1.7.8", - "@webassemblyjs/wasm-parser": "1.7.8" + "@webassemblyjs/ast": "1.7.6", + "@webassemblyjs/helper-buffer": "1.7.6", + "@webassemblyjs/wasm-gen": "1.7.6", + "@webassemblyjs/wasm-parser": "1.7.6" } }, "@webassemblyjs/wasm-parser": { - "version": "1.7.8", - "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-parser/-/wasm-parser-1.7.8.tgz", - "integrity": "sha512-rZ/zlhp9DHR/05zh1MbAjT2t624sjrPP/OkJCjXqzm7ynH+nIdNcn9Ixc+qzPMFXhIrk0rBoQ3to6sEIvHh9jQ==", + "version": "1.7.6", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-parser/-/wasm-parser-1.7.6.tgz", + "integrity": "sha512-t1T6TfwNY85pDA/HWPA8kB9xA4sp9ajlRg5W7EKikqrynTyFo+/qDzIpvdkOkOGjlS6d4n4SX59SPuIayR22Yg==", "dev": true, "requires": { - "@webassemblyjs/ast": "1.7.8", - "@webassemblyjs/helper-api-error": "1.7.8", - "@webassemblyjs/helper-wasm-bytecode": "1.7.8", - "@webassemblyjs/ieee754": "1.7.8", - "@webassemblyjs/leb128": "1.7.8", - "@webassemblyjs/utf8": "1.7.8" + "@webassemblyjs/ast": "1.7.6", + "@webassemblyjs/helper-api-error": "1.7.6", + "@webassemblyjs/helper-wasm-bytecode": "1.7.6", + "@webassemblyjs/ieee754": "1.7.6", + "@webassemblyjs/leb128": "1.7.6", + "@webassemblyjs/utf8": "1.7.6" } }, "@webassemblyjs/wast-parser": { - "version": "1.7.8", - "resolved": "https://registry.npmjs.org/@webassemblyjs/wast-parser/-/wast-parser-1.7.8.tgz", - "integrity": "sha512-Q/zrvtUvzWuSiJMcSp90fi6gp2nraiHXjTV2VgAluVdVapM4gy1MQn7akja2p6eSBDQpKJPJ6P4TxRkghRS5dg==", + "version": "1.7.6", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wast-parser/-/wast-parser-1.7.6.tgz", + "integrity": "sha512-1MaWTErN0ziOsNUlLdvwS+NS1QWuI/kgJaAGAMHX8+fMJFgOJDmN/xsG4h/A1Gtf/tz5VyXQciaqHZqp2q0vfg==", "dev": true, "requires": { - "@webassemblyjs/ast": "1.7.8", - "@webassemblyjs/floating-point-hex-parser": "1.7.8", - "@webassemblyjs/helper-api-error": "1.7.8", - "@webassemblyjs/helper-code-frame": "1.7.8", - "@webassemblyjs/helper-fsm": "1.7.8", - "@xtuc/long": "4.2.1" + "@webassemblyjs/ast": "1.7.6", + "@webassemblyjs/floating-point-hex-parser": "1.7.6", + "@webassemblyjs/helper-api-error": "1.7.6", + "@webassemblyjs/helper-code-frame": "1.7.6", + "@webassemblyjs/helper-fsm": "1.7.6", + "@xtuc/long": "4.2.1", + "mamacro": "^0.0.3" } }, "@webassemblyjs/wast-printer": { - "version": "1.7.8", - "resolved": "https://registry.npmjs.org/@webassemblyjs/wast-printer/-/wast-printer-1.7.8.tgz", - "integrity": "sha512-GllIthRtwTxRDAURRNXscu7Napzmdf1jt1gpiZiK/QN4fH0lSGs3OTmvdfsMNP7tqI4B3ZtfaaWRlNIQug6Xyg==", + "version": "1.7.6", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wast-printer/-/wast-printer-1.7.6.tgz", + "integrity": "sha512-vHdHSK1tOetvDcl1IV1OdDeGNe/NDDQ+KzuZHMtqTVP1xO/tZ/IKNpj5BaGk1OYFdsDWQqb31PIwdEyPntOWRQ==", "dev": true, "requires": { - "@webassemblyjs/ast": "1.7.8", - "@webassemblyjs/wast-parser": "1.7.8", + "@webassemblyjs/ast": "1.7.6", + "@webassemblyjs/wast-parser": "1.7.6", "@xtuc/long": "4.2.1" } }, @@ -281,9 +286,9 @@ } }, "ajv": { - "version": "6.5.4", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.5.4.tgz", - "integrity": "sha512-4Wyjt8+t6YszqaXnLDfMmG/8AlO5Zbcsy3ATHncCzjW/NoPzAId8AK6749Ybjmdt+kUY1gP60fCu46oDxPv/mg==", + "version": "6.5.3", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.5.3.tgz", + "integrity": "sha512-LqZ9wY+fx3UMiiPd741yB2pj3hhil+hQc8taf4o2QGRFpWgZ2V5C8HA165DY9sS3fJwsk7uT7ZlFEyC3Ig3lLg==", "dev": true, "requires": { "fast-deep-equal": "^2.0.1", @@ -298,6 +303,40 @@ "integrity": "sha1-6GuBnGAs+IIa1jdBNpjx3sAhhHo=", "dev": true }, + "align-text": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/align-text/-/align-text-0.1.4.tgz", + "integrity": "sha1-DNkKVhCT810KmSVsIrcGlDP60Rc=", + "dev": true, + "requires": { + "kind-of": "^3.0.2", + "longest": "^1.0.1", + "repeat-string": "^1.5.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "amdefine": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/amdefine/-/amdefine-1.0.1.tgz", + "integrity": "sha1-SlKCrBZHKek2Gbz9OtFR+BfOkfU=", + "dev": true + }, + "ansi-escapes": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-3.1.0.tgz", + "integrity": "sha512-UgAb8H9D41AQnu/PbWlCofQVcnV4Gs2bBJi9eZPxfU/hgglFh3SMDMENRIqdr7H6XFnXdoknctFByVsCOotTVw==", + "dev": true + }, "ansi-regex": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", @@ -412,13 +451,10 @@ "dev": true }, "async": { - "version": "2.6.1", - "resolved": "https://registry.npmjs.org/async/-/async-2.6.1.tgz", - "integrity": "sha512-fNEiL2+AZt6AlAw/29Cr0UDe4sRAHCpEHh54WMz+Bb7QfNcFw4h3loofyJpLeQs4Yx7yuqu/2dLgM5hKOs6HlQ==", - "dev": true, - "requires": { - "lodash": "^4.17.10" - } + "version": "1.5.2", + "resolved": "https://registry.npmjs.org/async/-/async-1.5.2.tgz", + "integrity": "sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo=", + "dev": true }, "async-each": { "version": "1.0.1", @@ -543,15 +579,15 @@ "dev": true }, "binary-extensions": { - "version": "1.12.0", - "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-1.12.0.tgz", - "integrity": "sha512-DYWGk01lDcxeS/K9IHPGWfT8PsJmbXRtRd2Sx72Tnb8pcYZQFF1oSDb8hJtS1vhp212q1Rzi5dUf9+nq0o9UIg==", + "version": "1.11.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-1.11.0.tgz", + "integrity": "sha1-RqoXUftqL5PuXmibsQh9SxTGwgU=", "dev": true }, "binaryen": { - "version": "51.0.0-nightly.20181010", - "resolved": "https://registry.npmjs.org/binaryen/-/binaryen-51.0.0-nightly.20181010.tgz", - "integrity": "sha512-zsarngrxO6hDyWcIHDUR4Uo3bls8EaywKo5+VhtaV2PwbqQtUr8ZnTdhWS6Xx6pWFQqfuJEz9pPk+GZ1wByJAQ==" + "version": "51.0.0", + "resolved": "https://registry.npmjs.org/binaryen/-/binaryen-51.0.0.tgz", + "integrity": "sha512-Iop30WDVekq1MV2ygWHvL0mzSUQLH7m8VB3DHpU3MTdQoPj8LoRWK4U5b5nAlHLYYU1v/tIkdmiPrGgx8ANSfw==" }, "bluebird": { "version": "3.5.2", @@ -610,14 +646,14 @@ "dev": true }, "browser-process-hrtime": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/browser-process-hrtime/-/browser-process-hrtime-1.0.0.tgz", - "integrity": "sha512-9o5UecI3GhkpM6DrXr69PblIuWxPKk9Y0jHBRhdocZ2y7YECBFCsHm79Pr3OyR2AvjhDkabFJaDJMYRazHgsow==", + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/browser-process-hrtime/-/browser-process-hrtime-0.1.2.tgz", + "integrity": "sha1-Ql1opY00R/AqBKqJQYf86K+Le44=", "dev": true }, "browserify-aes": { "version": "1.2.0", - "resolved": "https://registry.npmjs.org/browserify-aes/-/browserify-aes-1.2.0.tgz", + "resolved": "http://registry.npmjs.org/browserify-aes/-/browserify-aes-1.2.0.tgz", "integrity": "sha512-+7CHXqGuspUn/Sl5aO7Ea0xWGAtETPXNSAjHo48JfLdPWcMng33Xe4znFvQweqc/uzk5zSOI3H52CYnjCfb5hA==", "dev": true, "requires": { @@ -654,7 +690,7 @@ }, "browserify-rsa": { "version": "4.0.1", - "resolved": "https://registry.npmjs.org/browserify-rsa/-/browserify-rsa-4.0.1.tgz", + "resolved": "http://registry.npmjs.org/browserify-rsa/-/browserify-rsa-4.0.1.tgz", "integrity": "sha1-IeCr+vbyApzy+vsTNWenAdQTVSQ=", "dev": true, "requires": { @@ -688,7 +724,7 @@ }, "buffer": { "version": "4.9.1", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-4.9.1.tgz", + "resolved": "http://registry.npmjs.org/buffer/-/buffer-4.9.1.tgz", "integrity": "sha1-bRu2AbB6TvztlwlBMgkwJ8lbwpg=", "dev": true, "requires": { @@ -765,6 +801,17 @@ "integrity": "sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0=", "dev": true }, + "center-align": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/center-align/-/center-align-0.1.3.tgz", + "integrity": "sha1-qg0yYptu6XIgBBHL1EYckHvCt60=", + "dev": true, + "optional": true, + "requires": { + "align-text": "^0.1.3", + "lazy-cache": "^1.0.3" + } + }, "chalk": { "version": "2.4.1", "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.1.tgz", @@ -776,6 +823,12 @@ "supports-color": "^5.3.0" } }, + "chardet": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/chardet/-/chardet-0.5.0.tgz", + "integrity": "sha512-9ZTaoBaePSCFvNlNGrsyI8ZVACP2svUtq0DkM7t4K2ClAa96sqOIRjAzDTc8zXzFt1cZR46rRzLTiHFSJ+Qw0g==", + "dev": true + }, "chokidar": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-2.0.4.tgz", @@ -798,9 +851,9 @@ } }, "chownr": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.1.tgz", - "integrity": "sha512-j38EvO5+LHX84jlo6h4UzmOwi0UgW61WRyPtJz4qaadK5eY3BTS5TY/S1Stc3Uk2lIM6TPevAlULiEJwie860g==", + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.0.1.tgz", + "integrity": "sha1-4qdQQqlVGQi+vSW4Uj1fl2nXkYE=", "dev": true }, "chrome-trace-event": { @@ -845,6 +898,21 @@ } } }, + "cli-cursor": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-2.1.0.tgz", + "integrity": "sha1-s12sN2R5+sw+lHR9QdDQ9SOP/LU=", + "dev": true, + "requires": { + "restore-cursor": "^2.0.0" + } + }, + "cli-width": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-2.2.0.tgz", + "integrity": "sha1-/xnt6Kml5XkyQUewwR8PvLq+1jk=", + "dev": true + }, "cliui": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/cliui/-/cliui-4.1.0.tgz", @@ -992,7 +1060,7 @@ }, "create-hash": { "version": "1.2.0", - "resolved": "https://registry.npmjs.org/create-hash/-/create-hash-1.2.0.tgz", + "resolved": "http://registry.npmjs.org/create-hash/-/create-hash-1.2.0.tgz", "integrity": "sha512-z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg==", "dev": true, "requires": { @@ -1005,7 +1073,7 @@ }, "create-hmac": { "version": "1.1.7", - "resolved": "https://registry.npmjs.org/create-hmac/-/create-hmac-1.1.7.tgz", + "resolved": "http://registry.npmjs.org/create-hmac/-/create-hmac-1.1.7.tgz", "integrity": "sha512-MJG9liiZ+ogc4TzUwuvbER1JRdgvUFSB5+VR/g5h82fGaIRWMWddtKBHi7/sVhfjQZ6SehlyhvQYrcYkaUIpLg==", "dev": true, "requires": { @@ -1031,9 +1099,9 @@ }, "dependencies": { "semver": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.6.0.tgz", - "integrity": "sha512-RS9R6R35NYgQn++fkDWaOmqGoj4Ek9gGs+DPxNUZKuwE183xjJroKvyo1IzVFeXvUrvmALy6FWD5xrdJT25gMg==", + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.5.0.tgz", + "integrity": "sha512-4SJ3dm0WAwWy/NVeioZh5AntkdJoWKxHxcmyP622fOkgHa4z3R0TdBJICINyaSDE6uNwVc8gZr+ZinwZAH4xIA==", "dev": true } } @@ -1078,6 +1146,13 @@ "ms": "2.0.0" } }, + "decamelize": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", + "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", + "dev": true, + "optional": true + }, "decode-uri-component": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.0.tgz", @@ -1143,7 +1218,7 @@ }, "diffie-hellman": { "version": "5.0.3", - "resolved": "https://registry.npmjs.org/diffie-hellman/-/diffie-hellman-5.0.3.tgz", + "resolved": "http://registry.npmjs.org/diffie-hellman/-/diffie-hellman-5.0.3.tgz", "integrity": "sha512-kqag/Nl+f3GwyK25fhUMYj81BUOrZ9IuJsjIcDE5icNM9FJHAVm3VcUDxdLPoQtTuUylWm6ZIknYJwwaPxsUzg==", "dev": true, "requires": { @@ -1201,9 +1276,9 @@ } }, "enhanced-resolve": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-4.1.0.tgz", - "integrity": "sha512-F/7vkyTtyc/llOIn8oWclcB25KdRaiPBpZYDgJHgh/UHtpgT2p2eldQgtQnLtUvfMKPKxbRaQM/hHkvLHt1Vng==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-4.0.0.tgz", + "integrity": "sha512-jox/62b2GofV1qTUQTMPEJSDIGycS43evqYzD/KVtEb9OCoki9cnacUPxCrZa7JfPzZSYOCZhu9O9luaMxAX8g==", "dev": true, "requires": { "graceful-fs": "^4.1.2", @@ -1280,18 +1355,31 @@ } }, "execa": { - "version": "0.10.0", - "resolved": "https://registry.npmjs.org/execa/-/execa-0.10.0.tgz", - "integrity": "sha512-7XOMnz8Ynx1gGo/3hyV9loYNPWM94jG3+3T3Y8tsfSstFmETmENCMU/A/zj8Lyaj1lkgEepKepvd6240tBRvlw==", + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/execa/-/execa-0.7.0.tgz", + "integrity": "sha1-lEvs00zEHuMqY6n68nrVpl/Fl3c=", "dev": true, "requires": { - "cross-spawn": "^6.0.0", + "cross-spawn": "^5.0.1", "get-stream": "^3.0.0", "is-stream": "^1.1.0", "npm-run-path": "^2.0.0", "p-finally": "^1.0.0", "signal-exit": "^3.0.0", "strip-eof": "^1.0.0" + }, + "dependencies": { + "cross-spawn": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-5.1.0.tgz", + "integrity": "sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk=", + "dev": true, + "requires": { + "lru-cache": "^4.0.1", + "shebang-command": "^1.2.0", + "which": "^1.2.9" + } + } } }, "expand-brackets": { @@ -1350,6 +1438,17 @@ } } }, + "external-editor": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/external-editor/-/external-editor-3.0.0.tgz", + "integrity": "sha512-mpkfj0FEdxrIhOC04zk85X7StNtr0yXnG7zCb+8ikO8OJi2jsHh5YGoknNTyXgsbHOf1WOOcVU3kPFWT2WgCkQ==", + "dev": true, + "requires": { + "chardet": "^0.5.0", + "iconv-lite": "^0.4.22", + "tmp": "^0.0.33" + } + }, "extglob": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/extglob/-/extglob-2.0.4.tgz", @@ -1427,6 +1526,15 @@ "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=", "dev": true }, + "figures": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/figures/-/figures-2.0.0.tgz", + "integrity": "sha1-OrGi0qYsi/tDGgyUy3l6L84nyWI=", + "dev": true, + "requires": { + "escape-string-regexp": "^1.0.5" + } + }, "fill-range": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz", @@ -1506,9 +1614,9 @@ } }, "fs-extra": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-7.0.0.tgz", - "integrity": "sha512-EglNDLRpmaTWiD/qraZn6HREAEAHJcJOmxNEYwq6xeMKnVMAy3GUcFB+wXt2C6k4CNvB/mP1y/U3dzvKKj5OtQ==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-5.0.0.tgz", + "integrity": "sha512-66Pm4RYbjzdyeuqudYqhFiNBbCIuI9kgRqLPSHIlXHidW8NIQtVdkM1yeZ4lXwuhbTETv3EUGMNHAAw6hiundQ==", "dev": true, "requires": { "graceful-fs": "^4.1.2", @@ -2127,39 +2235,84 @@ "dev": true }, "handlebars": { - "version": "4.0.12", - "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.0.12.tgz", - "integrity": "sha512-RhmTekP+FZL+XNhwS1Wf+bTTZpdLougwt5pcgA1tuz6Jcx0fpH/7z0qd71RKnZHBCxIRBHfBOnio4gViPemNzA==", + "version": "4.0.11", + "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.0.11.tgz", + "integrity": "sha1-Ywo13+ApS8KB7a5v/F0yn8eYLcw=", "dev": true, "requires": { - "async": "^2.5.0", + "async": "^1.4.0", "optimist": "^0.6.1", - "source-map": "^0.6.1", - "uglify-js": "^3.1.4" + "source-map": "^0.4.4", + "uglify-js": "^2.6" }, "dependencies": { - "commander": { - "version": "2.17.1", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.17.1.tgz", - "integrity": "sha512-wPMUt6FnH2yzG95SA6mzjQOEKUU3aLaDEmzs1ti+1E9h+CsrZghRlqEM/EJ4KscsQVG8uNN4uVreUeT8+drlgg==", + "camelcase": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-1.2.1.tgz", + "integrity": "sha1-m7UwTS4LVmmLLHWLCKPqqdqlijk=", "dev": true, "optional": true }, - "source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dev": true - }, - "uglify-js": { - "version": "3.4.9", - "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.4.9.tgz", - "integrity": "sha512-8CJsbKOtEbnJsTyv6LE6m6ZKniqMiFWmm9sRbopbkGs3gMPPfd3Fh8iIA4Ykv5MgaTbqHr4BaoGLJLZNhsrW1Q==", + "cliui": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-2.1.0.tgz", + "integrity": "sha1-S0dXYP+AJkx2LDoXGQMukcf+oNE=", "dev": true, "optional": true, "requires": { - "commander": "~2.17.1", - "source-map": "~0.6.1" + "center-align": "^0.1.1", + "right-align": "^0.1.1", + "wordwrap": "0.0.2" + } + }, + "source-map": { + "version": "0.4.4", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.4.4.tgz", + "integrity": "sha1-66T12pwNyZneaAMti092FzZSA2s=", + "dev": true, + "requires": { + "amdefine": ">=0.0.4" + } + }, + "uglify-js": { + "version": "2.8.29", + "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-2.8.29.tgz", + "integrity": "sha1-KcVzMUgFe7Th913zW3qcty5qWd0=", + "dev": true, + "optional": true, + "requires": { + "source-map": "~0.5.1", + "uglify-to-browserify": "~1.0.0", + "yargs": "~3.10.0" + }, + "dependencies": { + "source-map": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", + "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", + "dev": true, + "optional": true + } + } + }, + "wordwrap": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.2.tgz", + "integrity": "sha1-t5Zpu0LstAn4PVg8rVLKF+qhZD8=", + "dev": true, + "optional": true + }, + "yargs": { + "version": "3.10.0", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-3.10.0.tgz", + "integrity": "sha1-9+572FfdfB0tOMDnTvvWgdFDH9E=", + "dev": true, + "optional": true, + "requires": { + "camelcase": "^1.0.2", + "cliui": "^2.1.0", + "decamelize": "^1.0.0", + "window-size": "0.1.0" } } } @@ -2254,6 +2407,15 @@ "integrity": "sha1-7AbBDgo0wPL68Zn3/X/Hj//QPHM=", "dev": true }, + "iconv-lite": { + "version": "0.4.23", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.23.tgz", + "integrity": "sha512-neyTUVFtahjf0mB3dZT77u+8O0QB89jFdnBkd5P1JgYPbPaia3gXXOVL2fq8VyU2gMMD7SaN7QukTB/pmXYvDA==", + "dev": true, + "requires": { + "safer-buffer": ">= 2.1.2 < 3" + } + }, "ieee754": { "version": "1.1.12", "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.1.12.tgz", @@ -2267,67 +2429,13 @@ "dev": true }, "import-local": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/import-local/-/import-local-2.0.0.tgz", - "integrity": "sha512-b6s04m3O+s3CGSbqDIyP4R6aAwAeYlVq9+WUWep6iHa8ETRf9yei1U48C5MmfJmV9AiLYYBKPMq/W+/WRpQmCQ==", + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/import-local/-/import-local-1.0.0.tgz", + "integrity": "sha512-vAaZHieK9qjGo58agRBg+bhHX3hoTZU/Oa3GESWLz7t1U62fk63aHuDJJEteXoDeTCcPmUT+z38gkHPZkkmpmQ==", "dev": true, "requires": { - "pkg-dir": "^3.0.0", + "pkg-dir": "^2.0.0", "resolve-cwd": "^2.0.0" - }, - "dependencies": { - "find-up": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", - "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", - "dev": true, - "requires": { - "locate-path": "^3.0.0" - } - }, - "locate-path": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", - "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", - "dev": true, - "requires": { - "p-locate": "^3.0.0", - "path-exists": "^3.0.0" - } - }, - "p-limit": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.0.0.tgz", - "integrity": "sha512-fl5s52lI5ahKCernzzIyAP0QAZbGIovtVHGwpcu1Jr/EpzLVDI2myISHwGqK7m8uQFugVWSrbxH7XnhGtvEc+A==", - "dev": true, - "requires": { - "p-try": "^2.0.0" - } - }, - "p-locate": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", - "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", - "dev": true, - "requires": { - "p-limit": "^2.0.0" - } - }, - "p-try": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.0.0.tgz", - "integrity": "sha512-hMp0onDKIajHfIkdRk3P4CdCmErkYAxxDtP3Wx/4nZ3aGlau2VKh3mZpcuFkH27WQkL/3WBCPOktzA9ZOAnMQQ==", - "dev": true - }, - "pkg-dir": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-3.0.0.tgz", - "integrity": "sha512-/E57AYkoeQ25qkxMj5PBOVgF8Kiu/h7cYS30Z5+R7WaiCCBfLq58ZI/dSeaEKb9WVJV5n/03QwrN3IeWIFllvw==", - "dev": true, - "requires": { - "find-up": "^3.0.0" - } - } } }, "imurmurhash": { @@ -2356,6 +2464,44 @@ "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" }, + "inquirer": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-6.0.0.tgz", + "integrity": "sha512-tISQWRwtcAgrz+SHPhTH7d3e73k31gsOy6i1csonLc0u1dVK/wYvuOnFeiWqC5OXFIYbmrIFInef31wbT8MEJg==", + "dev": true, + "requires": { + "ansi-escapes": "^3.0.0", + "chalk": "^2.0.0", + "cli-cursor": "^2.1.0", + "cli-width": "^2.0.0", + "external-editor": "^3.0.0", + "figures": "^2.0.0", + "lodash": "^4.3.0", + "mute-stream": "0.0.7", + "run-async": "^2.2.0", + "rxjs": "^6.1.0", + "string-width": "^2.1.0", + "strip-ansi": "^4.0.0", + "through": "^2.3.6" + }, + "dependencies": { + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "dev": true + }, + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "dev": true, + "requires": { + "ansi-regex": "^3.0.0" + } + } + } + }, "interpret": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/interpret/-/interpret-1.1.0.tgz", @@ -2363,9 +2509,9 @@ "dev": true }, "invert-kv": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-2.0.0.tgz", - "integrity": "sha512-wPVv/y/QQ/Uiirj/vh3oP+1Ww+AWehmi1g5fFWGPF6IpCBCDVrhgHRMvrLfdYcwDh3QJbGXDW4JAuzxElLSqKA==", + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-1.0.0.tgz", + "integrity": "sha1-EEqOSqym09jNFXqO+L+rLXo//bY=", "dev": true }, "is-accessor-descriptor": { @@ -2498,6 +2644,12 @@ "isobject": "^3.0.1" } }, + "is-promise": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-2.1.0.tgz", + "integrity": "sha1-eaKp7OfwlugPNtKy87wWwf9L8/o=", + "dev": true + }, "is-stream": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", @@ -2577,19 +2729,26 @@ "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", "dev": true }, + "lazy-cache": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/lazy-cache/-/lazy-cache-1.0.4.tgz", + "integrity": "sha1-odePw6UEdMuAhF07O24dpJpEbo4=", + "dev": true, + "optional": true + }, "lcid": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/lcid/-/lcid-2.0.0.tgz", - "integrity": "sha512-avPEb8P8EGnwXKClwsNUgryVjllcRqtMYa49NTsbQagYuT1DcXnl1915oxWjoyGrXR6zH/Y0Zc96xWsPcoDKeA==", + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/lcid/-/lcid-1.0.0.tgz", + "integrity": "sha1-MIrMr6C8SDo4Z7S28rlQYlHRuDU=", "dev": true, "requires": { - "invert-kv": "^2.0.0" + "invert-kv": "^1.0.0" } }, "loader-runner": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/loader-runner/-/loader-runner-2.3.1.tgz", - "integrity": "sha512-By6ZFY7ETWOc9RFaAIb23IjJVcM4dvJC/N57nmdz9RSkMXvAXGI7SyVlAw3v8vjtDRlqThgVDVmTnr9fqMlxkw==", + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/loader-runner/-/loader-runner-2.3.0.tgz", + "integrity": "sha1-9IKuqC1UPgeSFwDVpG7yb9rGuKI=", "dev": true }, "loader-utils": { @@ -2614,9 +2773,9 @@ } }, "lodash": { - "version": "4.17.11", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz", - "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==", + "version": "4.17.5", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.5.tgz", + "integrity": "sha512-svL3uiZf1RwhH+cWrfZn3A4+U58wbP0tGVTLQPbjplZxZ8ROD9VLuNgsRniTlLe7OlSqR79RUehXgpBW/s0IQw==", "dev": true }, "lodash.debounce": { @@ -2630,6 +2789,12 @@ "resolved": "https://registry.npmjs.org/long/-/long-4.0.0.tgz", "integrity": "sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA==" }, + "longest": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/longest/-/longest-1.0.1.tgz", + "integrity": "sha1-MKCy2jj3N3DoKUoNIuZiXtd9AJc=", + "dev": true + }, "lru-cache": { "version": "4.1.3", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.3.tgz", @@ -2655,14 +2820,11 @@ "integrity": "sha512-0Dab5btKVPhibSalc9QGXb559ED7G7iLjFXBaj9Wq8O3vorueR5K5jaE3hkG6ZQINyhA/JgG6Qk4qdFQjsYV6g==", "dev": true }, - "map-age-cleaner": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/map-age-cleaner/-/map-age-cleaner-0.1.2.tgz", - "integrity": "sha512-UN1dNocxQq44IhJyMI4TU8phc2m9BddacHRPRjKGLYaF0jqd3xLz0jS0skpAU9WgYyoR4gHtUpzytNBS385FWQ==", - "dev": true, - "requires": { - "p-defer": "^1.0.0" - } + "mamacro": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/mamacro/-/mamacro-0.0.3.tgz", + "integrity": "sha512-qMEwh+UujcQ+kbz3T6V+wAmO2U8veoq2w+3wY8MquqwVA3jChfwY+Tk52GZKDfACEPjuZ7r2oJLejwpt8jtwTA==", + "dev": true }, "map-cache": { "version": "0.2.2", @@ -2680,31 +2842,28 @@ } }, "marked": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/marked/-/marked-0.4.0.tgz", - "integrity": "sha512-tMsdNBgOsrUophCAFQl0XPe6Zqk/uy9gnue+jIIKhykO51hxyu6uNx7zBPy0+y/WKYVZZMspV9YeXLNdKk+iYw==", + "version": "0.3.17", + "resolved": "https://registry.npmjs.org/marked/-/marked-0.3.17.tgz", + "integrity": "sha512-+AKbNsjZl6jFfLPwHhWmGTqE009wTKn3RTmn9K8oUKHrX/abPJjtcRtXpYB/FFrwPJRUA86LX/de3T0knkPCmQ==", "dev": true }, "md5.js": { - "version": "1.3.5", - "resolved": "https://registry.npmjs.org/md5.js/-/md5.js-1.3.5.tgz", - "integrity": "sha512-xitP+WxNPcTTOgnTJcrhM0xvdPepipPSf3I8EIpGKeFLjt3PlJLIDG3u8EX53ZIubkb+5U2+3rELYpEhHhzdkg==", + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/md5.js/-/md5.js-1.3.4.tgz", + "integrity": "sha1-6b296UogpawYsENA/Fdk1bCdkB0=", "dev": true, "requires": { "hash-base": "^3.0.0", - "inherits": "^2.0.1", - "safe-buffer": "^5.1.2" + "inherits": "^2.0.1" } }, "mem": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/mem/-/mem-4.0.0.tgz", - "integrity": "sha512-WQxG/5xYc3tMbYLXoXPm81ET2WDULiU5FxbuIoNbJqLOOI8zehXFdZuiUEgfdrU2mVB1pxBZUGlYORSrpuJreA==", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/mem/-/mem-1.1.0.tgz", + "integrity": "sha1-Xt1StIXKHZAP5kiVUFOZoN+kX3Y=", "dev": true, "requires": { - "map-age-cleaner": "^0.1.1", - "mimic-fn": "^1.0.0", - "p-is-promise": "^1.1.0" + "mimic-fn": "^1.0.0" } }, "memory-fs": { @@ -2856,10 +3015,16 @@ "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", "dev": true }, + "mute-stream": { + "version": "0.0.7", + "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.7.tgz", + "integrity": "sha1-MHXOk7whuPq0PhvE2n6BFe0ee6s=", + "dev": true + }, "nan": { - "version": "2.11.1", - "resolved": "https://registry.npmjs.org/nan/-/nan-2.11.1.tgz", - "integrity": "sha512-iji6k87OSXa0CcrLl9z+ZiYSuR2o+c0bGuNmXdrhTQTakxytAFsC56SArGYoiHlJlFoHSnvmhpceZJaXkVuOtA==", + "version": "2.11.0", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.11.0.tgz", + "integrity": "sha512-F4miItu2rGnV2ySkXOQoA8FKz/SR2Q2sWP0sbTxNxz/tuokeC8WxOhPMcwi0qIyGtVn/rrSeLbvVkznqCdwYnw==", "dev": true, "optional": true }, @@ -2889,9 +3054,9 @@ "dev": true }, "nice-try": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz", - "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==", + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.4.tgz", + "integrity": "sha512-2NpiFHqC87y/zFke0fC0spBXL3bBsoh/p5H1EFhshxjCR5+0g2d6BiXbUFz9v1sAcxsk2htp2eQnNIci2dIYcA==", "dev": true }, "node-libs-browser": { @@ -3014,6 +3179,15 @@ "wrappy": "1" } }, + "onetime": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-2.0.1.tgz", + "integrity": "sha1-BnQoIw/WdEOyeUsiu6UotoZ5YtQ=", + "dev": true, + "requires": { + "mimic-fn": "^1.0.0" + } + }, "optimist": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/optimist/-/optimist-0.6.1.tgz", @@ -3026,7 +3200,7 @@ "dependencies": { "minimist": { "version": "0.0.10", - "resolved": "http://registry.npmjs.org/minimist/-/minimist-0.0.10.tgz", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.10.tgz", "integrity": "sha1-3j+YVD2/lggr5IrRoMfNqDYwHc8=", "dev": true } @@ -3039,20 +3213,20 @@ "dev": true }, "os-locale": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-3.0.1.tgz", - "integrity": "sha512-7g5e7dmXPtzcP4bgsZ8ixDVqA7oWYuEz4lOSujeWyliPai4gfVDiFIcwBg3aGCPnmSGfzOKTK3ccPn0CKv3DBw==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-2.1.0.tgz", + "integrity": "sha512-3sslG3zJbEYcaC4YVAvDorjGxc7tv6KVATnLPZONiljsUncvihe9BQoVCEs0RZ1kmf4Hk9OBqlZfJZWI4GanKA==", "dev": true, "requires": { - "execa": "^0.10.0", - "lcid": "^2.0.0", - "mem": "^4.0.0" + "execa": "^0.7.0", + "lcid": "^1.0.0", + "mem": "^1.1.0" } }, - "p-defer": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/p-defer/-/p-defer-1.0.0.tgz", - "integrity": "sha1-n26xgvbJqozXQwBKfU+WsZaw+ww=", + "os-tmpdir": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", + "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", "dev": true }, "p-finally": { @@ -3061,12 +3235,6 @@ "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=", "dev": true }, - "p-is-promise": { - "version": "1.1.0", - "resolved": "http://registry.npmjs.org/p-is-promise/-/p-is-promise-1.1.0.tgz", - "integrity": "sha1-nJRWmJ6fZYgBewQ01WCXZ1w9oF4=", - "dev": true - }, "p-limit": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz", @@ -3110,7 +3278,7 @@ }, "parse-asn1": { "version": "5.1.1", - "resolved": "https://registry.npmjs.org/parse-asn1/-/parse-asn1-5.1.1.tgz", + "resolved": "http://registry.npmjs.org/parse-asn1/-/parse-asn1-5.1.1.tgz", "integrity": "sha512-KPx7flKXg775zZpnp9SxJlz00gTd4BmJ2yJufSc44gMCRrRQ7NSzAcSJQfifuOLgW6bEi+ftrALtsgALeB2Adw==", "dev": true, "requires": { @@ -3163,9 +3331,9 @@ "dev": true }, "pbkdf2": { - "version": "3.0.17", - "resolved": "https://registry.npmjs.org/pbkdf2/-/pbkdf2-3.0.17.tgz", - "integrity": "sha512-U/il5MsrZp7mGg3mSQfn742na2T+1/vHDCG5/iTI3X9MKUuYUZVLQhyRsg06mCgDBTd57TxzgZt7P+fYfjRLtA==", + "version": "3.0.16", + "resolved": "https://registry.npmjs.org/pbkdf2/-/pbkdf2-3.0.16.tgz", + "integrity": "sha512-y4CXP3thSxqf7c0qmOF+9UeOTrifiVTIM+u7NWlq+PRsHbr7r7dpCmvzrZxa96JJUNi0Y5w9VqG5ZNeCVMoDcA==", "dev": true, "requires": { "create-hash": "^1.1.2", @@ -3233,17 +3401,16 @@ "dev": true }, "public-encrypt": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/public-encrypt/-/public-encrypt-4.0.3.tgz", - "integrity": "sha512-zVpa8oKZSz5bTMTFClc1fQOnyyEzpl5ozpi1B5YcvBrdohMjH2rfsBtyXcuNuwjsDIXmBYlF2N5FlJYhR29t8Q==", + "version": "4.0.2", + "resolved": "http://registry.npmjs.org/public-encrypt/-/public-encrypt-4.0.2.tgz", + "integrity": "sha512-4kJ5Esocg8X3h8YgJsKAuoesBgB7mqH3eowiDzMUPKiRDDE7E/BqqZD1hnTByIaAFiwAw246YEltSq7tdrOH0Q==", "dev": true, "requires": { "bn.js": "^4.1.0", "browserify-rsa": "^4.0.0", "create-hash": "^1.1.0", "parse-asn1": "^5.0.0", - "randombytes": "^2.0.1", - "safe-buffer": "^5.1.2" + "randombytes": "^2.0.1" } }, "pump": { @@ -3409,12 +3576,32 @@ "integrity": "sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo=", "dev": true }, + "restore-cursor": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-2.0.0.tgz", + "integrity": "sha1-n37ih/gv0ybU/RYpI9YhKe7g368=", + "dev": true, + "requires": { + "onetime": "^2.0.0", + "signal-exit": "^3.0.2" + } + }, "ret": { "version": "0.1.15", "resolved": "https://registry.npmjs.org/ret/-/ret-0.1.15.tgz", "integrity": "sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg==", "dev": true }, + "right-align": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/right-align/-/right-align-0.1.3.tgz", + "integrity": "sha1-YTObci/mo1FWiSENJOFMlhSGE+8=", + "dev": true, + "optional": true, + "requires": { + "align-text": "^0.1.1" + } + }, "rimraf": { "version": "2.6.2", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.2.tgz", @@ -3434,6 +3621,15 @@ "inherits": "^2.0.1" } }, + "run-async": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/run-async/-/run-async-2.3.0.tgz", + "integrity": "sha1-A3GrSuC91yDUFm19/aZP96RFpsA=", + "dev": true, + "requires": { + "is-promise": "^2.1.0" + } + }, "run-queue": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/run-queue/-/run-queue-1.0.3.tgz", @@ -3443,6 +3639,15 @@ "aproba": "^1.1.1" } }, + "rxjs": { + "version": "6.2.2", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.2.2.tgz", + "integrity": "sha512-0MI8+mkKAXZUF9vMrEoPnaoHkfzBPP4IGwUYRJhIRJF6/w3uByO1e91bEHn8zd43RdkTMKiooYKmwz7RH6zfOQ==", + "dev": true, + "requires": { + "tslib": "^1.9.0" + } + }, "safe-buffer": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", @@ -3458,6 +3663,12 @@ "ret": "~0.1.10" } }, + "safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", + "dev": true + }, "schema-utils": { "version": "0.4.7", "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-0.4.7.tgz", @@ -3517,7 +3728,7 @@ }, "sha.js": { "version": "2.4.11", - "resolved": "https://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz", + "resolved": "http://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz", "integrity": "sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ==", "dev": true, "requires": { @@ -3541,9 +3752,9 @@ "dev": true }, "shelljs": { - "version": "0.8.2", - "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.8.2.tgz", - "integrity": "sha512-pRXeNrCA2Wd9itwhvLp5LZQvPJ0wU6bcjaTMywHHGX5XWhVN2nzSu7WV0q+oUY7mGK3mgSkDDzP3MgjqdyIgbQ==", + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.8.1.tgz", + "integrity": "sha512-YA/iYtZpzFe5HyWVGrb02FjPxc4EMCfpoU/Phg9fQoyMC72u9598OUBrsU8IrtwAKG0tO8IYaqbaLIw+k3IRGA==", "dev": true, "requires": { "glob": "^7.0.0", @@ -3665,9 +3876,9 @@ } }, "source-list-map": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/source-list-map/-/source-list-map-2.0.1.tgz", - "integrity": "sha512-qnQ7gVMxGNxsiL4lEuJwe/To8UnK7fAnmbGEEH8RpLouuKbeEm0lhbQVFIrNSuB+G7tVrAlVsZgETT5nljf+Iw==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/source-list-map/-/source-list-map-2.0.0.tgz", + "integrity": "sha512-I2UmuJSRr/T8jisiROLU3A3ltr+swpniSmNPI4Ml3ZCX6tVnDsuZzK7F2hl5jTqbZBWCEKlj5HRQiPExXLgE8A==", "dev": true }, "source-map": { @@ -3863,6 +4074,12 @@ "integrity": "sha512-dQRhbNQkRnaqauC7WqSJ21EEksgT0fYZX2lqXzGkpo8JNig9zGZTYoMGvyI2nWmXlE2VSVXVDu7wLVGu/mQEsg==", "dev": true }, + "through": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", + "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=", + "dev": true + }, "through2": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.3.tgz", @@ -3882,6 +4099,15 @@ "setimmediate": "^1.0.4" } }, + "tmp": { + "version": "0.0.33", + "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", + "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==", + "dev": true, + "requires": { + "os-tmpdir": "~1.0.2" + } + }, "to-arraybuffer": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/to-arraybuffer/-/to-arraybuffer-1.0.1.tgz", @@ -3931,9 +4157,9 @@ } }, "ts-loader": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/ts-loader/-/ts-loader-5.2.1.tgz", - "integrity": "sha512-KC0cOvsFVyxBlg5h9jvaMlIL2tNsyQLvT2/OvIlO0AMUBJ4iXTtOfaDEqvmqv2lM/icekQfDsP2PsYBCDHpuOQ==", + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/ts-loader/-/ts-loader-4.5.0.tgz", + "integrity": "sha512-ihgVaSmgrX4crGV4n7yuoHPoCHbDzj9aepCZR9TgIx4SgJ9gdnB6xLHgUBb7bsFM/f0K6x9iXa65KY/Fu1Klkw==", "dev": true, "requires": { "chalk": "^2.3.0", @@ -4007,28 +4233,36 @@ "dev": true }, "typedoc": { - "version": "0.13.0", - "resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.13.0.tgz", - "integrity": "sha512-jQWtvPcV+0fiLZAXFEe70v5gqjDO6pJYJz4mlTtmGJeW2KRoIU/BEfktma6Uj8Xii7UakuZjbxFewl3UYOkU/w==", + "version": "0.11.1", + "resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.11.1.tgz", + "integrity": "sha512-jdNIoHm5wkZqxQTe/g9AQ3LKnZyrzHXqu6A/c9GUOeJyBWLxNr7/Dm3rwFvLksuxRNwTvY/0HRDU9sJTa9WQSg==", "dev": true, "requires": { - "@types/fs-extra": "^5.0.3", - "@types/handlebars": "^4.0.38", - "@types/highlight.js": "^9.12.3", - "@types/lodash": "^4.14.110", - "@types/marked": "^0.4.0", + "@types/fs-extra": "5.0.1", + "@types/handlebars": "4.0.36", + "@types/highlight.js": "9.12.2", + "@types/lodash": "4.14.104", + "@types/marked": "0.3.0", "@types/minimatch": "3.0.3", - "@types/shelljs": "^0.8.0", - "fs-extra": "^7.0.0", + "@types/shelljs": "0.7.8", + "fs-extra": "^5.0.0", "handlebars": "^4.0.6", "highlight.js": "^9.0.0", - "lodash": "^4.17.10", - "marked": "^0.4.0", + "lodash": "^4.17.5", + "marked": "^0.3.17", "minimatch": "^3.0.0", "progress": "^2.0.0", - "shelljs": "^0.8.2", + "shelljs": "^0.8.1", "typedoc-default-themes": "^0.5.0", - "typescript": "3.1.x" + "typescript": "2.7.2" + }, + "dependencies": { + "typescript": { + "version": "2.7.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-2.7.2.tgz", + "integrity": "sha512-p5TCYZDAO0m4G344hD+wx/LATebLWZNkkh2asWUFqSsD2OrDNhbAHuSjobrmsUmdzjJjEeZVU9g1h3O6vpstnw==", + "dev": true + } } }, "typedoc-default-themes": { @@ -4044,9 +4278,9 @@ "dev": true }, "typescript": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.1.2.tgz", - "integrity": "sha512-gOoGJWbNnFAfP9FlrSV63LYD5DJqYJHG5ky1kOXSl3pCImn4rqWy/flyq1BRd4iChQsoCqjbQaqtmXO4yCVPCA==", + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.0.3.tgz", + "integrity": "sha512-kk80vLW9iGtjMnIv11qyxLqZm20UklzuR2tL0QAnDIygIUIemcZMxlMWudl9OOt76H3ntVzcTiddQ1/pAAJMYg==", "dev": true }, "uglify-es": { @@ -4073,6 +4307,13 @@ } } }, + "uglify-to-browserify": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/uglify-to-browserify/-/uglify-to-browserify-1.0.2.tgz", + "integrity": "sha1-bgkk1r2mta/jSeOabWMoUKD4grc=", + "dev": true, + "optional": true + }, "uglifyjs-webpack-plugin": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/uglifyjs-webpack-plugin/-/uglifyjs-webpack-plugin-1.3.0.tgz", @@ -4133,27 +4374,27 @@ } }, "unique-filename": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/unique-filename/-/unique-filename-1.1.1.tgz", - "integrity": "sha512-Vmp0jIp2ln35UTXuryvjzkjGdRyf9b2lTXuSYUiPmzRcl3FDtYqAwOnTJkAngD9SWhnoJzDbTKwaOrZ+STtxNQ==", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/unique-filename/-/unique-filename-1.1.0.tgz", + "integrity": "sha1-0F8v5AMlYIcfMOk8vnNe6iAVFPM=", "dev": true, "requires": { "unique-slug": "^2.0.0" } }, "unique-slug": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/unique-slug/-/unique-slug-2.0.1.tgz", - "integrity": "sha512-n9cU6+gITaVu7VGj1Z8feKMmfAjEAQGhwD9fE3zvpRRa0wEIx8ODYkVGfSc94M2OX00tUFV8wH3zYbm1I8mxFg==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/unique-slug/-/unique-slug-2.0.0.tgz", + "integrity": "sha1-22Z258fMBimHj/GWCXx4hVrp9Ks=", "dev": true, "requires": { "imurmurhash": "^0.1.4" } }, "universalify": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", - "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==", + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.1.tgz", + "integrity": "sha1-+nG63UQ3r0wUiEHjs7Fl+enlkLc=", "dev": true }, "unset-value": { @@ -4257,9 +4498,9 @@ "dev": true }, "v8-compile-cache": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.0.2.tgz", - "integrity": "sha512-1wFuMUIM16MDJRCrpbpuEPTUGmM5QMUg0cr3KFwra2XgOgFcPGDQHDh3CszSCD2Zewc/dh/pamNEW8CbfDebUw==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.0.0.tgz", + "integrity": "sha512-qNdTUMaCjPs4eEnM3W9H94R3sU70YCuT+/ST7nUf+id1bVOrdjrpUaeZLqPBPRph3hsgn4a4BvwpxhHZx+oSDg==", "dev": true }, "vm-browserify": { @@ -4283,15 +4524,15 @@ } }, "webpack": { - "version": "4.20.2", - "resolved": "https://registry.npmjs.org/webpack/-/webpack-4.20.2.tgz", - "integrity": "sha512-75WFUMblcWYcocjSLlXCb71QuGyH7egdBZu50FtBGl2Nso8CK3Ej+J7bTZz2FPFq5l6fzCisD9modB7t30ikuA==", + "version": "4.18.1", + "resolved": "https://registry.npmjs.org/webpack/-/webpack-4.18.1.tgz", + "integrity": "sha512-YAKkdiasBy+XJqdxmr00NvL69I6TImnap/3+6YNEkS4lRMAfRCLEmtGWCIB0hGhb+qWDTdTV3C+zTPmctOhJ7Q==", "dev": true, "requires": { - "@webassemblyjs/ast": "1.7.8", - "@webassemblyjs/helper-module-context": "1.7.8", - "@webassemblyjs/wasm-edit": "1.7.8", - "@webassemblyjs/wasm-parser": "1.7.8", + "@webassemblyjs/ast": "1.7.6", + "@webassemblyjs/helper-module-context": "1.7.6", + "@webassemblyjs/wasm-edit": "1.7.6", + "@webassemblyjs/wasm-parser": "1.7.6", "acorn": "^5.6.2", "acorn-dynamic-import": "^3.0.0", "ajv": "^6.1.0", @@ -4311,7 +4552,7 @@ "tapable": "^1.1.0", "uglifyjs-webpack-plugin": "^1.2.4", "watchpack": "^1.5.0", - "webpack-sources": "^1.3.0" + "webpack-sources": "^1.2.0" }, "dependencies": { "enhanced-resolve": { @@ -4334,49 +4575,28 @@ } }, "webpack-cli": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/webpack-cli/-/webpack-cli-3.1.2.tgz", - "integrity": "sha512-Cnqo7CeqeSvC6PTdts+dywNi5CRlIPbLx1AoUPK2T6vC1YAugMG3IOoO9DmEscd+Dghw7uRlnzV1KwOe5IrtgQ==", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/webpack-cli/-/webpack-cli-3.1.0.tgz", + "integrity": "sha512-p5NeKDtYwjZozUWq6kGNs9w+Gtw/CPvyuXjXn2HMdz8Tie+krjEg8oAtonvIyITZdvpF7XG9xDHwscLr2c+ugQ==", "dev": true, "requires": { "chalk": "^2.4.1", "cross-spawn": "^6.0.5", - "enhanced-resolve": "^4.1.0", - "global-modules-path": "^2.3.0", - "import-local": "^2.0.0", + "enhanced-resolve": "^4.0.0", + "global-modules-path": "^2.1.0", + "import-local": "^1.0.0", + "inquirer": "^6.0.0", "interpret": "^1.1.0", "loader-utils": "^1.1.0", - "supports-color": "^5.5.0", - "v8-compile-cache": "^2.0.2", - "yargs": "^12.0.2" - }, - "dependencies": { - "enhanced-resolve": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-4.1.0.tgz", - "integrity": "sha512-F/7vkyTtyc/llOIn8oWclcB25KdRaiPBpZYDgJHgh/UHtpgT2p2eldQgtQnLtUvfMKPKxbRaQM/hHkvLHt1Vng==", - "dev": true, - "requires": { - "graceful-fs": "^4.1.2", - "memory-fs": "^0.4.0", - "tapable": "^1.0.0" - } - }, - "supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "dev": true, - "requires": { - "has-flag": "^3.0.0" - } - } + "supports-color": "^5.4.0", + "v8-compile-cache": "^2.0.0", + "yargs": "^12.0.1" } }, "webpack-sources": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-1.3.0.tgz", - "integrity": "sha512-OiVgSrbGu7NEnEvQJJgdSFPl2qWKkWq5lHMhgiToIiN9w34EBnjYzSYs+VbL5KoYiLNtFFa7BZIKxRED3I32pA==", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-1.2.0.tgz", + "integrity": "sha512-9BZwxR85dNsjWz3blyxdOhTgtnQvv3OEs5xofI0wPYTwu5kaWxS08UuD1oI7WLBLpRO+ylf0ofnXLXWmGb2WMw==", "dev": true, "requires": { "source-list-map": "^2.0.0", @@ -4406,6 +4626,13 @@ "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=", "dev": true }, + "window-size": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/window-size/-/window-size-0.1.0.tgz", + "integrity": "sha1-VDjNLqk7IC76Ohn+iIeu58lPnJ0=", + "dev": true, + "optional": true + }, "wordwrap": { "version": "0.0.3", "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.3.tgz", @@ -4483,16 +4710,16 @@ "dev": true }, "yargs": { - "version": "12.0.2", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-12.0.2.tgz", - "integrity": "sha512-e7SkEx6N6SIZ5c5H22RTZae61qtn3PYUE8JYbBFlK9sYmh3DMQ6E5ygtaG/2BW0JZi4WGgTR2IV5ChqlqrDGVQ==", + "version": "12.0.1", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-12.0.1.tgz", + "integrity": "sha512-B0vRAp1hRX4jgIOWFtjfNjd9OA9RWYZ6tqGA9/I/IrTMsxmKvtWy+ersM+jzpQqbC3YfLzeABPdeTgcJ9eu1qQ==", "dev": true, "requires": { "cliui": "^4.0.0", "decamelize": "^2.0.0", "find-up": "^3.0.0", "get-caller-file": "^1.0.1", - "os-locale": "^3.0.0", + "os-locale": "^2.0.0", "require-directory": "^2.1.1", "require-main-filename": "^1.0.1", "set-blocking": "^2.0.0", diff --git a/std/assembly/math.ts b/std/assembly/math.ts index 40e0d644..7407b708 100644 --- a/std/assembly/math.ts +++ b/std/assembly/math.ts @@ -24,6 +24,7 @@ import { // TODO: sin, cos, tan +/** @internal */ function R(z: f64): f64 { // Rational approximation of (asin(x)-x)/x^3 const // see: musl/src/math/asin.c and SUN COPYRIGHT NOTICE above pS0 = reinterpret(0x3FC5555555555555), // 1.66666666666666657415e-01 @@ -41,6 +42,7 @@ function R(z: f64): f64 { // Rational approximation of (asin(x)-x)/x^3 return p / q; } +@inline /** @internal */ function expo2(x: f64): f64 { // exp(x)/2 for x >= log(DBL_MAX) const // see: musl/src/math/__expo2.c k = 2043, @@ -50,9 +52,12 @@ function expo2(x: f64): f64 { // exp(x)/2 for x >= log(DBL_MAX) } var random_seeded = false; -var random_state0: u64; -var random_state1: u64; +var random_state0_64: u64; +var random_state1_64: u64; +var random_state0_32: u32; +var random_state1_32: u32; +/** @internal */ function murmurHash3(h: u64): u64 { // Force all bits of a hash block to avalanche h ^= h >> 33; // see: https://github.com/aappleby/smhasher h *= 0xFF51AFD7ED558CCD; @@ -62,6 +67,14 @@ function murmurHash3(h: u64): u64 { // Force all bits of a hash block to avalanc return h; } +/** @internal */ +function splitMix32(h: u32): u32 { + h += 0x6D2B79F5; + h = (h ^ (h >> 15)) * (h | 1); + h ^= h + (h ^ (h >> 7)) * (h | 61); + return h ^ (h >> 14); +} + export namespace NativeMath { export const E = reinterpret(0x4005BF0A8B145769); // 2.7182818284590452354 @@ -99,12 +112,14 @@ export namespace NativeMath { } var s: f64, w: f64, z: f64; if (hx >> 31) { - z = (1.0 + x) * 0.5; + // z = (1.0 + x) * 0.5; + z = 0.5 + x * 0.5; s = builtin_sqrt(z); w = R(z) * s - pio2_lo; return 2 * (pio2_hi - (s + w)); } - z = (1.0 - x) * 0.5; + // z = (1.0 - x) * 0.5; + z = 0.5 - x * 0.5; s = builtin_sqrt(z); var df = reinterpret(reinterpret(s) & 0xFFFFFFFF00000000); var c = (z - df * df) / (s + df); @@ -136,7 +151,8 @@ export namespace NativeMath { if (ix < 0x3E500000 && ix >= 0x00100000) return x; return x + x * R(x * x); } - var z = (1.0 - builtin_abs(x)) * 0.5; + // var z = (1.0 - builtin_abs(x)) * 0.5; + var z = 0.5 - builtin_abs(x) * 0.5; var s = builtin_sqrt(z); var r = R(z); if (ix >= 0x3FEF3333) x = pio2_hi - (2 * (s + s * r) - pio2_lo); @@ -153,13 +169,11 @@ export namespace NativeMath { const c = reinterpret(0x3FE62E42FEFA39EF); // 0.693147180559945309417232121458176568 var u = reinterpret(x); var e = u >> 52 & 0x7FF; - var s = u >> 63; - u &= 0x7FFFFFFFFFFFFFFF; - x = reinterpret(u); - if (e >= 0x3FF + 26) x = log(x) + c; - else if (e >= 0x3FF + 1) x = log(2 * x + 1 / (builtin_sqrt(x * x + 1) + x)); - else if (e >= 0x3FF - 26) x = log1p(x + x * x / (builtin_sqrt(x * x + 1) + 1)); - return s ? -x : x; + var y = reinterpret(u & 0x7FFFFFFFFFFFFFFF); + if (e >= 0x3FF + 26) y = log(y) + c; + else if (e >= 0x3FF + 1) y = log(2 * y + 1 / (builtin_sqrt(y * y + 1) + y)); + else if (e >= 0x3FF - 26) y = log1p(y + y * y / (builtin_sqrt(y * y + 1) + 1)); + return builtin_copysign(y, x); } export function atan(x: f64): f64 { // see musl/src/math/atan.c and SUN COPYRIGHT NOTICE above @@ -185,13 +199,13 @@ export namespace NativeMath { aT10 = reinterpret(0x3F90AD3AE322DA11), // 1.62858201153657823623e-02 Ox1p_120f = reinterpret(0x03800000); var ix = (reinterpret(x) >> 32); - var sign_ = ix >> 31; + var sx = x; ix &= 0x7FFFFFFF; var z: f64; if (ix >= 0x44100000) { if (isNaN(x)) return x; z = atanhi3 + Ox1p_120f; - return sign_ ? -z : z; + return builtin_copysign(z, sx); } var id: i32; if (ix < 0x3FDC0000) { @@ -221,15 +235,16 @@ export namespace NativeMath { var w = z * z; var s1 = z * (aT0 + w * (aT2 + w * (aT4 + w * (aT6 + w * (aT8 + w * aT10))))); var s2 = w * (aT1 + w * (aT3 + w * (aT5 + w * (aT7 + w * aT9)))); - if (id < 0) return x - x * (s1 + s2); + var s3 = x * (s1 + s2); + if (id < 0) return x - s3; switch (id) { - case 0: { z = atanhi0 - (x * (s1 + s2) - atanlo0 - x); break; } - case 1: { z = atanhi1 - (x * (s1 + s2) - atanlo1 - x); break; } - case 2: { z = atanhi2 - (x * (s1 + s2) - atanlo2 - x); break; } - case 3: { z = atanhi3 - (x * (s1 + s2) - atanlo3 - x); break; } + case 0: { z = atanhi0 - ((s3 - atanlo0) - x); break; } + case 1: { z = atanhi1 - ((s3 - atanlo1) - x); break; } + case 2: { z = atanhi2 - ((s3 - atanlo2) - x); break; } + case 3: { z = atanhi3 - ((s3 - atanlo3) - x); break; } default: unreachable(); } - return sign_ ? -z : z; + return builtin_copysign(z, sx); } export function atanh(x: f64): f64 { // see: musl/src/math/atanh.c @@ -243,13 +258,11 @@ export namespace NativeMath { } else { y = 0.5 * log1p(2 * (y / (1 - y))); } - return s ? -y : y; + return builtin_copysign(y, x); } export function atan2(y: f64, x: f64): f64 { // see: musl/src/math/atan2.c and SUN COPYRIGHT NOTICE above - const - pi = reinterpret(0x400921FB54442D18), // 3.1415926535897931160E+00 - pi_lo = reinterpret(0x3CA1A62633145C07); // 1.2246467991473531772E-16 + const pi_lo = reinterpret(0x3CA1A62633145C07); // 1.2246467991473531772E-16 if (isNaN(x) || isNaN(y)) return x + y; var u = reinterpret(x); var ix = (u >> 32); @@ -269,33 +282,33 @@ export namespace NativeMath { case 3: return -PI; } } - if ((ix | lx) == 0) return m & 1 ? -pi / 2 : pi / 2; + if ((ix | lx) == 0) return m & 1 ? -PI / 2 : PI / 2; if (ix == 0x7FF00000) { if (iy == 0x7FF00000) { switch (m) { - case 0: return pi / 4; - case 1: return -pi / 4; - case 2: return 3 * pi / 4; - case 3: return -3 * pi / 4; + case 0: return PI / 4; + case 1: return -PI / 4; + case 2: return 3 * PI / 4; + case 3: return -3 * PI / 4; } } else { switch (m) { case 0: return 0.0; case 1: return -0.0; - case 2: return pi; - case 3: return -pi; + case 2: return PI; + case 3: return -PI; } } } var z: f64; - if (ix + (64 << 20) < iy || iy == 0x7FF00000) return m & 1 ? -pi / 2 : pi / 2; + if (ix + (64 << 20) < iy || iy == 0x7FF00000) return m & 1 ? -PI / 2 : PI / 2; if ((m & 2) && iy + (64 << 20) < ix) z = 0; else z = atan(builtin_abs(y / x)); switch (m) { case 0: return z; case 1: return -z; - case 2: return pi - (z - pi_lo); - case 3: return (z - pi_lo) - pi; + case 2: return PI - (z - pi_lo); + case 3: return (z - pi_lo) - PI; } unreachable(); return 0; @@ -360,7 +373,8 @@ export namespace NativeMath { if (w < 0x3FE62E42) { if (w < 0x3FF00000 - (26 << 20)) return 1; t = expm1(x); - return 1 + t * t / (2 * (1 + t)); + // return 1 + t * t / (2 * (1 + t)); + return 1 + t * t / (2 + 2 * t); } if (w < 0x40862E42) { t = exp(x); @@ -395,12 +409,12 @@ export namespace NativeMath { if (x < underflow) return 0; } var hi: f64, lo: f64 = 0; - var k: i32 = 0; + var k = 0; if (hx > 0x3FD62E42) { if (hx >= 0x3FF0A2B2) { k = (invln2 * x + builtin_copysign(0.5, x)); } else { - k = 1 - sign_ - sign_; + k = 1 - (sign_ << 1); } hi = x - k * ln2hi; lo = k * ln2lo; @@ -433,30 +447,18 @@ export namespace NativeMath { if (hx >= 0x4043687A) { if (isNaN(x)) return x; if (sign_) return -1; - if (x > o_threshold) { - x *= Ox1p1023; - return x; - } + if (x > o_threshold) return x * Ox1p1023; } var c = 0.0, t: f64; if (hx > 0x3FD62E42) { - let hi: f64, lo: f64; - if (hx < 0x3FF0A2B2) { - if (!sign_) { - hi = x - ln2_hi; - lo = ln2_lo; - k = 1; - } else { - hi = x + ln2_hi; - lo = -ln2_lo; - k = -1; - } - } else { - k = (invln2 * x + (sign_ ? -0.5 : 0.5)); - t = k; - hi = x - t * ln2_hi; - lo = t * ln2_lo; - } + k = select( + 1 - (sign_ << 1), + (invln2 * x + builtin_copysign(0.5, x)), + hx < 0x3FF0A2B2 + ); + t = k; + let hi = x - t * ln2_hi; + let lo = t * ln2_lo; x = hi - lo; c = (hi - x) - lo; } else if (hx < 0x3C900000) return x; @@ -483,9 +485,10 @@ export namespace NativeMath { return y - 1.0; } u = (0x3FF - k) << 52; - if (k < 20) y = (x - e + (1 - reinterpret(u))) * twopk; - else y = (x - (e + reinterpret(u)) + 1) * twopk; - return y; + y = reinterpret(u); + if (k < 20) y = (1 - y) - e; + else y = 1 - (e + y); + return (x + y) * twopk; } @inline @@ -533,12 +536,12 @@ export namespace NativeMath { var h = x - c + c; var l = x - h; var hx = x * x; - var lx = h * h - hx + 2 * h * l + l * l; + var lx = h * h - hx + (2 * h + l) * l; c = y * SPLIT; h = y - c + c; l = y - h; var hy = y * y; - var ly = h * h - hy + 2 * h * l + l * l; + var ly = h * h - hy + (2 * h + l) * l; return z * builtin_sqrt(ly + lx + hy + hx); } @@ -563,7 +566,7 @@ export namespace NativeMath { var k = 0; if (hx < 0x00100000 || (hx >> 31)) { if (u << 1 == 0) return -1 / (x * x); - if (hx >> 31) return (x - x) / 0.0; + if (hx >> 31) return (x - x) / 0.0; k -= 54; x *= Ox1p54; u = reinterpret(x); @@ -637,8 +640,7 @@ export namespace NativeMath { var val_lo = dk * log10_2lo + (lo + hi) * ivln10lo + lo * ivln10hi; w = y + val_hi; val_lo += (y - w) + val_hi; - val_hi = w; - return val_lo + val_hi; + return val_lo + w; } export function log1p(x: f64): f64 { // see: musl/src/math/log1p.c and SUN COPYRIGHT NOTICE above @@ -781,7 +783,8 @@ export namespace NativeMath { cp_l = reinterpret(0xBE3E2FE0145B01F5), // -7.02846165095275826516e-09 ivln2 = reinterpret(0x3FF71547652B82FE), // 1.44269504088896338700e+00 ivln2_h = reinterpret(0x3FF7154760000000), // 1.44269502162933349609e+00 - ivln2_l = reinterpret(0x3E54AE0BF85DDF44); // 1.92596299112661746887e-08 + ivln2_l = reinterpret(0x3E54AE0BF85DDF44), // 1.92596299112661746887e-08 + inv3 = reinterpret(0x3FD5555555555555); // 0.3333333333333333333333 var u_ = reinterpret(x); var hx = (u_ >> 32); var lx = u_; @@ -801,13 +804,10 @@ export namespace NativeMath { if (iy >= 0x43400000) yisint = 2; else if (iy >= 0x3FF00000) { k = (iy >> 20) - 0x3FF; - if (k > 20) { - let jj = ly >> (52 - k); - if ((jj << (52 - k)) == ly) yisint = 2 - (jj & 1); - } else if (ly == 0) { - let jj = iy >> (20 - k); - if ((jj << (20 - k)) == iy) yisint = 2 - (jj & 1); - } + let offset = select(52, 20, k > 20) - k; + let Ly = select(ly, iy, k > 20); + let jj = Ly >> offset; + if ((jj << offset) == Ly) yisint = 2 - (jj & 1); } } if (ly == 0) { @@ -852,7 +852,7 @@ export namespace NativeMath { if (ix < 0x3FEFFFFF) return hy < 0 ? s * huge * huge : s * tiny * tiny; if (ix > 0x3FF00000) return hy > 0 ? s * huge * huge : s * tiny * tiny; t = ax - 1.0; - w = (t * t) * (0.5 - t * (0.3333333333333333333333 - t * 0.25)); + w = (t * t) * (0.5 - t * (inv3 - t * 0.25)); u = ivln2_h * t; v = t * ivln2_l - w * ivln2; t1 = u + v; @@ -877,7 +877,7 @@ export namespace NativeMath { ix -= 0x00100000; } ax = reinterpret(reinterpret(ax) & 0xFFFFFFFF | (ix << 32)); - let bp = select(1.5, 1.0, k); + let bp = select(1.5, 1.0, k); // k ? 1.5 : 1.0 u = ax - bp; v = 1.0 / (ax + bp); ss = u * v; @@ -954,51 +954,38 @@ export namespace NativeMath { export function seedRandom(value: i64): void { assert(value); random_seeded = true; - random_state0 = murmurHash3(value); - random_state1 = murmurHash3(random_state0); + random_state0_64 = murmurHash3(value); + random_state1_64 = murmurHash3(~random_state0_64); + random_state0_32 = splitMix32(value); + random_state1_32 = splitMix32(random_state0_32); } export function random(): f64 { // see: v8/src/base/random-number-generator.cc if (!random_seeded) throw new Error("PRNG must be seeded."); - var s1 = random_state0; - var s0 = random_state1; - random_state0 = s0; + var s1 = random_state0_64; + var s0 = random_state1_64; + random_state0_64 = s0; s1 ^= s1 << 23; s1 ^= s1 >> 17; s1 ^= s0; s1 ^= s0 >> 26; - random_state1 = s1; + random_state1_64 = s1; var r = ((s0 + s1) & 0x000FFFFFFFFFFFFF) | 0x3FF0000000000000; return reinterpret(r) - 1; } - export function round(x: f64): f64 { // see: musl/src/math/round.c - const toint = 1.0 / f64.EPSILON; - var ux = reinterpret(x); - var e = (ux >> 52 & 0x7FF); - if (e >= 0x3FF + 52) return x; - if (e < 0x3FF - 1) return 0 * x; - var y: f64; - if (ux >> 63) { - // FIXME: JS always rounds fractional 0.5 towards +Infinity - // and there certainly is a smarter way to do this. - y = toint - x - toint + x; - if (y >= 0.5) y = x - y + 1; - else if (y < -0.5) y = x - y - 1; - else y = x - y; - } else { - y = x + toint - toint - x; - if (y > 0.5) y = y + x - 1; - else if (y <= -0.5) y = y + x + 1; - else y = y + x; - } - return y; + @inline + export function round(x: f64): f64 { + return builtin_copysign(builtin_floor(x + 0.5), x); } @inline export function sign(x: f64): f64 { - // return x > 0 ? 1 : x < 0 ? -1 : x; - return builtin_abs(x) > 0 ? builtin_copysign(1, x) : x; + if (ASC_SHRINK_LEVEL > 0) { + return builtin_abs(x) > 0 ? builtin_copysign(1, x) : x; + } else { + return x > 0 ? 1 : x < 0 ? -1 : x; + } } export function sin(x: f64): f64 { // TODO @@ -1007,13 +994,11 @@ export namespace NativeMath { } export function sinh(x: f64): f64 { // see: musl/src/math/sinh.c - var u = reinterpret(x); - var h = 0.5; - if (u >> 63) h = -h; - u &= 0x7FFFFFFFFFFFFFFF; + var u = reinterpret(x) & 0x7FFFFFFFFFFFFFFF; var absx = reinterpret(u); var w = (u >> 32); var t: f64; + var h = builtin_copysign(0.5, x); if (w < 0x40862E42) { t = expm1(absx); if (w < 0x3FF00000) { @@ -1038,26 +1023,25 @@ export namespace NativeMath { export function tanh(x: f64): f64 { // see: musl/src/math/tanh.c var u = reinterpret(x); - var sign_ = (u >> 63); u &= 0x7FFFFFFFFFFFFFFF; - x = reinterpret(u); + var y = reinterpret(u); var w = (u >> 32); var t: f64; if (w > 0x3FE193EA) { if (w > 0x40340000) { - t = 1 - 0 / x; + t = 1 - 0 / y; } else { - t = expm1(2 * x); + t = expm1(2 * y); t = 1 - 2 / (t + 2); } } else if (w > 0x3FD058AE) { - t = expm1(2 * x); + t = expm1(2 * y); t = t / (t + 2); } else if (w >= 0x00100000) { - t = expm1(-2 * x); + t = expm1(-2 * y); t = -t / (t + 2); - } else t = x; - return sign_ ? -t : t; + } else t = y; + return builtin_copysign(t, x); } @inline @@ -1066,8 +1050,9 @@ export namespace NativeMath { } /** @internal */ - export function scalbn(x: f64, n: i32): f64 { // see: musl/src/math/scalbn.c + export function scalbn(x: f64, n: i32): f64 { // see: https://git.musl-libc.org/cgit/musl/tree/src/math/scalbn.c const + Ox1p53 = reinterpret(0x4340000000000000), Ox1p1023 = reinterpret(0x7FE0000000000000), Ox1p_1022 = reinterpret(0x0010000000000000); var y = x; @@ -1076,16 +1061,16 @@ export namespace NativeMath { n -= 1023; if (n > 1023) { y *= Ox1p1023; - n -= 1023; - if (n > 1023) n = 1023; + n = builtin_min(n - 1023, 1023); } } else if (n < -1022) { - y *= Ox1p_1022; - n += 1022; + /* make sure final n < -53 to avoid double + rounding in the subnormal range */ + y *= Ox1p_1022 * Ox1p53; + n += 1022 - 53; if (n < -1022) { - y *= Ox1p_1022; - n += 1022; - if (n < -1022) n = -1022; + y *= Ox1p_1022 * Ox1p53; + n = builtin_max(n + 1022 - 53, -1022); } } return y * reinterpret((0x3FF + n) << 52); @@ -1094,29 +1079,31 @@ export namespace NativeMath { export function mod(x: f64, y: f64): f64 { // see: musl/src/math/fmod.c var ux = reinterpret(x); var uy = reinterpret(y); - var ex = (ux >> 52 & 0x7FF); - var ey = (uy >> 52 & 0x7FF); - var sx = (ux >> 63); - if (uy << 1 == 0 || isNaN(y) || ex == 0x7FF) return (x * y) / (x * y); - if (ux << 1 <= uy << 1) { - if (ux << 1 == uy << 1) return 0 * x; + var ex = (ux >> 52 & 0x7FF); + var ey = (uy >> 52 & 0x7FF); + var sx = ux >> 63; + var uy1 = uy << 1; + if (uy1 == 0 || ex == 0x7FF || isNaN(y)) return (x * y) / (x * y); + var ux1 = ux << 1; + if (ux1 <= uy1) { + if (ux1 == uy1) return 0 * x; return x; } - var i: u64; if (!ex) { - for (i = ux << 12; !(i >> 63); i <<= 1) --ex; + ex -= builtin_clz(ux << 12); ux <<= -ex + 1; } else { ux &= -1 >> 12; ux |= 1 << 52; } if (!ey) { - for (i = uy << 12; !(i >> 63); i <<= 1) --ey; + ey -= builtin_clz(uy << 12); uy <<= -ey + 1; } else { uy &= -1 >> 12; uy |= 1 << 52; } + var i: u64; for (; ex > ey; ex--) { i = ux - uy; if (!(i >> 63)) { @@ -1130,37 +1117,39 @@ export namespace NativeMath { if (!i) return 0 * x; ux = i; } - for (; !(ux >> 52); ux <<= 1) --ex; + // for (; !(ux >> 52); ux <<= 1) --ex; + var shift = builtin_clz(ux << 11); + ex -= shift; + ux <<= shift; if (ex > 0) { ux -= 1 << 52; - ux |= ex << 52; + ux |= ex << 52; } else { ux >>= -ex + 1; } - ux |= sx << 63; + ux |= sx << 63; return reinterpret(ux); } export function rem(x: f64, y: f64): f64 { // see: musl/src/math/remquo.c var ux = reinterpret(x); var uy = reinterpret(y); - var ex = (ux >> 52 & 0x7FF); - var ey = (uy >> 52 & 0x7FF); + var ex = (ux >> 52 & 0x7FF); + var ey = (uy >> 52 & 0x7FF); var sx = (ux >> 63); var sy = (uy >> 63); - if (uy << 1 == 0 || isNaN(y) || ex == 0x7FF) return (x * y) / (x * y); + if (uy << 1 == 0 || ex == 0x7FF || isNaN(y)) return (x * y) / (x * y); if (ux << 1 == 0) return x; var uxi = ux; - var i: u64; if (!ex) { - for (i = uxi << 12; i >> 63 == 0; ex--, i <<= 1) {} + ex -= builtin_clz(uxi << 12); uxi <<= -ex + 1; } else { uxi &= -1 >> 12; uxi |= 1 << 52; } if (!ey) { - for (i = uy << 12; i >> 63 == 0; ey--, i <<= 1) {} + ey -= builtin_clz(uy << 12); uy <<= -ey + 1; } else { uy &= -1 >> 12; @@ -1172,6 +1161,7 @@ export namespace NativeMath { if (ex + 1 == ey) break; // goto end return x; } + let i: u64; for (; ex > ey; ex--) { i = uxi - uy; if (i >> 63 == 0) { @@ -1187,26 +1177,32 @@ export namespace NativeMath { ++q; } if (uxi == 0) ex = -60; - else for (; uxi >> 52 == 0; uxi <<= 1, ex--) {} + else { + let shift = builtin_clz(uxi << 11); + ex -= shift; + uxi <<= shift; + } break; } while (false); // end: if (ex > 0) { uxi -= 1 << 52; - uxi |= ex << 52; + uxi |= ex << 52; } else { uxi >>= -ex + 1; } x = reinterpret(uxi); if (sy) y = -y; - if (ex == ey || (ex + 1 == ey && (2.0 * x > y || (2.0 * x == y && (q & 1))))) { + var x2 = x + x; + if (ex == ey || (ex + 1 == ey && (x2 > y || (x2 == y && (q & 1))))) { x -= y; - ++q; + // ++q; } return sx ? -x : x; } } +/** @internal */ function Rf(z: f32): f32 { // Rational approximation of (asin(x)-x)/x^3 const // see: musl/src/math/asinf.c and SUN COPYRIGHT NOTICE above pS0 = reinterpret(0x3E2AAA75), // 1.6666586697e-01f @@ -1218,6 +1214,7 @@ function Rf(z: f32): f32 { // Rational approximation of (asin(x)-x)/x^3 return p / q; } +@inline /** @internal */ function expo2f(x: f32): f32 { // exp(x)/2 for x >= log(DBL_MAX) const // see: musl/src/math/__expo2f.c k = 235, @@ -1262,12 +1259,14 @@ export namespace NativeMathf { } var z: f32, w: f32, s: f32; if (hx >> 31) { - z = (1 + x) * 0.5; + // z = (1 + x) * 0.5; + z = 0.5 + x * 0.5; s = builtin_sqrt(z); w = Rf(z) * s - pio2_lo; return 2 * (pio2_hi - (s + w)); } - z = (1 - x) * 0.5; + // z = (1 - x) * 0.5; + z = 0.5 - x * 0.5; s = builtin_sqrt(z); hx = reinterpret(s); var df = reinterpret(hx & 0xFFFFF000); @@ -1280,7 +1279,10 @@ export namespace NativeMathf { const s = reinterpret(0x3F317218); // 0.693147180559945309417232121458176568f var u = reinterpret(x); var a = u & 0x7FFFFFFF; - if (a < 0x3F800000 + (1 << 23)) return log1p(x - 1 + builtin_sqrt((x - 1) * (x - 1) + 2 * (x - 1))); + if (a < 0x3F800000 + (1 << 23)) { + let xm1 = x - 1; + return log1p(xm1 + builtin_sqrt(xm1 * (xm1 + 2))); + } if (a < 0x3F800000 + (12 << 23)) return log(2 * x - 1 / (x + builtin_sqrt(x * x - 1))); return log(x) + s; } @@ -1289,34 +1291,31 @@ export namespace NativeMathf { const pio2 = reinterpret(0x3FC90FDB), // 1.570796326794896558e+00f Ox1p_120f = reinterpret(0x03800000); - var hx = reinterpret(x); - var ix = hx & 0x7FFFFFFF; - if (ix >= 0x3F800000) { - if (ix == 0x3F800000) return x * pio2 + Ox1p_120f; + var sx = x; + var hx = reinterpret(x) & 0x7FFFFFFF; + if (hx >= 0x3F800000) { + if (hx == 0x3F800000) return x * pio2 + Ox1p_120f; return 0 / (x - x); } - if (ix < 0x3F000000) { - if (ix < 0x39800000 && ix >= 0x00800000) return x; + if (hx < 0x3F000000) { + if (hx < 0x39800000 && hx >= 0x00800000) return x; return x + x * Rf(x * x); } - var z: f32 = (1 - builtin_abs(x)) * 0.5; + // var z: f32 = (1 - builtin_abs(x)) * 0.5; + var z: f32 = 0.5 - builtin_abs(x) * 0.5; var s = builtin_sqrt(z); // sic x = (pio2 - 2 * (s + s * Rf(z))); - if (hx >> 31) return -x; - return x; + return builtin_copysign(x, sx); } export function asinh(x: f32): f32 { // see: musl/src/math/asinhf.c const c = reinterpret(0x3F317218); // 0.693147180559945309417232121458176568f - var u = reinterpret(x); - var i = u & 0x7FFFFFFF; - var s = (u >> 31); - u = i; - x = reinterpret(u); - if (i >= 0x3F800000 + (12 << 23)) x = log(x) + c; - else if (i >= 0x3F800000 + (1 << 23)) x = log(2 * x + 1 / (builtin_sqrt(x * x + 1) + x)); - else if (i >= 0x3F800000 - (12 << 23)) x = log1p(x + x * x / (builtin_sqrt(x * x + 1) + 1)); - return s ? -x : x; + var u = reinterpret(x) & 0x7FFFFFFF; + var y = reinterpret(u); + if (u >= 0x3F800000 + (12 << 23)) y = log(y) + c; + else if (u >= 0x3F800000 + (1 << 23)) y = log(2 * y + 1 / (builtin_sqrt(y * y + 1) + y)); + else if (u >= 0x3F800000 - (12 << 23)) y = log1p(y + y * y / (builtin_sqrt(y * y + 1) + 1)); + return builtin_copysign(y, x); } export function atan(x: f32): f32 { // see: musl/src/math/atanf.c and SUN COPYRIGHT NOTICE above @@ -1336,13 +1335,13 @@ export namespace NativeMathf { aT4 = reinterpret(0x3D7CAC25), // 6.1687607318e-02f Ox1p_120f = reinterpret(0x03800000); var ix = reinterpret(x); - var sig = (ix >> 31); + var sx = x; ix &= 0x7FFFFFFF; var z: f32; if (ix >= 0x4C800000) { if (isNaN(x)) return x; z = atanhi3 + Ox1p_120f; - return sig ? -z : z; + return builtin_copysign(z, sx); } var id: i32; if (ix < 0x3EE00000) { @@ -1372,26 +1371,26 @@ export namespace NativeMathf { var w = z * z; var s1 = z * (aT0 + w * (aT2 + w * aT4)); var s2 = w * (aT1 + w * aT3); - if (id < 0) return x - x * (s1 + s2); + var s3 = x * (s1 + s2); + if (id < 0) return x - s3; switch (id) { - case 0: { z = atanhi0 - ((x * (s1 + s2) - atanlo0) - x); break; } - case 1: { z = atanhi1 - ((x * (s1 + s2) - atanlo1) - x); break; } - case 2: { z = atanhi2 - ((x * (s1 + s2) - atanlo2) - x); break; } - case 3: { z = atanhi3 - ((x * (s1 + s2) - atanlo3) - x); break; } + case 0: { z = atanhi0 - ((s3 - atanlo0) - x); break; } + case 1: { z = atanhi1 - ((s3 - atanlo1) - x); break; } + case 2: { z = atanhi2 - ((s3 - atanlo2) - x); break; } + case 3: { z = atanhi3 - ((s3 - atanlo3) - x); break; } default: unreachable(); } - return sig ? -z : z; + return builtin_copysign(z, sx); } export function atanh(x: f32): f32 { // see: musl/src/math/atanhf.c var u = reinterpret(x); - var s = (u >> 31); u &= 0x7FFFFFFF; var y = reinterpret(u); if (u < 0x3F800000 - (1 << 23)) { - if (u >= 0x3F800000 - (32 << 23)) y = 0.5 * log1p(2 * y + 2 * y * y / (1 - y)); + if (u >= 0x3F800000 - (32 << 23)) y = 0.5 * log1p(2 * y * (1.0 + y / (1 - y))); } else y = 0.5 * log1p(2 * (y / (1 - y))); - return s ? -y : y; + return builtin_copysign(y, x); } export function atan2(y: f32, x: f32): f32 { // see: musl/src/math/atan2f.c and SUN COPYRIGHT NOTICE above @@ -1463,12 +1462,12 @@ export namespace NativeMathf { } u &= 0x80000000; u |= hx; - var T = reinterpret(u); - var r = T * T * T; - T = T * (x + x + r) / (x + r + r); - r = T * T * T; - T = T * (x + x + r) / (x + r + r); - return T; + var t = reinterpret(u); + var r = t * t * t; + t = t * (x + x + r) / (x + r + r); + r = t * t * t; + t = t * (x + x + r) / (x + r + r); + return t; } @inline @@ -1493,11 +1492,13 @@ export namespace NativeMathf { if (u < 0x3F317217) { if (u < 0x3F800000 - (12 << 23)) return 1; let t = expm1(x); - return 1 + t * t / (2 * (1 + t)); + // return 1 + t * t / (2 * (1 + t)); + return 1 + t * t / (2 + 2 * t); } if (u < 0x42B17217) { let t = exp(x); - return 0.5 * (t + 1 / t); + // return 0.5 * (t + 1 / t); + return 0.5 * t + 0.5 / t; } return expo2f(x); } @@ -1519,11 +1520,14 @@ export namespace NativeMathf { var sign_ = (hx >> 31); hx &= 0x7FFFFFFF; if (hx >= 0x42AEAC50) { - if (hx >= 0x42B17218 && !sign_) { - x *= Ox1p127f; - return x; + if (hx >= 0x42B17218) { + if (!sign_) { + x *= Ox1p127f; + return x; + } else { + if (hx >= 0x42CFF1B5) return 0; + } } - if (sign_ && hx >= 0x42CFF1B5) return 0; } var hi: f32, lo: f32; var k: i32; @@ -1531,7 +1535,7 @@ export namespace NativeMathf { if (hx > 0x3F851592) { k = (invln2 * x + builtin_copysign(0.5, x)); } else { - k = 1 - sign_ - sign_; + k = 1 - (sign_ << 1); } hi = x - k * ln2hi; lo = k * ln2lo; @@ -1572,23 +1576,14 @@ export namespace NativeMathf { } var c: f32 = 0.0, t: f32, k: i32; if (hx > 0x3EB17218) { - let hi: f32, lo: f32; - if (hx < 0x3F851592) { - if (!sign_) { - hi = x - ln2_hi; - lo = ln2_lo; - k = 1; - } else { - hi = x + ln2_hi; - lo = -ln2_lo; - k = -1; - } - } else { - k = (invln2 * x + (sign_ ? -0.5 : 0.5)); - t = k; - hi = x - t * ln2_hi; - lo = t * ln2_lo; - } + k = select( + 1 - (sign_ << 1), + (invln2 * x + builtin_copysign(0.5, x)), + hx < 0x3F851592 + ); + t = k; + let hi = x - t * ln2_hi; + let lo = t * ln2_lo; x = hi - lo; c = (hi - x) - lo; } else if (hx < 0x33000000) { @@ -1617,9 +1612,10 @@ export namespace NativeMathf { return y - 1.0; } u = (0x7F - k) << 23; - if (k < 23) y = (x - e + (1 - reinterpret(u))) * twopk; - else y = (x - (e + reinterpret(u)) + 1) * twopk; - return y; + y = reinterpret(u); + if (k < 20) y = (1 - y) - e; + else y = 1 - (e + y); + return (x + y) * twopk; } @inline @@ -1646,11 +1642,11 @@ export namespace NativeMathf { if (ux >= 0xFF << 23 || uy == 0 || ux - uy >= 25 << 23) return x + y; var z: f32 = 1; if (ux >= (0x7F + 60) << 23) { - z = Ox1p90f; + z = Ox1p90f; x *= Ox1p_90f; y *= Ox1p_90f; } else if (uy < (0x7F - 60) << 23) { - z = Ox1p_90f; + z = Ox1p_90f; x *= Ox1p90f; y *= Ox1p90f; } @@ -1862,7 +1858,8 @@ export namespace NativeMathf { cp_l = reinterpret(0xB8F623C6), // -1.1736857402e-04 ivln2 = reinterpret(0x3FB8AA3B), // 1.4426950216e+00 ivln2_h = reinterpret(0x3FB8AA00), // 1.4426879883e+00 - ivln2_l = reinterpret(0x36ECA570); // 7.0526075433e-06 + ivln2_l = reinterpret(0x36ECA570), // 7.0526075433e-06 + inv3 = reinterpret(0x3EAAAAAB); // 0.333333333333 var hx = reinterpret(x); var hy = reinterpret(y); var ix = hx & 0x7FFFFFFF; @@ -1911,7 +1908,7 @@ export namespace NativeMathf { if (ix < 0x3F7FFFF8) return hy < 0 ? sn * huge * huge : sn * tiny * tiny; if (ix > 0x3F800007) return hy > 0 ? sn * huge * huge : sn * tiny * tiny; t = ax - 1; - w = (t * t) * (0.5 - t * (0.333333333333 - t * 0.25)); + w = (t * t) * (0.5 - t * (inv3 - t * 0.25)); u = ivln2_h * t; v = t * ivln2_l - w * ivln2; t1 = u + v; @@ -1937,7 +1934,7 @@ export namespace NativeMathf { ix -= 0x00800000; } ax = reinterpret(ix); - let bp = select(1.5, 1.0, k); + let bp = select(1.5, 1.0, k); // k ? 1.5 : 1.0 u = ax - bp; v = 1.0 / (ax + bp); s = u * v; @@ -1953,13 +1950,13 @@ export namespace NativeMathf { r += s_l * (s_h + s); s2 = s_h * s_h; t_h = 3.0 + s2 + r; - is = reinterpret(t_h); + is = reinterpret(t_h); t_h = reinterpret(is & 0xFFFFF000); t_l = r - ((t_h - 3.0) - s2); u = s_h * t_h; v = s_l * t_h + t_l * s; p_h = u + v; - is = reinterpret(p_h); + is = reinterpret(p_h); p_h = reinterpret(is & 0xFFFFF000); p_l = v - (p_h - u); let z_h = cp_h * p_h; @@ -2021,39 +2018,33 @@ export namespace NativeMathf { NativeMath.seedRandom(value); } + // Using xoroshiro64starstar from http://xoshiro.di.unimi.it/xoroshiro64starstar.c export function random(): f32 { - var f: f32; // FIXME: demoting from f64 to f32 might yield 1.0f - do f = NativeMath.random(); while (f == 1.0); - return f; + if (!random_seeded) throw new Error("PRNG must be seeded."); + + var s0 = random_state0_32; + var s1 = random_state1_32; + var r = rotl(s0 * 0x9E3779BB, 5) * 5; + + s1 ^= s0; + random_state0_32 = rotl(s0, 26) ^ s1 ^ (s1 << 9); + random_state1_32 = rotl(s1, 13); + + return reinterpret((r >> 9) | (127 << 23)) - 1.0; } - export function round(x: f32): f32 { // see: musl/src/math/roundf.c - const toint = 1.0 / f32.EPSILON; - var ux = reinterpret(x); - var e = (ux >> 23 & 0xFF); - if (e >= 0x7F + 23) return x; - if (e < 0x7F - 1) return 0 * x; - var y: f32; - if (ux >> 31) { - // FIXME: JS always rounds fractional 0.5 towards +Infinity - // and there certainly is a smarter way to do this. - y = toint - x - toint + x; - if (y >= 0.5) y = x - y + 1; - else if (y < -0.5) y = x - y - 1; - else y = x - y; - } else { - y = x + toint - toint - x; - if (y > 0.5) y = y + x - 1; - else if (y <= -0.5) y = y + x + 1; - else y = y + x; - } - return y; + @inline + export function round(x: f32): f32 { + return builtin_copysign(builtin_floor(x + 0.5), x); } @inline export function sign(x: f32): f32 { - // return x > 0 ? 1 : x < 0 ? -1 : x; - return builtin_abs(x) > 0 ? builtin_copysign(1, x) : x; + if (ASC_SHRINK_LEVEL > 0) { + return builtin_abs(x) > 0 ? builtin_copysign(1, x) : x; + } else { + return x > 0 ? 1 : x < 0 ? -1 : x; + } } export function sin(x: f32): f32 { // TODO @@ -2062,12 +2053,10 @@ export namespace NativeMathf { } export function sinh(x: f32): f32 { // see: musl/src/math/sinhf.c - var u = reinterpret(x); - var h: f32 = 0.5; - if (u >> 31) h = -h; - u &= 0x7FFFFFFF; + var u = reinterpret(x) & 0x7FFFFFFF; var absx = reinterpret(u); var t: f32; + var h = builtin_copysign(0.5, x); if (u < 0x42B17217) { t = expm1(absx); if (u < 0x3F800000) { @@ -2092,24 +2081,23 @@ export namespace NativeMathf { export function tanh(x: f32): f32 { // see: musl/src/math/tanhf.c var u = reinterpret(x); - var sig = u >> 31; u &= 0x7FFFFFFF; - x = reinterpret(u); + var y = reinterpret(u); var t: f32; if (u > 0x3F0C9F54) { - if (u > 0x41200000) t = 1 + 0 / x; + if (u > 0x41200000) t = 1 + 0 / y; else { - t = expm1(2 * x); + t = expm1(2 * y); t = 1 - 2 / (t + 2); } } else if (u > 0x3E82C578) { - t = expm1(2 * x); + t = expm1(2 * y); t = t / (t + 2); } else if (u >= 0x00800000) { - t = expm1(-2 * x); + t = expm1(-2 * y); t = -t / (t + 2); - } else t = x; - return sig ? -t : t; + } else t = y; + return builtin_copysign(t, x); } @inline @@ -2118,8 +2106,9 @@ export namespace NativeMathf { } /** @internal */ - export function scalbn(x: f32, n: i32): f32 { // see: musl/src/math/scalbnf.c + export function scalbn(x: f32, n: i32): f32 { // see: https://git.musl-libc.org/cgit/musl/tree/src/math/scalbnf.c const + Ox1p24f = reinterpret(0x4B800000), Ox1p127f = reinterpret(0x7F000000), Ox1p_126f = reinterpret(0x00800000); var y = x; @@ -2128,16 +2117,14 @@ export namespace NativeMathf { n -= 127; if (n > 127) { y *= Ox1p127f; - n -= 127; - if (n > 127) n = 127; + n = builtin_min(n - 127, 127); } } else if (n < -126) { - y *= Ox1p_126f; - n += 126; + y *= Ox1p_126f * Ox1p24f; + n += 126 - 24; if (n < -126) { - y *= Ox1p_126f; - n += 126; - if (n < -126) n = -126; + y *= Ox1p_126f * Ox1p24f; + n = builtin_max(n + 126 - 24, -126); } } return y * reinterpret((0x7F + n) << 23); @@ -2149,26 +2136,28 @@ export namespace NativeMathf { var ex = (ux >> 23 & 0xFF); var ey = (uy >> 23 & 0xFF); var sx = ux & 0x80000000; - if (uy << 1 == 0 || isNaN(y) || ex == 0xFF) return (x * y) / (x * y); - if (ux << 1 <= uy << 1) { - if (ux << 1 == uy << 1) return 0 * x; + var uy1 = uy << 1; + if (uy1 == 0 || ex == 0xFF || isNaN(y)) return (x * y) / (x * y); + var ux1 = ux << 1; + if (ux1 <= uy1) { + if (ux1 == uy1) return 0 * x; return x; } - var i: u32; if (!ex) { - for (i = ux << 9; !(i >> 31); i <<= 1) --ex; + ex -= builtin_clz(ux << 9); ux <<= -ex + 1; } else { ux &= -1 >> 9; ux |= 1 << 23; } if (!ey) { - for (i = uy << 9; !(i >> 31); i <<= 1) --ey; + ey -= builtin_clz(uy << 9); uy <<= -ey + 1; } else { uy &= -1 >> 9; uy |= 1 << 23; } + var i: u32; for (; ex > ey; --ex) { i = ux - uy; if (!(i >> 31)) { @@ -2182,7 +2171,10 @@ export namespace NativeMathf { if (!i) return 0 * x; ux = i; } - for (; !(ux >> 23); ux <<= 1) --ex; + // for (; !(ux >> 23); ux <<= 1) --ex; + var shift = builtin_clz(ux << 8); + ex -= shift; + ux <<= shift; if (ex > 0) { ux -= 1 << 23; ux |= ex << 23; @@ -2200,19 +2192,18 @@ export namespace NativeMathf { var ey = (uy >> 23 & 0xFF); var sx = (ux >> 31); var sy = (uy >> 31); - var i: u32; var uxi = ux; - if (uy << 1 == 0 || isNaN(y) || ex == 0xFF) return (x * y) / (x * y); + if (uy << 1 == 0 || ex == 0xFF || isNaN(y)) return (x * y) / (x * y); if (ux << 1 == 0) return x; if (!ex) { - for (i = uxi << 9; i >> 31 == 0; ex--, i <<= 1) {} + ex -= builtin_clz(uxi << 9); uxi <<= -ex + 1; } else { uxi &= -1 >> 9; uxi |= 1 << 23; } if (!ey) { - for (i = uy << 9; i >> 31 == 0; ey--, i <<= 1) {} + ey -= builtin_clz(uy << 9); uy <<= -ey + 1; } else { uy &= -1 >> 9; @@ -2224,6 +2215,7 @@ export namespace NativeMathf { if (ex + 1 == ey) break; // goto end return x; } + let i: u32; for (; ex > ey; ex--) { i = uxi - uy; if (i >> 31 == 0) { @@ -2239,7 +2231,11 @@ export namespace NativeMathf { q++; } if (uxi == 0) ex = -30; - else for (; uxi >> 23 == 0; uxi <<= 1, ex--) {} + else { + let shift = builtin_clz(uxi << 8); + ex -= shift; + uxi <<= shift; + } break; } while (false); // end diff --git a/tests/compiler/binary.optimized.wat b/tests/compiler/binary.optimized.wat index eb407656..8628b4ba 100644 --- a/tests/compiler/binary.optimized.wat +++ b/tests/compiler/binary.optimized.wat @@ -100,19 +100,14 @@ (local $4 i32) (block $folding-inner0 (set_local $3 - (i32.eq - (tee_local $2 - (i32.and - (i32.shr_u - (tee_local $1 - (i32.reinterpret/f32 - (get_local $0) - ) - ) - (i32.const 23) + (i32.and + (i32.shr_u + (tee_local $1 + (i32.reinterpret/f32 + (get_local $0) ) - (i32.const 255) ) + (i32.const 23) ) (i32.const 255) ) @@ -123,9 +118,22 @@ (i32.const -2147483648) ) ) + (if + (i32.eqz + (tee_local $2 + (i32.eq + (get_local $3) + (i32.const 255) + ) + ) + ) + (set_local $2 + (i32.const 0) + ) + ) (if (i32.and - (get_local $3) + (get_local $2) (i32.const 1) ) (return @@ -137,19 +145,18 @@ ) (if (i32.le_u - (i32.shl - (get_local $1) - (i32.const 1) + (tee_local $2 + (i32.shl + (get_local $1) + (i32.const 1) + ) ) (i32.const 2130706432) ) (block (br_if $folding-inner0 (i32.eq - (i32.shl - (get_local $1) - (i32.const 1) - ) + (get_local $2) (i32.const 2130706432) ) ) @@ -160,7 +167,7 @@ ) (set_local $1 (if (result i32) - (get_local $2) + (get_local $3) (i32.or (i32.and (get_local $1) @@ -168,58 +175,37 @@ ) (i32.const 8388608) ) - (block (result i32) - (block $break|0 - (set_local $3 - (i32.shl - (get_local $1) - (i32.const 9) - ) - ) - (loop $repeat|0 - (br_if $break|0 - (i32.shr_u - (get_local $3) - (i32.const 31) + (i32.shl + (get_local $1) + (i32.sub + (i32.const 1) + (tee_local $3 + (i32.sub + (get_local $3) + (i32.clz + (i32.shl + (get_local $1) + (i32.const 9) + ) ) ) - (set_local $2 - (i32.sub - (get_local $2) - (i32.const 1) - ) - ) - (set_local $3 - (i32.shl - (get_local $3) - (i32.const 1) - ) - ) - (br $repeat|0) - ) - ) - (i32.shl - (get_local $1) - (i32.sub - (i32.const 1) - (get_local $2) ) ) ) ) ) - (block $break|2 - (loop $repeat|2 - (br_if $break|2 + (block $break|0 + (loop $repeat|0 + (br_if $break|0 (i32.le_s - (get_local $2) + (get_local $3) (i32.const 127) ) ) (if (i32.eqz (i32.shr_u - (tee_local $3 + (tee_local $2 (i32.sub (get_local $1) (i32.const 8388608) @@ -231,11 +217,11 @@ (block (br_if $folding-inner0 (i32.eqz - (get_local $3) + (get_local $2) ) ) (set_local $1 - (get_local $3) + (get_local $2) ) ) ) @@ -245,19 +231,19 @@ (i32.const 1) ) ) - (set_local $2 + (set_local $3 (i32.sub - (get_local $2) + (get_local $3) (i32.const 1) ) ) - (br $repeat|2) + (br $repeat|0) ) ) (if (i32.eqz (i32.shr_u - (tee_local $3 + (tee_local $2 (i32.sub (get_local $1) (i32.const 8388608) @@ -269,35 +255,25 @@ (block (br_if $folding-inner0 (i32.eqz - (get_local $3) + (get_local $2) ) ) (set_local $1 - (get_local $3) + (get_local $2) ) ) ) - (block $break|3 - (loop $repeat|3 - (br_if $break|3 - (i32.shr_u - (get_local $1) - (i32.const 23) + (set_local $1 + (i32.shl + (get_local $1) + (tee_local $2 + (i32.clz + (i32.shl + (get_local $1) + (i32.const 8) + ) ) ) - (set_local $2 - (i32.sub - (get_local $2) - (i32.const 1) - ) - ) - (set_local $1 - (i32.shl - (get_local $1) - (i32.const 1) - ) - ) - (br $repeat|3) ) ) (return @@ -306,7 +282,12 @@ (tee_local $1 (if (result i32) (i32.gt_s - (get_local $2) + (tee_local $3 + (i32.sub + (get_local $3) + (get_local $2) + ) + ) (i32.const 0) ) (i32.or @@ -315,7 +296,7 @@ (i32.const 8388608) ) (i32.shl - (get_local $2) + (get_local $3) (i32.const 23) ) ) @@ -323,7 +304,7 @@ (get_local $1) (i32.sub (i32.const 1) - (get_local $2) + (get_local $3) ) ) ) @@ -376,38 +357,45 @@ ) (func $~lib/math/NativeMath.mod (; 3 ;) (; has Stack IR ;) (type $FUNCSIG$dd) (param $0 f64) (result f64) (local $1 i64) - (local $2 i32) + (local $2 i64) (local $3 i64) (local $4 i32) + (local $5 i64) (block $folding-inner0 (set_local $2 - (i32.wrap/i64 - (i64.and - (i64.shr_u - (tee_local $1 - (i64.reinterpret/f64 - (get_local $0) - ) + (i64.and + (i64.shr_u + (tee_local $1 + (i64.reinterpret/f64 + (get_local $0) ) - (i64.const 52) ) - (i64.const 2047) + (i64.const 52) ) + (i64.const 2047) ) ) - (set_local $4 - (i32.wrap/i64 - (i64.shr_u - (get_local $1) - (i64.const 63) - ) + (set_local $5 + (i64.shr_u + (get_local $1) + (i64.const 63) ) ) (if - (i32.eq - (get_local $2) - (i32.const 2047) + (i32.eqz + (tee_local $4 + (i64.eq + (get_local $2) + (i64.const 2047) + ) + ) ) + (set_local $4 + (i32.const 0) + ) + ) + (if + (get_local $4) (return (f64.div (get_local $0) @@ -417,19 +405,18 @@ ) (if (i64.le_u - (i64.shl - (get_local $1) - (i64.const 1) + (tee_local $3 + (i64.shl + (get_local $1) + (i64.const 1) + ) ) (i64.const 9214364837600034816) ) (block (br_if $folding-inner0 (i64.eq - (i64.shl - (get_local $1) - (i64.const 1) - ) + (get_local $3) (i64.const 9214364837600034816) ) ) @@ -440,7 +427,29 @@ ) (set_local $1 (if (result i64) - (get_local $2) + (i64.eqz + (get_local $2) + ) + (i64.shl + (get_local $1) + (i64.add + (i64.sub + (i64.const 0) + (tee_local $2 + (i64.sub + (get_local $2) + (i64.clz + (i64.shl + (get_local $1) + (i64.const 12) + ) + ) + ) + ) + ) + (i64.const 1) + ) + ) (i64.or (i64.and (get_local $1) @@ -448,58 +457,14 @@ ) (i64.const 4503599627370496) ) - (block (result i64) - (block $break|0 - (set_local $3 - (i64.shl - (get_local $1) - (i64.const 12) - ) - ) - (loop $repeat|0 - (br_if $break|0 - (i32.eqz - (i64.eqz - (i64.shr_u - (get_local $3) - (i64.const 63) - ) - ) - ) - ) - (set_local $2 - (i32.sub - (get_local $2) - (i32.const 1) - ) - ) - (set_local $3 - (i64.shl - (get_local $3) - (i64.const 1) - ) - ) - (br $repeat|0) - ) - ) - (i64.shl - (get_local $1) - (i64.extend_s/i32 - (i32.sub - (i32.const 1) - (get_local $2) - ) - ) - ) - ) ) ) - (block $break|2 - (loop $repeat|2 - (br_if $break|2 - (i32.le_s + (block $break|0 + (loop $repeat|0 + (br_if $break|0 + (i64.le_s (get_local $2) - (i32.const 1023) + (i64.const 1023) ) ) (if @@ -532,12 +497,12 @@ ) ) (set_local $2 - (i32.sub + (i64.sub (get_local $2) - (i32.const 1) + (i64.const 1) ) ) - (br $repeat|2) + (br $repeat|0) ) ) (if @@ -563,31 +528,17 @@ ) ) ) - (block $break|3 - (loop $repeat|3 - (br_if $break|3 - (i32.eqz - (i64.eqz - (i64.shr_u - (get_local $1) - (i64.const 52) - ) + (set_local $1 + (i64.shl + (get_local $1) + (tee_local $3 + (i64.clz + (i64.shl + (get_local $1) + (i64.const 11) ) ) ) - (set_local $2 - (i32.sub - (get_local $2) - (i32.const 1) - ) - ) - (set_local $1 - (i64.shl - (get_local $1) - (i64.const 1) - ) - ) - (br $repeat|3) ) ) (return @@ -595,9 +546,14 @@ (i64.or (tee_local $1 (if (result i64) - (i32.gt_s - (get_local $2) - (i32.const 0) + (i64.gt_s + (tee_local $2 + (i64.sub + (get_local $2) + (get_local $3) + ) + ) + (i64.const 0) ) (i64.or (i64.sub @@ -605,27 +561,24 @@ (i64.const 4503599627370496) ) (i64.shl - (i64.extend_s/i32 - (get_local $2) - ) + (get_local $2) (i64.const 52) ) ) (i64.shr_u (get_local $1) - (i64.extend_s/i32 - (i32.sub - (i32.const 1) + (i64.add + (i64.sub + (i64.const 0) (get_local $2) ) + (i64.const 1) ) ) ) ) (i64.shl - (i64.extend_s/i32 - (get_local $4) - ) + (get_local $5) (i64.const 63) ) ) diff --git a/tests/compiler/binary.untouched.wat b/tests/compiler/binary.untouched.wat index acf643a6..b628b60c 100644 --- a/tests/compiler/binary.untouched.wat +++ b/tests/compiler/binary.untouched.wat @@ -19,6 +19,8 @@ (start $start) (func $~lib/math/NativeMath.scalbn (; 0 ;) (type $FiF) (param $0 f64) (param $1 i32) (result f64) (local $2 f64) + (local $3 i32) + (local $4 i32) (set_local $2 (get_local $0) ) @@ -53,18 +55,20 @@ ) ) (set_local $1 - (i32.sub - (get_local $1) - (i32.const 1023) - ) - ) - (if - (i32.gt_s - (get_local $1) - (i32.const 1023) - ) - (set_local $1 - (i32.const 1023) + (select + (tee_local $3 + (i32.sub + (get_local $1) + (i32.const 1023) + ) + ) + (tee_local $4 + (i32.const 1023) + ) + (i32.lt_s + (get_local $3) + (get_local $4) + ) ) ) ) @@ -79,13 +83,19 @@ (set_local $2 (f64.mul (get_local $2) - (f64.const 2.2250738585072014e-308) + (f64.mul + (f64.const 2.2250738585072014e-308) + (f64.const 9007199254740992) + ) ) ) (set_local $1 (i32.add (get_local $1) - (i32.const 1022) + (i32.sub + (i32.const 1022) + (i32.const 53) + ) ) ) (if @@ -97,22 +107,30 @@ (set_local $2 (f64.mul (get_local $2) - (f64.const 2.2250738585072014e-308) + (f64.mul + (f64.const 2.2250738585072014e-308) + (f64.const 9007199254740992) + ) ) ) (set_local $1 - (i32.add - (get_local $1) - (i32.const 1022) - ) - ) - (if - (i32.lt_s - (get_local $1) - (i32.const -1022) - ) - (set_local $1 - (i32.const -1022) + (select + (tee_local $3 + (i32.sub + (i32.add + (get_local $1) + (i32.const 1022) + ) + (i32.const 53) + ) + ) + (tee_local $4 + (i32.const -1022) + ) + (i32.gt_s + (get_local $3) + (get_local $4) + ) ) ) ) @@ -146,8 +164,8 @@ (local $9 i32) (local $10 i32) (local $11 i32) - (local $12 f64) - (local $13 f64) + (local $12 i32) + (local $13 i32) (local $14 f64) (local $15 f64) (local $16 f64) @@ -158,10 +176,10 @@ (local $21 f64) (local $22 f64) (local $23 f64) - (local $24 i32) - (local $25 i32) - (local $26 f64) - (local $27 f64) + (local $24 f64) + (local $25 f64) + (local $26 i32) + (local $27 i32) (local $28 f64) (local $29 f64) (local $30 f64) @@ -172,7 +190,9 @@ (local $35 f64) (local $36 f64) (local $37 f64) - (local $38 i32) + (local $38 f64) + (local $39 f64) + (local $40 i32) (set_local $2 (i64.reinterpret/f64 (get_local $0) @@ -321,78 +341,49 @@ (i32.const 1023) ) ) - (if - (i32.gt_s + (set_local $9 + (i32.sub + (select + (i32.const 52) + (i32.const 20) + (i32.gt_s + (get_local $11) + (i32.const 20) + ) + ) (get_local $11) - (i32.const 20) ) - (block - (set_local $9 - (i32.shr_u - (get_local $6) - (i32.sub - (i32.const 52) - (get_local $11) - ) - ) - ) - (if - (i32.eq - (i32.shl - (get_local $9) - (i32.sub - (i32.const 52) - (get_local $11) - ) - ) - (get_local $6) - ) - (set_local $10 - (i32.sub - (i32.const 2) - (i32.and - (get_local $9) - (i32.const 1) - ) - ) - ) + ) + (set_local $12 + (select + (get_local $6) + (get_local $8) + (i32.gt_s + (get_local $11) + (i32.const 20) ) ) - (if - (i32.eq - (get_local $6) - (i32.const 0) + ) + (set_local $13 + (i32.shr_s + (get_local $12) + (get_local $9) + ) + ) + (if + (i32.eq + (i32.shl + (get_local $13) + (get_local $9) ) - (block - (set_local $9 - (i32.shr_s - (get_local $8) - (i32.sub - (i32.const 20) - (get_local $11) - ) - ) - ) - (if - (i32.eq - (i32.shl - (get_local $9) - (i32.sub - (i32.const 20) - (get_local $11) - ) - ) - (get_local $8) - ) - (set_local $10 - (i32.sub - (i32.const 2) - (i32.and - (get_local $9) - (i32.const 1) - ) - ) - ) + (get_local $12) + ) + (set_local $10 + (i32.sub + (i32.const 2) + (i32.and + (get_local $13) + (i32.const 1) ) ) ) @@ -513,7 +504,7 @@ ) ) ) - (set_local $12 + (set_local $14 (f64.abs (get_local $0) ) @@ -525,40 +516,40 @@ ) (if (if (result i32) - (tee_local $9 + (tee_local $13 (if (result i32) - (tee_local $9 + (tee_local $13 (i32.eq (get_local $7) (i32.const 2146435072) ) ) - (get_local $9) + (get_local $13) (i32.eq (get_local $7) (i32.const 0) ) ) ) - (get_local $9) + (get_local $13) (i32.eq (get_local $7) (i32.const 1072693248) ) ) (block - (set_local $13 - (get_local $12) + (set_local $15 + (get_local $14) ) (if (i32.lt_s (get_local $5) (i32.const 0) ) - (set_local $13 + (set_local $15 (f64.div (f64.const 1) - (get_local $13) + (get_local $15) ) ) ) @@ -578,15 +569,15 @@ ) (i32.const 0) ) - (set_local $13 + (set_local $15 (f64.div (f64.sub - (get_local $13) - (get_local $13) + (get_local $15) + (get_local $15) ) (f64.sub - (get_local $13) - (get_local $13) + (get_local $15) + (get_local $15) ) ) ) @@ -595,21 +586,21 @@ (get_local $10) (i32.const 1) ) - (set_local $13 + (set_local $15 (f64.neg - (get_local $13) + (get_local $15) ) ) ) ) ) (return - (get_local $13) + (get_local $15) ) ) ) ) - (set_local $14 + (set_local $16 (f64.const 1) ) (if @@ -641,7 +632,7 @@ (get_local $10) (i32.const 1) ) - (set_local $14 + (set_local $16 (f64.const -1) ) ) @@ -718,14 +709,14 @@ ) (f64.mul (f64.mul - (get_local $14) + (get_local $16) (f64.const 1.e+300) ) (f64.const 1.e+300) ) (f64.mul (f64.mul - (get_local $14) + (get_local $16) (f64.const 1e-300) ) (f64.const 1e-300) @@ -746,14 +737,14 @@ ) (f64.mul (f64.mul - (get_local $14) + (get_local $16) (f64.const 1.e+300) ) (f64.const 1.e+300) ) (f64.mul (f64.mul - (get_local $14) + (get_local $16) (f64.const 1e-300) ) (f64.const 1e-300) @@ -761,26 +752,26 @@ ) ) ) - (set_local $20 + (set_local $22 (f64.sub - (get_local $12) + (get_local $14) (f64.const 1) ) ) - (set_local $23 + (set_local $25 (f64.mul (f64.mul - (get_local $20) - (get_local $20) + (get_local $22) + (get_local $22) ) (f64.sub (f64.const 0.5) (f64.mul - (get_local $20) + (get_local $22) (f64.sub (f64.const 0.3333333333333333) (f64.mul - (get_local $20) + (get_local $22) (f64.const 0.25) ) ) @@ -788,52 +779,52 @@ ) ) ) - (set_local $21 + (set_local $23 (f64.mul (f64.const 1.4426950216293335) - (get_local $20) + (get_local $22) ) ) - (set_local $22 + (set_local $24 (f64.sub (f64.mul - (get_local $20) + (get_local $22) (f64.const 1.9259629911266175e-08) ) (f64.mul - (get_local $23) + (get_local $25) (f64.const 1.4426950408889634) ) ) ) - (set_local $15 + (set_local $17 (f64.add - (get_local $21) - (get_local $22) + (get_local $23) + (get_local $24) ) ) - (set_local $15 + (set_local $17 (f64.reinterpret/i64 (i64.and (i64.reinterpret/f64 - (get_local $15) + (get_local $17) ) (i64.const -4294967296) ) ) ) - (set_local $16 + (set_local $18 (f64.sub - (get_local $22) + (get_local $24) (f64.sub - (get_local $15) - (get_local $21) + (get_local $17) + (get_local $23) ) ) ) ) (block - (set_local $25 + (set_local $27 (i32.const 0) ) (if @@ -842,15 +833,15 @@ (i32.const 1048576) ) (block - (set_local $12 + (set_local $14 (f64.mul - (get_local $12) + (get_local $14) (f64.const 9007199254740992) ) ) - (set_local $25 + (set_local $27 (i32.sub - (get_local $25) + (get_local $27) (i32.const 53) ) ) @@ -858,7 +849,7 @@ (i32.wrap/i64 (i64.shr_u (i64.reinterpret/f64 - (get_local $12) + (get_local $14) ) (i64.const 32) ) @@ -866,9 +857,9 @@ ) ) ) - (set_local $25 + (set_local $27 (i32.add - (get_local $25) + (get_local $27) (i32.sub (i32.shr_s (get_local $7) @@ -878,7 +869,7 @@ ) ) ) - (set_local $24 + (set_local $26 (i32.and (get_local $7) (i32.const 1048575) @@ -886,13 +877,13 @@ ) (set_local $7 (i32.or - (get_local $24) + (get_local $26) (i32.const 1072693248) ) ) (if (i32.le_s - (get_local $24) + (get_local $26) (i32.const 235662) ) (set_local $11 @@ -900,7 +891,7 @@ ) (if (i32.lt_s - (get_local $24) + (get_local $26) (i32.const 767610) ) (set_local $11 @@ -910,9 +901,9 @@ (set_local $11 (i32.const 0) ) - (set_local $25 + (set_local $27 (i32.add - (get_local $25) + (get_local $27) (i32.const 1) ) ) @@ -925,12 +916,12 @@ ) ) ) - (set_local $12 + (set_local $14 (f64.reinterpret/i64 (i64.or (i64.and (i64.reinterpret/f64 - (get_local $12) + (get_local $14) ) (i64.const 4294967295) ) @@ -943,48 +934,48 @@ ) ) ) - (set_local $32 + (set_local $34 (select (f64.const 1.5) (f64.const 1) (get_local $11) ) ) - (set_local $21 + (set_local $23 (f64.sub - (get_local $12) - (get_local $32) + (get_local $14) + (get_local $34) ) ) - (set_local $22 + (set_local $24 (f64.div (f64.const 1) (f64.add - (get_local $12) - (get_local $32) + (get_local $14) + (get_local $34) ) ) ) - (set_local $26 + (set_local $28 (f64.mul - (get_local $21) - (get_local $22) + (get_local $23) + (get_local $24) ) ) - (set_local $28 - (get_local $26) + (set_local $30 + (get_local $28) ) - (set_local $28 + (set_local $30 (f64.reinterpret/i64 (i64.and (i64.reinterpret/f64 - (get_local $28) + (get_local $30) ) (i64.const -4294967296) ) ) ) - (set_local $30 + (set_local $32 (f64.reinterpret/i64 (i64.shl (i64.extend_s/i32 @@ -1009,65 +1000,65 @@ ) ) ) - (set_local $31 + (set_local $33 (f64.sub - (get_local $12) + (get_local $14) (f64.sub - (get_local $30) (get_local $32) + (get_local $34) + ) + ) + ) + (set_local $31 + (f64.mul + (get_local $24) + (f64.sub + (f64.sub + (get_local $23) + (f64.mul + (get_local $30) + (get_local $32) + ) + ) + (f64.mul + (get_local $30) + (get_local $33) + ) ) ) ) (set_local $29 (f64.mul - (get_local $22) - (f64.sub - (f64.sub - (get_local $21) - (f64.mul - (get_local $28) - (get_local $30) - ) - ) - (f64.mul - (get_local $28) - (get_local $31) - ) - ) + (get_local $28) + (get_local $28) ) ) - (set_local $27 - (f64.mul - (get_local $26) - (get_local $26) - ) - ) - (set_local $19 + (set_local $21 (f64.mul (f64.mul - (get_local $27) - (get_local $27) + (get_local $29) + (get_local $29) ) (f64.add (f64.const 0.5999999999999946) (f64.mul - (get_local $27) + (get_local $29) (f64.add (f64.const 0.4285714285785502) (f64.mul - (get_local $27) + (get_local $29) (f64.add (f64.const 0.33333332981837743) (f64.mul - (get_local $27) + (get_local $29) (f64.add (f64.const 0.272728123808534) (f64.mul - (get_local $27) + (get_local $29) (f64.add (f64.const 0.23066074577556175) (f64.mul - (get_local $27) + (get_local $29) (f64.const 0.20697501780033842) ) ) @@ -1081,76 +1072,147 @@ ) ) ) - (set_local $19 + (set_local $21 (f64.add - (get_local $19) + (get_local $21) (f64.mul - (get_local $29) + (get_local $31) (f64.add + (get_local $30) (get_local $28) - (get_local $26) ) ) ) ) - (set_local $27 + (set_local $29 (f64.mul - (get_local $28) - (get_local $28) + (get_local $30) + (get_local $30) ) ) - (set_local $30 + (set_local $32 (f64.add (f64.add (f64.const 3) - (get_local $27) + (get_local $29) ) - (get_local $19) + (get_local $21) ) ) - (set_local $30 + (set_local $32 (f64.reinterpret/i64 (i64.and (i64.reinterpret/f64 - (get_local $30) + (get_local $32) ) (i64.const -4294967296) ) ) ) - (set_local $31 + (set_local $33 (f64.sub - (get_local $19) + (get_local $21) (f64.sub (f64.sub - (get_local $30) + (get_local $32) (f64.const 3) ) - (get_local $27) + (get_local $29) ) ) ) - (set_local $21 + (set_local $23 (f64.mul - (get_local $28) (get_local $30) + (get_local $32) + ) + ) + (set_local $24 + (f64.add + (f64.mul + (get_local $31) + (get_local $32) + ) + (f64.mul + (get_local $33) + (get_local $28) + ) + ) + ) + (set_local $19 + (f64.add + (get_local $23) + (get_local $24) + ) + ) + (set_local $19 + (f64.reinterpret/i64 + (i64.and + (i64.reinterpret/f64 + (get_local $19) + ) + (i64.const -4294967296) + ) + ) + ) + (set_local $20 + (f64.sub + (get_local $24) + (f64.sub + (get_local $19) + (get_local $23) + ) + ) + ) + (set_local $35 + (f64.mul + (f64.const 0.9617967009544373) + (get_local $19) + ) + ) + (set_local $36 + (select + (f64.const 1.350039202129749e-08) + (f64.const 0) + (get_local $11) + ) + ) + (set_local $37 + (f64.add + (f64.add + (f64.mul + (f64.const -7.028461650952758e-09) + (get_local $19) + ) + (f64.mul + (get_local $20) + (f64.const 0.9617966939259756) + ) + ) + (get_local $36) ) ) (set_local $22 - (f64.add - (f64.mul - (get_local $29) - (get_local $30) - ) - (f64.mul - (get_local $31) - (get_local $26) - ) + (f64.convert_s/i32 + (get_local $27) + ) + ) + (set_local $38 + (select + (f64.const 0.5849624872207642) + (f64.const 0) + (get_local $11) ) ) (set_local $17 (f64.add - (get_local $21) + (f64.add + (f64.add + (get_local $35) + (get_local $37) + ) + (get_local $38) + ) (get_local $22) ) ) @@ -1166,138 +1228,67 @@ ) (set_local $18 (f64.sub - (get_local $22) - (f64.sub - (get_local $17) - (get_local $21) - ) - ) - ) - (set_local $33 - (f64.mul - (f64.const 0.9617967009544373) - (get_local $17) - ) - ) - (set_local $34 - (select - (f64.const 1.350039202129749e-08) - (f64.const 0) - (get_local $11) - ) - ) - (set_local $35 - (f64.add - (f64.add - (f64.mul - (f64.const -7.028461650952758e-09) - (get_local $17) - ) - (f64.mul - (get_local $18) - (f64.const 0.9617966939259756) - ) - ) - (get_local $34) - ) - ) - (set_local $20 - (f64.convert_s/i32 - (get_local $25) - ) - ) - (set_local $36 - (select - (f64.const 0.5849624872207642) - (f64.const 0) - (get_local $11) - ) - ) - (set_local $15 - (f64.add - (f64.add - (f64.add - (get_local $33) - (get_local $35) - ) - (get_local $36) - ) - (get_local $20) - ) - ) - (set_local $15 - (f64.reinterpret/i64 - (i64.and - (i64.reinterpret/f64 - (get_local $15) - ) - (i64.const -4294967296) - ) - ) - ) - (set_local $16 - (f64.sub - (get_local $35) + (get_local $37) (f64.sub (f64.sub (f64.sub - (get_local $15) - (get_local $20) + (get_local $17) + (get_local $22) ) - (get_local $36) + (get_local $38) ) - (get_local $33) + (get_local $35) ) ) ) ) ) - (set_local $37 + (set_local $39 (get_local $1) ) - (set_local $37 + (set_local $39 (f64.reinterpret/i64 (i64.and (i64.reinterpret/f64 - (get_local $37) + (get_local $39) ) (i64.const -4294967296) ) ) ) - (set_local $18 + (set_local $20 (f64.add (f64.mul (f64.sub (get_local $1) - (get_local $37) + (get_local $39) ) - (get_local $15) + (get_local $17) ) (f64.mul (get_local $1) - (get_local $16) + (get_local $18) ) ) ) - (set_local $17 + (set_local $19 (f64.mul - (get_local $37) - (get_local $15) + (get_local $39) + (get_local $17) ) ) - (set_local $13 + (set_local $15 (f64.add - (get_local $18) - (get_local $17) + (get_local $20) + (get_local $19) ) ) (set_local $2 (i64.reinterpret/f64 - (get_local $13) + (get_local $15) ) ) - (set_local $24 + (set_local $26 (i32.wrap/i64 (i64.shr_u (get_local $2) @@ -1305,14 +1296,14 @@ ) ) ) - (set_local $38 + (set_local $40 (i32.wrap/i64 (get_local $2) ) ) (if (i32.ge_s - (get_local $24) + (get_local $26) (i32.const 1083179008) ) (block @@ -1320,17 +1311,17 @@ (i32.ne (i32.or (i32.sub - (get_local $24) + (get_local $26) (i32.const 1083179008) ) - (get_local $38) + (get_local $40) ) (i32.const 0) ) (return (f64.mul (f64.mul - (get_local $14) + (get_local $16) (f64.const 1.e+300) ) (f64.const 1.e+300) @@ -1340,18 +1331,18 @@ (if (f64.gt (f64.add - (get_local $18) + (get_local $20) (f64.const 8.008566259537294e-17) ) (f64.sub - (get_local $13) - (get_local $17) + (get_local $15) + (get_local $19) ) ) (return (f64.mul (f64.mul - (get_local $14) + (get_local $16) (f64.const 1.e+300) ) (f64.const 1.e+300) @@ -1362,7 +1353,7 @@ (if (i32.ge_s (i32.and - (get_local $24) + (get_local $26) (i32.const 2147483647) ) (i32.const 1083231232) @@ -1372,17 +1363,17 @@ (i32.ne (i32.or (i32.sub - (get_local $24) + (get_local $26) (i32.const -1064252416) ) - (get_local $38) + (get_local $40) ) (i32.const 0) ) (return (f64.mul (f64.mul - (get_local $14) + (get_local $16) (f64.const 1e-300) ) (f64.const 1e-300) @@ -1391,16 +1382,16 @@ ) (if (f64.le - (get_local $18) + (get_local $20) (f64.sub - (get_local $13) - (get_local $17) + (get_local $15) + (get_local $19) ) ) (return (f64.mul (f64.mul - (get_local $14) + (get_local $16) (f64.const 1e-300) ) (f64.const 1e-300) @@ -1410,33 +1401,33 @@ ) ) ) - (set_local $38 + (set_local $40 (i32.and - (get_local $24) + (get_local $26) (i32.const 2147483647) ) ) (set_local $11 (i32.sub (i32.shr_s - (get_local $38) + (get_local $40) (i32.const 20) ) (i32.const 1023) ) ) - (set_local $25 + (set_local $27 (i32.const 0) ) (if (i32.gt_s - (get_local $38) + (get_local $40) (i32.const 1071644672) ) (block - (set_local $25 + (set_local $27 (i32.add - (get_local $24) + (get_local $26) (i32.shr_s (i32.const 1048576) (i32.add @@ -1450,7 +1441,7 @@ (i32.sub (i32.shr_s (i32.and - (get_local $25) + (get_local $27) (i32.const 2147483647) ) (i32.const 20) @@ -1458,15 +1449,15 @@ (i32.const 1023) ) ) - (set_local $20 + (set_local $22 (f64.const 0) ) - (set_local $20 + (set_local $22 (f64.reinterpret/i64 (i64.shl (i64.extend_s/i32 (i32.and - (get_local $25) + (get_local $27) (i32.xor (i32.shr_s (i32.const 1048575) @@ -1480,11 +1471,11 @@ ) ) ) - (set_local $25 + (set_local $27 (i32.shr_s (i32.or (i32.and - (get_local $25) + (get_local $27) (i32.const 1048575) ) (i32.const 1048576) @@ -1497,106 +1488,106 @@ ) (if (i32.lt_s - (get_local $24) + (get_local $26) (i32.const 0) ) - (set_local $25 + (set_local $27 (i32.sub (i32.const 0) - (get_local $25) + (get_local $27) ) ) ) - (set_local $17 + (set_local $19 (f64.sub - (get_local $17) - (get_local $20) + (get_local $19) + (get_local $22) ) ) ) ) - (set_local $20 + (set_local $22 (f64.add - (get_local $18) - (get_local $17) + (get_local $20) + (get_local $19) ) ) - (set_local $20 + (set_local $22 (f64.reinterpret/i64 (i64.and (i64.reinterpret/f64 - (get_local $20) + (get_local $22) ) (i64.const -4294967296) ) ) ) - (set_local $21 + (set_local $23 (f64.mul - (get_local $20) + (get_local $22) (f64.const 0.6931471824645996) ) ) - (set_local $22 + (set_local $24 (f64.add (f64.mul (f64.sub - (get_local $18) + (get_local $20) (f64.sub - (get_local $20) - (get_local $17) + (get_local $22) + (get_local $19) ) ) (f64.const 0.6931471805599453) ) (f64.mul - (get_local $20) + (get_local $22) (f64.const -1.904654299957768e-09) ) ) ) - (set_local $13 + (set_local $15 (f64.add - (get_local $21) - (get_local $22) + (get_local $23) + (get_local $24) ) ) - (set_local $23 + (set_local $25 (f64.sub - (get_local $22) + (get_local $24) (f64.sub - (get_local $13) - (get_local $21) + (get_local $15) + (get_local $23) ) ) ) - (set_local $20 + (set_local $22 (f64.mul - (get_local $13) - (get_local $13) + (get_local $15) + (get_local $15) ) ) - (set_local $15 + (set_local $17 (f64.sub - (get_local $13) + (get_local $15) (f64.mul - (get_local $20) + (get_local $22) (f64.add (f64.const 0.16666666666666602) (f64.mul - (get_local $20) + (get_local $22) (f64.add (f64.const -2.7777777777015593e-03) (f64.mul - (get_local $20) + (get_local $22) (f64.add (f64.const 6.613756321437934e-05) (f64.mul - (get_local $20) + (get_local $22) (f64.add (f64.const -1.6533902205465252e-06) (f64.mul - (get_local $20) + (get_local $22) (f64.const 4.1381367970572385e-08) ) ) @@ -1609,51 +1600,51 @@ ) ) ) - (set_local $19 + (set_local $21 (f64.sub (f64.div (f64.mul - (get_local $13) (get_local $15) + (get_local $17) ) (f64.sub - (get_local $15) + (get_local $17) (f64.const 2) ) ) (f64.add - (get_local $23) + (get_local $25) (f64.mul - (get_local $13) - (get_local $23) + (get_local $15) + (get_local $25) ) ) ) ) - (set_local $13 + (set_local $15 (f64.sub (f64.const 1) (f64.sub - (get_local $19) - (get_local $13) + (get_local $21) + (get_local $15) ) ) ) - (set_local $24 + (set_local $26 (i32.wrap/i64 (i64.shr_u (i64.reinterpret/f64 - (get_local $13) + (get_local $15) ) (i64.const 32) ) ) ) - (set_local $24 + (set_local $26 (i32.add - (get_local $24) + (get_local $26) (i32.shl - (get_local $25) + (get_local $27) (i32.const 20) ) ) @@ -1661,29 +1652,29 @@ (if (i32.le_s (i32.shr_s - (get_local $24) + (get_local $26) (i32.const 20) ) (i32.const 0) ) - (set_local $13 + (set_local $15 (call $~lib/math/NativeMath.scalbn - (get_local $13) - (get_local $25) + (get_local $15) + (get_local $27) ) ) - (set_local $13 + (set_local $15 (f64.reinterpret/i64 (i64.or (i64.and (i64.reinterpret/f64 - (get_local $13) + (get_local $15) ) (i64.const 4294967295) ) (i64.shl (i64.extend_s/i32 - (get_local $24) + (get_local $26) ) (i64.const 32) ) @@ -1692,8 +1683,8 @@ ) ) (f64.mul - (get_local $14) - (get_local $13) + (get_local $16) + (get_local $15) ) ) (func $~lib/math/NativeMathf.mod (; 2 ;) (type $fff) (param $0 f32) (param $1 f32) (result f32) @@ -1704,6 +1695,9 @@ (local $6 i32) (local $7 i32) (local $8 i32) + (local $9 i32) + (local $10 i32) + (local $11 i32) (set_local $2 (i32.reinterpret/f32 (get_local $0) @@ -1738,36 +1732,36 @@ (i32.const -2147483648) ) ) + (set_local $7 + (i32.shl + (get_local $3) + (i32.const 1) + ) + ) (if (i32.and (if (result i32) - (i32.and - (tee_local $7 - (if (result i32) - (tee_local $7 - (i32.eq - (i32.shl - (get_local $3) - (i32.const 1) - ) - (i32.const 0) - ) - ) - (get_local $7) - (block $~lib/builtins/isNaN|inlined.1 (result i32) - (f32.ne - (get_local $1) - (get_local $1) - ) + (tee_local $8 + (if (result i32) + (tee_local $8 + (i32.eq + (get_local $7) + (i32.const 0) ) ) + (get_local $8) + (i32.eq + (get_local $4) + (i32.const 255) + ) ) - (i32.const 1) ) - (get_local $7) - (i32.eq - (get_local $4) - (i32.const 255) + (get_local $8) + (block $~lib/builtins/isNaN|inlined.1 (result i32) + (f32.ne + (get_local $1) + (get_local $1) + ) ) ) (i32.const 1) @@ -1785,28 +1779,22 @@ ) ) ) + (set_local $9 + (i32.shl + (get_local $2) + (i32.const 1) + ) + ) (if (i32.le_u - (i32.shl - (get_local $2) - (i32.const 1) - ) - (i32.shl - (get_local $3) - (i32.const 1) - ) + (get_local $9) + (get_local $7) ) (block (if (i32.eq - (i32.shl - (get_local $2) - (i32.const 1) - ) - (i32.shl - (get_local $3) - (i32.const 1) - ) + (get_local $9) + (get_local $7) ) (return (f32.mul @@ -1825,37 +1813,15 @@ (get_local $4) ) (block - (block $break|0 - (set_local $8 - (i32.shl - (get_local $2) - (i32.const 9) - ) - ) - (loop $repeat|0 - (br_if $break|0 - (i32.eqz - (i32.eqz - (i32.shr_u - (get_local $8) - (i32.const 31) - ) - ) - ) - ) - (set_local $4 - (i32.sub - (get_local $4) - (i32.const 1) - ) - ) - (set_local $8 + (set_local $4 + (i32.sub + (get_local $4) + (i32.clz (i32.shl - (get_local $8) - (i32.const 1) + (get_local $2) + (i32.const 9) ) ) - (br $repeat|0) ) ) (set_local $2 @@ -1897,37 +1863,15 @@ (get_local $5) ) (block - (block $break|1 - (set_local $8 - (i32.shl - (get_local $3) - (i32.const 9) - ) - ) - (loop $repeat|1 - (br_if $break|1 - (i32.eqz - (i32.eqz - (i32.shr_u - (get_local $8) - (i32.const 31) - ) - ) - ) - ) - (set_local $5 - (i32.sub - (get_local $5) - (i32.const 1) - ) - ) - (set_local $8 + (set_local $5 + (i32.sub + (get_local $5) + (i32.clz (i32.shl - (get_local $8) - (i32.const 1) + (get_local $3) + (i32.const 9) ) ) - (br $repeat|1) ) ) (set_local $3 @@ -1964,9 +1908,9 @@ ) ) ) - (block $break|2 - (loop $repeat|2 - (br_if $break|2 + (block $break|0 + (loop $repeat|0 + (br_if $break|0 (i32.eqz (i32.gt_s (get_local $4) @@ -1975,7 +1919,7 @@ ) ) (block - (set_local $8 + (set_local $10 (i32.sub (get_local $2) (get_local $3) @@ -1984,14 +1928,14 @@ (if (i32.eqz (i32.shr_u - (get_local $8) + (get_local $10) (i32.const 31) ) ) (block (if (i32.eqz - (get_local $8) + (get_local $10) ) (return (f32.mul @@ -2001,7 +1945,7 @@ ) ) (set_local $2 - (get_local $8) + (get_local $10) ) ) ) @@ -2018,10 +1962,10 @@ (i32.const 1) ) ) - (br $repeat|2) + (br $repeat|0) ) ) - (set_local $8 + (set_local $10 (i32.sub (get_local $2) (get_local $3) @@ -2030,14 +1974,14 @@ (if (i32.eqz (i32.shr_u - (get_local $8) + (get_local $10) (i32.const 31) ) ) (block (if (i32.eqz - (get_local $8) + (get_local $10) ) (return (f32.mul @@ -2047,35 +1991,28 @@ ) ) (set_local $2 - (get_local $8) + (get_local $10) ) ) ) - (block $break|3 - (loop $repeat|3 - (br_if $break|3 - (i32.eqz - (i32.eqz - (i32.shr_u - (get_local $2) - (i32.const 23) - ) - ) - ) + (set_local $11 + (i32.clz + (i32.shl + (get_local $2) + (i32.const 8) ) - (set_local $4 - (i32.sub - (get_local $4) - (i32.const 1) - ) - ) - (set_local $2 - (i32.shl - (get_local $2) - (i32.const 1) - ) - ) - (br $repeat|3) + ) + ) + (set_local $4 + (i32.sub + (get_local $4) + (get_local $11) + ) + ) + (set_local $2 + (i32.shl + (get_local $2) + (get_local $11) ) ) (if @@ -2128,6 +2065,8 @@ ) (func $~lib/math/NativeMathf.scalbn (; 3 ;) (type $fif) (param $0 f32) (param $1 i32) (result f32) (local $2 f32) + (local $3 i32) + (local $4 i32) (set_local $2 (get_local $0) ) @@ -2162,18 +2101,20 @@ ) ) (set_local $1 - (i32.sub - (get_local $1) - (i32.const 127) - ) - ) - (if - (i32.gt_s - (get_local $1) - (i32.const 127) - ) - (set_local $1 - (i32.const 127) + (select + (tee_local $3 + (i32.sub + (get_local $1) + (i32.const 127) + ) + ) + (tee_local $4 + (i32.const 127) + ) + (i32.lt_s + (get_local $3) + (get_local $4) + ) ) ) ) @@ -2188,13 +2129,19 @@ (set_local $2 (f32.mul (get_local $2) - (f32.const 1.1754943508222875e-38) + (f32.mul + (f32.const 1.1754943508222875e-38) + (f32.const 16777216) + ) ) ) (set_local $1 (i32.add (get_local $1) - (i32.const 126) + (i32.sub + (i32.const 126) + (i32.const 24) + ) ) ) (if @@ -2206,22 +2153,30 @@ (set_local $2 (f32.mul (get_local $2) - (f32.const 1.1754943508222875e-38) + (f32.mul + (f32.const 1.1754943508222875e-38) + (f32.const 16777216) + ) ) ) (set_local $1 - (i32.add - (get_local $1) - (i32.const 126) - ) - ) - (if - (i32.lt_s - (get_local $1) - (i32.const -126) - ) - (set_local $1 - (i32.const -126) + (select + (tee_local $3 + (i32.sub + (i32.add + (get_local $1) + (i32.const 126) + ) + (i32.const 24) + ) + ) + (tee_local $4 + (i32.const -126) + ) + (i32.gt_s + (get_local $3) + (get_local $4) + ) ) ) ) @@ -3563,11 +3518,14 @@ (func $~lib/math/NativeMath.mod (; 5 ;) (type $FFF) (param $0 f64) (param $1 f64) (result f64) (local $2 i64) (local $3 i64) - (local $4 i32) - (local $5 i32) - (local $6 i32) - (local $7 i32) - (local $8 i64) + (local $4 i64) + (local $5 i64) + (local $6 i64) + (local $7 i64) + (local $8 i32) + (local $9 i64) + (local $10 i64) + (local $11 i64) (set_local $2 (i64.reinterpret/f64 (get_local $0) @@ -3579,65 +3537,59 @@ ) ) (set_local $4 - (i32.wrap/i64 - (i64.and - (i64.shr_u - (get_local $2) - (i64.const 52) - ) - (i64.const 2047) + (i64.and + (i64.shr_u + (get_local $2) + (i64.const 52) ) + (i64.const 2047) ) ) (set_local $5 - (i32.wrap/i64 - (i64.and - (i64.shr_u - (get_local $3) - (i64.const 52) - ) - (i64.const 2047) + (i64.and + (i64.shr_u + (get_local $3) + (i64.const 52) ) + (i64.const 2047) ) ) (set_local $6 - (i32.wrap/i64 - (i64.shr_u - (get_local $2) - (i64.const 63) - ) + (i64.shr_u + (get_local $2) + (i64.const 63) + ) + ) + (set_local $7 + (i64.shl + (get_local $3) + (i64.const 1) ) ) (if (i32.and (if (result i32) - (i32.and - (tee_local $7 - (if (result i32) - (tee_local $7 - (i64.eq - (i64.shl - (get_local $3) - (i64.const 1) - ) - (i64.const 0) - ) - ) - (get_local $7) - (block $~lib/builtins/isNaN|inlined.1 (result i32) - (f64.ne - (get_local $1) - (get_local $1) - ) + (tee_local $8 + (if (result i32) + (tee_local $8 + (i64.eq + (get_local $7) + (i64.const 0) ) ) + (get_local $8) + (i64.eq + (get_local $4) + (i64.const 2047) + ) ) - (i32.const 1) ) - (get_local $7) - (i32.eq - (get_local $4) - (i32.const 2047) + (get_local $8) + (block $~lib/builtins/isNaN|inlined.1 (result i32) + (f64.ne + (get_local $1) + (get_local $1) + ) ) ) (i32.const 1) @@ -3655,28 +3607,22 @@ ) ) ) + (set_local $9 + (i64.shl + (get_local $2) + (i64.const 1) + ) + ) (if (i64.le_u - (i64.shl - (get_local $2) - (i64.const 1) - ) - (i64.shl - (get_local $3) - (i64.const 1) - ) + (get_local $9) + (get_local $7) ) (block (if (i64.eq - (i64.shl - (get_local $2) - (i64.const 1) - ) - (i64.shl - (get_local $3) - (i64.const 1) - ) + (get_local $9) + (get_local $7) ) (return (f64.mul @@ -3691,54 +3637,30 @@ ) ) (if - (i32.eqz + (i64.eqz (get_local $4) ) (block - (block $break|0 - (set_local $8 - (i64.shl - (get_local $2) - (i64.const 12) - ) - ) - (loop $repeat|0 - (br_if $break|0 - (i32.eqz - (i64.eqz - (i64.shr_u - (get_local $8) - (i64.const 63) - ) - ) - ) - ) - (set_local $4 - (i32.sub - (get_local $4) - (i32.const 1) - ) - ) - (set_local $8 + (set_local $4 + (i64.sub + (get_local $4) + (i64.clz (i64.shl - (get_local $8) - (i64.const 1) + (get_local $2) + (i64.const 12) ) ) - (br $repeat|0) ) ) (set_local $2 (i64.shl (get_local $2) - (i64.extend_s/i32 - (i32.add - (i32.sub - (i32.const 0) - (get_local $4) - ) - (i32.const 1) + (i64.add + (i64.sub + (i64.const 0) + (get_local $4) ) + (i64.const 1) ) ) ) @@ -3765,54 +3687,30 @@ ) ) (if - (i32.eqz + (i64.eqz (get_local $5) ) (block - (block $break|1 - (set_local $8 - (i64.shl - (get_local $3) - (i64.const 12) - ) - ) - (loop $repeat|1 - (br_if $break|1 - (i32.eqz - (i64.eqz - (i64.shr_u - (get_local $8) - (i64.const 63) - ) - ) - ) - ) - (set_local $5 - (i32.sub - (get_local $5) - (i32.const 1) - ) - ) - (set_local $8 + (set_local $5 + (i64.sub + (get_local $5) + (i64.clz (i64.shl - (get_local $8) - (i64.const 1) + (get_local $3) + (i64.const 12) ) ) - (br $repeat|1) ) ) (set_local $3 (i64.shl (get_local $3) - (i64.extend_s/i32 - (i32.add - (i32.sub - (i32.const 0) - (get_local $5) - ) - (i32.const 1) + (i64.add + (i64.sub + (i64.const 0) + (get_local $5) ) + (i64.const 1) ) ) ) @@ -3838,18 +3736,18 @@ ) ) ) - (block $break|2 - (loop $repeat|2 - (br_if $break|2 + (block $break|0 + (loop $repeat|0 + (br_if $break|0 (i32.eqz - (i32.gt_s + (i64.gt_s (get_local $4) (get_local $5) ) ) ) (block - (set_local $8 + (set_local $10 (i64.sub (get_local $2) (get_local $3) @@ -3858,14 +3756,14 @@ (if (i64.eqz (i64.shr_u - (get_local $8) + (get_local $10) (i64.const 63) ) ) (block (if (i64.eqz - (get_local $8) + (get_local $10) ) (return (f64.mul @@ -3875,7 +3773,7 @@ ) ) (set_local $2 - (get_local $8) + (get_local $10) ) ) ) @@ -3887,15 +3785,15 @@ ) ) (set_local $4 - (i32.sub + (i64.sub (get_local $4) - (i32.const 1) + (i64.const 1) ) ) - (br $repeat|2) + (br $repeat|0) ) ) - (set_local $8 + (set_local $10 (i64.sub (get_local $2) (get_local $3) @@ -3904,14 +3802,14 @@ (if (i64.eqz (i64.shr_u - (get_local $8) + (get_local $10) (i64.const 63) ) ) (block (if (i64.eqz - (get_local $8) + (get_local $10) ) (return (f64.mul @@ -3921,41 +3819,34 @@ ) ) (set_local $2 - (get_local $8) + (get_local $10) ) ) ) - (block $break|3 - (loop $repeat|3 - (br_if $break|3 - (i32.eqz - (i64.eqz - (i64.shr_u - (get_local $2) - (i64.const 52) - ) - ) - ) + (set_local $11 + (i64.clz + (i64.shl + (get_local $2) + (i64.const 11) ) - (set_local $4 - (i32.sub - (get_local $4) - (i32.const 1) - ) - ) - (set_local $2 - (i64.shl - (get_local $2) - (i64.const 1) - ) - ) - (br $repeat|3) + ) + ) + (set_local $4 + (i64.sub + (get_local $4) + (get_local $11) + ) + ) + (set_local $2 + (i64.shl + (get_local $2) + (get_local $11) ) ) (if - (i32.gt_s + (i64.gt_s (get_local $4) - (i32.const 0) + (i64.const 0) ) (block (set_local $2 @@ -3971,9 +3862,7 @@ (i64.or (get_local $2) (i64.shl - (i64.extend_s/i32 - (get_local $4) - ) + (get_local $4) (i64.const 52) ) ) @@ -3982,14 +3871,12 @@ (set_local $2 (i64.shr_u (get_local $2) - (i64.extend_s/i32 - (i32.add - (i32.sub - (i32.const 0) - (get_local $4) - ) - (i32.const 1) + (i64.add + (i64.sub + (i64.const 0) + (get_local $4) ) + (i64.const 1) ) ) ) @@ -3998,9 +3885,7 @@ (i64.or (get_local $2) (i64.shl - (i64.extend_s/i32 - (get_local $6) - ) + (get_local $6) (i64.const 63) ) ) diff --git a/tests/compiler/std/array.optimized.wat b/tests/compiler/std/array.optimized.wat index 9d4a22a4..99b5fa76 100644 --- a/tests/compiler/std/array.optimized.wat +++ b/tests/compiler/std/array.optimized.wat @@ -237,8 +237,10 @@ (global $std/array/filteredArr (mut i32) (i32.const 0)) (global $std/array/boolVal (mut i32) (i32.const 0)) (global $~lib/math/random_seeded (mut i32) (i32.const 0)) - (global $~lib/math/random_state0 (mut i64) (i64.const 0)) - (global $~lib/math/random_state1 (mut i64) (i64.const 0)) + (global $~lib/math/random_state0_64 (mut i64) (i64.const 0)) + (global $~lib/math/random_state1_64 (mut i64) (i64.const 0)) + (global $~lib/math/random_state0_32 (mut i32) (i32.const 0)) + (global $~lib/math/random_state1_32 (mut i32) (i32.const 0)) (global $std/array/f32ArrayTyped (mut i32) (i32.const 728)) (global $std/array/f64ArrayTyped (mut i32) (i32.const 936)) (global $std/array/i32ArrayTyped (mut i32) (i32.const 1112)) @@ -4686,7 +4688,55 @@ ) ) ) - (func $~lib/math/NativeMath.seedRandom (; 70 ;) (; has Stack IR ;) (type $Iv) (param $0 i64) + (func $~lib/math/splitMix32 (; 70 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) + (i32.xor + (tee_local $0 + (i32.xor + (tee_local $0 + (i32.mul + (i32.xor + (tee_local $0 + (i32.add + (get_local $0) + (i32.const 1831565813) + ) + ) + (i32.shr_u + (get_local $0) + (i32.const 15) + ) + ) + (i32.or + (get_local $0) + (i32.const 1) + ) + ) + ) + (i32.add + (get_local $0) + (i32.mul + (i32.xor + (get_local $0) + (i32.shr_u + (get_local $0) + (i32.const 7) + ) + ) + (i32.or + (get_local $0) + (i32.const 61) + ) + ) + ) + ) + ) + (i32.shr_u + (get_local $0) + (i32.const 14) + ) + ) + ) + (func $~lib/math/NativeMath.seedRandom (; 71 ;) (; has Stack IR ;) (type $Iv) (param $0 i64) (if (i64.eqz (get_local $0) @@ -4704,18 +4754,33 @@ (set_global $~lib/math/random_seeded (i32.const 1) ) - (set_global $~lib/math/random_state0 + (set_global $~lib/math/random_state0_64 (call $~lib/math/murmurHash3 (get_local $0) ) ) - (set_global $~lib/math/random_state1 + (set_global $~lib/math/random_state1_64 (call $~lib/math/murmurHash3 - (get_global $~lib/math/random_state0) + (i64.xor + (get_global $~lib/math/random_state0_64) + (i64.const -1) + ) + ) + ) + (set_global $~lib/math/random_state0_32 + (call $~lib/math/splitMix32 + (i32.wrap/i64 + (get_local $0) + ) + ) + ) + (set_global $~lib/math/random_state1_32 + (call $~lib/math/splitMix32 + (get_global $~lib/math/random_state0_32) ) ) ) - (func $~lib/internal/array/insertionSort (; 71 ;) (; has Stack IR ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/internal/array/insertionSort (; 72 ;) (; has Stack IR ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 f32) @@ -4827,10 +4892,10 @@ ) ) ) - (func $~lib/allocator/arena/__memory_free (; 72 ;) (; has Stack IR ;) (type $FUNCSIG$v) + (func $~lib/allocator/arena/__memory_free (; 73 ;) (; has Stack IR ;) (type $FUNCSIG$v) (nop) ) - (func $~lib/internal/array/weakHeapSort (; 73 ;) (; has Stack IR ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/internal/array/weakHeapSort (; 74 ;) (; has Stack IR ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -5215,7 +5280,7 @@ (get_local $6) ) ) - (func $~lib/array/Array#sort (; 74 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array#sort (; 75 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 f32) @@ -5320,7 +5385,7 @@ ) (get_local $0) ) - (func $~lib/array/Array#sort|trampoline~anonymous|43 (; 75 ;) (; has Stack IR ;) (type $ffi) (param $0 f32) (param $1 f32) (result i32) + (func $~lib/array/Array#sort|trampoline~anonymous|43 (; 76 ;) (; has Stack IR ;) (type $ffi) (param $0 f32) (param $1 f32) (result i32) (local $2 i32) (local $3 i32) (i32.sub @@ -5364,7 +5429,7 @@ ) ) ) - (func $~lib/array/Array#sort|trampoline (; 76 ;) (; has Stack IR ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (func $~lib/array/Array#sort|trampoline (; 77 ;) (; has Stack IR ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) (local $1 i32) (block $1of1 (block $0of1 @@ -5384,13 +5449,13 @@ (get_local $1) ) ) - (func $~lib/builtins/isNaN (; 77 ;) (; has Stack IR ;) (type $fi) (param $0 f32) (result i32) + (func $~lib/builtins/isNaN (; 78 ;) (; has Stack IR ;) (type $fi) (param $0 f32) (result i32) (f32.ne (get_local $0) (get_local $0) ) ) - (func $std/array/isArraysEqual (; 78 ;) (; has Stack IR ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (func $std/array/isArraysEqual (; 79 ;) (; has Stack IR ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -5485,7 +5550,7 @@ ) (i32.const 1) ) - (func $~lib/internal/array/insertionSort (; 79 ;) (; has Stack IR ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/internal/array/insertionSort (; 80 ;) (; has Stack IR ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 f64) @@ -5597,7 +5662,7 @@ ) ) ) - (func $~lib/internal/array/weakHeapSort (; 80 ;) (; has Stack IR ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/internal/array/weakHeapSort (; 81 ;) (; has Stack IR ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -5982,7 +6047,7 @@ (get_local $6) ) ) - (func $~lib/array/Array#sort (; 81 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array#sort (; 82 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 f64) @@ -6087,7 +6152,7 @@ ) (get_local $0) ) - (func $~lib/array/Array#sort|trampoline~anonymous|44 (; 82 ;) (; has Stack IR ;) (type $FFi) (param $0 f64) (param $1 f64) (result i32) + (func $~lib/array/Array#sort|trampoline~anonymous|44 (; 83 ;) (; has Stack IR ;) (type $FFi) (param $0 f64) (param $1 f64) (result i32) (local $2 i64) (local $3 i64) (i32.sub @@ -6131,7 +6196,7 @@ ) ) ) - (func $~lib/array/Array#sort|trampoline (; 83 ;) (; has Stack IR ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (func $~lib/array/Array#sort|trampoline (; 84 ;) (; has Stack IR ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) (local $1 i32) (block $1of1 (block $0of1 @@ -6151,7 +6216,7 @@ (get_local $1) ) ) - (func $~lib/array/Array#__get (; 84 ;) (; has Stack IR ;) (type $iiF) (param $0 i32) (param $1 i32) (result f64) + (func $~lib/array/Array#__get (; 85 ;) (; has Stack IR ;) (type $iiF) (param $0 i32) (param $1 i32) (result f64) (if (result f64) (i32.lt_u (get_local $1) @@ -6178,13 +6243,13 @@ (unreachable) ) ) - (func $~lib/builtins/isNaN (; 85 ;) (; has Stack IR ;) (type $Fi) (param $0 f64) (result i32) + (func $~lib/builtins/isNaN (; 86 ;) (; has Stack IR ;) (type $Fi) (param $0 f64) (result i32) (f64.ne (get_local $0) (get_local $0) ) ) - (func $std/array/isArraysEqual (; 86 ;) (; has Stack IR ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (func $std/array/isArraysEqual (; 87 ;) (; has Stack IR ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -6279,7 +6344,7 @@ ) (i32.const 1) ) - (func $~lib/internal/array/insertionSort (; 87 ;) (; has Stack IR ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/internal/array/insertionSort (; 88 ;) (; has Stack IR ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -6394,7 +6459,7 @@ ) ) ) - (func $~lib/internal/array/weakHeapSort (; 88 ;) (; has Stack IR ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/internal/array/weakHeapSort (; 89 ;) (; has Stack IR ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -6779,7 +6844,7 @@ (get_local $1) ) ) - (func $~lib/array/Array#sort (; 89 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array#sort (; 90 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -6883,13 +6948,13 @@ ) (get_local $0) ) - (func $~lib/array/Array#sort|trampoline~anonymous|45 (; 90 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array#sort|trampoline~anonymous|45 (; 91 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.sub (get_local $0) (get_local $1) ) ) - (func $~lib/array/Array#sort|trampoline (; 91 ;) (; has Stack IR ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (func $~lib/array/Array#sort|trampoline (; 92 ;) (; has Stack IR ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) (local $1 i32) (block $1of1 (block $0of1 @@ -6909,7 +6974,7 @@ (get_local $1) ) ) - (func $~lib/array/Array#sort|trampoline~anonymous|46 (; 92 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array#sort|trampoline~anonymous|46 (; 93 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.sub (i32.gt_u (get_local $0) @@ -6921,7 +6986,7 @@ ) ) ) - (func $~lib/array/Array#sort|trampoline (; 93 ;) (; has Stack IR ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (func $~lib/array/Array#sort|trampoline (; 94 ;) (; has Stack IR ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) (local $1 i32) (block $1of1 (block $0of1 @@ -6941,7 +7006,7 @@ (get_local $1) ) ) - (func $std/array/createReverseOrderedArray (; 94 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) + (func $std/array/createReverseOrderedArray (; 95 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (set_local $1 (call $~lib/array/Array#constructor @@ -6985,7 +7050,7 @@ ) (get_local $1) ) - (func $~lib/math/NativeMath.random (; 95 ;) (; has Stack IR ;) (type $F) (result f64) + (func $~lib/math/NativeMath.random (; 96 ;) (; has Stack IR ;) (type $F) (result f64) (local $0 i64) (local $1 i64) (if @@ -6996,21 +7061,21 @@ (call $~lib/env/abort (i32.const 0) (i32.const 456) - (i32.const 962) + (i32.const 964) (i32.const 24) ) (unreachable) ) ) (set_local $0 - (get_global $~lib/math/random_state0) + (get_global $~lib/math/random_state0_64) ) - (set_global $~lib/math/random_state0 + (set_global $~lib/math/random_state0_64 (tee_local $1 - (get_global $~lib/math/random_state1) + (get_global $~lib/math/random_state1_64) ) ) - (set_global $~lib/math/random_state1 + (set_global $~lib/math/random_state1_64 (tee_local $0 (i64.xor (i64.xor @@ -7054,7 +7119,7 @@ (f64.const 1) ) ) - (func $std/array/createRandomOrderedArray (; 96 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) + (func $std/array/createRandomOrderedArray (; 97 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 f64) (set_local $0 @@ -7100,7 +7165,7 @@ ) (get_local $0) ) - (func $std/array/isSorted (; 97 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $std/array/isSorted (; 98 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -7165,7 +7230,7 @@ ) (i32.const 1) ) - (func $std/array/assertSorted (; 98 ;) (; has Stack IR ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $std/array/assertSorted (; 99 ;) (; has Stack IR ;) (type $iiv) (param $0 i32) (param $1 i32) (if (i32.eqz (call $std/array/isSorted @@ -7187,19 +7252,19 @@ ) ) ) - (func $std/array/assertSortedDefault (; 99 ;) (; has Stack IR ;) (type $iv) (param $0 i32) + (func $std/array/assertSortedDefault (; 100 ;) (; has Stack IR ;) (type $iv) (param $0 i32) (call $std/array/assertSorted (get_local $0) (i32.const 47) ) ) - (func $start~anonymous|49 (; 100 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $start~anonymous|49 (; 101 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.sub (get_local $1) (get_local $0) ) ) - (func $std/array/createReverseOrderedNestedArray (; 101 ;) (; has Stack IR ;) (type $FUNCSIG$i) (result i32) + (func $std/array/createReverseOrderedNestedArray (; 102 ;) (; has Stack IR ;) (type $FUNCSIG$i) (result i32) (local $0 i32) (local $1 i32) (local $2 i32) @@ -7257,7 +7322,7 @@ ) (get_local $1) ) - (func $start~anonymous|52 (; 102 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $start~anonymous|52 (; 103 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (set_local $0 (call $~lib/array/Array#__get (get_local $0) @@ -7275,7 +7340,7 @@ (get_local $1) ) ) - (func $~lib/array/Array>#sort (; 103 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array>#sort (; 104 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -7368,7 +7433,7 @@ ) (get_local $0) ) - (func $std/array/assertSorted> (; 104 ;) (; has Stack IR ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $std/array/assertSorted> (; 105 ;) (; has Stack IR ;) (type $iiv) (param $0 i32) (param $1 i32) (if (i32.eqz (call $std/array/isSorted @@ -7390,7 +7455,7 @@ ) ) ) - (func $std/array/Proxy#constructor (; 105 ;) (; has Stack IR ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (func $std/array/Proxy#constructor (; 106 ;) (; has Stack IR ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) (local $1 i32) (i32.store (tee_local $1 @@ -7402,7 +7467,7 @@ ) (get_local $1) ) - (func $std/array/createReverseOrderedElementsArray (; 106 ;) (; has Stack IR ;) (type $FUNCSIG$i) (result i32) + (func $std/array/createReverseOrderedElementsArray (; 107 ;) (; has Stack IR ;) (type $FUNCSIG$i) (result i32) (local $0 i32) (local $1 i32) (local $2 i32) @@ -7450,7 +7515,7 @@ ) (get_local $1) ) - (func $start~anonymous|53 (; 107 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $start~anonymous|53 (; 108 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.sub (i32.load (get_local $0) @@ -7460,7 +7525,7 @@ ) ) ) - (func $~lib/internal/string/compareUnsafe (; 108 ;) (; has Stack IR ;) (type $FUNCSIG$iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/internal/string/compareUnsafe (; 109 ;) (; has Stack IR ;) (type $FUNCSIG$iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (set_local $3 @@ -7511,7 +7576,7 @@ ) (get_local $4) ) - (func $~lib/string/String.__gt (; 109 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/string/String.__gt (; 110 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (if @@ -7586,7 +7651,7 @@ (i32.const 0) ) ) - (func $~lib/string/String.__lt (; 110 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/string/String.__lt (; 111 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (if @@ -7661,7 +7726,7 @@ (i32.const 0) ) ) - (func $start~anonymous|54 (; 111 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $start~anonymous|54 (; 112 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (set_local $2 (call $~lib/string/String.__gt @@ -7680,7 +7745,7 @@ (get_local $0) ) ) - (func $~lib/string/String.__eq (; 112 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/string/String.__eq (; 113 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (if (i32.eq @@ -7734,7 +7799,7 @@ ) ) ) - (func $~lib/string/String.__ne (; 113 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/string/String.__ne (; 114 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.eqz (call $~lib/string/String.__eq (get_local $0) @@ -7742,7 +7807,7 @@ ) ) ) - (func $std/array/isArraysEqual (; 114 ;) (; has Stack IR ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) + (func $std/array/isArraysEqual (; 115 ;) (; has Stack IR ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -7813,7 +7878,7 @@ ) (i32.const 1) ) - (func $~lib/internal/string/allocateUnsafe (; 115 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/string/allocateUnsafe (; 116 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (if (tee_local $1 @@ -7859,7 +7924,7 @@ ) (get_local $1) ) - (func $~lib/string/String#charAt (; 116 ;) (; has Stack IR ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (func $~lib/string/String#charAt (; 117 ;) (; has Stack IR ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) (local $1 i32) (if (i32.ge_u @@ -7890,7 +7955,7 @@ ) (get_local $1) ) - (func $~lib/internal/string/copyUnsafe (; 117 ;) (; has Stack IR ;) (type $iiiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (param $4 i32) + (func $~lib/internal/string/copyUnsafe (; 118 ;) (; has Stack IR ;) (type $iiiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (param $4 i32) (call $~lib/internal/memory/memmove (i32.add (i32.add @@ -7918,7 +7983,7 @@ ) ) ) - (func $~lib/string/String#concat (; 118 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/string/String#concat (; 119 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -7985,7 +8050,7 @@ ) (get_local $2) ) - (func $~lib/string/String.__concat (; 119 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/string/String.__concat (; 120 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (if (i32.eqz (get_local $0) @@ -7999,7 +8064,7 @@ (get_local $1) ) ) - (func $std/array/createRandomString (; 120 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) + (func $std/array/createRandomString (; 121 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -8047,7 +8112,7 @@ ) (get_local $1) ) - (func $std/array/createRandomStringArray (; 121 ;) (; has Stack IR ;) (type $FUNCSIG$i) (result i32) + (func $std/array/createRandomStringArray (; 122 ;) (; has Stack IR ;) (type $FUNCSIG$i) (result i32) (local $0 i32) (local $1 i32) (local $2 i32) @@ -8092,7 +8157,7 @@ ) (get_local $1) ) - (func $~lib/string/String#substring (; 122 ;) (; has Stack IR ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/string/String#substring (; 123 ;) (; has Stack IR ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -8208,7 +8273,7 @@ ) (get_local $2) ) - (func $~lib/array/Array#join (; 123 ;) (; has Stack IR ;) (type $FUNCSIG$i) (result i32) + (func $~lib/array/Array#join (; 124 ;) (; has Stack IR ;) (type $FUNCSIG$i) (result i32) (local $0 i32) (local $1 i32) (local $2 i32) @@ -8421,7 +8486,7 @@ ) (get_local $1) ) - (func $~lib/internal/number/decimalCount32 (; 124 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/number/decimalCount32 (; 125 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (if (result i32) (i32.lt_u (get_local $0) @@ -8487,7 +8552,7 @@ ) ) ) - (func $~lib/internal/number/utoa32_lut (; 125 ;) (; has Stack IR ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/internal/number/utoa32_lut (; 126 ;) (; has Stack IR ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (set_local $3 @@ -8648,7 +8713,7 @@ ) ) ) - (func $~lib/internal/number/itoa32 (; 126 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/number/itoa32 (; 127 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -8701,12 +8766,12 @@ ) (get_local $1) ) - (func $~lib/internal/number/itoa (; 127 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/number/itoa (; 128 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (call $~lib/internal/number/itoa32 (get_local $0) ) ) - (func $~lib/internal/number/itoa_stream (; 128 ;) (; has Stack IR ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/internal/number/itoa_stream (; 129 ;) (; has Stack IR ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (set_local $0 (i32.add @@ -8769,7 +8834,7 @@ ) (get_local $1) ) - (func $~lib/array/Array#join (; 129 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array#join (; 130 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -8947,7 +9012,7 @@ ) (get_local $3) ) - (func $~lib/internal/number/utoa32 (; 130 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/number/utoa32 (; 131 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (if @@ -8973,12 +9038,12 @@ ) (get_local $2) ) - (func $~lib/internal/number/itoa (; 131 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/number/itoa (; 132 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (call $~lib/internal/number/utoa32 (get_local $0) ) ) - (func $~lib/internal/number/itoa_stream (; 132 ;) (; has Stack IR ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/internal/number/itoa_stream (; 133 ;) (; has Stack IR ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (set_local $0 (i32.add @@ -9015,7 +9080,7 @@ ) (get_local $3) ) - (func $~lib/array/Array#join (; 133 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array#join (; 134 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -9193,7 +9258,7 @@ ) (get_local $3) ) - (func $~lib/builtins/isFinite (; 134 ;) (; has Stack IR ;) (type $Fi) (param $0 f64) (result i32) + (func $~lib/builtins/isFinite (; 135 ;) (; has Stack IR ;) (type $Fi) (param $0 f64) (result i32) (f64.eq (f64.sub (get_local $0) @@ -9202,7 +9267,7 @@ (f64.const 0) ) ) - (func $~lib/internal/number/genDigits (; 135 ;) (; has Stack IR ;) (type $iIiIiIii) (param $0 i32) (param $1 i64) (param $2 i32) (param $3 i64) (param $4 i32) (param $5 i64) (param $6 i32) (result i32) + (func $~lib/internal/number/genDigits (; 136 ;) (; has Stack IR ;) (type $iIiIiIii) (param $0 i32) (param $1 i64) (param $2 i32) (param $3 i64) (param $4 i32) (param $5 i64) (param $6 i32) (result i32) (local $7 i32) (local $8 i64) (local $9 i32) @@ -9801,7 +9866,7 @@ ) ) ) - (func $~lib/internal/number/prettify (; 136 ;) (; has Stack IR ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/internal/number/prettify (; 137 ;) (; has Stack IR ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (if @@ -10189,7 +10254,7 @@ ) ) ) - (func $~lib/internal/number/dtoa_core (; 137 ;) (; has Stack IR ;) (type $iFi) (param $0 i32) (param $1 f64) (result i32) + (func $~lib/internal/number/dtoa_core (; 138 ;) (; has Stack IR ;) (type $iFi) (param $0 i32) (param $1 f64) (result i32) (local $2 i64) (local $3 i32) (local $4 i64) @@ -10694,7 +10759,7 @@ (get_local $14) ) ) - (func $~lib/internal/number/dtoa (; 138 ;) (; has Stack IR ;) (type $Fi) (param $0 f64) (result i32) + (func $~lib/internal/number/dtoa (; 139 ;) (; has Stack IR ;) (type $Fi) (param $0 f64) (result i32) (local $1 i32) (local $2 i32) (if @@ -10766,7 +10831,7 @@ (call $~lib/allocator/arena/__memory_free) (get_local $2) ) - (func $~lib/internal/number/dtoa_stream (; 139 ;) (; has Stack IR ;) (type $iiFi) (param $0 i32) (param $1 i32) (param $2 f64) (result i32) + (func $~lib/internal/number/dtoa_stream (; 140 ;) (; has Stack IR ;) (type $iiFi) (param $0 i32) (param $1 i32) (param $2 f64) (result i32) (local $3 i32) (set_local $0 (i32.add @@ -10865,7 +10930,7 @@ (get_local $2) ) ) - (func $~lib/array/Array#join (; 140 ;) (; has Stack IR ;) (type $FUNCSIG$i) (result i32) + (func $~lib/array/Array#join (; 141 ;) (; has Stack IR ;) (type $FUNCSIG$i) (result i32) (local $0 i32) (local $1 i32) (local $2 i32) @@ -11044,7 +11109,7 @@ ) (get_local $3) ) - (func $~lib/array/Array#join (; 141 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array#join (; 142 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -11243,12 +11308,12 @@ ) (get_local $0) ) - (func $std/array/Ref#constructor (; 142 ;) (; has Stack IR ;) (type $FUNCSIG$i) (result i32) + (func $std/array/Ref#constructor (; 143 ;) (; has Stack IR ;) (type $FUNCSIG$i) (result i32) (call $~lib/memory/memory.allocate (i32.const 0) ) ) - (func $~lib/array/Array#__unchecked_set (; 143 ;) (; has Stack IR ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/array/Array#__unchecked_set (; 144 ;) (; has Stack IR ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (i32.store offset=8 (i32.add (i32.load @@ -11262,7 +11327,7 @@ (get_local $2) ) ) - (func $~lib/array/Array#join (; 144 ;) (; has Stack IR ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (func $~lib/array/Array#join (; 145 ;) (; has Stack IR ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -11446,7 +11511,7 @@ ) (get_local $2) ) - (func $~lib/internal/number/itoa (; 145 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/number/itoa (; 146 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (call $~lib/internal/number/itoa32 (i32.shr_s (i32.shl @@ -11457,7 +11522,7 @@ ) ) ) - (func $~lib/internal/number/itoa_stream (; 146 ;) (; has Stack IR ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/internal/number/itoa_stream (; 147 ;) (; has Stack IR ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (set_local $0 (i32.add @@ -11541,7 +11606,7 @@ ) (get_local $1) ) - (func $~lib/array/Array#join (; 147 ;) (; has Stack IR ;) (type $FUNCSIG$i) (result i32) + (func $~lib/array/Array#join (; 148 ;) (; has Stack IR ;) (type $FUNCSIG$i) (result i32) (local $0 i32) (local $1 i32) (local $2 i32) @@ -11714,7 +11779,7 @@ ) (get_local $3) ) - (func $~lib/internal/number/itoa (; 148 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/number/itoa (; 149 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (call $~lib/internal/number/utoa32 (i32.and (get_local $0) @@ -11722,7 +11787,7 @@ ) ) ) - (func $~lib/internal/number/itoa_stream (; 149 ;) (; has Stack IR ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/internal/number/itoa_stream (; 150 ;) (; has Stack IR ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (set_local $0 (i32.add @@ -11768,7 +11833,7 @@ ) (get_local $3) ) - (func $~lib/array/Array#join (; 150 ;) (; has Stack IR ;) (type $FUNCSIG$i) (result i32) + (func $~lib/array/Array#join (; 151 ;) (; has Stack IR ;) (type $FUNCSIG$i) (result i32) (local $0 i32) (local $1 i32) (local $2 i32) @@ -11947,7 +12012,7 @@ ) (get_local $3) ) - (func $~lib/internal/number/decimalCount64 (; 151 ;) (; has Stack IR ;) (type $Ii) (param $0 i64) (result i32) + (func $~lib/internal/number/decimalCount64 (; 152 ;) (; has Stack IR ;) (type $Ii) (param $0 i64) (result i32) (if (result i32) (i64.lt_u (get_local $0) @@ -12013,7 +12078,7 @@ ) ) ) - (func $~lib/internal/number/utoa64_lut (; 152 ;) (; has Stack IR ;) (type $iIiv) (param $0 i32) (param $1 i64) (param $2 i32) + (func $~lib/internal/number/utoa64_lut (; 153 ;) (; has Stack IR ;) (type $iIiv) (param $0 i32) (param $1 i64) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -12159,7 +12224,7 @@ (get_local $2) ) ) - (func $~lib/internal/number/utoa64 (; 153 ;) (; has Stack IR ;) (type $Ii) (param $0 i64) (result i32) + (func $~lib/internal/number/utoa64 (; 154 ;) (; has Stack IR ;) (type $Ii) (param $0 i64) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -12209,12 +12274,12 @@ ) (get_local $2) ) - (func $~lib/internal/number/itoa (; 154 ;) (; has Stack IR ;) (type $Ii) (param $0 i64) (result i32) + (func $~lib/internal/number/itoa (; 155 ;) (; has Stack IR ;) (type $Ii) (param $0 i64) (result i32) (call $~lib/internal/number/utoa64 (get_local $0) ) ) - (func $~lib/internal/number/itoa_stream (; 155 ;) (; has Stack IR ;) (type $iiIi) (param $0 i32) (param $1 i32) (param $2 i64) (result i32) + (func $~lib/internal/number/itoa_stream (; 156 ;) (; has Stack IR ;) (type $iiIi) (param $0 i32) (param $1 i32) (param $2 i64) (result i32) (local $3 i32) (set_local $0 (i32.add @@ -12275,7 +12340,7 @@ ) (get_local $1) ) - (func $~lib/array/Array#join (; 156 ;) (; has Stack IR ;) (type $FUNCSIG$i) (result i32) + (func $~lib/array/Array#join (; 157 ;) (; has Stack IR ;) (type $FUNCSIG$i) (result i32) (local $0 i32) (local $1 i32) (local $2 i32) @@ -12454,7 +12519,7 @@ ) (get_local $3) ) - (func $~lib/internal/number/itoa64 (; 157 ;) (; has Stack IR ;) (type $Ii) (param $0 i64) (result i32) + (func $~lib/internal/number/itoa64 (; 158 ;) (; has Stack IR ;) (type $Ii) (param $0 i64) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -12536,12 +12601,12 @@ ) (get_local $1) ) - (func $~lib/internal/number/itoa (; 158 ;) (; has Stack IR ;) (type $Ii) (param $0 i64) (result i32) + (func $~lib/internal/number/itoa (; 159 ;) (; has Stack IR ;) (type $Ii) (param $0 i64) (result i32) (call $~lib/internal/number/itoa64 (get_local $0) ) ) - (func $~lib/internal/number/itoa_stream (; 159 ;) (; has Stack IR ;) (type $iiIi) (param $0 i32) (param $1 i32) (param $2 i64) (result i32) + (func $~lib/internal/number/itoa_stream (; 160 ;) (; has Stack IR ;) (type $iiIi) (param $0 i32) (param $1 i32) (param $2 i64) (result i32) (local $3 i32) (local $4 i32) (set_local $0 @@ -12634,7 +12699,7 @@ ) (get_local $1) ) - (func $~lib/array/Array#join (; 160 ;) (; has Stack IR ;) (type $FUNCSIG$i) (result i32) + (func $~lib/array/Array#join (; 161 ;) (; has Stack IR ;) (type $FUNCSIG$i) (result i32) (local $0 i32) (local $1 i32) (local $2 i32) @@ -12813,7 +12878,7 @@ ) (get_local $3) ) - (func $~lib/array/Array>#join (; 161 ;) (; has Stack IR ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (func $~lib/array/Array>#join (; 162 ;) (; has Stack IR ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -12957,7 +13022,7 @@ ) (get_local $1) ) - (func $~lib/internal/number/itoa (; 162 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/number/itoa (; 163 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (call $~lib/internal/number/utoa32 (i32.and (get_local $0) @@ -12965,7 +13030,7 @@ ) ) ) - (func $~lib/internal/number/itoa_stream (; 163 ;) (; has Stack IR ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/internal/number/itoa_stream (; 164 ;) (; has Stack IR ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (set_local $0 (i32.add @@ -13011,7 +13076,7 @@ ) (get_local $3) ) - (func $~lib/array/Array#join (; 164 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array#join (; 165 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -13183,7 +13248,7 @@ ) (get_local $3) ) - (func $~lib/array/Array>#join (; 165 ;) (; has Stack IR ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (func $~lib/array/Array>#join (; 166 ;) (; has Stack IR ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -13327,7 +13392,7 @@ ) (get_local $1) ) - (func $~lib/array/Array>#join (; 166 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array>#join (; 167 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -13471,7 +13536,7 @@ ) (get_local $2) ) - (func $~lib/array/Array>>#join (; 167 ;) (; has Stack IR ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (func $~lib/array/Array>>#join (; 168 ;) (; has Stack IR ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -13615,7 +13680,7 @@ ) (get_local $1) ) - (func $start (; 168 ;) (; has Stack IR ;) (type $v) + (func $start (; 169 ;) (; has Stack IR ;) (type $v) (local $0 i32) (local $1 i32) (local $2 f32) @@ -17577,7 +17642,7 @@ ) ) ) - (func $null (; 169 ;) (; has Stack IR ;) (type $v) + (func $null (; 170 ;) (; has Stack IR ;) (type $v) (nop) ) ) diff --git a/tests/compiler/std/array.untouched.wat b/tests/compiler/std/array.untouched.wat index 88053d7e..a704d511 100644 --- a/tests/compiler/std/array.untouched.wat +++ b/tests/compiler/std/array.untouched.wat @@ -230,8 +230,10 @@ (global $std/array/filteredArr (mut i32) (i32.const 0)) (global $std/array/boolVal (mut i32) (i32.const 0)) (global $~lib/math/random_seeded (mut i32) (i32.const 0)) - (global $~lib/math/random_state0 (mut i64) (i64.const 0)) - (global $~lib/math/random_state1 (mut i64) (i64.const 0)) + (global $~lib/math/random_state0_64 (mut i64) (i64.const 0)) + (global $~lib/math/random_state1_64 (mut i64) (i64.const 0)) + (global $~lib/math/random_state0_32 (mut i32) (i32.const 0)) + (global $~lib/math/random_state1_32 (mut i32) (i32.const 0)) (global $std/array/charset i32 (i32.const 488)) (global $NaN f64 (f64.const nan:0x8000000000000)) (global $Infinity f64 (f64.const inf)) @@ -5958,7 +5960,58 @@ ) (get_local $0) ) - (func $~lib/math/NativeMath.seedRandom (; 85 ;) (type $Iv) (param $0 i64) + (func $~lib/math/splitMix32 (; 85 ;) (type $ii) (param $0 i32) (result i32) + (set_local $0 + (i32.add + (get_local $0) + (i32.const 1831565813) + ) + ) + (set_local $0 + (i32.mul + (i32.xor + (get_local $0) + (i32.shr_u + (get_local $0) + (i32.const 15) + ) + ) + (i32.or + (get_local $0) + (i32.const 1) + ) + ) + ) + (set_local $0 + (i32.xor + (get_local $0) + (i32.add + (get_local $0) + (i32.mul + (i32.xor + (get_local $0) + (i32.shr_u + (get_local $0) + (i32.const 7) + ) + ) + (i32.or + (get_local $0) + (i32.const 61) + ) + ) + ) + ) + ) + (i32.xor + (get_local $0) + (i32.shr_u + (get_local $0) + (i32.const 14) + ) + ) + ) + (func $~lib/math/NativeMath.seedRandom (; 86 ;) (type $Iv) (param $0 i64) (if (i64.eqz (get_local $0) @@ -5976,18 +6029,33 @@ (set_global $~lib/math/random_seeded (i32.const 1) ) - (set_global $~lib/math/random_state0 + (set_global $~lib/math/random_state0_64 (call $~lib/math/murmurHash3 (get_local $0) ) ) - (set_global $~lib/math/random_state1 + (set_global $~lib/math/random_state1_64 (call $~lib/math/murmurHash3 - (get_global $~lib/math/random_state0) + (i64.xor + (get_global $~lib/math/random_state0_64) + (i64.const -1) + ) + ) + ) + (set_global $~lib/math/random_state0_32 + (call $~lib/math/splitMix32 + (i32.wrap/i64 + (get_local $0) + ) + ) + ) + (set_global $~lib/math/random_state1_32 + (call $~lib/math/splitMix32 + (get_global $~lib/math/random_state0_32) ) ) ) - (func $~lib/internal/array/insertionSort (; 86 ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) + (func $~lib/internal/array/insertionSort (; 87 ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (local $4 i32) (local $5 f32) (local $6 i32) @@ -6140,10 +6208,10 @@ ) ) ) - (func $~lib/allocator/arena/__memory_free (; 87 ;) (type $iv) (param $0 i32) + (func $~lib/allocator/arena/__memory_free (; 88 ;) (type $iv) (param $0 i32) (nop) ) - (func $~lib/internal/array/weakHeapSort (; 88 ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) + (func $~lib/internal/array/weakHeapSort (; 89 ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (local $4 i32) (local $5 i32) (local $6 i32) @@ -6741,7 +6809,7 @@ ) ) ) - (func $~lib/array/Array#sort (; 89 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array#sort (; 90 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -6892,7 +6960,7 @@ (get_local $0) ) ) - (func $~lib/array/Array#sort|trampoline~anonymous|43 (; 90 ;) (type $ffi) (param $0 f32) (param $1 f32) (result i32) + (func $~lib/array/Array#sort|trampoline~anonymous|43 (; 91 ;) (type $ffi) (param $0 f32) (param $1 f32) (result i32) (local $2 i32) (local $3 i32) (set_local $2 @@ -6940,7 +7008,7 @@ ) ) ) - (func $~lib/array/Array#sort|trampoline (; 91 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array#sort|trampoline (; 92 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (block $1of1 (block $0of1 (block $outOfRange @@ -6963,13 +7031,13 @@ (get_local $1) ) ) - (func $~lib/builtins/isNaN (; 92 ;) (type $fi) (param $0 f32) (result i32) + (func $~lib/builtins/isNaN (; 93 ;) (type $fi) (param $0 f32) (result i32) (f32.ne (get_local $0) (get_local $0) ) ) - (func $std/array/isArraysEqual (; 93 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $std/array/isArraysEqual (; 94 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (if (i32.eqz @@ -7067,7 +7135,7 @@ ) (i32.const 1) ) - (func $~lib/internal/array/insertionSort (; 94 ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) + (func $~lib/internal/array/insertionSort (; 95 ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (local $4 i32) (local $5 f64) (local $6 i32) @@ -7220,7 +7288,7 @@ ) ) ) - (func $~lib/internal/array/weakHeapSort (; 95 ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) + (func $~lib/internal/array/weakHeapSort (; 96 ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (local $4 i32) (local $5 i32) (local $6 i32) @@ -7818,7 +7886,7 @@ ) ) ) - (func $~lib/array/Array#sort (; 96 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array#sort (; 97 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -7969,7 +8037,7 @@ (get_local $0) ) ) - (func $~lib/array/Array#sort|trampoline~anonymous|44 (; 97 ;) (type $FFi) (param $0 f64) (param $1 f64) (result i32) + (func $~lib/array/Array#sort|trampoline~anonymous|44 (; 98 ;) (type $FFi) (param $0 f64) (param $1 f64) (result i32) (local $2 i64) (local $3 i64) (set_local $2 @@ -8017,7 +8085,7 @@ ) ) ) - (func $~lib/array/Array#sort|trampoline (; 98 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array#sort|trampoline (; 99 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (block $1of1 (block $0of1 (block $outOfRange @@ -8040,7 +8108,7 @@ (get_local $1) ) ) - (func $~lib/array/Array#__get (; 99 ;) (type $iiF) (param $0 i32) (param $1 i32) (result f64) + (func $~lib/array/Array#__get (; 100 ;) (type $iiF) (param $0 i32) (param $1 i32) (result f64) (local $2 i32) (set_local $2 (i32.load @@ -8071,13 +8139,13 @@ (unreachable) ) ) - (func $~lib/builtins/isNaN (; 100 ;) (type $Fi) (param $0 f64) (result i32) + (func $~lib/builtins/isNaN (; 101 ;) (type $Fi) (param $0 f64) (result i32) (f64.ne (get_local $0) (get_local $0) ) ) - (func $std/array/isArraysEqual (; 101 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $std/array/isArraysEqual (; 102 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (if (i32.eqz @@ -8175,7 +8243,7 @@ ) (i32.const 1) ) - (func $~lib/internal/array/insertionSort (; 102 ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) + (func $~lib/internal/array/insertionSort (; 103 ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (local $4 i32) (local $5 i32) (local $6 i32) @@ -8328,7 +8396,7 @@ ) ) ) - (func $~lib/internal/array/weakHeapSort (; 103 ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) + (func $~lib/internal/array/weakHeapSort (; 104 ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (local $4 i32) (local $5 i32) (local $6 i32) @@ -8926,7 +8994,7 @@ ) ) ) - (func $~lib/array/Array#sort (; 104 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array#sort (; 105 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -9077,13 +9145,13 @@ (get_local $0) ) ) - (func $~lib/array/Array#sort|trampoline~anonymous|45 (; 105 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array#sort|trampoline~anonymous|45 (; 106 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.sub (get_local $0) (get_local $1) ) ) - (func $~lib/array/Array#sort|trampoline (; 106 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array#sort|trampoline (; 107 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (block $1of1 (block $0of1 (block $outOfRange @@ -9106,7 +9174,7 @@ (get_local $1) ) ) - (func $std/array/isArraysEqual (; 107 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $std/array/isArraysEqual (; 108 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (if (i32.eqz @@ -9183,7 +9251,7 @@ ) (i32.const 1) ) - (func $~lib/internal/array/insertionSort (; 108 ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) + (func $~lib/internal/array/insertionSort (; 109 ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (local $4 i32) (local $5 i32) (local $6 i32) @@ -9336,7 +9404,7 @@ ) ) ) - (func $~lib/internal/array/weakHeapSort (; 109 ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) + (func $~lib/internal/array/weakHeapSort (; 110 ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (local $4 i32) (local $5 i32) (local $6 i32) @@ -9934,7 +10002,7 @@ ) ) ) - (func $~lib/array/Array#sort (; 110 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array#sort (; 111 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -10085,7 +10153,7 @@ (get_local $0) ) ) - (func $~lib/array/Array#sort|trampoline~anonymous|46 (; 111 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array#sort|trampoline~anonymous|46 (; 112 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.sub (i32.gt_u (get_local $0) @@ -10097,7 +10165,7 @@ ) ) ) - (func $~lib/array/Array#sort|trampoline (; 112 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array#sort|trampoline (; 113 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (block $1of1 (block $0of1 (block $outOfRange @@ -10120,7 +10188,7 @@ (get_local $1) ) ) - (func $std/array/createReverseOrderedArray (; 113 ;) (type $ii) (param $0 i32) (result i32) + (func $std/array/createReverseOrderedArray (; 114 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (set_local $1 @@ -10172,7 +10240,7 @@ ) (get_local $1) ) - (func $~lib/math/NativeMath.random (; 114 ;) (type $F) (result f64) + (func $~lib/math/NativeMath.random (; 115 ;) (type $F) (result f64) (local $0 i64) (local $1 i64) (local $2 i64) @@ -10184,19 +10252,19 @@ (call $~lib/env/abort (i32.const 0) (i32.const 456) - (i32.const 962) + (i32.const 964) (i32.const 24) ) (unreachable) ) ) (set_local $0 - (get_global $~lib/math/random_state0) + (get_global $~lib/math/random_state0_64) ) (set_local $1 - (get_global $~lib/math/random_state1) + (get_global $~lib/math/random_state1_64) ) - (set_global $~lib/math/random_state0 + (set_global $~lib/math/random_state0_64 (get_local $1) ) (set_local $0 @@ -10232,7 +10300,7 @@ ) ) ) - (set_global $~lib/math/random_state1 + (set_global $~lib/math/random_state1_64 (get_local $0) ) (set_local $2 @@ -10254,7 +10322,7 @@ (f64.const 1) ) ) - (func $std/array/createRandomOrderedArray (; 115 ;) (type $ii) (param $0 i32) (result i32) + (func $std/array/createRandomOrderedArray (; 116 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (set_local $1 @@ -10307,13 +10375,13 @@ ) (get_local $1) ) - (func $std/array/assertSortedDefault~anonymous|47 (; 116 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $std/array/assertSortedDefault~anonymous|47 (; 117 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.sub (get_local $0) (get_local $1) ) ) - (func $std/array/isSorted (; 117 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $std/array/isSorted (; 118 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (block $break|0 @@ -10376,7 +10444,7 @@ ) (i32.const 1) ) - (func $std/array/assertSorted (; 118 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $std/array/assertSorted (; 119 ;) (type $iiv) (param $0 i32) (param $1 i32) (if (i32.eqz (call $std/array/isSorted @@ -10398,7 +10466,7 @@ ) ) ) - (func $std/array/assertSortedDefault (; 119 ;) (type $iv) (param $0 i32) + (func $std/array/assertSortedDefault (; 120 ;) (type $iv) (param $0 i32) (call $std/array/assertSorted (get_local $0) (block $~lib/internal/array/defaultComparator|inlined.1 (result i32) @@ -10408,31 +10476,31 @@ ) ) ) - (func $start~anonymous|48 (; 120 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $start~anonymous|48 (; 121 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.sub (get_local $0) (get_local $1) ) ) - (func $start~anonymous|49 (; 121 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $start~anonymous|49 (; 122 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.sub (get_local $1) (get_local $0) ) ) - (func $start~anonymous|50 (; 122 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $start~anonymous|50 (; 123 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.sub (get_local $0) (get_local $1) ) ) - (func $start~anonymous|51 (; 123 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $start~anonymous|51 (; 124 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.sub (get_local $1) (get_local $0) ) ) - (func $~lib/array/Array>#constructor (; 124 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array>#constructor (; 125 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -10512,7 +10580,7 @@ ) (get_local $0) ) - (func $~lib/array/Array>#__set (; 125 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/array/Array>#__set (; 126 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (set_local $3 @@ -10587,7 +10655,7 @@ ) ) ) - (func $~lib/array/Array>#__get (; 126 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array>#__get (; 127 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (set_local $2 (i32.load @@ -10618,7 +10686,7 @@ (unreachable) ) ) - (func $std/array/createReverseOrderedNestedArray (; 127 ;) (type $ii) (param $0 i32) (result i32) + (func $std/array/createReverseOrderedNestedArray (; 128 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (set_local $1 @@ -10683,7 +10751,7 @@ ) (get_local $1) ) - (func $start~anonymous|52 (; 128 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $start~anonymous|52 (; 129 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.sub (call $~lib/array/Array#__get (get_local $0) @@ -10695,7 +10763,7 @@ ) ) ) - (func $~lib/internal/array/insertionSort> (; 129 ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) + (func $~lib/internal/array/insertionSort> (; 130 ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (local $4 i32) (local $5 i32) (local $6 i32) @@ -10848,7 +10916,7 @@ ) ) ) - (func $~lib/array/Array>#sort (; 130 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array>#sort (; 131 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -10987,7 +11055,7 @@ (get_local $0) ) ) - (func $std/array/isSorted> (; 131 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $std/array/isSorted> (; 132 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (block $break|0 @@ -11050,7 +11118,7 @@ ) (i32.const 1) ) - (func $std/array/assertSorted> (; 132 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $std/array/assertSorted> (; 133 ;) (type $iiv) (param $0 i32) (param $1 i32) (if (i32.eqz (call $std/array/isSorted> @@ -11072,7 +11140,7 @@ ) ) ) - (func $~lib/array/Array>#constructor (; 133 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array>#constructor (; 134 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -11152,7 +11220,7 @@ ) (get_local $0) ) - (func $std/array/Proxy#constructor (; 134 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $std/array/Proxy#constructor (; 135 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (tee_local $0 (if (result i32) @@ -11175,7 +11243,7 @@ ) ) ) - (func $~lib/array/Array>#__set (; 135 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/array/Array>#__set (; 136 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (set_local $3 @@ -11250,7 +11318,7 @@ ) ) ) - (func $std/array/createReverseOrderedElementsArray (; 136 ;) (type $ii) (param $0 i32) (result i32) + (func $std/array/createReverseOrderedElementsArray (; 137 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (set_local $1 @@ -11305,7 +11373,7 @@ ) (get_local $1) ) - (func $start~anonymous|53 (; 137 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $start~anonymous|53 (; 138 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.sub (i32.load (get_local $0) @@ -11315,7 +11383,7 @@ ) ) ) - (func $~lib/internal/array/insertionSort> (; 138 ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) + (func $~lib/internal/array/insertionSort> (; 139 ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (local $4 i32) (local $5 i32) (local $6 i32) @@ -11468,7 +11536,7 @@ ) ) ) - (func $~lib/array/Array>#sort (; 139 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array>#sort (; 140 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -11607,7 +11675,7 @@ (get_local $0) ) ) - (func $~lib/array/Array>#__get (; 140 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array>#__get (; 141 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (set_local $2 (i32.load @@ -11638,7 +11706,7 @@ (unreachable) ) ) - (func $std/array/isSorted> (; 141 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $std/array/isSorted> (; 142 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (block $break|0 @@ -11701,7 +11769,7 @@ ) (i32.const 1) ) - (func $std/array/assertSorted> (; 142 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $std/array/assertSorted> (; 143 ;) (type $iiv) (param $0 i32) (param $1 i32) (if (i32.eqz (call $std/array/isSorted> @@ -11723,7 +11791,7 @@ ) ) ) - (func $~lib/internal/string/compareUnsafe (; 143 ;) (type $iiiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (param $4 i32) (result i32) + (func $~lib/internal/string/compareUnsafe (; 144 ;) (type $iiiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (param $4 i32) (result i32) (local $5 i32) (local $6 i32) (local $7 i32) @@ -11795,7 +11863,7 @@ ) (get_local $5) ) - (func $~lib/string/String.__gt (; 144 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/string/String.__gt (; 145 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -11879,7 +11947,7 @@ (i32.const 0) ) ) - (func $~lib/string/String.__lt (; 145 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/string/String.__lt (; 146 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -11963,7 +12031,7 @@ (i32.const 0) ) ) - (func $start~anonymous|54 (; 146 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $start~anonymous|54 (; 147 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.sub (call $~lib/string/String.__gt (get_local $0) @@ -11975,7 +12043,7 @@ ) ) ) - (func $~lib/internal/array/insertionSort (; 147 ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) + (func $~lib/internal/array/insertionSort (; 148 ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (local $4 i32) (local $5 i32) (local $6 i32) @@ -12128,7 +12196,7 @@ ) ) ) - (func $~lib/array/Array#sort (; 148 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array#sort (; 149 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -12267,7 +12335,7 @@ (get_local $0) ) ) - (func $~lib/array/Array#__get (; 149 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array#__get (; 150 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (set_local $2 (i32.load @@ -12298,7 +12366,7 @@ (unreachable) ) ) - (func $std/array/isSorted (; 150 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $std/array/isSorted (; 151 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (block $break|0 @@ -12361,7 +12429,7 @@ ) (i32.const 1) ) - (func $std/array/assertSorted (; 151 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $std/array/assertSorted (; 152 ;) (type $iiv) (param $0 i32) (param $1 i32) (if (i32.eqz (call $std/array/isSorted @@ -12383,7 +12451,7 @@ ) ) ) - (func $~lib/string/String.__eq (; 152 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/string/String.__eq (; 153 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (if @@ -12439,7 +12507,7 @@ ) ) ) - (func $~lib/string/String.__ne (; 153 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/string/String.__ne (; 154 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.eqz (call $~lib/string/String.__eq (get_local $0) @@ -12447,7 +12515,7 @@ ) ) ) - (func $std/array/isArraysEqual (; 154 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $std/array/isArraysEqual (; 155 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (if (i32.eqz @@ -12524,7 +12592,7 @@ ) (i32.const 1) ) - (func $~lib/array/Array#constructor (; 155 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array#constructor (; 156 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -12604,7 +12672,7 @@ ) (get_local $0) ) - (func $~lib/internal/string/allocateUnsafe (; 156 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/string/allocateUnsafe (; 157 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (if @@ -12657,7 +12725,7 @@ ) (get_local $2) ) - (func $~lib/string/String#charAt (; 157 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/string/String#charAt (; 158 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (if (i32.eqz @@ -12706,7 +12774,7 @@ ) (get_local $2) ) - (func $~lib/internal/string/copyUnsafe (; 158 ;) (type $iiiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (param $4 i32) + (func $~lib/internal/string/copyUnsafe (; 159 ;) (type $iiiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (param $4 i32) (local $5 i32) (local $6 i32) (local $7 i32) @@ -12748,7 +12816,7 @@ ) ) ) - (func $~lib/string/String#concat (; 159 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/string/String#concat (; 160 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -12825,7 +12893,7 @@ ) (get_local $5) ) - (func $~lib/string/String.__concat (; 160 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/string/String.__concat (; 161 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (if (i32.eqz (get_local $0) @@ -12839,7 +12907,7 @@ (get_local $1) ) ) - (func $std/array/createRandomString (; 161 ;) (type $ii) (param $0 i32) (result i32) + (func $std/array/createRandomString (; 162 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 f64) @@ -12895,7 +12963,7 @@ ) (get_local $1) ) - (func $~lib/array/Array#__set (; 162 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/array/Array#__set (; 163 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (set_local $3 @@ -12970,7 +13038,7 @@ ) ) ) - (func $std/array/createRandomStringArray (; 163 ;) (type $ii) (param $0 i32) (result i32) + (func $std/array/createRandomStringArray (; 164 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (set_local $1 @@ -13019,7 +13087,7 @@ ) (get_local $1) ) - (func $start~anonymous|55 (; 164 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $start~anonymous|55 (; 165 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.sub (call $~lib/string/String.__gt (get_local $0) @@ -13031,7 +13099,7 @@ ) ) ) - (func $~lib/string/String#substring (; 165 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/string/String#substring (; 166 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -13187,7 +13255,7 @@ ) (get_local $10) ) - (func $~lib/array/Array#join (; 166 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array#join (; 167 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -13464,7 +13532,7 @@ (get_local $12) ) ) - (func $~lib/internal/number/decimalCount32 (; 167 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/number/decimalCount32 (; 168 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (if (i32.lt_u @@ -13556,7 +13624,7 @@ ) (unreachable) ) - (func $~lib/internal/number/utoa32_lut (; 168 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/internal/number/utoa32_lut (; 169 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -13775,7 +13843,7 @@ ) ) ) - (func $~lib/internal/number/itoa32 (; 169 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/number/itoa32 (; 170 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -13831,14 +13899,14 @@ ) (get_local $3) ) - (func $~lib/internal/number/itoa (; 170 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/number/itoa (; 171 ;) (type $ii) (param $0 i32) (result i32) (return (call $~lib/internal/number/itoa32 (get_local $0) ) ) ) - (func $~lib/internal/number/itoa_stream (; 171 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/internal/number/itoa_stream (; 172 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (set_local $0 @@ -13906,7 +13974,7 @@ ) (get_local $3) ) - (func $~lib/array/Array#join (; 172 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array#join (; 173 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -14132,7 +14200,7 @@ (get_local $11) ) ) - (func $~lib/internal/number/utoa32 (; 173 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/number/utoa32 (; 174 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (if @@ -14162,14 +14230,14 @@ ) (get_local $2) ) - (func $~lib/internal/number/itoa (; 174 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/number/itoa (; 175 ;) (type $ii) (param $0 i32) (result i32) (return (call $~lib/internal/number/utoa32 (get_local $0) ) ) ) - (func $~lib/internal/number/itoa_stream (; 175 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/internal/number/itoa_stream (; 176 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (set_local $0 (i32.add @@ -14211,7 +14279,7 @@ ) (get_local $3) ) - (func $~lib/array/Array#join (; 176 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array#join (; 177 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -14437,7 +14505,7 @@ (get_local $11) ) ) - (func $~lib/builtins/isFinite (; 177 ;) (type $Fi) (param $0 f64) (result i32) + (func $~lib/builtins/isFinite (; 178 ;) (type $Fi) (param $0 f64) (result i32) (f64.eq (f64.sub (get_local $0) @@ -14446,7 +14514,7 @@ (f64.const 0) ) ) - (func $~lib/internal/number/genDigits (; 178 ;) (type $iIiIiIii) (param $0 i32) (param $1 i64) (param $2 i32) (param $3 i64) (param $4 i32) (param $5 i64) (param $6 i32) (result i32) + (func $~lib/internal/number/genDigits (; 179 ;) (type $iIiIiIii) (param $0 i32) (param $1 i64) (param $2 i32) (param $3 i64) (param $4 i32) (param $5 i64) (param $6 i32) (result i32) (local $7 i32) (local $8 i64) (local $9 i64) @@ -15172,7 +15240,7 @@ ) (get_local $15) ) - (func $~lib/internal/number/prettify (; 179 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/internal/number/prettify (; 180 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -15652,7 +15720,7 @@ ) (unreachable) ) - (func $~lib/internal/number/dtoa_core (; 180 ;) (type $iFi) (param $0 i32) (param $1 f64) (result i32) + (func $~lib/internal/number/dtoa_core (; 181 ;) (type $iFi) (param $0 i32) (param $1 f64) (result i32) (local $2 i32) (local $3 i64) (local $4 i32) @@ -16278,7 +16346,7 @@ (get_local $2) ) ) - (func $~lib/internal/number/dtoa (; 181 ;) (type $Fi) (param $0 f64) (result i32) + (func $~lib/internal/number/dtoa (; 182 ;) (type $Fi) (param $0 f64) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -16364,7 +16432,7 @@ ) (get_local $3) ) - (func $~lib/internal/number/dtoa_stream (; 182 ;) (type $iiFi) (param $0 i32) (param $1 i32) (param $2 f64) (result i32) + (func $~lib/internal/number/dtoa_stream (; 183 ;) (type $iiFi) (param $0 i32) (param $1 i32) (param $2 f64) (result i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -16482,7 +16550,7 @@ (get_local $2) ) ) - (func $~lib/array/Array#join (; 183 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array#join (; 184 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 f64) @@ -16708,7 +16776,7 @@ (get_local $11) ) ) - (func $~lib/array/Array#join (; 184 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array#join (; 185 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -16954,7 +17022,7 @@ (get_local $9) ) ) - (func $std/array/Ref#constructor (; 185 ;) (type $ii) (param $0 i32) (result i32) + (func $std/array/Ref#constructor (; 186 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (tee_local $0 (if (result i32) @@ -16973,7 +17041,7 @@ ) ) ) - (func $~lib/array/Array#constructor (; 186 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array#constructor (; 187 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -17053,7 +17121,7 @@ ) (get_local $0) ) - (func $~lib/array/Array#__unchecked_set (; 187 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/array/Array#__unchecked_set (; 188 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (block $~lib/internal/arraybuffer/storeUnsafe|inlined.0 (set_local $3 @@ -17073,7 +17141,7 @@ ) ) ) - (func $~lib/array/Array#join (; 188 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array#join (; 189 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -17297,7 +17365,7 @@ (get_local $11) ) ) - (func $~lib/internal/number/itoa (; 189 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/number/itoa (; 190 ;) (type $ii) (param $0 i32) (result i32) (return (call $~lib/internal/number/itoa32 (i32.shr_s @@ -17310,7 +17378,7 @@ ) ) ) - (func $~lib/internal/number/itoa_stream (; 190 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/internal/number/itoa_stream (; 191 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -17406,7 +17474,7 @@ ) (get_local $3) ) - (func $~lib/array/Array#join (; 191 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array#join (; 192 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -17632,7 +17700,7 @@ (get_local $11) ) ) - (func $~lib/internal/number/itoa (; 192 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/number/itoa (; 193 ;) (type $ii) (param $0 i32) (result i32) (return (call $~lib/internal/number/utoa32 (i32.and @@ -17642,7 +17710,7 @@ ) ) ) - (func $~lib/internal/number/itoa_stream (; 193 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/internal/number/itoa_stream (; 194 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (set_local $0 @@ -17697,7 +17765,7 @@ ) (get_local $3) ) - (func $~lib/array/Array#join (; 194 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array#join (; 195 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -17923,7 +17991,7 @@ (get_local $11) ) ) - (func $~lib/internal/number/decimalCount64 (; 195 ;) (type $Ii) (param $0 i64) (result i32) + (func $~lib/internal/number/decimalCount64 (; 196 ;) (type $Ii) (param $0 i64) (result i32) (local $1 i32) (if (i64.lt_u @@ -18015,7 +18083,7 @@ ) (unreachable) ) - (func $~lib/internal/number/utoa64_lut (; 196 ;) (type $iIiv) (param $0 i32) (param $1 i64) (param $2 i32) + (func $~lib/internal/number/utoa64_lut (; 197 ;) (type $iIiv) (param $0 i32) (param $1 i64) (param $2 i32) (local $3 i32) (local $4 i64) (local $5 i32) @@ -18209,7 +18277,7 @@ (get_local $2) ) ) - (func $~lib/internal/number/utoa64 (; 197 ;) (type $Ii) (param $0 i64) (result i32) + (func $~lib/internal/number/utoa64 (; 198 ;) (type $Ii) (param $0 i64) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -18274,14 +18342,14 @@ ) (get_local $1) ) - (func $~lib/internal/number/itoa (; 198 ;) (type $Ii) (param $0 i64) (result i32) + (func $~lib/internal/number/itoa (; 199 ;) (type $Ii) (param $0 i64) (result i32) (return (call $~lib/internal/number/utoa64 (get_local $0) ) ) ) - (func $~lib/internal/number/itoa_stream (; 199 ;) (type $iiIi) (param $0 i32) (param $1 i32) (param $2 i64) (result i32) + (func $~lib/internal/number/itoa_stream (; 200 ;) (type $iiIi) (param $0 i32) (param $1 i32) (param $2 i64) (result i32) (local $3 i32) (local $4 i32) (set_local $0 @@ -18353,7 +18421,7 @@ ) (get_local $3) ) - (func $~lib/array/Array#join (; 200 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array#join (; 201 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i64) @@ -18579,7 +18647,7 @@ (get_local $11) ) ) - (func $~lib/internal/number/itoa64 (; 201 ;) (type $Ii) (param $0 i64) (result i32) + (func $~lib/internal/number/itoa64 (; 202 ;) (type $Ii) (param $0 i64) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -18673,14 +18741,14 @@ ) (get_local $2) ) - (func $~lib/internal/number/itoa (; 202 ;) (type $Ii) (param $0 i64) (result i32) + (func $~lib/internal/number/itoa (; 203 ;) (type $Ii) (param $0 i64) (result i32) (return (call $~lib/internal/number/itoa64 (get_local $0) ) ) ) - (func $~lib/internal/number/itoa_stream (; 203 ;) (type $iiIi) (param $0 i32) (param $1 i32) (param $2 i64) (result i32) + (func $~lib/internal/number/itoa_stream (; 204 ;) (type $iiIi) (param $0 i32) (param $1 i32) (param $2 i64) (result i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -18781,7 +18849,7 @@ ) (get_local $3) ) - (func $~lib/array/Array#join (; 204 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array#join (; 205 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i64) @@ -19007,7 +19075,7 @@ (get_local $11) ) ) - (func $~lib/array/Array>#join (; 205 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array>#join (; 206 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -19171,7 +19239,7 @@ (get_local $3) ) ) - (func $~lib/internal/number/itoa (; 206 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/number/itoa (; 207 ;) (type $ii) (param $0 i32) (result i32) (return (call $~lib/internal/number/utoa32 (i32.and @@ -19181,7 +19249,7 @@ ) ) ) - (func $~lib/internal/number/itoa_stream (; 207 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/internal/number/itoa_stream (; 208 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (set_local $0 @@ -19236,7 +19304,7 @@ ) (get_local $3) ) - (func $~lib/array/Array#join (; 208 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array#join (; 209 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -19462,7 +19530,7 @@ (get_local $11) ) ) - (func $~lib/array/Array>#join (; 209 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array>#join (; 210 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -19626,7 +19694,7 @@ (get_local $3) ) ) - (func $~lib/array/Array>#join (; 210 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array>#join (; 211 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -19790,7 +19858,7 @@ (get_local $3) ) ) - (func $~lib/array/Array>>#join (; 211 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array>>#join (; 212 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -19954,7 +20022,7 @@ (get_local $3) ) ) - (func $start (; 212 ;) (type $v) + (func $start (; 213 ;) (type $v) (local $0 i32) (local $1 i32) (local $2 i32) @@ -24653,6 +24721,6 @@ ) ) ) - (func $null (; 213 ;) (type $v) + (func $null (; 214 ;) (type $v) ) ) diff --git a/tests/compiler/std/libm.optimized.wat b/tests/compiler/std/libm.optimized.wat index 92ccde65..c1063e9f 100644 --- a/tests/compiler/std/libm.optimized.wat +++ b/tests/compiler/std/libm.optimized.wat @@ -244,12 +244,12 @@ (set_local $0 (f64.sqrt (tee_local $1 - (f64.mul - (f64.add - (f64.const 1) - (get_local $0) - ) + (f64.add (f64.const 0.5) + (f64.mul + (get_local $0) + (f64.const 0.5) + ) ) ) ) @@ -282,12 +282,12 @@ (set_local $0 (f64.sqrt (tee_local $1 - (f64.mul - (f64.sub - (f64.const 1) - (get_local $0) - ) + (f64.sub (f64.const 0.5) + (f64.mul + (get_local $0) + (f64.const 0.5) + ) ) ) ) @@ -1096,14 +1096,14 @@ (set_local $0 (f64.sqrt (tee_local $1 - (f64.mul - (f64.sub - (f64.const 1) + (f64.sub + (f64.const 0.5) + (f64.mul (f64.abs (get_local $0) ) + (f64.const 0.5) ) - (f64.const 0.5) ) ) ) @@ -1205,60 +1205,52 @@ ) ) (func $~lib/math/NativeMath.asinh (; 10 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) - (local $1 i64) + (local $1 f64) (local $2 i64) - (local $3 i64) (set_local $1 - (i64.and - (i64.shr_u + (f64.reinterpret/i64 + (i64.and (tee_local $2 (i64.reinterpret/f64 (get_local $0) ) ) - (i64.const 52) - ) - (i64.const 2047) - ) - ) - (set_local $3 - (i64.shr_u - (get_local $2) - (i64.const 63) - ) - ) - (set_local $0 - (f64.reinterpret/i64 - (i64.and - (get_local $2) (i64.const 9223372036854775807) ) ) ) (if (i64.ge_u - (get_local $1) + (tee_local $2 + (i64.and + (i64.shr_u + (get_local $2) + (i64.const 52) + ) + (i64.const 2047) + ) + ) (i64.const 1049) ) - (set_local $0 + (set_local $1 (f64.add (call $~lib/math/NativeMath.log - (get_local $0) + (get_local $1) ) (f64.const 0.6931471805599453) ) ) (if (i64.ge_u - (get_local $1) + (get_local $2) (i64.const 1024) ) - (set_local $0 + (set_local $1 (call $~lib/math/NativeMath.log (f64.add (f64.mul (f64.const 2) - (get_local $0) + (get_local $1) ) (f64.div (f64.const 1) @@ -1266,13 +1258,13 @@ (f64.sqrt (f64.add (f64.mul - (get_local $0) - (get_local $0) + (get_local $1) + (get_local $1) ) (f64.const 1) ) ) - (get_local $0) + (get_local $1) ) ) ) @@ -1280,24 +1272,24 @@ ) (if (i64.ge_u - (get_local $1) + (get_local $2) (i64.const 997) ) - (set_local $0 + (set_local $1 (call $~lib/math/NativeMath.log1p (f64.add - (get_local $0) + (get_local $1) (f64.div - (tee_local $0 + (tee_local $1 (f64.mul - (get_local $0) - (get_local $0) + (get_local $1) + (get_local $1) ) ) (f64.add (f64.sqrt (f64.add - (get_local $0) + (get_local $1) (f64.const 1) ) ) @@ -1310,18 +1302,10 @@ ) ) ) - (if - (i64.ne - (get_local $3) - (i64.const 0) - ) - (set_local $0 - (f64.neg - (get_local $0) - ) - ) + (f64.copysign + (get_local $1) + (get_local $0) ) - (get_local $0) ) (func $std/libm/asinh (; 11 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) (call $~lib/math/NativeMath.asinh @@ -1335,30 +1319,25 @@ ) ) (func $~lib/math/NativeMath.atan (; 13 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) - (local $1 i32) - (local $2 f64) + (local $1 f64) + (local $2 i32) (local $3 f64) - (local $4 i32) + (local $4 f64) (set_local $4 - (i32.shr_u - (tee_local $1 - (i32.wrap/i64 - (i64.shr_u - (i64.reinterpret/f64 - (get_local $0) - ) - (i64.const 32) - ) - ) - ) - (i32.const 31) - ) + (get_local $0) ) (if (i32.ge_u - (tee_local $1 + (tee_local $2 (i32.and - (get_local $1) + (i32.wrap/i64 + (i64.shr_u + (i64.reinterpret/f64 + (get_local $0) + ) + (i64.const 32) + ) + ) (i32.const 2147483647) ) ) @@ -1374,32 +1353,29 @@ ) ) (return - (tee_local $0 - (if (result f64) - (get_local $4) - (f64.const -1.5707963267948966) - (f64.const 1.5707963267948966) - ) + (f64.copysign + (f64.const 1.5707963267948966) + (get_local $4) ) ) ) ) (if (i32.lt_u - (get_local $1) + (get_local $2) (i32.const 1071382528) ) (block (if (i32.lt_u - (get_local $1) + (get_local $2) (i32.const 1044381696) ) (return (get_local $0) ) ) - (set_local $1 + (set_local $2 (i32.const -1) ) ) @@ -1412,16 +1388,16 @@ (set_local $0 (if (result f64) (i32.lt_u - (get_local $1) + (get_local $2) (i32.const 1072889856) ) (if (result f64) (i32.lt_u - (get_local $1) + (get_local $2) (i32.const 1072037888) ) (block (result f64) - (set_local $1 + (set_local $2 (i32.const 0) ) (f64.div @@ -1439,7 +1415,7 @@ ) ) (block (result f64) - (set_local $1 + (set_local $2 (i32.const 1) ) (f64.div @@ -1456,11 +1432,11 @@ ) (if (result f64) (i32.lt_u - (get_local $1) + (get_local $2) (i32.const 1073971200) ) (block (result f64) - (set_local $1 + (set_local $2 (i32.const 2) ) (f64.div @@ -1478,7 +1454,7 @@ ) ) (block (result f64) - (set_local $1 + (set_local $2 (i32.const 3) ) (f64.div @@ -1491,7 +1467,7 @@ ) ) ) - (set_local $2 + (set_local $1 (f64.mul (tee_local $3 (f64.mul @@ -1502,30 +1478,63 @@ (get_local $3) ) ) - (set_local $3 + (set_local $1 (f64.mul - (get_local $3) + (get_local $0) (f64.add - (f64.const 0.3333333333333293) (f64.mul - (get_local $2) + (get_local $3) (f64.add - (f64.const 0.14285714272503466) + (f64.const 0.3333333333333293) (f64.mul - (get_local $2) + (get_local $1) (f64.add - (f64.const 0.09090887133436507) + (f64.const 0.14285714272503466) (f64.mul - (get_local $2) + (get_local $1) (f64.add - (f64.const 0.06661073137387531) + (f64.const 0.09090887133436507) (f64.mul - (get_local $2) + (get_local $1) (f64.add - (f64.const 0.049768779946159324) + (f64.const 0.06661073137387531) (f64.mul - (get_local $2) - (f64.const 0.016285820115365782) + (get_local $1) + (f64.add + (f64.const 0.049768779946159324) + (f64.mul + (get_local $1) + (f64.const 0.016285820115365782) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + (f64.mul + (get_local $1) + (f64.add + (f64.const -0.19999999999876483) + (f64.mul + (get_local $1) + (f64.add + (f64.const -0.11111110405462356) + (f64.mul + (get_local $1) + (f64.add + (f64.const -0.0769187620504483) + (f64.mul + (get_local $1) + (f64.add + (f64.const -0.058335701337905735) + (f64.mul + (get_local $1) + (f64.const -0.036531572744216916) ) ) ) @@ -1538,51 +1547,15 @@ ) ) ) - (set_local $2 - (f64.mul - (get_local $2) - (f64.add - (f64.const -0.19999999999876483) - (f64.mul - (get_local $2) - (f64.add - (f64.const -0.11111110405462356) - (f64.mul - (get_local $2) - (f64.add - (f64.const -0.0769187620504483) - (f64.mul - (get_local $2) - (f64.add - (f64.const -0.058335701337905735) - (f64.mul - (get_local $2) - (f64.const -0.036531572744216916) - ) - ) - ) - ) - ) - ) - ) - ) - ) - ) (if (i32.lt_s - (get_local $1) + (get_local $2) (i32.const 0) ) (return (f64.sub (get_local $0) - (f64.mul - (get_local $0) - (f64.add - (get_local $3) - (get_local $2) - ) - ) + (get_local $1) ) ) ) @@ -1592,12 +1565,12 @@ (block $case2|0 (block $case1|0 (if - (get_local $1) + (get_local $2) (block (block $tablify|0 (br_table $case1|0 $case2|0 $case3|0 $tablify|0 (i32.sub - (get_local $1) + (get_local $2) (i32.const 1) ) ) @@ -1610,13 +1583,7 @@ (f64.const 0.4636476090008061) (f64.sub (f64.sub - (f64.mul - (get_local $0) - (f64.add - (get_local $3) - (get_local $2) - ) - ) + (get_local $1) (f64.const 2.2698777452961687e-17) ) (get_local $0) @@ -1630,13 +1597,7 @@ (f64.const 0.7853981633974483) (f64.sub (f64.sub - (f64.mul - (get_local $0) - (f64.add - (get_local $3) - (get_local $2) - ) - ) + (get_local $1) (f64.const 3.061616997868383e-17) ) (get_local $0) @@ -1650,13 +1611,7 @@ (f64.const 0.982793723247329) (f64.sub (f64.sub - (f64.mul - (get_local $0) - (f64.add - (get_local $3) - (get_local $2) - ) - ) + (get_local $1) (f64.const 1.3903311031230998e-17) ) (get_local $0) @@ -1670,13 +1625,7 @@ (f64.const 1.5707963267948966) (f64.sub (f64.sub - (f64.mul - (get_local $0) - (f64.add - (get_local $3) - (get_local $2) - ) - ) + (get_local $1) (f64.const 6.123233995736766e-17) ) (get_local $0) @@ -1687,15 +1636,10 @@ ) (unreachable) ) - (if + (f64.copysign + (get_local $3) (get_local $4) - (set_local $3 - (f64.neg - (get_local $3) - ) - ) ) - (get_local $3) ) (func $std/libm/atan (; 14 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) (call $~lib/math/NativeMath.atan @@ -1703,14 +1647,14 @@ ) ) (func $~lib/math/NativeMath.atanh (; 15 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) - (local $1 i64) + (local $1 f64) (local $2 i64) (local $3 i64) (local $4 f64) (set_local $2 (i64.and (i64.shr_u - (tee_local $1 + (tee_local $3 (i64.reinterpret/f64 (get_local $0) ) @@ -1720,16 +1664,10 @@ (i64.const 2047) ) ) - (set_local $3 - (i64.shr_u - (get_local $1) - (i64.const 63) - ) - ) - (set_local $0 + (set_local $1 (f64.reinterpret/i64 (i64.and - (get_local $1) + (get_local $3) (i64.const 9223372036854775807) ) ) @@ -1744,7 +1682,7 @@ (get_local $2) (i64.const 991) ) - (set_local $0 + (set_local $1 (f64.mul (f64.const 0.5) (call $~lib/math/NativeMath.log1p @@ -1752,17 +1690,17 @@ (tee_local $4 (f64.mul (f64.const 2) - (get_local $0) + (get_local $1) ) ) (f64.div (f64.mul (get_local $4) - (get_local $0) + (get_local $1) ) (f64.sub (f64.const 1) - (get_local $0) + (get_local $1) ) ) ) @@ -1770,17 +1708,17 @@ ) ) ) - (set_local $0 + (set_local $1 (f64.mul (f64.const 0.5) (call $~lib/math/NativeMath.log1p (f64.mul (f64.const 2) (f64.div - (get_local $0) + (get_local $1) (f64.sub (f64.const 1) - (get_local $0) + (get_local $1) ) ) ) @@ -1788,18 +1726,10 @@ ) ) ) - (if - (i64.ne - (get_local $3) - (i64.const 0) - ) - (set_local $0 - (f64.neg - (get_local $0) - ) - ) + (f64.copysign + (get_local $1) + (get_local $0) ) - (get_local $0) ) (func $std/libm/atanh (; 16 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) (call $~lib/math/NativeMath.atanh @@ -2372,17 +2302,17 @@ ) (func $~lib/math/NativeMath.expm1 (; 25 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) (local $1 f64) - (local $2 i32) - (local $3 f64) + (local $2 f64) + (local $3 i32) (local $4 i32) - (local $5 i64) + (local $5 f64) (local $6 i32) - (local $7 f64) + (local $7 i64) (local $8 f64) - (set_local $4 + (set_local $6 (i32.wrap/i64 (i64.shr_u - (tee_local $5 + (tee_local $7 (i64.reinterpret/f64 (get_local $0) ) @@ -2393,11 +2323,11 @@ ) (if (i32.ge_u - (tee_local $6 + (tee_local $4 (i32.wrap/i64 (i64.and (i64.shr_u - (get_local $5) + (get_local $7) (i64.const 32) ) (i64.const 2147483647) @@ -2416,7 +2346,7 @@ ) ) (if - (get_local $4) + (get_local $6) (return (f64.const -1) ) @@ -2437,68 +2367,43 @@ ) (if (i32.gt_u - (get_local $6) + (get_local $4) (i32.const 1071001154) ) (block - (if - (i32.lt_u - (get_local $6) - (i32.const 1072734898) - ) - (set_local $0 - (if (result f64) - (get_local $4) - (block (result f64) - (set_local $1 - (f64.const -1.9082149292705877e-10) - ) - (set_local $2 - (i32.const -1) - ) - (f64.add - (get_local $0) - (f64.const 0.6931471803691238) - ) - ) - (block (result f64) - (set_local $1 - (f64.const 1.9082149292705877e-10) - ) - (set_local $2 - (i32.const 1) - ) - (f64.sub - (get_local $0) - (f64.const 0.6931471803691238) - ) - ) - ) - ) - (block - (set_local $0 + (set_local $0 + (f64.sub + (tee_local $2 (f64.sub (get_local $0) (f64.mul (tee_local $1 (f64.convert_s/i32 - (tee_local $2 - (i32.trunc_s/f64 - (f64.add - (tee_local $3 + (tee_local $3 + (select + (i32.sub + (i32.const 1) + (i32.shl + (get_local $6) + (i32.const 1) + ) + ) + (i32.trunc_s/f64 + (f64.add (f64.mul (f64.const 1.4426950408889634) (get_local $0) ) - ) - (tee_local $1 - (if (result f64) - (get_local $4) - (f64.const -0.5) + (f64.copysign (f64.const 0.5) + (get_local $0) ) ) ) + (i32.lt_u + (get_local $4) + (i32.const 1072734898) + ) ) ) ) @@ -2507,7 +2412,7 @@ ) ) ) - (set_local $1 + (tee_local $1 (f64.mul (get_local $1) (f64.const 1.9082149292705877e-10) @@ -2515,16 +2420,11 @@ ) ) ) - (set_local $7 + (set_local $5 (f64.sub (f64.sub + (get_local $2) (get_local $0) - (tee_local $0 - (f64.sub - (get_local $0) - (get_local $1) - ) - ) ) (get_local $1) ) @@ -2532,7 +2432,7 @@ ) (if (i32.lt_u - (get_local $6) + (get_local $4) (i32.const 1016070144) ) (return @@ -2544,7 +2444,7 @@ (f64.add (f64.const 1) (f64.mul - (tee_local $3 + (tee_local $2 (f64.mul (get_local $0) (tee_local $8 @@ -2558,19 +2458,19 @@ (f64.add (f64.const -0.03333333333333313) (f64.mul - (get_local $3) + (get_local $2) (f64.add (f64.const 1.5873015872548146e-03) (f64.mul - (get_local $3) + (get_local $2) (f64.add (f64.const -7.93650757867488e-05) (f64.mul - (get_local $3) + (get_local $2) (f64.add (f64.const 4.008217827329362e-06) (f64.mul - (get_local $3) + (get_local $2) (f64.const -2.0109921818362437e-07) ) ) @@ -2585,7 +2485,7 @@ ) (set_local $1 (f64.mul - (get_local $3) + (get_local $2) (f64.div (f64.sub (get_local $1) @@ -2611,7 +2511,7 @@ ) (if (i32.eqz - (get_local $2) + (get_local $3) ) (return (f64.sub @@ -2621,7 +2521,7 @@ (get_local $0) (get_local $1) ) - (get_local $3) + (get_local $2) ) ) ) @@ -2633,17 +2533,17 @@ (get_local $0) (f64.sub (get_local $1) - (get_local $7) + (get_local $5) ) ) - (get_local $7) + (get_local $5) ) - (get_local $3) + (get_local $2) ) ) (if (i32.eq - (get_local $2) + (get_local $3) (i32.const -1) ) (return @@ -2661,7 +2561,7 @@ ) (if (i32.eq - (get_local $2) + (get_local $3) (i32.const 1) ) (block @@ -2697,12 +2597,12 @@ ) ) ) - (set_local $3 + (set_local $5 (f64.reinterpret/i64 (i64.shl (i64.add (i64.extend_s/i32 - (get_local $2) + (get_local $3) ) (i64.const 1023) ) @@ -2714,14 +2614,14 @@ (i32.eqz (tee_local $4 (i32.lt_s - (get_local $2) + (get_local $3) (i32.const 0) ) ) ) (set_local $4 (i32.gt_s - (get_local $2) + (get_local $3) (i32.const 56) ) ) @@ -2729,7 +2629,7 @@ (if (get_local $4) (block - (set_local $0 + (set_local $2 (f64.add (f64.sub (get_local $0) @@ -2740,94 +2640,82 @@ ) (return (f64.sub - (tee_local $0 + (tee_local $2 (if (result f64) (i32.eq - (get_local $2) + (get_local $3) (i32.const 1024) ) (f64.mul (f64.mul - (get_local $0) + (get_local $2) (f64.const 2) ) (f64.const 8988465674311579538646525e283) ) (f64.mul - (get_local $0) - (get_local $3) - ) - ) - ) - (f64.const 1) - ) - ) - ) - ) - (set_local $5 - (i64.shl - (i64.sub - (i64.const 1023) - (i64.extend_s/i32 - (get_local $2) - ) - ) - (i64.const 52) - ) - ) - (tee_local $0 - (if (result f64) - (i32.lt_s - (get_local $2) - (i32.const 20) - ) - (f64.mul - (f64.add - (f64.sub - (get_local $0) - (get_local $1) - ) - (f64.sub - (f64.const 1) - (f64.reinterpret/i64 - (get_local $5) - ) - ) - ) - (get_local $3) - ) - (f64.mul - (f64.add - (f64.sub - (get_local $0) - (f64.add - (get_local $1) - (f64.reinterpret/i64 + (get_local $2) (get_local $5) ) ) ) (f64.const 1) ) - (get_local $3) ) ) ) + (set_local $2 + (f64.reinterpret/i64 + (i64.shl + (i64.sub + (i64.const 1023) + (i64.extend_s/i32 + (get_local $3) + ) + ) + (i64.const 52) + ) + ) + ) + (f64.mul + (f64.add + (get_local $0) + (tee_local $2 + (if (result f64) + (i32.lt_s + (get_local $3) + (i32.const 20) + ) + (f64.sub + (f64.sub + (f64.const 1) + (get_local $2) + ) + (get_local $1) + ) + (f64.sub + (f64.const 1) + (f64.add + (get_local $1) + (get_local $2) + ) + ) + ) + ) + ) + (get_local $5) + ) ) (func $~lib/math/NativeMath.scalbn (; 26 ;) (; has Stack IR ;) (type $FiF) (param $0 f64) (param $1 i32) (result f64) - (local $2 f64) - (set_local $2 - (get_local $0) - ) (if (i32.gt_s (get_local $1) (i32.const 1023) ) (block - (set_local $2 + (set_local $0 (f64.mul - (get_local $2) + (get_local $0) (f64.const 8988465674311579538646525e283) ) ) @@ -2842,14 +2730,14 @@ (i32.const 1023) ) (block - (set_local $2 + (set_local $0 (f64.mul - (get_local $2) + (get_local $0) (f64.const 8988465674311579538646525e283) ) ) - (if - (i32.gt_s + (set_local $1 + (select (tee_local $1 (i32.sub (get_local $1) @@ -2857,9 +2745,10 @@ ) ) (i32.const 1023) - ) - (set_local $1 - (i32.const 1023) + (i32.lt_s + (get_local $1) + (i32.const 1023) + ) ) ) ) @@ -2871,10 +2760,10 @@ (i32.const -1022) ) (block - (set_local $2 + (set_local $0 (f64.mul - (get_local $2) - (f64.const 2.2250738585072014e-308) + (get_local $0) + (f64.const 2.004168360008973e-292) ) ) (if @@ -2882,30 +2771,31 @@ (tee_local $1 (i32.add (get_local $1) - (i32.const 1022) + (i32.const 969) ) ) (i32.const -1022) ) (block - (set_local $2 + (set_local $0 (f64.mul - (get_local $2) - (f64.const 2.2250738585072014e-308) + (get_local $0) + (f64.const 2.004168360008973e-292) ) ) - (if - (i32.lt_s + (set_local $1 + (select (tee_local $1 (i32.add (get_local $1) - (i32.const 1022) + (i32.const 969) ) ) (i32.const -1022) - ) - (set_local $1 - (i32.const -1022) + (i32.gt_s + (get_local $1) + (i32.const -1022) + ) ) ) ) @@ -2914,7 +2804,7 @@ ) ) (f64.mul - (get_local $2) + (get_local $0) (f64.reinterpret/i64 (i64.shl (i64.add @@ -2931,10 +2821,10 @@ (func $~lib/math/NativeMath.exp (; 27 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) (local $1 i32) (local $2 i32) - (local $3 i32) + (local $3 f64) (local $4 f64) - (local $5 f64) - (set_local $3 + (local $5 i32) + (set_local $5 (i32.shr_u (tee_local $1 (i32.wrap/i64 @@ -2998,7 +2888,7 @@ ) (set_local $0 (f64.sub - (tee_local $5 + (tee_local $4 (f64.sub (get_local $0) (f64.mul @@ -3023,11 +2913,11 @@ ) ) (i32.sub - (i32.sub + (i32.const 1) + (i32.shl + (get_local $5) (i32.const 1) - (get_local $3) ) - (get_local $3) ) ) ) @@ -3037,7 +2927,7 @@ ) ) ) - (tee_local $4 + (tee_local $3 (f64.mul (get_local $0) (f64.const 1.9082149292705877e-10) @@ -3045,7 +2935,7 @@ ) ) ) - (set_local $5 + (set_local $4 (if (result f64) (i32.gt_u (get_local $1) @@ -3113,9 +3003,9 @@ (get_local $0) ) ) - (get_local $4) + (get_local $3) ) - (get_local $5) + (get_local $4) ) ) ) @@ -3132,21 +3022,7 @@ (get_local $2) ) ) - (func $~lib/math/expo2 (; 28 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) - (f64.mul - (f64.mul - (call $~lib/math/NativeMath.exp - (f64.sub - (get_local $0) - (f64.const 1416.0996898839683) - ) - ) - (f64.const 2247116418577894884661631e283) - ) - (f64.const 2247116418577894884661631e283) - ) - ) - (func $~lib/math/NativeMath.cosh (; 29 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) + (func $~lib/math/NativeMath.cosh (; 28 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) (local $1 i32) (local $2 i64) (set_local $0 @@ -3195,10 +3071,10 @@ ) (get_local $0) ) - (f64.mul + (f64.add (f64.const 2) - (f64.add - (f64.const 1) + (f64.mul + (f64.const 2) (get_local $0) ) ) @@ -3229,39 +3105,48 @@ ) ) ) - (call $~lib/math/expo2 - (get_local $0) + (f64.mul + (f64.mul + (call $~lib/math/NativeMath.exp + (f64.sub + (get_local $0) + (f64.const 1416.0996898839683) + ) + ) + (f64.const 2247116418577894884661631e283) + ) + (f64.const 2247116418577894884661631e283) ) ) - (func $std/libm/cosh (; 30 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) + (func $std/libm/cosh (; 29 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) (call $~lib/math/NativeMath.cosh (get_local $0) ) ) - (func $std/libm/exp (; 31 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) + (func $std/libm/exp (; 30 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) (call $~lib/math/NativeMath.exp (get_local $0) ) ) - (func $std/libm/expm1 (; 32 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) + (func $std/libm/expm1 (; 31 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) (call $~lib/math/NativeMath.expm1 (get_local $0) ) ) - (func $std/libm/floor (; 33 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) + (func $std/libm/floor (; 32 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) (f64.floor (get_local $0) ) ) - (func $std/libm/fround (; 34 ;) (; has Stack IR ;) (type $Ff) (param $0 f64) (result f32) + (func $std/libm/fround (; 33 ;) (; has Stack IR ;) (type $Ff) (param $0 f64) (result f32) (f32.demote/f64 (get_local $0) ) ) - (func $~lib/math/NativeMath.hypot (; 35 ;) (; has Stack IR ;) (type $FFF) (param $0 f64) (param $1 f64) (result f64) + (func $~lib/math/NativeMath.hypot (; 34 ;) (; has Stack IR ;) (type $FFF) (param $0 f64) (param $1 f64) (result f64) (local $2 f64) - (local $3 f64) - (local $4 i64) + (local $3 i64) + (local $4 f64) (local $5 i64) (local $6 i32) (local $7 f64) @@ -3279,7 +3164,7 @@ (i64.const 9223372036854775807) ) ) - (tee_local $4 + (tee_local $3 (i64.and (i64.reinterpret/f64 (get_local $1) @@ -3293,9 +3178,9 @@ (get_local $5) ) (set_local $5 - (get_local $4) + (get_local $3) ) - (set_local $4 + (set_local $3 (get_local $10) ) ) @@ -3310,7 +3195,7 @@ ) (set_local $1 (f64.reinterpret/i64 - (get_local $4) + (get_local $3) ) ) (if @@ -3318,7 +3203,7 @@ (tee_local $8 (i32.wrap/i64 (i64.shr_u - (get_local $4) + (get_local $3) (i64.const 52) ) ) @@ -3345,7 +3230,7 @@ ) (set_local $9 (i64.eq - (get_local $4) + (get_local $3) (i64.const 0) ) ) @@ -3420,7 +3305,7 @@ ) ) ) - (set_local $3 + (set_local $4 (f64.sub (get_local $0) (tee_local $2 @@ -3441,34 +3326,31 @@ ) (set_local $11 (f64.add - (f64.add - (f64.sub + (f64.sub + (f64.mul + (get_local $2) + (get_local $2) + ) + (tee_local $0 (f64.mul - (get_local $2) - (get_local $2) - ) - (tee_local $0 - (f64.mul - (get_local $0) - (get_local $0) - ) + (get_local $0) + (get_local $0) ) ) - (f64.mul + ) + (f64.mul + (f64.add (f64.mul (f64.const 2) (get_local $2) ) - (get_local $3) + (get_local $4) ) - ) - (f64.mul - (get_local $3) - (get_local $3) + (get_local $4) ) ) ) - (set_local $3 + (set_local $4 (f64.sub (get_local $1) (tee_local $2 @@ -3495,30 +3377,27 @@ (f64.add (tee_local $2 (f64.add - (f64.add - (f64.sub + (f64.sub + (f64.mul + (get_local $2) + (get_local $2) + ) + (tee_local $1 (f64.mul - (get_local $2) - (get_local $2) - ) - (tee_local $1 - (f64.mul - (get_local $1) - (get_local $1) - ) + (get_local $1) + (get_local $1) ) ) - (f64.mul + ) + (f64.mul + (f64.add (f64.mul (f64.const 2) (get_local $2) ) - (get_local $3) + (get_local $4) ) - ) - (f64.mul - (get_local $3) - (get_local $3) + (get_local $4) ) ) ) @@ -3531,13 +3410,13 @@ ) ) ) - (func $std/libm/hypot (; 36 ;) (; has Stack IR ;) (type $FFF) (param $0 f64) (param $1 f64) (result f64) + (func $std/libm/hypot (; 35 ;) (; has Stack IR ;) (type $FFF) (param $0 f64) (param $1 f64) (result f64) (call $~lib/math/NativeMath.hypot (get_local $0) (get_local $1) ) ) - (func $~lib/math/NativeMath.imul (; 37 ;) (; has Stack IR ;) (type $FFF) (param $0 f64) (param $1 f64) (result f64) + (func $~lib/math/NativeMath.imul (; 36 ;) (; has Stack IR ;) (type $FFF) (param $0 f64) (param $1 f64) (result f64) (f64.convert_s/i32 (i32.mul (i32.trunc_s/f64 @@ -3549,18 +3428,18 @@ ) ) ) - (func $std/libm/imul (; 38 ;) (; has Stack IR ;) (type $FFF) (param $0 f64) (param $1 f64) (result f64) + (func $std/libm/imul (; 37 ;) (; has Stack IR ;) (type $FFF) (param $0 f64) (param $1 f64) (result f64) (call $~lib/math/NativeMath.imul (get_local $0) (get_local $1) ) ) - (func $std/libm/log (; 39 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) + (func $std/libm/log (; 38 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) (call $~lib/math/NativeMath.log (get_local $0) ) ) - (func $~lib/math/NativeMath.log10 (; 40 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) + (func $~lib/math/NativeMath.log10 (; 39 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) (local $1 i32) (local $2 f64) (local $3 i32) @@ -3708,9 +3587,9 @@ ) (set_local $0 (f64.mul - (tee_local $7 + (tee_local $8 (f64.mul - (tee_local $6 + (tee_local $7 (f64.div (tee_local $2 (f64.sub @@ -3743,13 +3622,13 @@ ) ) ) - (get_local $6) + (get_local $7) ) ) - (get_local $7) + (get_local $8) ) ) - (set_local $8 + (set_local $9 (f64.mul (tee_local $11 (f64.convert_s/i32 @@ -3760,85 +3639,83 @@ ) ) (f64.add - (tee_local $6 - (f64.add - (tee_local $6 + (f64.add + (tee_local $2 + (f64.add (f64.add - (f64.add - (f64.mul - (get_local $11) - (f64.const 3.694239077158931e-13) - ) - (f64.mul - (f64.add - (tee_local $0 - (f64.add + (f64.mul + (get_local $11) + (f64.const 3.694239077158931e-13) + ) + (f64.mul + (f64.add + (tee_local $0 + (f64.add + (f64.sub (f64.sub - (f64.sub - (get_local $2) - (tee_local $10 - (f64.reinterpret/i64 - (i64.and - (i64.reinterpret/f64 - (f64.sub - (get_local $2) - (tee_local $9 + (get_local $2) + (tee_local $6 + (f64.reinterpret/i64 + (i64.and + (i64.reinterpret/f64 + (f64.sub + (get_local $2) + (tee_local $10 + (f64.mul (f64.mul - (f64.mul - (f64.const 0.5) - (get_local $2) - ) + (f64.const 0.5) (get_local $2) ) + (get_local $2) ) ) ) - (i64.const -4294967296) ) + (i64.const -4294967296) ) ) ) - (get_local $9) ) - (f64.mul - (get_local $6) + (get_local $10) + ) + (f64.mul + (get_local $7) + (f64.add + (get_local $10) (f64.add - (get_local $9) - (f64.add - (f64.mul - (get_local $7) - (f64.add - (f64.const 0.6666666666666735) - (f64.mul - (get_local $0) - (f64.add - (f64.const 0.2857142874366239) - (f64.mul - (get_local $0) - (f64.add - (f64.const 0.1818357216161805) - (f64.mul - (get_local $0) - (f64.const 0.14798198605116586) - ) + (f64.mul + (get_local $8) + (f64.add + (f64.const 0.6666666666666735) + (f64.mul + (get_local $0) + (f64.add + (f64.const 0.2857142874366239) + (f64.mul + (get_local $0) + (f64.add + (f64.const 0.1818357216161805) + (f64.mul + (get_local $0) + (f64.const 0.14798198605116586) ) ) ) ) ) ) - (f64.mul - (get_local $0) - (f64.add - (f64.const 0.3999999999940942) - (f64.mul - (get_local $0) - (f64.add - (f64.const 0.22222198432149784) - (f64.mul - (get_local $0) - (f64.const 0.15313837699209373) - ) + ) + (f64.mul + (get_local $0) + (f64.add + (f64.const 0.3999999999940942) + (f64.mul + (get_local $0) + (f64.add + (f64.const 0.22222198432149784) + (f64.mul + (get_local $0) + (f64.const 0.15313837699209373) ) ) ) @@ -3848,52 +3725,50 @@ ) ) ) - (get_local $10) ) - (f64.const 2.5082946711645275e-11) + (get_local $6) ) - ) - (f64.mul - (get_local $0) - (f64.const 0.4342944818781689) + (f64.const 2.5082946711645275e-11) ) ) - ) - (f64.add - (f64.sub - (get_local $8) - (tee_local $0 - (f64.add - (get_local $8) - (tee_local $2 - (f64.mul - (get_local $10) - (f64.const 0.4342944818781689) - ) - ) - ) - ) + (f64.mul + (get_local $0) + (f64.const 0.4342944818781689) ) - (get_local $2) ) ) + (f64.add + (f64.sub + (get_local $9) + (tee_local $0 + (f64.add + (get_local $9) + (tee_local $6 + (f64.mul + (get_local $6) + (f64.const 0.4342944818781689) + ) + ) + ) + ) + ) + (get_local $6) + ) ) - (tee_local $2 - (get_local $0) - ) + (get_local $0) ) ) - (func $std/libm/log10 (; 41 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) + (func $std/libm/log10 (; 40 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) (call $~lib/math/NativeMath.log10 (get_local $0) ) ) - (func $std/libm/log1p (; 42 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) + (func $std/libm/log1p (; 41 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) (call $~lib/math/NativeMath.log1p (get_local $0) ) ) - (func $~lib/math/NativeMath.log2 (; 43 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) + (func $~lib/math/NativeMath.log2 (; 42 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) (local $1 i32) (local $2 f64) (local $3 i32) @@ -4204,24 +4079,24 @@ ) ) ) - (func $std/libm/log2 (; 44 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) + (func $std/libm/log2 (; 43 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) (call $~lib/math/NativeMath.log2 (get_local $0) ) ) - (func $std/libm/max (; 45 ;) (; has Stack IR ;) (type $FFF) (param $0 f64) (param $1 f64) (result f64) + (func $std/libm/max (; 44 ;) (; has Stack IR ;) (type $FFF) (param $0 f64) (param $1 f64) (result f64) (f64.max (get_local $0) (get_local $1) ) ) - (func $std/libm/min (; 46 ;) (; has Stack IR ;) (type $FFF) (param $0 f64) (param $1 f64) (result f64) + (func $std/libm/min (; 45 ;) (; has Stack IR ;) (type $FFF) (param $0 f64) (param $1 f64) (result f64) (f64.min (get_local $0) (get_local $1) ) ) - (func $~lib/math/NativeMath.pow (; 47 ;) (; has Stack IR ;) (type $FFF) (param $0 f64) (param $1 f64) (result f64) + (func $~lib/math/NativeMath.pow (; 46 ;) (; has Stack IR ;) (type $FFF) (param $0 f64) (param $1 f64) (result f64) (local $2 f64) (local $3 f64) (local $4 i32) @@ -4235,12 +4110,12 @@ (local $12 i32) (local $13 f64) (local $14 f64) - (local $15 i32) - (local $16 f64) + (local $15 f64) + (local $16 i32) (local $17 i64) (local $18 i32) - (local $19 i32) - (local $20 f64) + (local $19 f64) + (local $20 i32) (block $folding-inner1 (block $folding-inner0 (set_local $18 @@ -4255,12 +4130,12 @@ ) ) ) - (set_local $7 + (set_local $20 (i32.wrap/i64 (get_local $17) ) ) - (set_local $5 + (set_local $4 (i32.and (get_local $18) (i32.const 2147483647) @@ -4269,9 +4144,9 @@ (if (i32.eqz (i32.or - (tee_local $11 + (tee_local $12 (i32.and - (tee_local $12 + (tee_local $11 (i32.wrap/i64 (i64.shr_u (tee_local $17 @@ -4286,7 +4161,7 @@ (i32.const 2147483647) ) ) - (tee_local $19 + (tee_local $7 (i32.wrap/i64 (get_local $17) ) @@ -4299,21 +4174,51 @@ ) (if (i32.eqz - (tee_local $4 + (tee_local $8 (i32.gt_s - (get_local $5) + (get_local $4) (i32.const 2146435072) ) ) ) (if - (tee_local $4 + (tee_local $8 (i32.eq - (get_local $5) + (get_local $4) (i32.const 2146435072) ) ) - (set_local $4 + (set_local $8 + (i32.ne + (get_local $20) + (i32.const 0) + ) + ) + ) + ) + (if + (i32.eqz + (get_local $8) + ) + (set_local $8 + (i32.gt_s + (get_local $12) + (i32.const 2146435072) + ) + ) + ) + (if + (i32.eqz + (get_local $8) + ) + (if + (tee_local $8 + (i32.eq + (get_local $12) + (i32.const 2146435072) + ) + ) + (set_local $8 (i32.ne (get_local $7) (i32.const 0) @@ -4322,37 +4227,7 @@ ) ) (if - (i32.eqz - (get_local $4) - ) - (set_local $4 - (i32.gt_s - (get_local $11) - (i32.const 2146435072) - ) - ) - ) - (if - (i32.eqz - (get_local $4) - ) - (if - (tee_local $4 - (i32.eq - (get_local $11) - (i32.const 2146435072) - ) - ) - (set_local $4 - (i32.ne - (get_local $19) - (i32.const 0) - ) - ) - ) - ) - (if - (get_local $4) + (get_local $8) (return (f64.add (get_local $0) @@ -4367,122 +4242,101 @@ ) (if (i32.ge_s - (get_local $11) + (get_local $12) (i32.const 1128267776) ) - (set_local $15 + (set_local $16 (i32.const 2) ) (if (i32.ge_s - (get_local $11) + (get_local $12) (i32.const 1072693248) ) - (if - (i32.gt_s - (tee_local $10 - (i32.sub - (i32.shr_s - (get_local $11) - (i32.const 20) + (block + (set_local $8 + (i32.sub + (select + (i32.const 52) + (i32.const 20) + (tee_local $5 + (i32.gt_s + (tee_local $10 + (i32.sub + (i32.shr_s + (get_local $12) + (i32.const 20) + ) + (i32.const 1023) + ) + ) + (i32.const 20) + ) ) - (i32.const 1023) ) + (get_local $10) ) - (i32.const 20) ) (if (i32.eq (i32.shl - (tee_local $4 - (i32.shr_u - (get_local $19) - (tee_local $8 - (i32.sub - (i32.const 52) - (get_local $10) + (tee_local $5 + (i32.shr_s + (tee_local $10 + (select + (get_local $7) + (get_local $12) + (get_local $5) ) ) + (get_local $8) ) ) (get_local $8) ) - (get_local $19) + (get_local $10) ) - (set_local $15 + (set_local $16 (i32.sub (i32.const 2) (i32.and - (get_local $4) + (get_local $5) (i32.const 1) ) ) ) ) - (if - (i32.eqz - (get_local $19) - ) - (if - (i32.eq - (i32.shl - (tee_local $4 - (i32.shr_s - (get_local $11) - (tee_local $8 - (i32.sub - (i32.const 20) - (get_local $10) - ) - ) - ) - ) - (get_local $8) - ) - (get_local $11) - ) - (set_local $15 - (i32.sub - (i32.const 2) - (i32.and - (get_local $4) - (i32.const 1) - ) - ) - ) - ) - ) ) ) ) ) (if (i32.eqz - (get_local $19) + (get_local $7) ) (block (if (i32.eq - (get_local $11) + (get_local $12) (i32.const 2146435072) ) (if (i32.or (i32.sub - (get_local $5) + (get_local $4) (i32.const 1072693248) ) - (get_local $7) + (get_local $20) ) (if (i32.ge_s - (get_local $5) + (get_local $4) (i32.const 1072693248) ) (block (if (i32.lt_s - (get_local $12) + (get_local $11) (i32.const 0) ) (set_local $1 @@ -4497,7 +4351,7 @@ (tee_local $0 (if (result f64) (i32.ge_s - (get_local $12) + (get_local $11) (i32.const 0) ) (f64.const 0) @@ -4515,13 +4369,13 @@ ) (if (i32.eq - (get_local $11) + (get_local $12) (i32.const 1072693248) ) (block (if (i32.ge_s - (get_local $12) + (get_local $11) (i32.const 0) ) (return @@ -4538,7 +4392,7 @@ ) (if (i32.eq - (get_local $12) + (get_local $11) (i32.const 1073741824) ) (return @@ -4550,7 +4404,7 @@ ) (if (i32.eq - (get_local $12) + (get_local $11) (i32.const 1071644672) ) (if @@ -4574,41 +4428,41 @@ ) (if (i32.eqz - (get_local $7) + (get_local $20) ) (block (if (i32.eqz - (tee_local $4 + (tee_local $5 (i32.eq - (get_local $5) + (get_local $4) (i32.const 2146435072) ) ) ) - (set_local $4 + (set_local $5 (i32.eqz - (get_local $5) + (get_local $4) ) ) ) (if (i32.eqz - (get_local $4) + (get_local $5) ) - (set_local $4 + (set_local $5 (i32.eq - (get_local $5) + (get_local $4) (i32.const 1072693248) ) ) ) (if - (get_local $4) + (get_local $5) (block (if (i32.lt_s - (get_local $12) + (get_local $11) (i32.const 0) ) (set_local $2 @@ -4626,14 +4480,14 @@ (if (i32.or (i32.sub - (get_local $5) + (get_local $4) (i32.const 1072693248) ) - (get_local $15) + (get_local $16) ) (if (i32.eq - (get_local $15) + (get_local $16) (i32.const 1) ) (set_local $2 @@ -4673,7 +4527,7 @@ (block (if (i32.eqz - (get_local $15) + (get_local $16) ) (return (f64.div @@ -4689,7 +4543,7 @@ ) (if (i32.eq - (get_local $15) + (get_local $16) (i32.const 1) ) (set_local $13 @@ -4701,26 +4555,26 @@ (set_local $2 (if (result f64) (i32.gt_s - (get_local $11) + (get_local $12) (i32.const 1105199104) ) (block (result f64) (if (i32.gt_s - (get_local $11) + (get_local $12) (i32.const 1139802112) ) (block (if (i32.le_s - (get_local $5) + (get_local $4) (i32.const 1072693247) ) (return (tee_local $0 (if (result f64) (i32.lt_s - (get_local $12) + (get_local $11) (i32.const 0) ) (f64.const inf) @@ -4731,14 +4585,14 @@ ) (if (i32.ge_s - (get_local $5) + (get_local $4) (i32.const 1072693248) ) (return (tee_local $0 (if (result f64) (i32.gt_s - (get_local $12) + (get_local $11) (i32.const 0) ) (f64.const inf) @@ -4751,14 +4605,14 @@ ) (if (i32.lt_s - (get_local $5) + (get_local $4) (i32.const 1072693247) ) (return (tee_local $0 (if (result f64) (i32.lt_s - (get_local $12) + (get_local $11) (i32.const 0) ) (f64.mul @@ -4781,14 +4635,14 @@ ) (if (i32.gt_s - (get_local $5) + (get_local $4) (i32.const 1072693248) ) (return (tee_local $0 (if (result f64) (i32.gt_s - (get_local $12) + (get_local $11) (i32.const 0) ) (f64.mul @@ -4837,7 +4691,7 @@ ) (set_local $9 (f64.add - (tee_local $16 + (tee_local $15 (f64.mul (f64.const 1.4426950216293335) (get_local $3) @@ -4870,7 +4724,7 @@ ) ) ) - (get_local $16) + (get_local $15) ) ) ) @@ -4880,14 +4734,14 @@ ) (if (i32.lt_s - (get_local $5) + (get_local $4) (i32.const 1048576) ) (block (set_local $7 (i32.const -53) ) - (set_local $5 + (set_local $4 (i32.wrap/i64 (i64.shr_u (i64.reinterpret/f64 @@ -4909,18 +4763,18 @@ (get_local $7) (i32.sub (i32.shr_s - (get_local $5) + (get_local $4) (i32.const 20) ) (i32.const 1023) ) ) ) - (set_local $5 + (set_local $4 (i32.or - (tee_local $8 + (tee_local $5 (i32.and - (get_local $5) + (get_local $4) (i32.const 1048575) ) ) @@ -4930,13 +4784,13 @@ (set_local $10 (if (result i32) (i32.le_s - (get_local $8) + (get_local $5) (i32.const 235662) ) (i32.const 0) (if (result i32) (i32.lt_s - (get_local $8) + (get_local $5) (i32.const 767610) ) (i32.const 1) @@ -4947,9 +4801,9 @@ (i32.const 1) ) ) - (set_local $5 + (set_local $4 (i32.add - (get_local $5) + (get_local $4) (i32.const -1048576) ) ) @@ -4960,7 +4814,7 @@ ) (set_local $9 (f64.mul - (tee_local $16 + (tee_local $15 (f64.sub (tee_local $2 (f64.reinterpret/i64 @@ -4973,7 +4827,7 @@ ) (i64.shl (i64.extend_s/i32 - (get_local $5) + (get_local $4) ) (i64.const 32) ) @@ -5012,7 +4866,7 @@ (i32.add (i32.or (i32.shr_s - (get_local $5) + (get_local $4) (i32.const 1) ) (i32.const 536870912) @@ -5033,7 +4887,7 @@ ) ) ) - (set_local $20 + (set_local $19 (f64.mul (f64.mul (tee_local $14 @@ -5082,7 +4936,7 @@ (get_local $6) (f64.sub (f64.sub - (get_local $16) + (get_local $15) (f64.mul (tee_local $6 (f64.reinterpret/i64 @@ -5115,9 +4969,9 @@ ) ) ) - (tee_local $20 + (tee_local $19 (f64.add - (get_local $20) + (get_local $19) (f64.mul (get_local $0) (f64.add @@ -5131,7 +4985,7 @@ ) (set_local $2 (f64.sub - (get_local $20) + (get_local $19) (f64.sub (f64.sub (tee_local $3 @@ -5152,7 +5006,7 @@ ) (set_local $0 (f64.add - (tee_local $16 + (tee_local $15 (f64.mul (get_local $6) (get_local $3) @@ -5186,7 +5040,7 @@ ) ) ) - (get_local $16) + (get_local $15) ) ) ) @@ -5194,7 +5048,7 @@ (f64.add (f64.add (f64.add - (tee_local $20 + (tee_local $19 (f64.mul (f64.const 0.9617967009544373) (get_local $0) @@ -5254,13 +5108,13 @@ ) (get_local $0) ) - (get_local $20) + (get_local $19) ) ) ) ) ) - (set_local $4 + (set_local $8 (i32.wrap/i64 (tee_local $17 (i64.reinterpret/f64 @@ -5304,7 +5158,7 @@ ) (if (i32.ge_s - (tee_local $8 + (tee_local $5 (i32.wrap/i64 (i64.shr_u (get_local $17) @@ -5318,10 +5172,10 @@ (br_if $folding-inner1 (i32.or (i32.sub - (get_local $8) + (get_local $5) (i32.const 1083179008) ) - (get_local $4) + (get_local $8) ) ) (br_if $folding-inner1 @@ -5340,7 +5194,7 @@ (if (i32.ge_s (i32.and - (get_local $8) + (get_local $5) (i32.const 2147483647) ) (i32.const 1083231232) @@ -5349,10 +5203,10 @@ (br_if $folding-inner0 (i32.or (i32.sub - (get_local $8) + (get_local $5) (i32.const -1064252416) ) - (get_local $4) + (get_local $8) ) ) (br_if $folding-inner0 @@ -5370,9 +5224,9 @@ (set_local $10 (i32.sub (i32.shr_s - (tee_local $4 + (tee_local $8 (i32.and - (get_local $8) + (get_local $5) (i32.const 2147483647) ) ) @@ -5386,7 +5240,7 @@ ) (if (i32.gt_s - (get_local $4) + (get_local $8) (i32.const 1071644672) ) (block @@ -5396,7 +5250,7 @@ (i32.and (tee_local $7 (i32.add - (get_local $8) + (get_local $5) (i32.shr_s (i32.const 1048576) (i32.add @@ -5449,7 +5303,7 @@ ) (if (i32.lt_s - (get_local $8) + (get_local $5) (i32.const 0) ) (set_local $7 @@ -5471,7 +5325,7 @@ (f64.mul (tee_local $2 (f64.add - (tee_local $16 + (tee_local $15 (f64.mul (tee_local $3 (f64.reinterpret/i64 @@ -5516,7 +5370,7 @@ (if (result f64) (i32.le_s (i32.shr_s - (tee_local $8 + (tee_local $5 (i32.add (i32.wrap/i64 (i64.shr_u @@ -5574,7 +5428,7 @@ (get_local $6) (f64.sub (get_local $2) - (get_local $16) + (get_local $15) ) ) ) @@ -5616,7 +5470,7 @@ ) (i64.shl (i64.extend_s/i32 - (get_local $8) + (get_local $5) ) (i64.const 32) ) @@ -5649,205 +5503,73 @@ (f64.const 1.e+300) ) ) - (func $std/libm/pow (; 48 ;) (; has Stack IR ;) (type $FFF) (param $0 f64) (param $1 f64) (result f64) + (func $std/libm/pow (; 47 ;) (; has Stack IR ;) (type $FFF) (param $0 f64) (param $1 f64) (result f64) (call $~lib/math/NativeMath.pow (get_local $0) (get_local $1) ) ) - (func $~lib/math/NativeMath.round (; 49 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) - (local $1 f64) - (local $2 i64) - (local $3 i32) - (if - (i32.ge_s - (tee_local $3 - (i32.wrap/i64 - (i64.and - (i64.shr_u - (tee_local $2 - (i64.reinterpret/f64 - (get_local $0) - ) - ) - (i64.const 52) - ) - (i64.const 2047) - ) - ) - ) - (i32.const 1075) - ) - (return - (get_local $0) - ) - ) - (if - (i32.lt_s - (get_local $3) - (i32.const 1022) - ) - (return - (f64.mul - (f64.const 0) + (func $std/libm/round (; 48 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) + (f64.copysign + (f64.floor + (f64.add (get_local $0) + (f64.const 0.5) ) ) - ) - (tee_local $1 - (if (result f64) - (i64.ne - (i64.shr_u - (get_local $2) - (i64.const 63) - ) - (i64.const 0) - ) - (if (result f64) - (f64.ge - (tee_local $1 - (f64.add - (f64.sub - (f64.sub - (f64.const 4503599627370496) - (get_local $0) - ) - (f64.const 4503599627370496) - ) - (get_local $0) - ) - ) - (f64.const 0.5) - ) - (f64.add - (f64.sub - (get_local $0) - (get_local $1) - ) - (f64.const 1) - ) - (if (result f64) - (f64.lt - (get_local $1) - (f64.const -0.5) - ) - (f64.sub - (f64.sub - (get_local $0) - (get_local $1) - ) - (f64.const 1) - ) - (f64.sub - (get_local $0) - (get_local $1) - ) - ) - ) - (if (result f64) - (f64.gt - (tee_local $1 - (f64.sub - (f64.sub - (f64.add - (get_local $0) - (f64.const 4503599627370496) - ) - (f64.const 4503599627370496) - ) - (get_local $0) - ) - ) - (f64.const 0.5) - ) - (f64.sub - (f64.add - (get_local $1) - (get_local $0) - ) - (f64.const 1) - ) - (if (result f64) - (f64.le - (get_local $1) - (f64.const -0.5) - ) - (f64.add - (f64.add - (get_local $1) - (get_local $0) - ) - (f64.const 1) - ) - (f64.add - (get_local $1) - (get_local $0) - ) - ) - ) - ) - ) - ) - (func $std/libm/round (; 50 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) - (call $~lib/math/NativeMath.round (get_local $0) ) ) - (func $std/libm/sign (; 51 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) - (if (result f64) + (func $std/libm/sign (; 49 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) + (if (f64.gt - (f64.abs - (get_local $0) - ) + (get_local $0) (f64.const 0) ) - (f64.copysign + (set_local $0 (f64.const 1) - (get_local $0) ) - (get_local $0) + (if + (f64.lt + (get_local $0) + (f64.const 0) + ) + (set_local $0 + (f64.const -1) + ) + ) ) + (get_local $0) ) - (func $~lib/math/NativeMath.sinh (; 52 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) + (func $~lib/math/NativeMath.sinh (; 50 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) (local $1 f64) (local $2 f64) - (local $3 i64) - (local $4 i32) - (set_local $2 - (f64.const 0.5) - ) - (if - (i64.ne - (i64.shr_u - (tee_local $3 + (local $3 i32) + (local $4 i64) + (set_local $1 + (f64.reinterpret/i64 + (tee_local $4 + (i64.and (i64.reinterpret/f64 (get_local $0) ) - ) - (i64.const 63) - ) - (i64.const 0) - ) - (set_local $2 - (f64.const -0.5) - ) - ) - (set_local $1 - (f64.reinterpret/i64 - (tee_local $3 - (i64.and - (get_local $3) (i64.const 9223372036854775807) ) ) ) ) + (set_local $2 + (f64.copysign + (f64.const 0.5) + (get_local $0) + ) + ) (if (i32.lt_u - (tee_local $4 + (tee_local $3 (i32.wrap/i64 (i64.shr_u - (get_local $3) + (get_local $4) (i64.const 32) ) ) @@ -5862,13 +5584,13 @@ ) (if (i32.lt_u - (get_local $4) + (get_local $3) (i32.const 1072693248) ) (block (if (i32.lt_u - (get_local $4) + (get_local $3) (i32.const 1045430272) ) (return @@ -5922,8 +5644,17 @@ ) ) (set_local $1 - (call $~lib/math/expo2 - (get_local $1) + (f64.mul + (f64.mul + (call $~lib/math/NativeMath.exp + (f64.sub + (get_local $1) + (f64.const 1416.0996898839683) + ) + ) + (f64.const 2247116418577894884661631e283) + ) + (f64.const 2247116418577894884661631e283) ) ) (f64.mul @@ -5931,37 +5662,27 @@ (get_local $1) ) ) - (func $std/libm/sinh (; 53 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) + (func $std/libm/sinh (; 51 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) (call $~lib/math/NativeMath.sinh (get_local $0) ) ) - (func $std/libm/sqrt (; 54 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) + (func $std/libm/sqrt (; 52 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) (f64.sqrt (get_local $0) ) ) - (func $~lib/math/NativeMath.tanh (; 55 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) - (local $1 i64) + (func $~lib/math/NativeMath.tanh (; 53 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) + (local $1 f64) (local $2 i32) - (local $3 i32) - (set_local $3 - (i32.wrap/i64 - (i64.shr_u - (tee_local $1 + (local $3 i64) + (set_local $1 + (f64.reinterpret/i64 + (tee_local $3 + (i64.and (i64.reinterpret/f64 (get_local $0) ) - ) - (i64.const 63) - ) - ) - ) - (set_local $0 - (f64.reinterpret/i64 - (tee_local $1 - (i64.and - (get_local $1) (i64.const 9223372036854775807) ) ) @@ -5972,14 +5693,14 @@ (tee_local $2 (i32.wrap/i64 (i64.shr_u - (get_local $1) + (get_local $3) (i64.const 32) ) ) ) (i32.const 1071748074) ) - (set_local $0 + (set_local $1 (if (result f64) (i32.gt_u (get_local $2) @@ -5989,7 +5710,7 @@ (f64.const 1) (f64.div (f64.const 0) - (get_local $0) + (get_local $1) ) ) (f64.sub @@ -6000,7 +5721,7 @@ (call $~lib/math/NativeMath.expm1 (f64.mul (f64.const 2) - (get_local $0) + (get_local $1) ) ) (f64.const 2) @@ -6014,18 +5735,18 @@ (get_local $2) (i32.const 1070618798) ) - (set_local $0 + (set_local $1 (f64.div - (tee_local $0 + (tee_local $1 (call $~lib/math/NativeMath.expm1 (f64.mul (f64.const 2) - (get_local $0) + (get_local $1) ) ) ) (f64.add - (get_local $0) + (get_local $1) (f64.const 2) ) ) @@ -6035,20 +5756,20 @@ (get_local $2) (i32.const 1048576) ) - (set_local $0 + (set_local $1 (f64.div (f64.neg - (tee_local $0 + (tee_local $1 (call $~lib/math/NativeMath.expm1 (f64.mul (f64.const -2) - (get_local $0) + (get_local $1) ) ) ) ) (f64.add - (get_local $0) + (get_local $1) (f64.const 2) ) ) @@ -6056,27 +5777,22 @@ ) ) ) - (if - (get_local $3) - (set_local $0 - (f64.neg - (get_local $0) - ) - ) + (f64.copysign + (get_local $1) + (get_local $0) ) - (get_local $0) ) - (func $std/libm/tanh (; 56 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) + (func $std/libm/tanh (; 54 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) (call $~lib/math/NativeMath.tanh (get_local $0) ) ) - (func $std/libm/trunc (; 57 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) + (func $std/libm/trunc (; 55 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) (f64.trunc (get_local $0) ) ) - (func $null (; 58 ;) (; has Stack IR ;) (type $v) + (func $null (; 56 ;) (; has Stack IR ;) (type $v) (nop) ) ) diff --git a/tests/compiler/std/libm.untouched.wat b/tests/compiler/std/libm.untouched.wat index 77d177d5..01a6b00d 100644 --- a/tests/compiler/std/libm.untouched.wat +++ b/tests/compiler/std/libm.untouched.wat @@ -25,7 +25,7 @@ (global $~lib/math/NativeMath.SQRT2 f64 (f64.const 1.4142135623730951)) (global $std/libm/SQRT2 f64 (f64.const 1.4142135623730951)) (global $NaN f64 (f64.const nan:0x8000000000000)) - (global $~lib/builtins/f64.EPSILON f64 (f64.const 2.220446049250313e-16)) + (global $ASC_SHRINK_LEVEL i32 (i32.const 0)) (global $HEAP_BASE i32 (i32.const 8)) (export "memory" (memory $0)) (export "table" (table $0)) @@ -281,12 +281,12 @@ ) (block (set_local $6 - (f64.mul - (f64.add - (f64.const 1) - (get_local $0) - ) + (f64.add (f64.const 0.5) + (f64.mul + (get_local $0) + (f64.const 0.5) + ) ) ) (set_local $4 @@ -320,12 +320,12 @@ ) ) (set_local $6 - (f64.mul - (f64.sub - (f64.const 1) - (get_local $0) - ) + (f64.sub (f64.const 0.5) + (f64.mul + (get_local $0) + (f64.const 0.5) + ) ) ) (set_local $4 @@ -1246,14 +1246,14 @@ ) ) (set_local $4 - (f64.mul - (f64.sub - (f64.const 1) + (f64.sub + (f64.const 0.5) + (f64.mul (f64.abs (get_local $0) ) + (f64.const 0.5) ) - (f64.const 0.5) ) ) (set_local $5 @@ -1374,7 +1374,7 @@ (func $~lib/math/NativeMath.asinh (; 10 ;) (type $FF) (param $0 f64) (result f64) (local $1 i64) (local $2 i64) - (local $3 i64) + (local $3 f64) (set_local $1 (i64.reinterpret/f64 (get_local $0) @@ -1390,20 +1390,11 @@ ) ) (set_local $3 - (i64.shr_u - (get_local $1) - (i64.const 63) - ) - ) - (set_local $1 - (i64.and - (get_local $1) - (i64.const 9223372036854775807) - ) - ) - (set_local $0 (f64.reinterpret/i64 - (get_local $1) + (i64.and + (get_local $1) + (i64.const 9223372036854775807) + ) ) ) (if @@ -1414,10 +1405,10 @@ (i64.const 26) ) ) - (set_local $0 + (set_local $3 (f64.add (call $~lib/math/NativeMath.log - (get_local $0) + (get_local $3) ) (f64.const 0.6931471805599453) ) @@ -1430,12 +1421,12 @@ (i64.const 1) ) ) - (set_local $0 + (set_local $3 (call $~lib/math/NativeMath.log (f64.add (f64.mul (f64.const 2) - (get_local $0) + (get_local $3) ) (f64.div (f64.const 1) @@ -1443,13 +1434,13 @@ (f64.sqrt (f64.add (f64.mul - (get_local $0) - (get_local $0) + (get_local $3) + (get_local $3) ) (f64.const 1) ) ) - (get_local $0) + (get_local $3) ) ) ) @@ -1463,21 +1454,21 @@ (i64.const 26) ) ) - (set_local $0 + (set_local $3 (call $~lib/math/NativeMath.log1p (f64.add - (get_local $0) + (get_local $3) (f64.div (f64.mul - (get_local $0) - (get_local $0) + (get_local $3) + (get_local $3) ) (f64.add (f64.sqrt (f64.add (f64.mul - (get_local $0) - (get_local $0) + (get_local $3) + (get_local $3) ) (f64.const 1) ) @@ -1491,14 +1482,8 @@ ) ) ) - (if (result f64) - (i64.ne - (get_local $3) - (i64.const 0) - ) - (f64.neg - (get_local $0) - ) + (f64.copysign + (get_local $3) (get_local $0) ) ) @@ -1515,13 +1500,14 @@ ) (func $~lib/math/NativeMath.atan (; 13 ;) (type $FF) (param $0 f64) (result f64) (local $1 i32) - (local $2 i32) + (local $2 f64) (local $3 f64) (local $4 i32) (local $5 f64) (local $6 f64) (local $7 f64) - (local $8 i32) + (local $8 f64) + (local $9 i32) (set_local $1 (i32.wrap/i64 (i64.shr_u @@ -1533,10 +1519,7 @@ ) ) (set_local $2 - (i32.shr_u - (get_local $1) - (i32.const 31) - ) + (get_local $0) ) (set_local $1 (i32.and @@ -1567,12 +1550,9 @@ ) ) (return - (if (result f64) - (get_local $2) - (f64.neg - (get_local $3) - ) + (f64.copysign (get_local $3) + (get_local $2) ) ) ) @@ -1768,6 +1748,15 @@ ) ) ) + (set_local $8 + (f64.mul + (get_local $0) + (f64.add + (get_local $6) + (get_local $7) + ) + ) + ) (if (i32.lt_s (get_local $4) @@ -1776,13 +1765,7 @@ (return (f64.sub (get_local $0) - (f64.mul - (get_local $0) - (f64.add - (get_local $6) - (get_local $7) - ) - ) + (get_local $8) ) ) ) @@ -1792,30 +1775,30 @@ (block $case2|0 (block $case1|0 (block $case0|0 - (set_local $8 + (set_local $9 (get_local $4) ) (br_if $case0|0 (i32.eq - (get_local $8) + (get_local $9) (i32.const 0) ) ) (br_if $case1|0 (i32.eq - (get_local $8) + (get_local $9) (i32.const 1) ) ) (br_if $case2|0 (i32.eq - (get_local $8) + (get_local $9) (i32.const 2) ) ) (br_if $case3|0 (i32.eq - (get_local $8) + (get_local $9) (i32.const 3) ) ) @@ -1827,13 +1810,7 @@ (f64.const 0.4636476090008061) (f64.sub (f64.sub - (f64.mul - (get_local $0) - (f64.add - (get_local $6) - (get_local $7) - ) - ) + (get_local $8) (f64.const 2.2698777452961687e-17) ) (get_local $0) @@ -1849,13 +1826,7 @@ (f64.const 0.7853981633974483) (f64.sub (f64.sub - (f64.mul - (get_local $0) - (f64.add - (get_local $6) - (get_local $7) - ) - ) + (get_local $8) (f64.const 3.061616997868383e-17) ) (get_local $0) @@ -1871,13 +1842,7 @@ (f64.const 0.982793723247329) (f64.sub (f64.sub - (f64.mul - (get_local $0) - (f64.add - (get_local $6) - (get_local $7) - ) - ) + (get_local $8) (f64.const 1.3903311031230998e-17) ) (get_local $0) @@ -1893,13 +1858,7 @@ (f64.const 1.5707963267948966) (f64.sub (f64.sub - (f64.mul - (get_local $0) - (f64.add - (get_local $6) - (get_local $7) - ) - ) + (get_local $8) (f64.const 6.123233995736766e-17) ) (get_local $0) @@ -1911,12 +1870,9 @@ ) (unreachable) ) - (if (result f64) - (get_local $2) - (f64.neg - (get_local $3) - ) + (f64.copysign (get_local $3) + (get_local $2) ) ) (func $std/libm/atan (; 14 ;) (type $FF) (param $0 f64) (result f64) @@ -2021,15 +1977,9 @@ ) ) ) - (if (result f64) - (i64.ne - (get_local $3) - (i64.const 0) - ) - (f64.neg - (get_local $4) - ) + (f64.copysign (get_local $4) + (get_local $0) ) ) (func $std/libm/atanh (; 16 ;) (type $FF) (param $0 f64) (result f64) @@ -2222,12 +2172,12 @@ ) (f64.div (f64.neg - (f64.const 3.141592653589793) + (get_global $~lib/math/NativeMath.PI) ) (f64.const 2) ) (f64.div - (f64.const 3.141592653589793) + (get_global $~lib/math/NativeMath.PI) (f64.const 2) ) ) @@ -2279,7 +2229,7 @@ ) (return (f64.div - (f64.const 3.141592653589793) + (get_global $~lib/math/NativeMath.PI) (f64.const 4) ) ) @@ -2287,7 +2237,7 @@ (return (f64.div (f64.neg - (f64.const 3.141592653589793) + (get_global $~lib/math/NativeMath.PI) ) (f64.const 4) ) @@ -2297,7 +2247,7 @@ (f64.div (f64.mul (f64.const 3) - (f64.const 3.141592653589793) + (get_global $~lib/math/NativeMath.PI) ) (f64.const 4) ) @@ -2307,7 +2257,7 @@ (f64.div (f64.mul (f64.const -3) - (f64.const 3.141592653589793) + (get_global $~lib/math/NativeMath.PI) ) (f64.const 4) ) @@ -2356,12 +2306,12 @@ ) ) (return - (f64.const 3.141592653589793) + (get_global $~lib/math/NativeMath.PI) ) ) (return (f64.neg - (f64.const 3.141592653589793) + (get_global $~lib/math/NativeMath.PI) ) ) ) @@ -2395,12 +2345,12 @@ ) (f64.div (f64.neg - (f64.const 3.141592653589793) + (get_global $~lib/math/NativeMath.PI) ) (f64.const 2) ) (f64.div - (f64.const 3.141592653589793) + (get_global $~lib/math/NativeMath.PI) (f64.const 2) ) ) @@ -2486,7 +2436,7 @@ ) (return (f64.sub - (f64.const 3.141592653589793) + (get_global $~lib/math/NativeMath.PI) (f64.sub (get_local $9) (f64.const 1.2246467991473532e-16) @@ -2500,7 +2450,7 @@ (get_local $9) (f64.const 1.2246467991473532e-16) ) - (f64.const 3.141592653589793) + (get_global $~lib/math/NativeMath.PI) ) ) ) @@ -2829,15 +2779,10 @@ (get_local $0) (f64.const 709.782712893384) ) - (block - (set_local $0 - (f64.mul - (get_local $0) - (f64.const 8988465674311579538646525e283) - ) - ) - (return + (return + (f64.mul (get_local $0) + (f64.const 8988465674311579538646525e283) ) ) ) @@ -2852,84 +2797,53 @@ (i32.const 1071001154) ) (block - (if - (i32.lt_u - (get_local $2) - (i32.const 1072734898) - ) - (if - (i32.eqz - (get_local $4) - ) - (block - (set_local $7 - (f64.sub - (get_local $0) - (f64.const 0.6931471803691238) - ) - ) - (set_local $8 - (f64.const 1.9082149292705877e-10) - ) - (set_local $3 + (set_local $3 + (select + (i32.sub + (i32.const 1) + (i32.shl + (get_local $4) (i32.const 1) ) ) - (block - (set_local $7 - (f64.add + (i32.trunc_s/f64 + (f64.add + (f64.mul + (f64.const 1.4426950408889634) + (get_local $0) + ) + (f64.copysign + (f64.const 0.5) (get_local $0) - (f64.const 0.6931471803691238) ) ) - (set_local $8 - (f64.neg - (f64.const 1.9082149292705877e-10) - ) - ) - (set_local $3 - (i32.const -1) - ) + ) + (i32.lt_u + (get_local $2) + (i32.const 1072734898) ) ) - (block - (set_local $3 - (i32.trunc_s/f64 - (f64.add - (f64.mul - (f64.const 1.4426950408889634) - (get_local $0) - ) - (if (result f64) - (get_local $4) - (f64.const -0.5) - (f64.const 0.5) - ) - ) - ) - ) - (set_local $6 - (f64.convert_s/i32 - (get_local $3) - ) - ) - (set_local $7 - (f64.sub - (get_local $0) - (f64.mul - (get_local $6) - (f64.const 0.6931471803691238) - ) - ) - ) - (set_local $8 - (f64.mul - (get_local $6) - (f64.const 1.9082149292705877e-10) - ) + ) + (set_local $6 + (f64.convert_s/i32 + (get_local $3) + ) + ) + (set_local $7 + (f64.sub + (get_local $0) + (f64.mul + (get_local $6) + (f64.const 0.6931471803691238) ) ) ) + (set_local $8 + (f64.mul + (get_local $6) + (f64.const 1.9082149292705877e-10) + ) + ) (set_local $0 (f64.sub (get_local $7) @@ -3200,50 +3114,47 @@ (i64.const 52) ) ) + (set_local $14 + (f64.reinterpret/i64 + (get_local $1) + ) + ) (if (i32.lt_s (get_local $3) (i32.const 20) ) (set_local $14 - (f64.mul - (f64.add - (f64.sub - (get_local $0) - (get_local $12) - ) - (f64.sub - (f64.const 1) - (f64.reinterpret/i64 - (get_local $1) - ) - ) + (f64.sub + (f64.sub + (f64.const 1) + (get_local $14) ) - (get_local $13) + (get_local $12) ) ) (set_local $14 - (f64.mul + (f64.sub + (f64.const 1) (f64.add - (f64.sub - (get_local $0) - (f64.add - (get_local $12) - (f64.reinterpret/i64 - (get_local $1) - ) - ) - ) - (f64.const 1) + (get_local $12) + (get_local $14) ) - (get_local $13) ) ) ) - (get_local $14) + (f64.mul + (f64.add + (get_local $0) + (get_local $14) + ) + (get_local $13) + ) ) (func $~lib/math/NativeMath.scalbn (; 26 ;) (type $FiF) (param $0 f64) (param $1 i32) (result f64) (local $2 f64) + (local $3 i32) + (local $4 i32) (set_local $2 (get_local $0) ) @@ -3278,18 +3189,20 @@ ) ) (set_local $1 - (i32.sub - (get_local $1) - (i32.const 1023) - ) - ) - (if - (i32.gt_s - (get_local $1) - (i32.const 1023) - ) - (set_local $1 - (i32.const 1023) + (select + (tee_local $3 + (i32.sub + (get_local $1) + (i32.const 1023) + ) + ) + (tee_local $4 + (i32.const 1023) + ) + (i32.lt_s + (get_local $3) + (get_local $4) + ) ) ) ) @@ -3304,13 +3217,19 @@ (set_local $2 (f64.mul (get_local $2) - (f64.const 2.2250738585072014e-308) + (f64.mul + (f64.const 2.2250738585072014e-308) + (f64.const 9007199254740992) + ) ) ) (set_local $1 (i32.add (get_local $1) - (i32.const 1022) + (i32.sub + (i32.const 1022) + (i32.const 53) + ) ) ) (if @@ -3322,22 +3241,30 @@ (set_local $2 (f64.mul (get_local $2) - (f64.const 2.2250738585072014e-308) + (f64.mul + (f64.const 2.2250738585072014e-308) + (f64.const 9007199254740992) + ) ) ) (set_local $1 - (i32.add - (get_local $1) - (i32.const 1022) - ) - ) - (if - (i32.lt_s - (get_local $1) - (i32.const -1022) - ) - (set_local $1 - (i32.const -1022) + (select + (tee_local $3 + (i32.sub + (i32.add + (get_local $1) + (i32.const 1022) + ) + (i32.const 53) + ) + ) + (tee_local $4 + (i32.const -1022) + ) + (i32.gt_s + (get_local $3) + (get_local $4) + ) ) ) ) @@ -3466,11 +3393,11 @@ ) (set_local $5 (i32.sub - (i32.sub - (i32.const 1) + (i32.const 1) + (i32.shl (get_local $2) + (i32.const 1) ) - (get_local $2) ) ) ) @@ -3590,44 +3517,11 @@ (get_local $5) ) ) - (func $~lib/math/expo2 (; 28 ;) (type $FF) (param $0 f64) (result f64) - (local $1 f64) - (set_local $1 - (f64.reinterpret/i64 - (i64.shl - (i64.extend_u/i32 - (i32.shl - (i32.add - (i32.const 1023) - (i32.div_u - (i32.const 2043) - (i32.const 2) - ) - ) - (i32.const 20) - ) - ) - (i64.const 32) - ) - ) - ) - (f64.mul - (f64.mul - (call $~lib/math/NativeMath.exp - (f64.sub - (get_local $0) - (f64.const 1416.0996898839683) - ) - ) - (get_local $1) - ) - (get_local $1) - ) - ) - (func $~lib/math/NativeMath.cosh (; 29 ;) (type $FF) (param $0 f64) (result f64) + (func $~lib/math/NativeMath.cosh (; 28 ;) (type $FF) (param $0 f64) (result f64) (local $1 i64) (local $2 i32) (local $3 f64) + (local $4 f64) (set_local $1 (i64.reinterpret/f64 (get_local $0) @@ -3686,10 +3580,10 @@ (get_local $3) (get_local $3) ) - (f64.mul + (f64.add (f64.const 2) - (f64.add - (f64.const 1) + (f64.mul + (f64.const 2) (get_local $3) ) ) @@ -3724,42 +3618,72 @@ ) ) (set_local $3 - (call $~lib/math/expo2 - (get_local $0) + (block $~lib/math/expo2|inlined.0 (result f64) + (set_local $4 + (f64.reinterpret/i64 + (i64.shl + (i64.extend_u/i32 + (i32.shl + (i32.add + (i32.const 1023) + (i32.div_u + (i32.const 2043) + (i32.const 2) + ) + ) + (i32.const 20) + ) + ) + (i64.const 32) + ) + ) + ) + (f64.mul + (f64.mul + (call $~lib/math/NativeMath.exp + (f64.sub + (get_local $0) + (f64.const 1416.0996898839683) + ) + ) + (get_local $4) + ) + (get_local $4) + ) ) ) (get_local $3) ) - (func $std/libm/cosh (; 30 ;) (type $FF) (param $0 f64) (result f64) + (func $std/libm/cosh (; 29 ;) (type $FF) (param $0 f64) (result f64) (call $~lib/math/NativeMath.cosh (get_local $0) ) ) - (func $std/libm/exp (; 31 ;) (type $FF) (param $0 f64) (result f64) + (func $std/libm/exp (; 30 ;) (type $FF) (param $0 f64) (result f64) (call $~lib/math/NativeMath.exp (get_local $0) ) ) - (func $std/libm/expm1 (; 32 ;) (type $FF) (param $0 f64) (result f64) + (func $std/libm/expm1 (; 31 ;) (type $FF) (param $0 f64) (result f64) (call $~lib/math/NativeMath.expm1 (get_local $0) ) ) - (func $std/libm/floor (; 33 ;) (type $FF) (param $0 f64) (result f64) + (func $std/libm/floor (; 32 ;) (type $FF) (param $0 f64) (result f64) (block $~lib/math/NativeMath.floor|inlined.0 (result f64) (f64.floor (get_local $0) ) ) ) - (func $std/libm/fround (; 34 ;) (type $Ff) (param $0 f64) (result f32) + (func $std/libm/fround (; 33 ;) (type $Ff) (param $0 f64) (result f32) (block $~lib/math/NativeMath.fround|inlined.0 (result f32) (f32.demote/f64 (get_local $0) ) ) ) - (func $~lib/math/NativeMath.hypot (; 35 ;) (type $FFF) (param $0 f64) (param $1 f64) (result f64) + (func $~lib/math/NativeMath.hypot (; 34 ;) (type $FFF) (param $0 f64) (param $1 f64) (result f64) (local $2 i64) (local $3 i64) (local $4 i64) @@ -3965,24 +3889,21 @@ ) (set_local $13 (f64.add - (f64.add - (f64.sub - (f64.mul - (get_local $10) - (get_local $10) - ) - (get_local $12) - ) + (f64.sub (f64.mul + (get_local $10) + (get_local $10) + ) + (get_local $12) + ) + (f64.mul + (f64.add (f64.mul (f64.const 2) (get_local $10) ) (get_local $11) ) - ) - (f64.mul - (get_local $11) (get_local $11) ) ) @@ -4016,24 +3937,21 @@ ) (set_local $15 (f64.add - (f64.add - (f64.sub - (f64.mul - (get_local $10) - (get_local $10) - ) - (get_local $14) - ) + (f64.sub (f64.mul + (get_local $10) + (get_local $10) + ) + (get_local $14) + ) + (f64.mul + (f64.add (f64.mul (f64.const 2) (get_local $10) ) (get_local $11) ) - ) - (f64.mul - (get_local $11) (get_local $11) ) ) @@ -4054,13 +3972,13 @@ ) ) ) - (func $std/libm/hypot (; 36 ;) (type $FFF) (param $0 f64) (param $1 f64) (result f64) + (func $std/libm/hypot (; 35 ;) (type $FFF) (param $0 f64) (param $1 f64) (result f64) (call $~lib/math/NativeMath.hypot (get_local $0) (get_local $1) ) ) - (func $~lib/math/NativeMath.imul (; 37 ;) (type $FFF) (param $0 f64) (param $1 f64) (result f64) + (func $~lib/math/NativeMath.imul (; 36 ;) (type $FFF) (param $0 f64) (param $1 f64) (result f64) (f64.convert_s/i32 (i32.mul (i32.trunc_s/f64 @@ -4072,18 +3990,18 @@ ) ) ) - (func $std/libm/imul (; 38 ;) (type $FFF) (param $0 f64) (param $1 f64) (result f64) + (func $std/libm/imul (; 37 ;) (type $FFF) (param $0 f64) (param $1 f64) (result f64) (call $~lib/math/NativeMath.imul (get_local $0) (get_local $1) ) ) - (func $std/libm/log (; 39 ;) (type $FF) (param $0 f64) (result f64) + (func $std/libm/log (; 38 ;) (type $FF) (param $0 f64) (result f64) (call $~lib/math/NativeMath.log (get_local $0) ) ) - (func $~lib/math/NativeMath.log10 (; 40 ;) (type $FF) (param $0 f64) (result f64) + (func $~lib/math/NativeMath.log10 (; 39 ;) (type $FF) (param $0 f64) (result f64) (local $1 i64) (local $2 i32) (local $3 i32) @@ -4452,25 +4370,22 @@ ) ) ) - (set_local $15 - (get_local $9) - ) (f64.add (get_local $18) - (get_local $15) + (get_local $9) ) ) - (func $std/libm/log10 (; 41 ;) (type $FF) (param $0 f64) (result f64) + (func $std/libm/log10 (; 40 ;) (type $FF) (param $0 f64) (result f64) (call $~lib/math/NativeMath.log10 (get_local $0) ) ) - (func $std/libm/log1p (; 42 ;) (type $FF) (param $0 f64) (result f64) + (func $std/libm/log1p (; 41 ;) (type $FF) (param $0 f64) (result f64) (call $~lib/math/NativeMath.log1p (get_local $0) ) ) - (func $~lib/math/NativeMath.log2 (; 43 ;) (type $FF) (param $0 f64) (result f64) + (func $~lib/math/NativeMath.log2 (; 42 ;) (type $FF) (param $0 f64) (result f64) (local $1 i64) (local $2 i32) (local $3 i32) @@ -4834,12 +4749,12 @@ (get_local $15) ) ) - (func $std/libm/log2 (; 44 ;) (type $FF) (param $0 f64) (result f64) + (func $std/libm/log2 (; 43 ;) (type $FF) (param $0 f64) (result f64) (call $~lib/math/NativeMath.log2 (get_local $0) ) ) - (func $std/libm/max (; 45 ;) (type $FFF) (param $0 f64) (param $1 f64) (result f64) + (func $std/libm/max (; 44 ;) (type $FFF) (param $0 f64) (param $1 f64) (result f64) (block $~lib/math/NativeMath.max|inlined.0 (result f64) (f64.max (get_local $0) @@ -4847,7 +4762,7 @@ ) ) ) - (func $std/libm/min (; 46 ;) (type $FFF) (param $0 f64) (param $1 f64) (result f64) + (func $std/libm/min (; 45 ;) (type $FFF) (param $0 f64) (param $1 f64) (result f64) (block $~lib/math/NativeMath.min|inlined.0 (result f64) (f64.min (get_local $0) @@ -4855,7 +4770,7 @@ ) ) ) - (func $~lib/math/NativeMath.pow (; 47 ;) (type $FFF) (param $0 f64) (param $1 f64) (result f64) + (func $~lib/math/NativeMath.pow (; 46 ;) (type $FFF) (param $0 f64) (param $1 f64) (result f64) (local $2 i64) (local $3 i32) (local $4 i32) @@ -4866,8 +4781,8 @@ (local $9 i32) (local $10 i32) (local $11 i32) - (local $12 f64) - (local $13 f64) + (local $12 i32) + (local $13 i32) (local $14 f64) (local $15 f64) (local $16 f64) @@ -4878,10 +4793,10 @@ (local $21 f64) (local $22 f64) (local $23 f64) - (local $24 i32) - (local $25 i32) - (local $26 f64) - (local $27 f64) + (local $24 f64) + (local $25 f64) + (local $26 i32) + (local $27 i32) (local $28 f64) (local $29 f64) (local $30 f64) @@ -4892,7 +4807,9 @@ (local $35 f64) (local $36 f64) (local $37 f64) - (local $38 i32) + (local $38 f64) + (local $39 f64) + (local $40 i32) (set_local $2 (i64.reinterpret/f64 (get_local $0) @@ -5041,78 +4958,49 @@ (i32.const 1023) ) ) - (if - (i32.gt_s + (set_local $9 + (i32.sub + (select + (i32.const 52) + (i32.const 20) + (i32.gt_s + (get_local $11) + (i32.const 20) + ) + ) (get_local $11) - (i32.const 20) ) - (block - (set_local $9 - (i32.shr_u - (get_local $6) - (i32.sub - (i32.const 52) - (get_local $11) - ) - ) - ) - (if - (i32.eq - (i32.shl - (get_local $9) - (i32.sub - (i32.const 52) - (get_local $11) - ) - ) - (get_local $6) - ) - (set_local $10 - (i32.sub - (i32.const 2) - (i32.and - (get_local $9) - (i32.const 1) - ) - ) - ) + ) + (set_local $12 + (select + (get_local $6) + (get_local $8) + (i32.gt_s + (get_local $11) + (i32.const 20) ) ) - (if - (i32.eq - (get_local $6) - (i32.const 0) + ) + (set_local $13 + (i32.shr_s + (get_local $12) + (get_local $9) + ) + ) + (if + (i32.eq + (i32.shl + (get_local $13) + (get_local $9) ) - (block - (set_local $9 - (i32.shr_s - (get_local $8) - (i32.sub - (i32.const 20) - (get_local $11) - ) - ) - ) - (if - (i32.eq - (i32.shl - (get_local $9) - (i32.sub - (i32.const 20) - (get_local $11) - ) - ) - (get_local $8) - ) - (set_local $10 - (i32.sub - (i32.const 2) - (i32.and - (get_local $9) - (i32.const 1) - ) - ) - ) + (get_local $12) + ) + (set_local $10 + (i32.sub + (i32.const 2) + (i32.and + (get_local $13) + (i32.const 1) ) ) ) @@ -5233,7 +5121,7 @@ ) ) ) - (set_local $12 + (set_local $14 (f64.abs (get_local $0) ) @@ -5245,40 +5133,40 @@ ) (if (if (result i32) - (tee_local $9 + (tee_local $13 (if (result i32) - (tee_local $9 + (tee_local $13 (i32.eq (get_local $7) (i32.const 2146435072) ) ) - (get_local $9) + (get_local $13) (i32.eq (get_local $7) (i32.const 0) ) ) ) - (get_local $9) + (get_local $13) (i32.eq (get_local $7) (i32.const 1072693248) ) ) (block - (set_local $13 - (get_local $12) + (set_local $15 + (get_local $14) ) (if (i32.lt_s (get_local $5) (i32.const 0) ) - (set_local $13 + (set_local $15 (f64.div (f64.const 1) - (get_local $13) + (get_local $15) ) ) ) @@ -5298,15 +5186,15 @@ ) (i32.const 0) ) - (set_local $13 + (set_local $15 (f64.div (f64.sub - (get_local $13) - (get_local $13) + (get_local $15) + (get_local $15) ) (f64.sub - (get_local $13) - (get_local $13) + (get_local $15) + (get_local $15) ) ) ) @@ -5315,21 +5203,21 @@ (get_local $10) (i32.const 1) ) - (set_local $13 + (set_local $15 (f64.neg - (get_local $13) + (get_local $15) ) ) ) ) ) (return - (get_local $13) + (get_local $15) ) ) ) ) - (set_local $14 + (set_local $16 (f64.const 1) ) (if @@ -5361,7 +5249,7 @@ (get_local $10) (i32.const 1) ) - (set_local $14 + (set_local $16 (f64.const -1) ) ) @@ -5438,14 +5326,14 @@ ) (f64.mul (f64.mul - (get_local $14) + (get_local $16) (f64.const 1.e+300) ) (f64.const 1.e+300) ) (f64.mul (f64.mul - (get_local $14) + (get_local $16) (f64.const 1e-300) ) (f64.const 1e-300) @@ -5466,14 +5354,14 @@ ) (f64.mul (f64.mul - (get_local $14) + (get_local $16) (f64.const 1.e+300) ) (f64.const 1.e+300) ) (f64.mul (f64.mul - (get_local $14) + (get_local $16) (f64.const 1e-300) ) (f64.const 1e-300) @@ -5481,26 +5369,26 @@ ) ) ) - (set_local $20 + (set_local $22 (f64.sub - (get_local $12) + (get_local $14) (f64.const 1) ) ) - (set_local $23 + (set_local $25 (f64.mul (f64.mul - (get_local $20) - (get_local $20) + (get_local $22) + (get_local $22) ) (f64.sub (f64.const 0.5) (f64.mul - (get_local $20) + (get_local $22) (f64.sub (f64.const 0.3333333333333333) (f64.mul - (get_local $20) + (get_local $22) (f64.const 0.25) ) ) @@ -5508,52 +5396,52 @@ ) ) ) - (set_local $21 + (set_local $23 (f64.mul (f64.const 1.4426950216293335) - (get_local $20) + (get_local $22) ) ) - (set_local $22 + (set_local $24 (f64.sub (f64.mul - (get_local $20) + (get_local $22) (f64.const 1.9259629911266175e-08) ) (f64.mul - (get_local $23) + (get_local $25) (f64.const 1.4426950408889634) ) ) ) - (set_local $15 + (set_local $17 (f64.add - (get_local $21) - (get_local $22) + (get_local $23) + (get_local $24) ) ) - (set_local $15 + (set_local $17 (f64.reinterpret/i64 (i64.and (i64.reinterpret/f64 - (get_local $15) + (get_local $17) ) (i64.const -4294967296) ) ) ) - (set_local $16 + (set_local $18 (f64.sub - (get_local $22) + (get_local $24) (f64.sub - (get_local $15) - (get_local $21) + (get_local $17) + (get_local $23) ) ) ) ) (block - (set_local $25 + (set_local $27 (i32.const 0) ) (if @@ -5562,15 +5450,15 @@ (i32.const 1048576) ) (block - (set_local $12 + (set_local $14 (f64.mul - (get_local $12) + (get_local $14) (f64.const 9007199254740992) ) ) - (set_local $25 + (set_local $27 (i32.sub - (get_local $25) + (get_local $27) (i32.const 53) ) ) @@ -5578,7 +5466,7 @@ (i32.wrap/i64 (i64.shr_u (i64.reinterpret/f64 - (get_local $12) + (get_local $14) ) (i64.const 32) ) @@ -5586,9 +5474,9 @@ ) ) ) - (set_local $25 + (set_local $27 (i32.add - (get_local $25) + (get_local $27) (i32.sub (i32.shr_s (get_local $7) @@ -5598,7 +5486,7 @@ ) ) ) - (set_local $24 + (set_local $26 (i32.and (get_local $7) (i32.const 1048575) @@ -5606,13 +5494,13 @@ ) (set_local $7 (i32.or - (get_local $24) + (get_local $26) (i32.const 1072693248) ) ) (if (i32.le_s - (get_local $24) + (get_local $26) (i32.const 235662) ) (set_local $11 @@ -5620,7 +5508,7 @@ ) (if (i32.lt_s - (get_local $24) + (get_local $26) (i32.const 767610) ) (set_local $11 @@ -5630,9 +5518,9 @@ (set_local $11 (i32.const 0) ) - (set_local $25 + (set_local $27 (i32.add - (get_local $25) + (get_local $27) (i32.const 1) ) ) @@ -5645,12 +5533,12 @@ ) ) ) - (set_local $12 + (set_local $14 (f64.reinterpret/i64 (i64.or (i64.and (i64.reinterpret/f64 - (get_local $12) + (get_local $14) ) (i64.const 4294967295) ) @@ -5663,48 +5551,48 @@ ) ) ) - (set_local $32 + (set_local $34 (select (f64.const 1.5) (f64.const 1) (get_local $11) ) ) - (set_local $21 + (set_local $23 (f64.sub - (get_local $12) - (get_local $32) + (get_local $14) + (get_local $34) ) ) - (set_local $22 + (set_local $24 (f64.div (f64.const 1) (f64.add - (get_local $12) - (get_local $32) + (get_local $14) + (get_local $34) ) ) ) - (set_local $26 + (set_local $28 (f64.mul - (get_local $21) - (get_local $22) + (get_local $23) + (get_local $24) ) ) - (set_local $28 - (get_local $26) + (set_local $30 + (get_local $28) ) - (set_local $28 + (set_local $30 (f64.reinterpret/i64 (i64.and (i64.reinterpret/f64 - (get_local $28) + (get_local $30) ) (i64.const -4294967296) ) ) ) - (set_local $30 + (set_local $32 (f64.reinterpret/i64 (i64.shl (i64.extend_s/i32 @@ -5729,65 +5617,65 @@ ) ) ) - (set_local $31 + (set_local $33 (f64.sub - (get_local $12) + (get_local $14) (f64.sub - (get_local $30) (get_local $32) + (get_local $34) + ) + ) + ) + (set_local $31 + (f64.mul + (get_local $24) + (f64.sub + (f64.sub + (get_local $23) + (f64.mul + (get_local $30) + (get_local $32) + ) + ) + (f64.mul + (get_local $30) + (get_local $33) + ) ) ) ) (set_local $29 (f64.mul - (get_local $22) - (f64.sub - (f64.sub - (get_local $21) - (f64.mul - (get_local $28) - (get_local $30) - ) - ) - (f64.mul - (get_local $28) - (get_local $31) - ) - ) + (get_local $28) + (get_local $28) ) ) - (set_local $27 - (f64.mul - (get_local $26) - (get_local $26) - ) - ) - (set_local $19 + (set_local $21 (f64.mul (f64.mul - (get_local $27) - (get_local $27) + (get_local $29) + (get_local $29) ) (f64.add (f64.const 0.5999999999999946) (f64.mul - (get_local $27) + (get_local $29) (f64.add (f64.const 0.4285714285785502) (f64.mul - (get_local $27) + (get_local $29) (f64.add (f64.const 0.33333332981837743) (f64.mul - (get_local $27) + (get_local $29) (f64.add (f64.const 0.272728123808534) (f64.mul - (get_local $27) + (get_local $29) (f64.add (f64.const 0.23066074577556175) (f64.mul - (get_local $27) + (get_local $29) (f64.const 0.20697501780033842) ) ) @@ -5801,76 +5689,147 @@ ) ) ) - (set_local $19 + (set_local $21 (f64.add - (get_local $19) + (get_local $21) (f64.mul - (get_local $29) + (get_local $31) (f64.add + (get_local $30) (get_local $28) - (get_local $26) ) ) ) ) - (set_local $27 + (set_local $29 (f64.mul - (get_local $28) - (get_local $28) + (get_local $30) + (get_local $30) ) ) - (set_local $30 + (set_local $32 (f64.add (f64.add (f64.const 3) - (get_local $27) + (get_local $29) ) - (get_local $19) + (get_local $21) ) ) - (set_local $30 + (set_local $32 (f64.reinterpret/i64 (i64.and (i64.reinterpret/f64 - (get_local $30) + (get_local $32) ) (i64.const -4294967296) ) ) ) - (set_local $31 + (set_local $33 (f64.sub - (get_local $19) + (get_local $21) (f64.sub (f64.sub - (get_local $30) + (get_local $32) (f64.const 3) ) - (get_local $27) + (get_local $29) ) ) ) - (set_local $21 + (set_local $23 (f64.mul - (get_local $28) (get_local $30) + (get_local $32) + ) + ) + (set_local $24 + (f64.add + (f64.mul + (get_local $31) + (get_local $32) + ) + (f64.mul + (get_local $33) + (get_local $28) + ) + ) + ) + (set_local $19 + (f64.add + (get_local $23) + (get_local $24) + ) + ) + (set_local $19 + (f64.reinterpret/i64 + (i64.and + (i64.reinterpret/f64 + (get_local $19) + ) + (i64.const -4294967296) + ) + ) + ) + (set_local $20 + (f64.sub + (get_local $24) + (f64.sub + (get_local $19) + (get_local $23) + ) + ) + ) + (set_local $35 + (f64.mul + (f64.const 0.9617967009544373) + (get_local $19) + ) + ) + (set_local $36 + (select + (f64.const 1.350039202129749e-08) + (f64.const 0) + (get_local $11) + ) + ) + (set_local $37 + (f64.add + (f64.add + (f64.mul + (f64.const -7.028461650952758e-09) + (get_local $19) + ) + (f64.mul + (get_local $20) + (f64.const 0.9617966939259756) + ) + ) + (get_local $36) ) ) (set_local $22 - (f64.add - (f64.mul - (get_local $29) - (get_local $30) - ) - (f64.mul - (get_local $31) - (get_local $26) - ) + (f64.convert_s/i32 + (get_local $27) + ) + ) + (set_local $38 + (select + (f64.const 0.5849624872207642) + (f64.const 0) + (get_local $11) ) ) (set_local $17 (f64.add - (get_local $21) + (f64.add + (f64.add + (get_local $35) + (get_local $37) + ) + (get_local $38) + ) (get_local $22) ) ) @@ -5886,138 +5845,67 @@ ) (set_local $18 (f64.sub - (get_local $22) - (f64.sub - (get_local $17) - (get_local $21) - ) - ) - ) - (set_local $33 - (f64.mul - (f64.const 0.9617967009544373) - (get_local $17) - ) - ) - (set_local $34 - (select - (f64.const 1.350039202129749e-08) - (f64.const 0) - (get_local $11) - ) - ) - (set_local $35 - (f64.add - (f64.add - (f64.mul - (f64.const -7.028461650952758e-09) - (get_local $17) - ) - (f64.mul - (get_local $18) - (f64.const 0.9617966939259756) - ) - ) - (get_local $34) - ) - ) - (set_local $20 - (f64.convert_s/i32 - (get_local $25) - ) - ) - (set_local $36 - (select - (f64.const 0.5849624872207642) - (f64.const 0) - (get_local $11) - ) - ) - (set_local $15 - (f64.add - (f64.add - (f64.add - (get_local $33) - (get_local $35) - ) - (get_local $36) - ) - (get_local $20) - ) - ) - (set_local $15 - (f64.reinterpret/i64 - (i64.and - (i64.reinterpret/f64 - (get_local $15) - ) - (i64.const -4294967296) - ) - ) - ) - (set_local $16 - (f64.sub - (get_local $35) + (get_local $37) (f64.sub (f64.sub (f64.sub - (get_local $15) - (get_local $20) + (get_local $17) + (get_local $22) ) - (get_local $36) + (get_local $38) ) - (get_local $33) + (get_local $35) ) ) ) ) ) - (set_local $37 + (set_local $39 (get_local $1) ) - (set_local $37 + (set_local $39 (f64.reinterpret/i64 (i64.and (i64.reinterpret/f64 - (get_local $37) + (get_local $39) ) (i64.const -4294967296) ) ) ) - (set_local $18 + (set_local $20 (f64.add (f64.mul (f64.sub (get_local $1) - (get_local $37) + (get_local $39) ) - (get_local $15) + (get_local $17) ) (f64.mul (get_local $1) - (get_local $16) + (get_local $18) ) ) ) - (set_local $17 + (set_local $19 (f64.mul - (get_local $37) - (get_local $15) + (get_local $39) + (get_local $17) ) ) - (set_local $13 + (set_local $15 (f64.add - (get_local $18) - (get_local $17) + (get_local $20) + (get_local $19) ) ) (set_local $2 (i64.reinterpret/f64 - (get_local $13) + (get_local $15) ) ) - (set_local $24 + (set_local $26 (i32.wrap/i64 (i64.shr_u (get_local $2) @@ -6025,14 +5913,14 @@ ) ) ) - (set_local $38 + (set_local $40 (i32.wrap/i64 (get_local $2) ) ) (if (i32.ge_s - (get_local $24) + (get_local $26) (i32.const 1083179008) ) (block @@ -6040,17 +5928,17 @@ (i32.ne (i32.or (i32.sub - (get_local $24) + (get_local $26) (i32.const 1083179008) ) - (get_local $38) + (get_local $40) ) (i32.const 0) ) (return (f64.mul (f64.mul - (get_local $14) + (get_local $16) (f64.const 1.e+300) ) (f64.const 1.e+300) @@ -6060,18 +5948,18 @@ (if (f64.gt (f64.add - (get_local $18) + (get_local $20) (f64.const 8.008566259537294e-17) ) (f64.sub - (get_local $13) - (get_local $17) + (get_local $15) + (get_local $19) ) ) (return (f64.mul (f64.mul - (get_local $14) + (get_local $16) (f64.const 1.e+300) ) (f64.const 1.e+300) @@ -6082,7 +5970,7 @@ (if (i32.ge_s (i32.and - (get_local $24) + (get_local $26) (i32.const 2147483647) ) (i32.const 1083231232) @@ -6092,17 +5980,17 @@ (i32.ne (i32.or (i32.sub - (get_local $24) + (get_local $26) (i32.const -1064252416) ) - (get_local $38) + (get_local $40) ) (i32.const 0) ) (return (f64.mul (f64.mul - (get_local $14) + (get_local $16) (f64.const 1e-300) ) (f64.const 1e-300) @@ -6111,16 +5999,16 @@ ) (if (f64.le - (get_local $18) + (get_local $20) (f64.sub - (get_local $13) - (get_local $17) + (get_local $15) + (get_local $19) ) ) (return (f64.mul (f64.mul - (get_local $14) + (get_local $16) (f64.const 1e-300) ) (f64.const 1e-300) @@ -6130,33 +6018,33 @@ ) ) ) - (set_local $38 + (set_local $40 (i32.and - (get_local $24) + (get_local $26) (i32.const 2147483647) ) ) (set_local $11 (i32.sub (i32.shr_s - (get_local $38) + (get_local $40) (i32.const 20) ) (i32.const 1023) ) ) - (set_local $25 + (set_local $27 (i32.const 0) ) (if (i32.gt_s - (get_local $38) + (get_local $40) (i32.const 1071644672) ) (block - (set_local $25 + (set_local $27 (i32.add - (get_local $24) + (get_local $26) (i32.shr_s (i32.const 1048576) (i32.add @@ -6170,7 +6058,7 @@ (i32.sub (i32.shr_s (i32.and - (get_local $25) + (get_local $27) (i32.const 2147483647) ) (i32.const 20) @@ -6178,15 +6066,15 @@ (i32.const 1023) ) ) - (set_local $20 + (set_local $22 (f64.const 0) ) - (set_local $20 + (set_local $22 (f64.reinterpret/i64 (i64.shl (i64.extend_s/i32 (i32.and - (get_local $25) + (get_local $27) (i32.xor (i32.shr_s (i32.const 1048575) @@ -6200,11 +6088,11 @@ ) ) ) - (set_local $25 + (set_local $27 (i32.shr_s (i32.or (i32.and - (get_local $25) + (get_local $27) (i32.const 1048575) ) (i32.const 1048576) @@ -6217,106 +6105,106 @@ ) (if (i32.lt_s - (get_local $24) + (get_local $26) (i32.const 0) ) - (set_local $25 + (set_local $27 (i32.sub (i32.const 0) - (get_local $25) + (get_local $27) ) ) ) - (set_local $17 + (set_local $19 (f64.sub - (get_local $17) - (get_local $20) + (get_local $19) + (get_local $22) ) ) ) ) - (set_local $20 + (set_local $22 (f64.add - (get_local $18) - (get_local $17) + (get_local $20) + (get_local $19) ) ) - (set_local $20 + (set_local $22 (f64.reinterpret/i64 (i64.and (i64.reinterpret/f64 - (get_local $20) + (get_local $22) ) (i64.const -4294967296) ) ) ) - (set_local $21 + (set_local $23 (f64.mul - (get_local $20) + (get_local $22) (f64.const 0.6931471824645996) ) ) - (set_local $22 + (set_local $24 (f64.add (f64.mul (f64.sub - (get_local $18) + (get_local $20) (f64.sub - (get_local $20) - (get_local $17) + (get_local $22) + (get_local $19) ) ) (f64.const 0.6931471805599453) ) (f64.mul - (get_local $20) + (get_local $22) (f64.const -1.904654299957768e-09) ) ) ) - (set_local $13 + (set_local $15 (f64.add - (get_local $21) - (get_local $22) + (get_local $23) + (get_local $24) ) ) - (set_local $23 + (set_local $25 (f64.sub - (get_local $22) + (get_local $24) (f64.sub - (get_local $13) - (get_local $21) + (get_local $15) + (get_local $23) ) ) ) - (set_local $20 + (set_local $22 (f64.mul - (get_local $13) - (get_local $13) + (get_local $15) + (get_local $15) ) ) - (set_local $15 + (set_local $17 (f64.sub - (get_local $13) + (get_local $15) (f64.mul - (get_local $20) + (get_local $22) (f64.add (f64.const 0.16666666666666602) (f64.mul - (get_local $20) + (get_local $22) (f64.add (f64.const -2.7777777777015593e-03) (f64.mul - (get_local $20) + (get_local $22) (f64.add (f64.const 6.613756321437934e-05) (f64.mul - (get_local $20) + (get_local $22) (f64.add (f64.const -1.6533902205465252e-06) (f64.mul - (get_local $20) + (get_local $22) (f64.const 4.1381367970572385e-08) ) ) @@ -6329,51 +6217,51 @@ ) ) ) - (set_local $19 + (set_local $21 (f64.sub (f64.div (f64.mul - (get_local $13) (get_local $15) + (get_local $17) ) (f64.sub - (get_local $15) + (get_local $17) (f64.const 2) ) ) (f64.add - (get_local $23) + (get_local $25) (f64.mul - (get_local $13) - (get_local $23) + (get_local $15) + (get_local $25) ) ) ) ) - (set_local $13 + (set_local $15 (f64.sub (f64.const 1) (f64.sub - (get_local $19) - (get_local $13) + (get_local $21) + (get_local $15) ) ) ) - (set_local $24 + (set_local $26 (i32.wrap/i64 (i64.shr_u (i64.reinterpret/f64 - (get_local $13) + (get_local $15) ) (i64.const 32) ) ) ) - (set_local $24 + (set_local $26 (i32.add - (get_local $24) + (get_local $26) (i32.shl - (get_local $25) + (get_local $27) (i32.const 20) ) ) @@ -6381,29 +6269,29 @@ (if (i32.le_s (i32.shr_s - (get_local $24) + (get_local $26) (i32.const 20) ) (i32.const 0) ) - (set_local $13 + (set_local $15 (call $~lib/math/NativeMath.scalbn - (get_local $13) - (get_local $25) + (get_local $15) + (get_local $27) ) ) - (set_local $13 + (set_local $15 (f64.reinterpret/i64 (i64.or (i64.and (i64.reinterpret/f64 - (get_local $13) + (get_local $15) ) (i64.const 4294967295) ) (i64.shl (i64.extend_s/i32 - (get_local $24) + (get_local $26) ) (i64.const 32) ) @@ -6412,245 +6300,80 @@ ) ) (f64.mul - (get_local $14) - (get_local $13) + (get_local $16) + (get_local $15) ) ) - (func $std/libm/pow (; 48 ;) (type $FFF) (param $0 f64) (param $1 f64) (result f64) + (func $std/libm/pow (; 47 ;) (type $FFF) (param $0 f64) (param $1 f64) (result f64) (call $~lib/math/NativeMath.pow (get_local $0) (get_local $1) ) ) - (func $~lib/math/NativeMath.round (; 49 ;) (type $FF) (param $0 f64) (result f64) - (local $1 i64) - (local $2 i32) - (local $3 f64) - (set_local $1 - (i64.reinterpret/f64 - (get_local $0) - ) - ) - (set_local $2 - (i32.wrap/i64 - (i64.and - (i64.shr_u - (get_local $1) - (i64.const 52) - ) - (i64.const 2047) - ) - ) - ) - (if - (i32.ge_s - (get_local $2) - (i32.add - (i32.const 1023) - (i32.const 52) - ) - ) - (return - (get_local $0) - ) - ) - (if - (i32.lt_s - (get_local $2) - (i32.sub - (i32.const 1023) - (i32.const 1) - ) - ) - (return - (f64.mul - (f64.const 0) - (get_local $0) - ) - ) - ) - (if - (i64.ne - (i64.shr_u - (get_local $1) - (i64.const 63) - ) - (i64.const 0) - ) - (block - (set_local $3 + (func $std/libm/round (; 48 ;) (type $FF) (param $0 f64) (result f64) + (block $~lib/math/NativeMath.round|inlined.0 (result f64) + (f64.copysign + (f64.floor (f64.add - (f64.sub - (f64.sub - (f64.const 4503599627370496) - (get_local $0) - ) - (f64.const 4503599627370496) - ) (get_local $0) - ) - ) - (if - (f64.ge - (get_local $3) (f64.const 0.5) ) - (set_local $3 - (f64.add - (f64.sub - (get_local $0) - (get_local $3) - ) - (f64.const 1) - ) - ) - (if - (f64.lt - (get_local $3) - (f64.const -0.5) - ) - (set_local $3 - (f64.sub - (f64.sub - (get_local $0) - (get_local $3) - ) - (f64.const 1) - ) - ) - (set_local $3 - (f64.sub - (get_local $0) - (get_local $3) - ) - ) - ) - ) - ) - (block - (set_local $3 - (f64.sub - (f64.sub - (f64.add - (get_local $0) - (f64.const 4503599627370496) - ) - (f64.const 4503599627370496) - ) - (get_local $0) - ) - ) - (if - (f64.gt - (get_local $3) - (f64.const 0.5) - ) - (set_local $3 - (f64.sub - (f64.add - (get_local $3) - (get_local $0) - ) - (f64.const 1) - ) - ) - (if - (f64.le - (get_local $3) - (f64.const -0.5) - ) - (set_local $3 - (f64.add - (f64.add - (get_local $3) - (get_local $0) - ) - (f64.const 1) - ) - ) - (set_local $3 - (f64.add - (get_local $3) - (get_local $0) - ) - ) - ) - ) - ) - ) - (get_local $3) - ) - (func $std/libm/round (; 50 ;) (type $FF) (param $0 f64) (result f64) - (call $~lib/math/NativeMath.round - (get_local $0) - ) - ) - (func $std/libm/sign (; 51 ;) (type $FF) (param $0 f64) (result f64) - (block $~lib/math/NativeMath.sign|inlined.0 (result f64) - (if (result f64) - (f64.gt - (f64.abs - (get_local $0) - ) - (f64.const 0) - ) - (f64.copysign - (f64.const 1) - (get_local $0) ) (get_local $0) ) ) ) - (func $~lib/math/NativeMath.sin (; 52 ;) (type $FF) (param $0 f64) (result f64) + (func $std/libm/sign (; 49 ;) (type $FF) (param $0 f64) (result f64) + (block $~lib/math/NativeMath.sign|inlined.0 (result f64) + (br $~lib/math/NativeMath.sign|inlined.0 + (if (result f64) + (f64.gt + (get_local $0) + (f64.const 0) + ) + (f64.const 1) + (if (result f64) + (f64.lt + (get_local $0) + (f64.const 0) + ) + (f64.const -1) + (get_local $0) + ) + ) + ) + ) + ) + (func $~lib/math/NativeMath.sin (; 50 ;) (type $FF) (param $0 f64) (result f64) (unreachable) (f64.const 0) ) - (func $std/libm/sin (; 53 ;) (type $FF) (param $0 f64) (result f64) + (func $std/libm/sin (; 51 ;) (type $FF) (param $0 f64) (result f64) (call $~lib/math/NativeMath.sin (get_local $0) ) ) - (func $~lib/math/NativeMath.sinh (; 54 ;) (type $FF) (param $0 f64) (result f64) + (func $~lib/math/NativeMath.sinh (; 52 ;) (type $FF) (param $0 f64) (result f64) (local $1 i64) (local $2 f64) - (local $3 f64) - (local $4 i32) + (local $3 i32) + (local $4 f64) (local $5 f64) - (set_local $1 - (i64.reinterpret/f64 - (get_local $0) - ) - ) - (set_local $2 - (f64.const 0.5) - ) - (if - (i64.ne - (i64.shr_u - (get_local $1) - (i64.const 63) - ) - (i64.const 0) - ) - (set_local $2 - (f64.neg - (get_local $2) - ) - ) - ) + (local $6 f64) (set_local $1 (i64.and - (get_local $1) + (i64.reinterpret/f64 + (get_local $0) + ) (i64.const 9223372036854775807) ) ) - (set_local $3 + (set_local $2 (f64.reinterpret/i64 (get_local $1) ) ) - (set_local $4 + (set_local $3 (i32.wrap/i64 (i64.shr_u (get_local $1) @@ -6658,26 +6381,32 @@ ) ) ) + (set_local $5 + (f64.copysign + (f64.const 0.5) + (get_local $0) + ) + ) (if (i32.lt_u - (get_local $4) + (get_local $3) (i32.const 1082535490) ) (block - (set_local $5 + (set_local $4 (call $~lib/math/NativeMath.expm1 - (get_local $3) + (get_local $2) ) ) (if (i32.lt_u - (get_local $4) + (get_local $3) (i32.const 1072693248) ) (block (if (i32.lt_u - (get_local $4) + (get_local $3) (i32.sub (i32.const 1072693248) (i32.shl @@ -6692,19 +6421,19 @@ ) (return (f64.mul - (get_local $2) + (get_local $5) (f64.sub (f64.mul (f64.const 2) - (get_local $5) + (get_local $4) ) (f64.div (f64.mul - (get_local $5) - (get_local $5) + (get_local $4) + (get_local $4) ) (f64.add - (get_local $5) + (get_local $4) (f64.const 1) ) ) @@ -6715,13 +6444,13 @@ ) (return (f64.mul - (get_local $2) + (get_local $5) (f64.add - (get_local $5) + (get_local $4) (f64.div - (get_local $5) + (get_local $4) (f64.add - (get_local $5) + (get_local $4) (f64.const 1) ) ) @@ -6730,43 +6459,73 @@ ) ) ) - (set_local $5 + (set_local $4 (f64.mul (f64.mul (f64.const 2) - (get_local $2) + (get_local $5) ) - (call $~lib/math/expo2 - (get_local $3) + (block $~lib/math/expo2|inlined.1 (result f64) + (set_local $6 + (f64.reinterpret/i64 + (i64.shl + (i64.extend_u/i32 + (i32.shl + (i32.add + (i32.const 1023) + (i32.div_u + (i32.const 2043) + (i32.const 2) + ) + ) + (i32.const 20) + ) + ) + (i64.const 32) + ) + ) + ) + (f64.mul + (f64.mul + (call $~lib/math/NativeMath.exp + (f64.sub + (get_local $2) + (f64.const 1416.0996898839683) + ) + ) + (get_local $6) + ) + (get_local $6) + ) ) ) ) - (get_local $5) + (get_local $4) ) - (func $std/libm/sinh (; 55 ;) (type $FF) (param $0 f64) (result f64) + (func $std/libm/sinh (; 53 ;) (type $FF) (param $0 f64) (result f64) (call $~lib/math/NativeMath.sinh (get_local $0) ) ) - (func $std/libm/sqrt (; 56 ;) (type $FF) (param $0 f64) (result f64) + (func $std/libm/sqrt (; 54 ;) (type $FF) (param $0 f64) (result f64) (block $~lib/math/NativeMath.sqrt|inlined.0 (result f64) (f64.sqrt (get_local $0) ) ) ) - (func $~lib/math/NativeMath.tan (; 57 ;) (type $FF) (param $0 f64) (result f64) + (func $~lib/math/NativeMath.tan (; 55 ;) (type $FF) (param $0 f64) (result f64) (unreachable) (f64.const 0) ) - (func $std/libm/tan (; 58 ;) (type $FF) (param $0 f64) (result f64) + (func $std/libm/tan (; 56 ;) (type $FF) (param $0 f64) (result f64) (call $~lib/math/NativeMath.tan (get_local $0) ) ) - (func $~lib/math/NativeMath.tanh (; 59 ;) (type $FF) (param $0 f64) (result f64) + (func $~lib/math/NativeMath.tanh (; 57 ;) (type $FF) (param $0 f64) (result f64) (local $1 i64) - (local $2 i32) + (local $2 f64) (local $3 i32) (local $4 f64) (set_local $1 @@ -6774,21 +6533,13 @@ (get_local $0) ) ) - (set_local $2 - (i32.wrap/i64 - (i64.shr_u - (get_local $1) - (i64.const 63) - ) - ) - ) (set_local $1 (i64.and (get_local $1) (i64.const 9223372036854775807) ) ) - (set_local $0 + (set_local $2 (f64.reinterpret/i64 (get_local $1) ) @@ -6816,7 +6567,7 @@ (f64.const 1) (f64.div (f64.const 0) - (get_local $0) + (get_local $2) ) ) ) @@ -6825,7 +6576,7 @@ (call $~lib/math/NativeMath.expm1 (f64.mul (f64.const 2) - (get_local $0) + (get_local $2) ) ) ) @@ -6853,7 +6604,7 @@ (call $~lib/math/NativeMath.expm1 (f64.mul (f64.const 2) - (get_local $0) + (get_local $2) ) ) ) @@ -6877,7 +6628,7 @@ (call $~lib/math/NativeMath.expm1 (f64.mul (f64.const -2) - (get_local $0) + (get_local $2) ) ) ) @@ -6894,31 +6645,28 @@ ) ) (set_local $4 - (get_local $0) + (get_local $2) ) ) ) ) - (if (result f64) - (get_local $2) - (f64.neg - (get_local $4) - ) + (f64.copysign (get_local $4) + (get_local $0) ) ) - (func $std/libm/tanh (; 60 ;) (type $FF) (param $0 f64) (result f64) + (func $std/libm/tanh (; 58 ;) (type $FF) (param $0 f64) (result f64) (call $~lib/math/NativeMath.tanh (get_local $0) ) ) - (func $std/libm/trunc (; 61 ;) (type $FF) (param $0 f64) (result f64) + (func $std/libm/trunc (; 59 ;) (type $FF) (param $0 f64) (result f64) (block $~lib/math/NativeMath.trunc|inlined.0 (result f64) (f64.trunc (get_local $0) ) ) ) - (func $null (; 62 ;) (type $v) + (func $null (; 60 ;) (type $v) ) ) diff --git a/tests/compiler/std/math.optimized.wat b/tests/compiler/std/math.optimized.wat index 0fa7c47e..945627b7 100644 --- a/tests/compiler/std/math.optimized.wat +++ b/tests/compiler/std/math.optimized.wat @@ -17,6 +17,7 @@ (type $F (func (result f64))) (type $Iv (func (param i64))) (type $II (func (param i64) (result i64))) + (type $ii (func (param i32) (result i32))) (type $f (func (result f32))) (type $IiI (func (param i64 i32) (result i64))) (type $v (func)) @@ -73,8 +74,10 @@ (import "Math" "tanh" (func $~lib/bindings/Math/tanh (param f64) (result f64))) (import "Math" "trunc" (func $~lib/bindings/Math/trunc (param f64) (result f64))) (global $~lib/math/random_seeded (mut i32) (i32.const 0)) - (global $~lib/math/random_state0 (mut i64) (i64.const 0)) - (global $~lib/math/random_state1 (mut i64) (i64.const 0)) + (global $~lib/math/random_state0_64 (mut i64) (i64.const 0)) + (global $~lib/math/random_state1_64 (mut i64) (i64.const 0)) + (global $~lib/math/random_state0_32 (mut i32) (i32.const 0)) + (global $~lib/math/random_state1_32 (mut i32) (i32.const 0)) (export "memory" (memory $0)) (export "table" (table $0)) (start $start) @@ -134,19 +137,15 @@ ) ) (func $~lib/math/NativeMath.scalbn (; 34 ;) (; has Stack IR ;) (type $FiF) (param $0 f64) (param $1 i32) (result f64) - (local $2 f64) - (set_local $2 - (get_local $0) - ) (if (i32.gt_s (get_local $1) (i32.const 1023) ) (block - (set_local $2 + (set_local $0 (f64.mul - (get_local $2) + (get_local $0) (f64.const 8988465674311579538646525e283) ) ) @@ -161,14 +160,14 @@ (i32.const 1023) ) (block - (set_local $2 + (set_local $0 (f64.mul - (get_local $2) + (get_local $0) (f64.const 8988465674311579538646525e283) ) ) - (if - (i32.gt_s + (set_local $1 + (select (tee_local $1 (i32.sub (get_local $1) @@ -176,9 +175,10 @@ ) ) (i32.const 1023) - ) - (set_local $1 - (i32.const 1023) + (i32.lt_s + (get_local $1) + (i32.const 1023) + ) ) ) ) @@ -190,10 +190,10 @@ (i32.const -1022) ) (block - (set_local $2 + (set_local $0 (f64.mul - (get_local $2) - (f64.const 2.2250738585072014e-308) + (get_local $0) + (f64.const 2.004168360008973e-292) ) ) (if @@ -201,30 +201,31 @@ (tee_local $1 (i32.add (get_local $1) - (i32.const 1022) + (i32.const 969) ) ) (i32.const -1022) ) (block - (set_local $2 + (set_local $0 (f64.mul - (get_local $2) - (f64.const 2.2250738585072014e-308) + (get_local $0) + (f64.const 2.004168360008973e-292) ) ) - (if - (i32.lt_s + (set_local $1 + (select (tee_local $1 (i32.add (get_local $1) - (i32.const 1022) + (i32.const 969) ) ) (i32.const -1022) - ) - (set_local $1 - (i32.const -1022) + (i32.gt_s + (get_local $1) + (i32.const -1022) + ) ) ) ) @@ -233,7 +234,7 @@ ) ) (f64.mul - (get_local $2) + (get_local $0) (f64.reinterpret/i64 (i64.shl (i64.add @@ -432,19 +433,15 @@ ) ) (func $~lib/math/NativeMathf.scalbn (; 41 ;) (; has Stack IR ;) (type $fif) (param $0 f32) (param $1 i32) (result f32) - (local $2 f32) - (set_local $2 - (get_local $0) - ) (if (i32.gt_s (get_local $1) (i32.const 127) ) (block - (set_local $2 + (set_local $0 (f32.mul - (get_local $2) + (get_local $0) (f32.const 1701411834604692317316873e14) ) ) @@ -459,14 +456,14 @@ (i32.const 127) ) (block - (set_local $2 + (set_local $0 (f32.mul - (get_local $2) + (get_local $0) (f32.const 1701411834604692317316873e14) ) ) - (if - (i32.gt_s + (set_local $1 + (select (tee_local $1 (i32.sub (get_local $1) @@ -474,9 +471,10 @@ ) ) (i32.const 127) - ) - (set_local $1 - (i32.const 127) + (i32.lt_s + (get_local $1) + (i32.const 127) + ) ) ) ) @@ -488,10 +486,10 @@ (i32.const -126) ) (block - (set_local $2 + (set_local $0 (f32.mul - (get_local $2) - (f32.const 1.1754943508222875e-38) + (get_local $0) + (f32.const 1.9721522630525295e-31) ) ) (if @@ -499,30 +497,31 @@ (tee_local $1 (i32.add (get_local $1) - (i32.const 126) + (i32.const 102) ) ) (i32.const -126) ) (block - (set_local $2 + (set_local $0 (f32.mul - (get_local $2) - (f32.const 1.1754943508222875e-38) + (get_local $0) + (f32.const 1.9721522630525295e-31) ) ) - (if - (i32.lt_s + (set_local $1 + (select (tee_local $1 (i32.add (get_local $1) - (i32.const 126) + (i32.const 102) ) ) (i32.const -126) - ) - (set_local $1 - (i32.const -126) + (i32.gt_s + (get_local $1) + (i32.const -126) + ) ) ) ) @@ -531,7 +530,7 @@ ) ) (f32.mul - (get_local $2) + (get_local $0) (f32.reinterpret/i32 (i32.shl (i32.add @@ -909,12 +908,12 @@ (set_local $0 (f64.sqrt (tee_local $1 - (f64.mul - (f64.add - (f64.const 1) - (get_local $0) - ) + (f64.add (f64.const 0.5) + (f64.mul + (get_local $0) + (f64.const 0.5) + ) ) ) ) @@ -947,12 +946,12 @@ (set_local $0 (f64.sqrt (tee_local $1 - (f64.mul - (f64.sub - (f64.const 1) - (get_local $0) - ) + (f64.sub (f64.const 0.5) + (f64.mul + (get_local $0) + (f64.const 0.5) + ) ) ) ) @@ -1154,12 +1153,12 @@ (set_local $0 (f32.sqrt (tee_local $1 - (f32.mul - (f32.add - (f32.const 1) - (get_local $0) - ) + (f32.add (f32.const 0.5) + (f32.mul + (get_local $0) + (f32.const 0.5) + ) ) ) ) @@ -1194,12 +1193,12 @@ (tee_local $0 (f32.sqrt (tee_local $1 - (f32.mul - (f32.sub - (f32.const 1) - (get_local $0) - ) + (f32.sub (f32.const 0.5) + (f32.mul + (get_local $0) + (f32.const 0.5) + ) ) ) ) @@ -2404,14 +2403,11 @@ ) ) (f32.sqrt - (f32.add - (f32.mul + (f32.mul + (get_local $0) + (f32.add (get_local $0) - (get_local $0) - ) - (f32.mul (f32.const 2) - (get_local $0) ) ) ) @@ -2574,14 +2570,14 @@ (set_local $0 (f64.sqrt (tee_local $1 - (f64.mul - (f64.sub - (f64.const 1) + (f64.sub + (f64.const 0.5) + (f64.mul (f64.abs (get_local $0) ) + (f64.const 0.5) ) - (f64.const 0.5) ) ) ) @@ -2705,18 +2701,16 @@ ) (func $~lib/math/NativeMathf.asin (; 64 ;) (; has Stack IR ;) (type $ff) (param $0 f32) (result f32) (local $1 i32) - (local $2 i32) - (local $3 f64) - (local $4 f32) + (local $2 f32) + (local $3 i32) + (local $4 f64) (local $5 f64) (if (i32.ge_u - (tee_local $2 + (tee_local $1 (i32.and - (tee_local $1 - (i32.reinterpret/f32 - (get_local $0) - ) + (i32.reinterpret/f32 + (get_local $0) ) (i32.const 2147483647) ) @@ -2726,7 +2720,7 @@ (block (if (i32.eq - (get_local $2) + (get_local $1) (i32.const 1065353216) ) (return @@ -2752,31 +2746,31 @@ ) (if (i32.lt_u - (get_local $2) + (get_local $1) (i32.const 1056964608) ) (block (if - (tee_local $1 + (tee_local $3 (i32.lt_u - (get_local $2) + (get_local $1) (i32.const 964689920) ) ) - (set_local $1 + (set_local $3 (i32.ge_u - (get_local $2) + (get_local $1) (i32.const 8388608) ) ) ) (if - (get_local $1) + (get_local $3) (return (get_local $0) ) ) - (set_local $4 + (set_local $2 (call $~lib/math/Rf (f32.mul (get_local $0) @@ -2789,24 +2783,24 @@ (get_local $0) (f32.mul (get_local $0) - (get_local $4) + (get_local $2) ) ) ) ) ) - (set_local $3 + (set_local $4 (f64.sqrt (f64.promote/f32 - (tee_local $0 - (f32.mul - (f32.sub - (f32.const 1) + (tee_local $2 + (f32.sub + (f32.const 0.5) + (f32.mul (f32.abs (get_local $0) ) + (f32.const 0.5) ) - (f32.const 0.5) ) ) ) @@ -2815,39 +2809,28 @@ (set_local $5 (f64.promote/f32 (call $~lib/math/Rf - (get_local $0) + (get_local $2) ) ) ) - (set_local $0 + (f32.copysign (f32.demote/f64 (f64.sub (f64.const 1.5707963705062866) (f64.mul (f64.const 2) (f64.add - (get_local $3) + (get_local $4) (f64.mul - (get_local $3) + (get_local $4) (get_local $5) ) ) ) ) ) + (get_local $0) ) - (if - (i32.shr_u - (get_local $1) - (i32.const 31) - ) - (return - (f32.neg - (get_local $0) - ) - ) - ) - (get_local $0) ) (func $std/math/test_asinf (; 65 ;) (; has Stack IR ;) (type $fffii) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 i32) (result i32) (call $std/math/check @@ -2859,60 +2842,52 @@ ) ) (func $~lib/math/NativeMath.asinh (; 66 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) - (local $1 i64) + (local $1 f64) (local $2 i64) - (local $3 i64) (set_local $1 - (i64.and - (i64.shr_u + (f64.reinterpret/i64 + (i64.and (tee_local $2 (i64.reinterpret/f64 (get_local $0) ) ) - (i64.const 52) - ) - (i64.const 2047) - ) - ) - (set_local $3 - (i64.shr_u - (get_local $2) - (i64.const 63) - ) - ) - (set_local $0 - (f64.reinterpret/i64 - (i64.and - (get_local $2) (i64.const 9223372036854775807) ) ) ) (if (i64.ge_u - (get_local $1) + (tee_local $2 + (i64.and + (i64.shr_u + (get_local $2) + (i64.const 52) + ) + (i64.const 2047) + ) + ) (i64.const 1049) ) - (set_local $0 + (set_local $1 (f64.add (call $~lib/math/NativeMath.log - (get_local $0) + (get_local $1) ) (f64.const 0.6931471805599453) ) ) (if (i64.ge_u - (get_local $1) + (get_local $2) (i64.const 1024) ) - (set_local $0 + (set_local $1 (call $~lib/math/NativeMath.log (f64.add (f64.mul (f64.const 2) - (get_local $0) + (get_local $1) ) (f64.div (f64.const 1) @@ -2920,13 +2895,13 @@ (f64.sqrt (f64.add (f64.mul - (get_local $0) - (get_local $0) + (get_local $1) + (get_local $1) ) (f64.const 1) ) ) - (get_local $0) + (get_local $1) ) ) ) @@ -2934,24 +2909,24 @@ ) (if (i64.ge_u - (get_local $1) + (get_local $2) (i64.const 997) ) - (set_local $0 + (set_local $1 (call $~lib/math/NativeMath.log1p (f64.add - (get_local $0) + (get_local $1) (f64.div - (tee_local $0 + (tee_local $1 (f64.mul - (get_local $0) - (get_local $0) + (get_local $1) + (get_local $1) ) ) (f64.add (f64.sqrt (f64.add - (get_local $0) + (get_local $1) (f64.const 1) ) ) @@ -2964,18 +2939,10 @@ ) ) ) - (if - (i64.ne - (get_local $3) - (i64.const 0) - ) - (set_local $0 - (f64.neg - (get_local $0) - ) - ) + (f64.copysign + (get_local $1) + (get_local $0) ) - (get_local $0) ) (func $std/math/test_asinh (; 67 ;) (; has Stack IR ;) (type $FFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 i32) (result i32) (local $4 i32) @@ -3004,40 +2971,29 @@ ) ) (func $~lib/math/NativeMathf.asinh (; 68 ;) (; has Stack IR ;) (type $ff) (param $0 f32) (result f32) - (local $1 i32) + (local $1 f32) (local $2 i32) - (local $3 i32) - (set_local $3 - (i32.shr_u - (tee_local $1 - (i32.reinterpret/f32 - (get_local $0) - ) - ) - (i32.const 31) - ) - ) - (set_local $0 + (set_local $1 (f32.reinterpret/i32 - (tee_local $1 - (tee_local $2 - (i32.and - (get_local $1) - (i32.const 2147483647) + (tee_local $2 + (i32.and + (i32.reinterpret/f32 + (get_local $0) ) + (i32.const 2147483647) ) ) ) ) (if (i32.ge_u - (get_local $1) + (get_local $2) (i32.const 1166016512) ) - (set_local $0 + (set_local $1 (f32.add (call $~lib/math/NativeMathf.log - (get_local $0) + (get_local $1) ) (f32.const 0.6931471824645996) ) @@ -3047,12 +3003,12 @@ (get_local $2) (i32.const 1073741824) ) - (set_local $0 + (set_local $1 (call $~lib/math/NativeMathf.log (f32.add (f32.mul (f32.const 2) - (get_local $0) + (get_local $1) ) (f32.div (f32.const 1) @@ -3060,13 +3016,13 @@ (f32.sqrt (f32.add (f32.mul - (get_local $0) - (get_local $0) + (get_local $1) + (get_local $1) ) (f32.const 1) ) ) - (get_local $0) + (get_local $1) ) ) ) @@ -3077,21 +3033,21 @@ (get_local $2) (i32.const 964689920) ) - (set_local $0 + (set_local $1 (call $~lib/math/NativeMathf.log1p (f32.add - (get_local $0) + (get_local $1) (f32.div - (tee_local $0 + (tee_local $1 (f32.mul - (get_local $0) - (get_local $0) + (get_local $1) + (get_local $1) ) ) (f32.add (f32.sqrt (f32.add - (get_local $0) + (get_local $1) (f32.const 1) ) ) @@ -3104,15 +3060,10 @@ ) ) ) - (if - (get_local $3) - (set_local $0 - (f32.neg - (get_local $0) - ) - ) + (f32.copysign + (get_local $1) + (get_local $0) ) - (get_local $0) ) (func $std/math/test_asinhf (; 69 ;) (; has Stack IR ;) (type $fffii) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 i32) (result i32) (call $std/math/check @@ -3124,30 +3075,25 @@ ) ) (func $~lib/math/NativeMath.atan (; 70 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) - (local $1 i32) - (local $2 f64) + (local $1 f64) + (local $2 i32) (local $3 f64) - (local $4 i32) + (local $4 f64) (set_local $4 - (i32.shr_u - (tee_local $1 - (i32.wrap/i64 - (i64.shr_u - (i64.reinterpret/f64 - (get_local $0) - ) - (i64.const 32) - ) - ) - ) - (i32.const 31) - ) + (get_local $0) ) (if (i32.ge_u - (tee_local $1 + (tee_local $2 (i32.and - (get_local $1) + (i32.wrap/i64 + (i64.shr_u + (i64.reinterpret/f64 + (get_local $0) + ) + (i64.const 32) + ) + ) (i32.const 2147483647) ) ) @@ -3163,32 +3109,29 @@ ) ) (return - (tee_local $0 - (if (result f64) - (get_local $4) - (f64.const -1.5707963267948966) - (f64.const 1.5707963267948966) - ) + (f64.copysign + (f64.const 1.5707963267948966) + (get_local $4) ) ) ) ) (if (i32.lt_u - (get_local $1) + (get_local $2) (i32.const 1071382528) ) (block (if (i32.lt_u - (get_local $1) + (get_local $2) (i32.const 1044381696) ) (return (get_local $0) ) ) - (set_local $1 + (set_local $2 (i32.const -1) ) ) @@ -3201,16 +3144,16 @@ (set_local $0 (if (result f64) (i32.lt_u - (get_local $1) + (get_local $2) (i32.const 1072889856) ) (if (result f64) (i32.lt_u - (get_local $1) + (get_local $2) (i32.const 1072037888) ) (block (result f64) - (set_local $1 + (set_local $2 (i32.const 0) ) (f64.div @@ -3228,7 +3171,7 @@ ) ) (block (result f64) - (set_local $1 + (set_local $2 (i32.const 1) ) (f64.div @@ -3245,11 +3188,11 @@ ) (if (result f64) (i32.lt_u - (get_local $1) + (get_local $2) (i32.const 1073971200) ) (block (result f64) - (set_local $1 + (set_local $2 (i32.const 2) ) (f64.div @@ -3267,7 +3210,7 @@ ) ) (block (result f64) - (set_local $1 + (set_local $2 (i32.const 3) ) (f64.div @@ -3280,7 +3223,7 @@ ) ) ) - (set_local $2 + (set_local $1 (f64.mul (tee_local $3 (f64.mul @@ -3291,30 +3234,63 @@ (get_local $3) ) ) - (set_local $3 + (set_local $1 (f64.mul - (get_local $3) + (get_local $0) (f64.add - (f64.const 0.3333333333333293) (f64.mul - (get_local $2) + (get_local $3) (f64.add - (f64.const 0.14285714272503466) + (f64.const 0.3333333333333293) (f64.mul - (get_local $2) + (get_local $1) (f64.add - (f64.const 0.09090887133436507) + (f64.const 0.14285714272503466) (f64.mul - (get_local $2) + (get_local $1) (f64.add - (f64.const 0.06661073137387531) + (f64.const 0.09090887133436507) (f64.mul - (get_local $2) + (get_local $1) (f64.add - (f64.const 0.049768779946159324) + (f64.const 0.06661073137387531) (f64.mul - (get_local $2) - (f64.const 0.016285820115365782) + (get_local $1) + (f64.add + (f64.const 0.049768779946159324) + (f64.mul + (get_local $1) + (f64.const 0.016285820115365782) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + (f64.mul + (get_local $1) + (f64.add + (f64.const -0.19999999999876483) + (f64.mul + (get_local $1) + (f64.add + (f64.const -0.11111110405462356) + (f64.mul + (get_local $1) + (f64.add + (f64.const -0.0769187620504483) + (f64.mul + (get_local $1) + (f64.add + (f64.const -0.058335701337905735) + (f64.mul + (get_local $1) + (f64.const -0.036531572744216916) ) ) ) @@ -3327,51 +3303,15 @@ ) ) ) - (set_local $2 - (f64.mul - (get_local $2) - (f64.add - (f64.const -0.19999999999876483) - (f64.mul - (get_local $2) - (f64.add - (f64.const -0.11111110405462356) - (f64.mul - (get_local $2) - (f64.add - (f64.const -0.0769187620504483) - (f64.mul - (get_local $2) - (f64.add - (f64.const -0.058335701337905735) - (f64.mul - (get_local $2) - (f64.const -0.036531572744216916) - ) - ) - ) - ) - ) - ) - ) - ) - ) - ) (if (i32.lt_s - (get_local $1) + (get_local $2) (i32.const 0) ) (return (f64.sub (get_local $0) - (f64.mul - (get_local $0) - (f64.add - (get_local $3) - (get_local $2) - ) - ) + (get_local $1) ) ) ) @@ -3381,12 +3321,12 @@ (block $case2|0 (block $case1|0 (if - (get_local $1) + (get_local $2) (block (block $tablify|0 (br_table $case1|0 $case2|0 $case3|0 $tablify|0 (i32.sub - (get_local $1) + (get_local $2) (i32.const 1) ) ) @@ -3399,13 +3339,7 @@ (f64.const 0.4636476090008061) (f64.sub (f64.sub - (f64.mul - (get_local $0) - (f64.add - (get_local $3) - (get_local $2) - ) - ) + (get_local $1) (f64.const 2.2698777452961687e-17) ) (get_local $0) @@ -3419,13 +3353,7 @@ (f64.const 0.7853981633974483) (f64.sub (f64.sub - (f64.mul - (get_local $0) - (f64.add - (get_local $3) - (get_local $2) - ) - ) + (get_local $1) (f64.const 3.061616997868383e-17) ) (get_local $0) @@ -3439,13 +3367,7 @@ (f64.const 0.982793723247329) (f64.sub (f64.sub - (f64.mul - (get_local $0) - (f64.add - (get_local $3) - (get_local $2) - ) - ) + (get_local $1) (f64.const 1.3903311031230998e-17) ) (get_local $0) @@ -3459,13 +3381,7 @@ (f64.const 1.5707963267948966) (f64.sub (f64.sub - (f64.mul - (get_local $0) - (f64.add - (get_local $3) - (get_local $2) - ) - ) + (get_local $1) (f64.const 6.123233995736766e-17) ) (get_local $0) @@ -3476,15 +3392,10 @@ ) (unreachable) ) - (if + (f64.copysign + (get_local $3) (get_local $4) - (set_local $3 - (f64.neg - (get_local $3) - ) - ) ) - (get_local $3) ) (func $std/math/test_atan (; 71 ;) (; has Stack IR ;) (type $FFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 i32) (result i32) (local $4 i32) @@ -3516,22 +3427,17 @@ (local $1 i32) (local $2 f32) (local $3 f32) - (local $4 i32) + (local $4 f32) (set_local $4 - (i32.shr_u - (tee_local $1 - (i32.reinterpret/f32 - (get_local $0) - ) - ) - (i32.const 31) - ) + (get_local $0) ) (if (i32.ge_u (tee_local $1 (i32.and - (get_local $1) + (i32.reinterpret/f32 + (get_local $0) + ) (i32.const 2147483647) ) ) @@ -3547,12 +3453,9 @@ ) ) (return - (tee_local $0 - (if (result f32) - (get_local $4) - (f32.const -1.570796251296997) - (f32.const 1.570796251296997) - ) + (f32.copysign + (f32.const 1.570796251296997) + (get_local $4) ) ) ) @@ -3677,30 +3580,33 @@ ) (set_local $2 (f32.mul - (get_local $2) + (get_local $0) (f32.add - (f32.const 0.333333283662796) (f32.mul - (get_local $3) + (get_local $2) (f32.add - (f32.const 0.14253635704517365) + (f32.const 0.333333283662796) (f32.mul (get_local $3) - (f32.const 0.06168760731816292) + (f32.add + (f32.const 0.14253635704517365) + (f32.mul + (get_local $3) + (f32.const 0.06168760731816292) + ) + ) ) ) ) - ) - ) - ) - (set_local $3 - (f32.mul - (get_local $3) - (f32.add - (f32.const -0.19999158382415771) (f32.mul (get_local $3) - (f32.const -0.106480173766613) + (f32.add + (f32.const -0.19999158382415771) + (f32.mul + (get_local $3) + (f32.const -0.106480173766613) + ) + ) ) ) ) @@ -3713,13 +3619,7 @@ (return (f32.sub (get_local $0) - (f32.mul - (get_local $0) - (f32.add - (get_local $2) - (get_local $3) - ) - ) + (get_local $2) ) ) ) @@ -3747,13 +3647,7 @@ (f32.const 0.46364760398864746) (f32.sub (f32.sub - (f32.mul - (get_local $0) - (f32.add - (get_local $2) - (get_local $3) - ) - ) + (get_local $2) (f32.const 5.01215824399992e-09) ) (get_local $0) @@ -3767,13 +3661,7 @@ (f32.const 0.7853981256484985) (f32.sub (f32.sub - (f32.mul - (get_local $0) - (f32.add - (get_local $2) - (get_local $3) - ) - ) + (get_local $2) (f32.const 3.774894707930798e-08) ) (get_local $0) @@ -3787,13 +3675,7 @@ (f32.const 0.9827936887741089) (f32.sub (f32.sub - (f32.mul - (get_local $0) - (f32.add - (get_local $2) - (get_local $3) - ) - ) + (get_local $2) (f32.const 3.447321716976148e-08) ) (get_local $0) @@ -3807,13 +3689,7 @@ (f32.const 1.570796251296997) (f32.sub (f32.sub - (f32.mul - (get_local $0) - (f32.add - (get_local $2) - (get_local $3) - ) - ) + (get_local $2) (f32.const 7.549789415861596e-08) ) (get_local $0) @@ -3824,15 +3700,10 @@ ) (unreachable) ) - (if + (f32.copysign + (get_local $2) (get_local $4) - (set_local $2 - (f32.neg - (get_local $2) - ) - ) ) - (get_local $2) ) (func $std/math/test_atanf (; 73 ;) (; has Stack IR ;) (type $fffii) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 i32) (result i32) (call $std/math/check @@ -3844,14 +3715,14 @@ ) ) (func $~lib/math/NativeMath.atanh (; 74 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) - (local $1 i64) + (local $1 f64) (local $2 i64) (local $3 i64) (local $4 f64) (set_local $2 (i64.and (i64.shr_u - (tee_local $1 + (tee_local $3 (i64.reinterpret/f64 (get_local $0) ) @@ -3861,16 +3732,10 @@ (i64.const 2047) ) ) - (set_local $3 - (i64.shr_u - (get_local $1) - (i64.const 63) - ) - ) - (set_local $0 + (set_local $1 (f64.reinterpret/i64 (i64.and - (get_local $1) + (get_local $3) (i64.const 9223372036854775807) ) ) @@ -3885,7 +3750,7 @@ (get_local $2) (i64.const 991) ) - (set_local $0 + (set_local $1 (f64.mul (f64.const 0.5) (call $~lib/math/NativeMath.log1p @@ -3893,17 +3758,17 @@ (tee_local $4 (f64.mul (f64.const 2) - (get_local $0) + (get_local $1) ) ) (f64.div (f64.mul (get_local $4) - (get_local $0) + (get_local $1) ) (f64.sub (f64.const 1) - (get_local $0) + (get_local $1) ) ) ) @@ -3911,17 +3776,17 @@ ) ) ) - (set_local $0 + (set_local $1 (f64.mul (f64.const 0.5) (call $~lib/math/NativeMath.log1p (f64.mul (f64.const 2) (f64.div - (get_local $0) + (get_local $1) (f64.sub (f64.const 1) - (get_local $0) + (get_local $1) ) ) ) @@ -3929,18 +3794,10 @@ ) ) ) - (if - (i64.ne - (get_local $3) - (i64.const 0) - ) - (set_local $0 - (f64.neg - (get_local $0) - ) - ) + (f64.copysign + (get_local $1) + (get_local $0) ) - (get_local $0) ) (func $std/math/test_atanh (; 75 ;) (; has Stack IR ;) (type $FFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 i32) (result i32) (local $4 i32) @@ -3969,24 +3826,15 @@ ) ) (func $~lib/math/NativeMathf.atanh (; 76 ;) (; has Stack IR ;) (type $ff) (param $0 f32) (result f32) - (local $1 i32) + (local $1 f32) (local $2 i32) - (local $3 f32) - (set_local $2 - (i32.shr_u - (tee_local $1 - (i32.reinterpret/f32 - (get_local $0) - ) - ) - (i32.const 31) - ) - ) - (set_local $0 + (set_local $1 (f32.reinterpret/i32 - (tee_local $1 + (tee_local $2 (i32.and - (get_local $1) + (i32.reinterpret/f32 + (get_local $0) + ) (i32.const 2147483647) ) ) @@ -3994,33 +3842,31 @@ ) (if (i32.lt_u - (get_local $1) + (get_local $2) (i32.const 1056964608) ) (if (i32.ge_u - (get_local $1) + (get_local $2) (i32.const 796917760) ) - (set_local $0 + (set_local $1 (f32.mul (f32.const 0.5) (call $~lib/math/NativeMathf.log1p - (f32.add - (tee_local $3 - (f32.mul - (f32.const 2) - (get_local $0) - ) + (f32.mul + (f32.mul + (f32.const 2) + (get_local $1) ) - (f32.div - (f32.mul - (get_local $3) - (get_local $0) - ) - (f32.sub - (f32.const 1) - (get_local $0) + (f32.add + (f32.const 1) + (f32.div + (get_local $1) + (f32.sub + (f32.const 1) + (get_local $1) + ) ) ) ) @@ -4028,17 +3874,17 @@ ) ) ) - (set_local $0 + (set_local $1 (f32.mul (f32.const 0.5) (call $~lib/math/NativeMathf.log1p (f32.mul (f32.const 2) (f32.div - (get_local $0) + (get_local $1) (f32.sub (f32.const 1) - (get_local $0) + (get_local $1) ) ) ) @@ -4046,15 +3892,10 @@ ) ) ) - (if - (get_local $2) - (set_local $0 - (f32.neg - (get_local $0) - ) - ) + (f32.copysign + (get_local $1) + (get_local $0) ) - (get_local $0) ) (func $std/math/test_atanhf (; 77 ;) (; has Stack IR ;) (type $fffii) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 i32) (result i32) (call $std/math/check @@ -5163,17 +5004,17 @@ ) (func $~lib/math/NativeMath.expm1 (; 88 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) (local $1 f64) - (local $2 i32) - (local $3 f64) + (local $2 f64) + (local $3 i32) (local $4 i32) - (local $5 i64) + (local $5 f64) (local $6 i32) - (local $7 f64) + (local $7 i64) (local $8 f64) - (set_local $4 + (set_local $6 (i32.wrap/i64 (i64.shr_u - (tee_local $5 + (tee_local $7 (i64.reinterpret/f64 (get_local $0) ) @@ -5184,11 +5025,11 @@ ) (if (i32.ge_u - (tee_local $6 + (tee_local $4 (i32.wrap/i64 (i64.and (i64.shr_u - (get_local $5) + (get_local $7) (i64.const 32) ) (i64.const 2147483647) @@ -5207,7 +5048,7 @@ ) ) (if - (get_local $4) + (get_local $6) (return (f64.const -1) ) @@ -5228,68 +5069,43 @@ ) (if (i32.gt_u - (get_local $6) + (get_local $4) (i32.const 1071001154) ) (block - (if - (i32.lt_u - (get_local $6) - (i32.const 1072734898) - ) - (set_local $0 - (if (result f64) - (get_local $4) - (block (result f64) - (set_local $1 - (f64.const -1.9082149292705877e-10) - ) - (set_local $2 - (i32.const -1) - ) - (f64.add - (get_local $0) - (f64.const 0.6931471803691238) - ) - ) - (block (result f64) - (set_local $1 - (f64.const 1.9082149292705877e-10) - ) - (set_local $2 - (i32.const 1) - ) - (f64.sub - (get_local $0) - (f64.const 0.6931471803691238) - ) - ) - ) - ) - (block - (set_local $0 + (set_local $0 + (f64.sub + (tee_local $2 (f64.sub (get_local $0) (f64.mul (tee_local $1 (f64.convert_s/i32 - (tee_local $2 - (i32.trunc_s/f64 - (f64.add - (tee_local $3 + (tee_local $3 + (select + (i32.sub + (i32.const 1) + (i32.shl + (get_local $6) + (i32.const 1) + ) + ) + (i32.trunc_s/f64 + (f64.add (f64.mul (f64.const 1.4426950408889634) (get_local $0) ) - ) - (tee_local $1 - (if (result f64) - (get_local $4) - (f64.const -0.5) + (f64.copysign (f64.const 0.5) + (get_local $0) ) ) ) + (i32.lt_u + (get_local $4) + (i32.const 1072734898) + ) ) ) ) @@ -5298,7 +5114,7 @@ ) ) ) - (set_local $1 + (tee_local $1 (f64.mul (get_local $1) (f64.const 1.9082149292705877e-10) @@ -5306,16 +5122,11 @@ ) ) ) - (set_local $7 + (set_local $5 (f64.sub (f64.sub + (get_local $2) (get_local $0) - (tee_local $0 - (f64.sub - (get_local $0) - (get_local $1) - ) - ) ) (get_local $1) ) @@ -5323,7 +5134,7 @@ ) (if (i32.lt_u - (get_local $6) + (get_local $4) (i32.const 1016070144) ) (return @@ -5335,7 +5146,7 @@ (f64.add (f64.const 1) (f64.mul - (tee_local $3 + (tee_local $2 (f64.mul (get_local $0) (tee_local $8 @@ -5349,19 +5160,19 @@ (f64.add (f64.const -0.03333333333333313) (f64.mul - (get_local $3) + (get_local $2) (f64.add (f64.const 1.5873015872548146e-03) (f64.mul - (get_local $3) + (get_local $2) (f64.add (f64.const -7.93650757867488e-05) (f64.mul - (get_local $3) + (get_local $2) (f64.add (f64.const 4.008217827329362e-06) (f64.mul - (get_local $3) + (get_local $2) (f64.const -2.0109921818362437e-07) ) ) @@ -5376,7 +5187,7 @@ ) (set_local $1 (f64.mul - (get_local $3) + (get_local $2) (f64.div (f64.sub (get_local $1) @@ -5402,7 +5213,7 @@ ) (if (i32.eqz - (get_local $2) + (get_local $3) ) (return (f64.sub @@ -5412,7 +5223,7 @@ (get_local $0) (get_local $1) ) - (get_local $3) + (get_local $2) ) ) ) @@ -5424,17 +5235,17 @@ (get_local $0) (f64.sub (get_local $1) - (get_local $7) + (get_local $5) ) ) - (get_local $7) + (get_local $5) ) - (get_local $3) + (get_local $2) ) ) (if (i32.eq - (get_local $2) + (get_local $3) (i32.const -1) ) (return @@ -5452,7 +5263,7 @@ ) (if (i32.eq - (get_local $2) + (get_local $3) (i32.const 1) ) (block @@ -5488,12 +5299,12 @@ ) ) ) - (set_local $3 + (set_local $5 (f64.reinterpret/i64 (i64.shl (i64.add (i64.extend_s/i32 - (get_local $2) + (get_local $3) ) (i64.const 1023) ) @@ -5505,14 +5316,14 @@ (i32.eqz (tee_local $4 (i32.lt_s - (get_local $2) + (get_local $3) (i32.const 0) ) ) ) (set_local $4 (i32.gt_s - (get_local $2) + (get_local $3) (i32.const 56) ) ) @@ -5520,7 +5331,7 @@ (if (get_local $4) (block - (set_local $0 + (set_local $2 (f64.add (f64.sub (get_local $0) @@ -5531,87 +5342,79 @@ ) (return (f64.sub - (tee_local $0 + (tee_local $2 (if (result f64) (i32.eq - (get_local $2) + (get_local $3) (i32.const 1024) ) (f64.mul (f64.mul - (get_local $0) + (get_local $2) (f64.const 2) ) (f64.const 8988465674311579538646525e283) ) (f64.mul - (get_local $0) - (get_local $3) - ) - ) - ) - (f64.const 1) - ) - ) - ) - ) - (set_local $5 - (i64.shl - (i64.sub - (i64.const 1023) - (i64.extend_s/i32 - (get_local $2) - ) - ) - (i64.const 52) - ) - ) - (tee_local $0 - (if (result f64) - (i32.lt_s - (get_local $2) - (i32.const 20) - ) - (f64.mul - (f64.add - (f64.sub - (get_local $0) - (get_local $1) - ) - (f64.sub - (f64.const 1) - (f64.reinterpret/i64 - (get_local $5) - ) - ) - ) - (get_local $3) - ) - (f64.mul - (f64.add - (f64.sub - (get_local $0) - (f64.add - (get_local $1) - (f64.reinterpret/i64 + (get_local $2) (get_local $5) ) ) ) (f64.const 1) ) - (get_local $3) ) ) ) + (set_local $2 + (f64.reinterpret/i64 + (i64.shl + (i64.sub + (i64.const 1023) + (i64.extend_s/i32 + (get_local $3) + ) + ) + (i64.const 52) + ) + ) + ) + (f64.mul + (f64.add + (get_local $0) + (tee_local $2 + (if (result f64) + (i32.lt_s + (get_local $3) + (i32.const 20) + ) + (f64.sub + (f64.sub + (f64.const 1) + (get_local $2) + ) + (get_local $1) + ) + (f64.sub + (f64.const 1) + (f64.add + (get_local $1) + (get_local $2) + ) + ) + ) + ) + ) + (get_local $5) + ) ) (func $~lib/math/NativeMath.exp (; 89 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) (local $1 i32) (local $2 i32) - (local $3 i32) + (local $3 f64) (local $4 f64) - (local $5 f64) - (set_local $3 + (local $5 i32) + (set_local $5 (i32.shr_u (tee_local $1 (i32.wrap/i64 @@ -5675,7 +5478,7 @@ ) (set_local $0 (f64.sub - (tee_local $5 + (tee_local $4 (f64.sub (get_local $0) (f64.mul @@ -5700,11 +5503,11 @@ ) ) (i32.sub - (i32.sub + (i32.const 1) + (i32.shl + (get_local $5) (i32.const 1) - (get_local $3) ) - (get_local $3) ) ) ) @@ -5714,7 +5517,7 @@ ) ) ) - (tee_local $4 + (tee_local $3 (f64.mul (get_local $0) (f64.const 1.9082149292705877e-10) @@ -5722,7 +5525,7 @@ ) ) ) - (set_local $5 + (set_local $4 (if (result f64) (i32.gt_u (get_local $1) @@ -5790,9 +5593,9 @@ (get_local $0) ) ) - (get_local $4) + (get_local $3) ) - (get_local $5) + (get_local $4) ) ) ) @@ -5809,21 +5612,7 @@ (get_local $2) ) ) - (func $~lib/math/expo2 (; 90 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) - (f64.mul - (f64.mul - (call $~lib/math/NativeMath.exp - (f64.sub - (get_local $0) - (f64.const 1416.0996898839683) - ) - ) - (f64.const 2247116418577894884661631e283) - ) - (f64.const 2247116418577894884661631e283) - ) - ) - (func $~lib/math/NativeMath.cosh (; 91 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) + (func $~lib/math/NativeMath.cosh (; 90 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) (local $1 i32) (local $2 i64) (set_local $0 @@ -5872,10 +5661,10 @@ ) (get_local $0) ) - (f64.mul + (f64.add (f64.const 2) - (f64.add - (f64.const 1) + (f64.mul + (f64.const 2) (get_local $0) ) ) @@ -5906,11 +5695,20 @@ ) ) ) - (call $~lib/math/expo2 - (get_local $0) + (f64.mul + (f64.mul + (call $~lib/math/NativeMath.exp + (f64.sub + (get_local $0) + (f64.const 1416.0996898839683) + ) + ) + (f64.const 2247116418577894884661631e283) + ) + (f64.const 2247116418577894884661631e283) ) ) - (func $std/math/test_cosh (; 92 ;) (; has Stack IR ;) (type $FFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 i32) (result i32) + (func $std/math/test_cosh (; 91 ;) (; has Stack IR ;) (type $FFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 i32) (result i32) (local $4 i32) (tee_local $3 (if (result i32) @@ -5936,16 +5734,16 @@ ) ) ) - (func $~lib/math/NativeMathf.expm1 (; 93 ;) (; has Stack IR ;) (type $ff) (param $0 f32) (result f32) + (func $~lib/math/NativeMathf.expm1 (; 92 ;) (; has Stack IR ;) (type $ff) (param $0 f32) (result f32) (local $1 f32) - (local $2 i32) + (local $2 f32) (local $3 i32) - (local $4 f32) + (local $4 i32) (local $5 f32) (local $6 f32) - (set_local $2 + (set_local $3 (i32.shr_u - (tee_local $3 + (tee_local $4 (i32.reinterpret/f32 (get_local $0) ) @@ -5955,9 +5753,9 @@ ) (if (i32.ge_u - (tee_local $3 + (tee_local $4 (i32.and - (get_local $3) + (get_local $4) (i32.const 2147483647) ) ) @@ -5966,7 +5764,7 @@ (block (if (i32.gt_u - (get_local $3) + (get_local $4) (i32.const 2139095040) ) (return @@ -5974,7 +5772,7 @@ ) ) (if - (get_local $2) + (get_local $3) (return (f32.const -1) ) @@ -5995,68 +5793,43 @@ ) (if (i32.gt_u - (get_local $3) + (get_local $4) (i32.const 1051816472) ) (block - (if - (i32.lt_u - (get_local $3) - (i32.const 1065686418) - ) - (set_local $0 - (if (result f32) - (get_local $2) - (block (result f32) - (set_local $1 - (f32.const -9.05800061445916e-06) - ) - (set_local $2 - (i32.const -1) - ) - (f32.add - (get_local $0) - (f32.const 0.6931381225585938) - ) - ) - (block (result f32) - (set_local $1 - (f32.const 9.05800061445916e-06) - ) - (set_local $2 - (i32.const 1) - ) - (f32.sub - (get_local $0) - (f32.const 0.6931381225585938) - ) - ) - ) - ) - (block - (set_local $0 + (set_local $0 + (f32.sub + (tee_local $2 (f32.sub (get_local $0) (f32.mul (tee_local $1 (f32.convert_s/i32 - (tee_local $2 - (i32.trunc_s/f32 - (f32.add - (tee_local $4 + (tee_local $3 + (select + (i32.sub + (i32.const 1) + (i32.shl + (get_local $3) + (i32.const 1) + ) + ) + (i32.trunc_s/f32 + (f32.add (f32.mul (f32.const 1.4426950216293335) (get_local $0) ) - ) - (tee_local $1 - (if (result f32) - (get_local $2) - (f32.const -0.5) + (f32.copysign (f32.const 0.5) + (get_local $0) ) ) ) + (i32.lt_u + (get_local $4) + (i32.const 1065686418) + ) ) ) ) @@ -6065,7 +5838,7 @@ ) ) ) - (set_local $1 + (tee_local $1 (f32.mul (get_local $1) (f32.const 9.05800061445916e-06) @@ -6076,22 +5849,17 @@ (set_local $5 (f32.sub (f32.sub + (get_local $2) (get_local $0) - (tee_local $0 - (f32.sub - (get_local $0) - (get_local $1) - ) - ) ) (get_local $1) ) ) ) - (set_local $2 + (set_local $3 (if (result i32) (i32.lt_u - (get_local $3) + (get_local $4) (i32.const 855638016) ) (return @@ -6105,7 +5873,7 @@ (f32.add (f32.const 1) (f32.mul - (tee_local $4 + (tee_local $2 (f32.mul (get_local $0) (tee_local $6 @@ -6119,7 +5887,7 @@ (f32.add (f32.const -0.03333321213722229) (f32.mul - (get_local $4) + (get_local $2) (f32.const 1.5807170420885086e-03) ) ) @@ -6128,7 +5896,7 @@ ) (set_local $1 (f32.mul - (get_local $4) + (get_local $2) (f32.div (f32.sub (get_local $1) @@ -6154,7 +5922,7 @@ ) (if (i32.eqz - (get_local $2) + (get_local $3) ) (return (f32.sub @@ -6164,7 +5932,7 @@ (get_local $0) (get_local $1) ) - (get_local $4) + (get_local $2) ) ) ) @@ -6181,12 +5949,12 @@ ) (get_local $5) ) - (get_local $4) + (get_local $2) ) ) (if (i32.eq - (get_local $2) + (get_local $3) (i32.const -1) ) (return @@ -6204,7 +5972,7 @@ ) (if (i32.eq - (get_local $2) + (get_local $3) (i32.const 1) ) (block @@ -6240,11 +6008,11 @@ ) ) ) - (set_local $4 + (set_local $5 (f32.reinterpret/i32 (i32.shl (i32.add - (get_local $2) + (get_local $3) (i32.const 127) ) (i32.const 23) @@ -6253,24 +6021,24 @@ ) (if (i32.eqz - (tee_local $3 + (tee_local $4 (i32.lt_s - (get_local $2) + (get_local $3) (i32.const 0) ) ) ) - (set_local $3 + (set_local $4 (i32.gt_s - (get_local $2) + (get_local $3) (i32.const 56) ) ) ) (if - (get_local $3) + (get_local $4) (block - (set_local $0 + (set_local $2 (f32.add (f32.sub (get_local $0) @@ -6281,22 +6049,22 @@ ) (return (f32.sub - (tee_local $0 + (tee_local $2 (if (result f32) (i32.eq - (get_local $2) + (get_local $3) (i32.const 128) ) (f32.mul (f32.mul - (get_local $0) + (get_local $2) (f32.const 2) ) (f32.const 1701411834604692317316873e14) ) (f32.mul - (get_local $0) - (get_local $4) + (get_local $2) + (get_local $5) ) ) ) @@ -6305,63 +6073,54 @@ ) ) ) - (set_local $3 - (i32.shl - (i32.sub - (i32.const 127) - (get_local $2) - ) - (i32.const 23) - ) - ) - (tee_local $0 - (if (result f32) - (i32.lt_s - (get_local $2) + (set_local $2 + (f32.reinterpret/i32 + (i32.shl + (i32.sub + (i32.const 127) + (get_local $3) + ) (i32.const 23) ) - (f32.mul - (f32.add + ) + ) + (f32.mul + (f32.add + (get_local $0) + (tee_local $2 + (if (result f32) + (i32.lt_s + (get_local $3) + (i32.const 20) + ) (f32.sub - (get_local $0) + (f32.sub + (f32.const 1) + (get_local $2) + ) (get_local $1) ) (f32.sub (f32.const 1) - (f32.reinterpret/i32 - (get_local $3) - ) - ) - ) - (get_local $4) - ) - (f32.mul - (f32.add - (f32.sub - (get_local $0) (f32.add (get_local $1) - (f32.reinterpret/i32 - (get_local $3) - ) + (get_local $2) ) ) - (f32.const 1) ) - (get_local $4) ) ) + (get_local $5) ) ) - (func $~lib/math/NativeMathf.exp (; 94 ;) (; has Stack IR ;) (type $ff) (param $0 f32) (result f32) + (func $~lib/math/NativeMathf.exp (; 93 ;) (; has Stack IR ;) (type $ff) (param $0 f32) (result f32) (local $1 i32) (local $2 i32) - (local $3 i32) + (local $3 f32) (local $4 f32) - (local $5 f32) - (set_local $1 + (set_local $2 (i32.shr_u - (tee_local $2 + (tee_local $1 (i32.reinterpret/f32 (get_local $0) ) @@ -6371,30 +6130,30 @@ ) (if (i32.ge_u - (tee_local $2 + (tee_local $1 (i32.and - (get_local $2) + (get_local $1) (i32.const 2147483647) ) ) (i32.const 1118743632) ) - (block - (if - (tee_local $3 - (i32.ge_u - (get_local $2) - (i32.const 1118925336) - ) - ) - (set_local $3 - (i32.eqz - (get_local $1) - ) - ) + (if + (i32.ge_u + (get_local $1) + (i32.const 1118925336) ) (if - (get_local $3) + (get_local $2) + (if + (i32.ge_u + (get_local $1) + (i32.const 1120924085) + ) + (return + (f32.const 0) + ) + ) (return (f32.mul (get_local $0) @@ -6402,31 +6161,16 @@ ) ) ) - (if - (tee_local $3 - (if (result i32) - (get_local $1) - (i32.ge_u - (get_local $2) - (i32.const 1120924085) - ) - (get_local $1) - ) - ) - (return - (f32.const 0) - ) - ) ) ) (if (i32.gt_u - (get_local $2) + (get_local $1) (i32.const 1051816472) ) (set_local $0 (f32.sub - (tee_local $4 + (tee_local $3 (f32.sub (get_local $0) (f32.mul @@ -6435,7 +6179,7 @@ (tee_local $1 (if (result i32) (i32.gt_u - (get_local $2) + (get_local $1) (i32.const 1065686418) ) (i32.trunc_s/f32 @@ -6451,11 +6195,11 @@ ) ) (i32.sub - (i32.sub + (i32.const 1) + (i32.shl + (get_local $2) (i32.const 1) - (get_local $1) ) - (get_local $1) ) ) ) @@ -6465,7 +6209,7 @@ ) ) ) - (tee_local $5 + (tee_local $4 (f32.mul (get_local $0) (f32.const 1.428606765330187e-06) @@ -6473,17 +6217,17 @@ ) ) ) - (set_local $1 - (if (result i32) + (set_local $3 + (if (result f32) (i32.gt_u - (get_local $2) + (get_local $1) (i32.const 956301312) ) - (block (result i32) - (set_local $4 - (get_local $0) + (block (result f32) + (set_local $1 + (i32.const 0) ) - (i32.const 0) + (get_local $0) ) (return (f32.add @@ -6528,9 +6272,9 @@ (get_local $0) ) ) - (get_local $5) + (get_local $4) ) - (get_local $4) + (get_local $3) ) ) ) @@ -6547,21 +6291,7 @@ (get_local $1) ) ) - (func $~lib/math/expo2f (; 95 ;) (; has Stack IR ;) (type $ff) (param $0 f32) (result f32) - (f32.mul - (f32.mul - (call $~lib/math/NativeMathf.exp - (f32.sub - (get_local $0) - (f32.const 162.88958740234375) - ) - ) - (f32.const 1661534994731144841129758e11) - ) - (f32.const 1661534994731144841129758e11) - ) - ) - (func $~lib/math/NativeMathf.cosh (; 96 ;) (; has Stack IR ;) (type $ff) (param $0 f32) (result f32) + (func $~lib/math/NativeMathf.cosh (; 94 ;) (; has Stack IR ;) (type $ff) (param $0 f32) (result f32) (local $1 i32) (set_local $0 (f32.reinterpret/i32 @@ -6602,10 +6332,10 @@ ) (get_local $0) ) - (f32.mul + (f32.add (f32.const 2) - (f32.add - (f32.const 1) + (f32.mul + (f32.const 2) (get_local $0) ) ) @@ -6620,27 +6350,36 @@ (i32.const 1118925335) ) (return - (f32.mul - (f32.const 0.5) - (f32.add + (f32.add + (f32.mul + (f32.const 0.5) (tee_local $0 (call $~lib/math/NativeMathf.exp (get_local $0) ) ) - (f32.div - (f32.const 1) - (get_local $0) - ) + ) + (f32.div + (f32.const 0.5) + (get_local $0) ) ) ) ) - (call $~lib/math/expo2f - (get_local $0) + (f32.mul + (f32.mul + (call $~lib/math/NativeMathf.exp + (f32.sub + (get_local $0) + (f32.const 162.88958740234375) + ) + ) + (f32.const 1661534994731144841129758e11) + ) + (f32.const 1661534994731144841129758e11) ) ) - (func $std/math/test_coshf (; 97 ;) (; has Stack IR ;) (type $fffii) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 i32) (result i32) + (func $std/math/test_coshf (; 95 ;) (; has Stack IR ;) (type $fffii) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 i32) (result i32) (call $std/math/check (call $~lib/math/NativeMathf.cosh (get_local $0) @@ -6649,7 +6388,7 @@ (get_local $2) ) ) - (func $std/math/test_exp (; 98 ;) (; has Stack IR ;) (type $FFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 i32) (result i32) + (func $std/math/test_exp (; 96 ;) (; has Stack IR ;) (type $FFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 i32) (result i32) (local $4 i32) (tee_local $3 (if (result i32) @@ -6675,7 +6414,7 @@ ) ) ) - (func $std/math/test_expf (; 99 ;) (; has Stack IR ;) (type $fffii) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 i32) (result i32) + (func $std/math/test_expf (; 97 ;) (; has Stack IR ;) (type $fffii) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 i32) (result i32) (call $std/math/check (call $~lib/math/NativeMathf.exp (get_local $0) @@ -6684,7 +6423,7 @@ (get_local $2) ) ) - (func $std/math/test_expm1 (; 100 ;) (; has Stack IR ;) (type $FFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 i32) (result i32) + (func $std/math/test_expm1 (; 98 ;) (; has Stack IR ;) (type $FFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 i32) (result i32) (local $4 i32) (tee_local $3 (if (result i32) @@ -6710,7 +6449,7 @@ ) ) ) - (func $std/math/test_expm1f (; 101 ;) (; has Stack IR ;) (type $fffii) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 i32) (result i32) + (func $std/math/test_expm1f (; 99 ;) (; has Stack IR ;) (type $fffii) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 i32) (result i32) (call $std/math/check (call $~lib/math/NativeMathf.expm1 (get_local $0) @@ -6719,7 +6458,7 @@ (get_local $2) ) ) - (func $std/math/test_floor (; 102 ;) (; has Stack IR ;) (type $FUNCSIG$iddi) (param $0 f64) (param $1 f64) (param $2 i32) (result i32) + (func $std/math/test_floor (; 100 ;) (; has Stack IR ;) (type $FUNCSIG$iddi) (param $0 f64) (param $1 f64) (param $2 i32) (result i32) (if (tee_local $2 (call $std/math/check @@ -6744,7 +6483,7 @@ ) (get_local $2) ) - (func $std/math/test_floorf (; 103 ;) (; has Stack IR ;) (type $FUNCSIG$iffi) (param $0 f32) (param $1 f32) (param $2 i32) (result i32) + (func $std/math/test_floorf (; 101 ;) (; has Stack IR ;) (type $FUNCSIG$iffi) (param $0 f32) (param $1 f32) (param $2 i32) (result i32) (call $std/math/check (f32.floor (get_local $0) @@ -6753,10 +6492,10 @@ (f32.const 0) ) ) - (func $~lib/math/NativeMath.hypot (; 104 ;) (; has Stack IR ;) (type $FFF) (param $0 f64) (param $1 f64) (result f64) + (func $~lib/math/NativeMath.hypot (; 102 ;) (; has Stack IR ;) (type $FFF) (param $0 f64) (param $1 f64) (result f64) (local $2 f64) - (local $3 f64) - (local $4 i64) + (local $3 i64) + (local $4 f64) (local $5 i64) (local $6 i32) (local $7 f64) @@ -6774,7 +6513,7 @@ (i64.const 9223372036854775807) ) ) - (tee_local $4 + (tee_local $3 (i64.and (i64.reinterpret/f64 (get_local $1) @@ -6788,9 +6527,9 @@ (get_local $5) ) (set_local $5 - (get_local $4) + (get_local $3) ) - (set_local $4 + (set_local $3 (get_local $10) ) ) @@ -6805,7 +6544,7 @@ ) (set_local $1 (f64.reinterpret/i64 - (get_local $4) + (get_local $3) ) ) (if @@ -6813,7 +6552,7 @@ (tee_local $8 (i32.wrap/i64 (i64.shr_u - (get_local $4) + (get_local $3) (i64.const 52) ) ) @@ -6840,7 +6579,7 @@ ) (set_local $9 (i64.eq - (get_local $4) + (get_local $3) (i64.const 0) ) ) @@ -6915,7 +6654,7 @@ ) ) ) - (set_local $3 + (set_local $4 (f64.sub (get_local $0) (tee_local $2 @@ -6936,34 +6675,31 @@ ) (set_local $11 (f64.add - (f64.add - (f64.sub + (f64.sub + (f64.mul + (get_local $2) + (get_local $2) + ) + (tee_local $0 (f64.mul - (get_local $2) - (get_local $2) - ) - (tee_local $0 - (f64.mul - (get_local $0) - (get_local $0) - ) + (get_local $0) + (get_local $0) ) ) - (f64.mul + ) + (f64.mul + (f64.add (f64.mul (f64.const 2) (get_local $2) ) - (get_local $3) + (get_local $4) ) - ) - (f64.mul - (get_local $3) - (get_local $3) + (get_local $4) ) ) ) - (set_local $3 + (set_local $4 (f64.sub (get_local $1) (tee_local $2 @@ -6990,30 +6726,27 @@ (f64.add (tee_local $2 (f64.add - (f64.add - (f64.sub + (f64.sub + (f64.mul + (get_local $2) + (get_local $2) + ) + (tee_local $1 (f64.mul - (get_local $2) - (get_local $2) - ) - (tee_local $1 - (f64.mul - (get_local $1) - (get_local $1) - ) + (get_local $1) + (get_local $1) ) ) - (f64.mul + ) + (f64.mul + (f64.add (f64.mul (f64.const 2) (get_local $2) ) - (get_local $3) + (get_local $4) ) - ) - (f64.mul - (get_local $3) - (get_local $3) + (get_local $4) ) ) ) @@ -7026,7 +6759,7 @@ ) ) ) - (func $std/math/test_hypot (; 105 ;) (; has Stack IR ;) (type $FFFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 f64) (param $4 i32) (result i32) + (func $std/math/test_hypot (; 103 ;) (; has Stack IR ;) (type $FFFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 f64) (param $4 i32) (result i32) (local $5 i32) (tee_local $4 (if (result i32) @@ -7054,7 +6787,7 @@ ) ) ) - (func $~lib/math/NativeMathf.hypot (; 106 ;) (; has Stack IR ;) (type $fff) (param $0 f32) (param $1 f32) (result f32) + (func $~lib/math/NativeMathf.hypot (; 104 ;) (; has Stack IR ;) (type $fff) (param $0 f32) (param $1 f32) (result f32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -7223,7 +6956,7 @@ ) ) ) - (func $std/math/test_hypotf (; 107 ;) (; has Stack IR ;) (type $ffffii) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 f32) (param $4 i32) (result i32) + (func $std/math/test_hypotf (; 105 ;) (; has Stack IR ;) (type $ffffii) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 f32) (param $4 i32) (result i32) (call $std/math/check (call $~lib/math/NativeMathf.hypot (get_local $0) @@ -7233,7 +6966,7 @@ (get_local $3) ) ) - (func $std/math/test_log (; 108 ;) (; has Stack IR ;) (type $FFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 i32) (result i32) + (func $std/math/test_log (; 106 ;) (; has Stack IR ;) (type $FFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 i32) (result i32) (local $4 i32) (tee_local $3 (if (result i32) @@ -7259,7 +6992,7 @@ ) ) ) - (func $std/math/test_logf (; 109 ;) (; has Stack IR ;) (type $FUNCSIG$iffi) (param $0 f32) (param $1 f32) (param $2 i32) (result i32) + (func $std/math/test_logf (; 107 ;) (; has Stack IR ;) (type $FUNCSIG$iffi) (param $0 f32) (param $1 f32) (param $2 i32) (result i32) (call $std/math/check (call $~lib/math/NativeMathf.log (get_local $0) @@ -7268,7 +7001,7 @@ (f32.const 0) ) ) - (func $~lib/math/NativeMath.log10 (; 110 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) + (func $~lib/math/NativeMath.log10 (; 108 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) (local $1 i32) (local $2 f64) (local $3 i32) @@ -7416,9 +7149,9 @@ ) (set_local $0 (f64.mul - (tee_local $7 + (tee_local $8 (f64.mul - (tee_local $6 + (tee_local $7 (f64.div (tee_local $2 (f64.sub @@ -7451,13 +7184,13 @@ ) ) ) - (get_local $6) + (get_local $7) ) ) - (get_local $7) + (get_local $8) ) ) - (set_local $8 + (set_local $9 (f64.mul (tee_local $11 (f64.convert_s/i32 @@ -7468,85 +7201,83 @@ ) ) (f64.add - (tee_local $6 - (f64.add - (tee_local $6 + (f64.add + (tee_local $2 + (f64.add (f64.add - (f64.add - (f64.mul - (get_local $11) - (f64.const 3.694239077158931e-13) - ) - (f64.mul - (f64.add - (tee_local $0 - (f64.add + (f64.mul + (get_local $11) + (f64.const 3.694239077158931e-13) + ) + (f64.mul + (f64.add + (tee_local $0 + (f64.add + (f64.sub (f64.sub - (f64.sub - (get_local $2) - (tee_local $10 - (f64.reinterpret/i64 - (i64.and - (i64.reinterpret/f64 - (f64.sub - (get_local $2) - (tee_local $9 + (get_local $2) + (tee_local $6 + (f64.reinterpret/i64 + (i64.and + (i64.reinterpret/f64 + (f64.sub + (get_local $2) + (tee_local $10 + (f64.mul (f64.mul - (f64.mul - (f64.const 0.5) - (get_local $2) - ) + (f64.const 0.5) (get_local $2) ) + (get_local $2) ) ) ) - (i64.const -4294967296) ) + (i64.const -4294967296) ) ) ) - (get_local $9) ) - (f64.mul - (get_local $6) + (get_local $10) + ) + (f64.mul + (get_local $7) + (f64.add + (get_local $10) (f64.add - (get_local $9) - (f64.add - (f64.mul - (get_local $7) - (f64.add - (f64.const 0.6666666666666735) - (f64.mul - (get_local $0) - (f64.add - (f64.const 0.2857142874366239) - (f64.mul - (get_local $0) - (f64.add - (f64.const 0.1818357216161805) - (f64.mul - (get_local $0) - (f64.const 0.14798198605116586) - ) + (f64.mul + (get_local $8) + (f64.add + (f64.const 0.6666666666666735) + (f64.mul + (get_local $0) + (f64.add + (f64.const 0.2857142874366239) + (f64.mul + (get_local $0) + (f64.add + (f64.const 0.1818357216161805) + (f64.mul + (get_local $0) + (f64.const 0.14798198605116586) ) ) ) ) ) ) - (f64.mul - (get_local $0) - (f64.add - (f64.const 0.3999999999940942) - (f64.mul - (get_local $0) - (f64.add - (f64.const 0.22222198432149784) - (f64.mul - (get_local $0) - (f64.const 0.15313837699209373) - ) + ) + (f64.mul + (get_local $0) + (f64.add + (f64.const 0.3999999999940942) + (f64.mul + (get_local $0) + (f64.add + (f64.const 0.22222198432149784) + (f64.mul + (get_local $0) + (f64.const 0.15313837699209373) ) ) ) @@ -7556,42 +7287,40 @@ ) ) ) - (get_local $10) ) - (f64.const 2.5082946711645275e-11) + (get_local $6) ) - ) - (f64.mul - (get_local $0) - (f64.const 0.4342944818781689) + (f64.const 2.5082946711645275e-11) ) ) - ) - (f64.add - (f64.sub - (get_local $8) - (tee_local $0 - (f64.add - (get_local $8) - (tee_local $2 - (f64.mul - (get_local $10) - (f64.const 0.4342944818781689) - ) - ) - ) - ) + (f64.mul + (get_local $0) + (f64.const 0.4342944818781689) ) - (get_local $2) ) ) + (f64.add + (f64.sub + (get_local $9) + (tee_local $0 + (f64.add + (get_local $9) + (tee_local $6 + (f64.mul + (get_local $6) + (f64.const 0.4342944818781689) + ) + ) + ) + ) + ) + (get_local $6) + ) ) - (tee_local $2 - (get_local $0) - ) + (get_local $0) ) ) - (func $std/math/test_log10 (; 111 ;) (; has Stack IR ;) (type $FFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 i32) (result i32) + (func $std/math/test_log10 (; 109 ;) (; has Stack IR ;) (type $FFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 i32) (result i32) (local $4 i32) (tee_local $3 (if (result i32) @@ -7617,7 +7346,7 @@ ) ) ) - (func $~lib/math/NativeMathf.log10 (; 112 ;) (; has Stack IR ;) (type $ff) (param $0 f32) (result f32) + (func $~lib/math/NativeMathf.log10 (; 110 ;) (; has Stack IR ;) (type $ff) (param $0 f32) (result f32) (local $1 i32) (local $2 i32) (local $3 f32) @@ -7856,7 +7585,7 @@ ) ) ) - (func $std/math/test_log10f (; 113 ;) (; has Stack IR ;) (type $fffii) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 i32) (result i32) + (func $std/math/test_log10f (; 111 ;) (; has Stack IR ;) (type $fffii) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 i32) (result i32) (call $std/math/check (call $~lib/math/NativeMathf.log10 (get_local $0) @@ -7865,7 +7594,7 @@ (get_local $2) ) ) - (func $std/math/test_log1p (; 114 ;) (; has Stack IR ;) (type $FFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 i32) (result i32) + (func $std/math/test_log1p (; 112 ;) (; has Stack IR ;) (type $FFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 i32) (result i32) (local $4 i32) (tee_local $3 (if (result i32) @@ -7891,7 +7620,7 @@ ) ) ) - (func $std/math/test_log1pf (; 115 ;) (; has Stack IR ;) (type $fffii) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 i32) (result i32) + (func $std/math/test_log1pf (; 113 ;) (; has Stack IR ;) (type $fffii) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 i32) (result i32) (call $std/math/check (call $~lib/math/NativeMathf.log1p (get_local $0) @@ -7900,7 +7629,7 @@ (get_local $2) ) ) - (func $~lib/math/NativeMath.log2 (; 116 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) + (func $~lib/math/NativeMath.log2 (; 114 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) (local $1 i32) (local $2 f64) (local $3 i32) @@ -8211,7 +7940,7 @@ ) ) ) - (func $std/math/test_log2 (; 117 ;) (; has Stack IR ;) (type $FFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 i32) (result i32) + (func $std/math/test_log2 (; 115 ;) (; has Stack IR ;) (type $FFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 i32) (result i32) (local $4 i32) (tee_local $3 (if (result i32) @@ -8237,7 +7966,7 @@ ) ) ) - (func $~lib/math/NativeMathf.log2 (; 118 ;) (; has Stack IR ;) (type $ff) (param $0 f32) (result f32) + (func $~lib/math/NativeMathf.log2 (; 116 ;) (; has Stack IR ;) (type $ff) (param $0 f32) (result f32) (local $1 i32) (local $2 i32) (local $3 f32) @@ -8464,7 +8193,7 @@ ) ) ) - (func $std/math/test_log2f (; 119 ;) (; has Stack IR ;) (type $fffii) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 i32) (result i32) + (func $std/math/test_log2f (; 117 ;) (; has Stack IR ;) (type $fffii) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 i32) (result i32) (call $std/math/check (call $~lib/math/NativeMathf.log2 (get_local $0) @@ -8473,7 +8202,7 @@ (get_local $2) ) ) - (func $std/math/test_max (; 120 ;) (; has Stack IR ;) (type $FUNCSIG$iddd) (param $0 f64) (param $1 f64) (param $2 f64) (result i32) + (func $std/math/test_max (; 118 ;) (; has Stack IR ;) (type $FUNCSIG$iddd) (param $0 f64) (param $1 f64) (param $2 f64) (result i32) (local $3 i32) (if (tee_local $3 @@ -8501,7 +8230,7 @@ ) (get_local $3) ) - (func $std/math/test_maxf (; 121 ;) (; has Stack IR ;) (type $FUNCSIG$ifff) (param $0 f32) (param $1 f32) (param $2 f32) (result i32) + (func $std/math/test_maxf (; 119 ;) (; has Stack IR ;) (type $FUNCSIG$ifff) (param $0 f32) (param $1 f32) (param $2 f32) (result i32) (call $std/math/check (f32.max (get_local $0) @@ -8511,7 +8240,7 @@ (f32.const 0) ) ) - (func $std/math/test_min (; 122 ;) (; has Stack IR ;) (type $FUNCSIG$iddd) (param $0 f64) (param $1 f64) (param $2 f64) (result i32) + (func $std/math/test_min (; 120 ;) (; has Stack IR ;) (type $FUNCSIG$iddd) (param $0 f64) (param $1 f64) (param $2 f64) (result i32) (local $3 i32) (if (tee_local $3 @@ -8539,7 +8268,7 @@ ) (get_local $3) ) - (func $std/math/test_minf (; 123 ;) (; has Stack IR ;) (type $FUNCSIG$ifff) (param $0 f32) (param $1 f32) (param $2 f32) (result i32) + (func $std/math/test_minf (; 121 ;) (; has Stack IR ;) (type $FUNCSIG$ifff) (param $0 f32) (param $1 f32) (param $2 f32) (result i32) (call $std/math/check (f32.min (get_local $0) @@ -8549,69 +8278,66 @@ (f32.const 0) ) ) - (func $~lib/math/NativeMath.mod (; 124 ;) (; has Stack IR ;) (type $FFF) (param $0 f64) (param $1 f64) (result f64) + (func $~lib/math/NativeMath.mod (; 122 ;) (; has Stack IR ;) (type $FFF) (param $0 f64) (param $1 f64) (result f64) (local $2 i64) - (local $3 i32) + (local $3 i64) (local $4 i64) (local $5 i64) - (local $6 i32) + (local $6 i64) (local $7 i32) - (local $8 i32) + (local $8 i64) + (local $9 i64) (block $folding-inner0 (set_local $3 - (i32.wrap/i64 - (i64.and - (i64.shr_u - (tee_local $2 - (i64.reinterpret/f64 - (get_local $0) - ) + (i64.and + (i64.shr_u + (tee_local $2 + (i64.reinterpret/f64 + (get_local $0) ) - (i64.const 52) ) - (i64.const 2047) + (i64.const 52) ) + (i64.const 2047) ) ) (set_local $6 - (i32.wrap/i64 - (i64.and - (i64.shr_u - (tee_local $5 - (i64.reinterpret/f64 - (get_local $1) - ) + (i64.and + (i64.shr_u + (tee_local $5 + (i64.reinterpret/f64 + (get_local $1) ) - (i64.const 52) ) - (i64.const 2047) + (i64.const 52) ) + (i64.const 2047) ) ) (set_local $8 - (i32.wrap/i64 - (i64.shr_u - (get_local $2) - (i64.const 63) - ) + (i64.shr_u + (get_local $2) + (i64.const 63) ) ) (if (i32.eqz (tee_local $7 (i64.eq - (i64.shl - (get_local $5) - (i64.const 1) + (tee_local $4 + (i64.shl + (get_local $5) + (i64.const 1) + ) ) (i64.const 0) ) ) ) (set_local $7 - (f64.ne - (get_local $1) - (get_local $1) + (i64.eq + (get_local $3) + (i64.const 2047) ) ) ) @@ -8620,9 +8346,9 @@ (get_local $7) ) (set_local $7 - (i32.eq - (get_local $3) - (i32.const 2047) + (f64.ne + (get_local $1) + (get_local $1) ) ) ) @@ -8642,26 +8368,19 @@ ) (if (i64.le_u - (i64.shl - (get_local $2) - (i64.const 1) - ) - (i64.shl - (get_local $5) - (i64.const 1) + (tee_local $9 + (i64.shl + (get_local $2) + (i64.const 1) + ) ) + (get_local $4) ) (block (br_if $folding-inner0 (i64.eq - (i64.shl - (get_local $2) - (i64.const 1) - ) - (i64.shl - (get_local $5) - (i64.const 1) - ) + (get_local $9) + (get_local $4) ) ) (return @@ -8671,7 +8390,29 @@ ) (set_local $2 (if (result i64) - (get_local $3) + (i64.eqz + (get_local $3) + ) + (i64.shl + (get_local $2) + (i64.add + (i64.sub + (i64.const 0) + (tee_local $3 + (i64.sub + (get_local $3) + (i64.clz + (i64.shl + (get_local $2) + (i64.const 12) + ) + ) + ) + ) + ) + (i64.const 1) + ) + ) (i64.or (i64.and (get_local $2) @@ -8679,55 +8420,33 @@ ) (i64.const 4503599627370496) ) - (block (result i64) - (block $break|0 - (set_local $4 - (i64.shl - (get_local $2) - (i64.const 12) - ) - ) - (loop $repeat|0 - (br_if $break|0 - (i32.eqz - (i64.eqz - (i64.shr_u - (get_local $4) - (i64.const 63) - ) - ) - ) - ) - (set_local $3 - (i32.sub - (get_local $3) - (i32.const 1) - ) - ) - (set_local $4 - (i64.shl - (get_local $4) - (i64.const 1) - ) - ) - (br $repeat|0) - ) - ) - (i64.shl - (get_local $2) - (i64.extend_s/i32 - (i32.sub - (i32.const 1) - (get_local $3) - ) - ) - ) - ) ) ) (set_local $5 (if (result i64) - (get_local $6) + (i64.eqz + (get_local $6) + ) + (i64.shl + (get_local $5) + (i64.add + (i64.sub + (i64.const 0) + (tee_local $6 + (i64.sub + (get_local $6) + (i64.clz + (i64.shl + (get_local $5) + (i64.const 12) + ) + ) + ) + ) + ) + (i64.const 1) + ) + ) (i64.or (i64.and (get_local $5) @@ -8735,56 +8454,12 @@ ) (i64.const 4503599627370496) ) - (block (result i64) - (block $break|1 - (set_local $4 - (i64.shl - (get_local $5) - (i64.const 12) - ) - ) - (loop $repeat|1 - (br_if $break|1 - (i32.eqz - (i64.eqz - (i64.shr_u - (get_local $4) - (i64.const 63) - ) - ) - ) - ) - (set_local $6 - (i32.sub - (get_local $6) - (i32.const 1) - ) - ) - (set_local $4 - (i64.shl - (get_local $4) - (i64.const 1) - ) - ) - (br $repeat|1) - ) - ) - (i64.shl - (get_local $5) - (i64.extend_s/i32 - (i32.sub - (i32.const 1) - (get_local $6) - ) - ) - ) - ) ) ) - (block $break|2 - (loop $repeat|2 - (br_if $break|2 - (i32.le_s + (block $break|0 + (loop $repeat|0 + (br_if $break|0 + (i64.le_s (get_local $3) (get_local $6) ) @@ -8819,12 +8494,12 @@ ) ) (set_local $3 - (i32.sub + (i64.sub (get_local $3) - (i32.const 1) + (i64.const 1) ) ) - (br $repeat|2) + (br $repeat|0) ) ) (if @@ -8850,31 +8525,17 @@ ) ) ) - (block $break|3 - (loop $repeat|3 - (br_if $break|3 - (i32.eqz - (i64.eqz - (i64.shr_u - (get_local $2) - (i64.const 52) - ) + (set_local $2 + (i64.shl + (get_local $2) + (tee_local $4 + (i64.clz + (i64.shl + (get_local $2) + (i64.const 11) ) ) ) - (set_local $3 - (i32.sub - (get_local $3) - (i32.const 1) - ) - ) - (set_local $2 - (i64.shl - (get_local $2) - (i64.const 1) - ) - ) - (br $repeat|3) ) ) (return @@ -8882,9 +8543,14 @@ (i64.or (tee_local $2 (if (result i64) - (i32.gt_s - (get_local $3) - (i32.const 0) + (i64.gt_s + (tee_local $3 + (i64.sub + (get_local $3) + (get_local $4) + ) + ) + (i64.const 0) ) (i64.or (i64.sub @@ -8892,27 +8558,24 @@ (i64.const 4503599627370496) ) (i64.shl - (i64.extend_s/i32 - (get_local $3) - ) + (get_local $3) (i64.const 52) ) ) (i64.shr_u (get_local $2) - (i64.extend_s/i32 - (i32.sub - (i32.const 1) + (i64.add + (i64.sub + (i64.const 0) (get_local $3) ) + (i64.const 1) ) ) ) ) (i64.shl - (i64.extend_s/i32 - (get_local $8) - ) + (get_local $8) (i64.const 63) ) ) @@ -8924,7 +8587,7 @@ (get_local $0) ) ) - (func $std/math/test_mod (; 125 ;) (; has Stack IR ;) (type $FUNCSIG$idddi) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 i32) (result i32) + (func $std/math/test_mod (; 123 ;) (; has Stack IR ;) (type $FUNCSIG$idddi) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 i32) (result i32) (if (tee_local $3 (call $std/math/check @@ -8951,13 +8614,14 @@ ) (get_local $3) ) - (func $~lib/math/NativeMathf.mod (; 126 ;) (; has Stack IR ;) (type $fff) (param $0 f32) (param $1 f32) (result f32) + (func $~lib/math/NativeMathf.mod (; 124 ;) (; has Stack IR ;) (type $fff) (param $0 f32) (param $1 f32) (result f32) (local $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) (local $6 i32) (local $7 i32) + (local $8 i32) (block $folding-inner0 (set_local $4 (i32.and @@ -8985,7 +8649,7 @@ (i32.const 255) ) ) - (set_local $7 + (set_local $8 (i32.and (get_local $2) (i32.const -2147483648) @@ -8995,27 +8659,15 @@ (i32.eqz (tee_local $3 (i32.eqz - (i32.shl - (get_local $5) - (i32.const 1) + (tee_local $7 + (i32.shl + (get_local $5) + (i32.const 1) + ) ) ) ) ) - (set_local $3 - (f32.ne - (get_local $1) - (get_local $1) - ) - ) - ) - (if - (i32.eqz - (i32.and - (get_local $3) - (i32.const 1) - ) - ) (set_local $3 (i32.eq (get_local $4) @@ -9023,6 +8675,17 @@ ) ) ) + (if + (i32.eqz + (get_local $3) + ) + (set_local $3 + (f32.ne + (get_local $1) + (get_local $1) + ) + ) + ) (if (i32.and (get_local $3) @@ -9042,26 +8705,19 @@ ) (if (i32.le_u - (i32.shl - (get_local $2) - (i32.const 1) - ) - (i32.shl - (get_local $5) - (i32.const 1) + (tee_local $3 + (i32.shl + (get_local $2) + (i32.const 1) + ) ) + (get_local $7) ) (block (br_if $folding-inner0 (i32.eq - (i32.shl - (get_local $2) - (i32.const 1) - ) - (i32.shl - (get_local $5) - (i32.const 1) - ) + (get_local $3) + (get_local $7) ) ) (return @@ -9079,41 +8735,20 @@ ) (i32.const 8388608) ) - (block (result i32) - (block $break|0 - (set_local $3 - (i32.shl - (get_local $2) - (i32.const 9) - ) - ) - (loop $repeat|0 - (br_if $break|0 - (i32.shr_u - (get_local $3) - (i32.const 31) + (i32.shl + (get_local $2) + (i32.sub + (i32.const 1) + (tee_local $4 + (i32.sub + (get_local $4) + (i32.clz + (i32.shl + (get_local $2) + (i32.const 9) + ) ) ) - (set_local $4 - (i32.sub - (get_local $4) - (i32.const 1) - ) - ) - (set_local $3 - (i32.shl - (get_local $3) - (i32.const 1) - ) - ) - (br $repeat|0) - ) - ) - (i32.shl - (get_local $2) - (i32.sub - (i32.const 1) - (get_local $4) ) ) ) @@ -9129,49 +8764,28 @@ ) (i32.const 8388608) ) - (block (result i32) - (block $break|1 - (set_local $3 - (i32.shl - (get_local $5) - (i32.const 9) - ) - ) - (loop $repeat|1 - (br_if $break|1 - (i32.shr_u - (get_local $3) - (i32.const 31) + (i32.shl + (get_local $5) + (i32.sub + (i32.const 1) + (tee_local $6 + (i32.sub + (get_local $6) + (i32.clz + (i32.shl + (get_local $5) + (i32.const 9) + ) ) ) - (set_local $6 - (i32.sub - (get_local $6) - (i32.const 1) - ) - ) - (set_local $3 - (i32.shl - (get_local $3) - (i32.const 1) - ) - ) - (br $repeat|1) - ) - ) - (i32.shl - (get_local $5) - (i32.sub - (i32.const 1) - (get_local $6) ) ) ) ) ) - (block $break|2 - (loop $repeat|2 - (br_if $break|2 + (block $break|0 + (loop $repeat|0 + (br_if $break|0 (i32.le_s (get_local $4) (get_local $6) @@ -9212,7 +8826,7 @@ (i32.const 1) ) ) - (br $repeat|2) + (br $repeat|0) ) ) (if @@ -9238,27 +8852,17 @@ ) ) ) - (block $break|3 - (loop $repeat|3 - (br_if $break|3 - (i32.shr_u - (get_local $2) - (i32.const 23) + (set_local $2 + (i32.shl + (get_local $2) + (tee_local $3 + (i32.clz + (i32.shl + (get_local $2) + (i32.const 8) + ) ) ) - (set_local $4 - (i32.sub - (get_local $4) - (i32.const 1) - ) - ) - (set_local $2 - (i32.shl - (get_local $2) - (i32.const 1) - ) - ) - (br $repeat|3) ) ) (return @@ -9267,7 +8871,12 @@ (tee_local $2 (if (result i32) (i32.gt_s - (get_local $4) + (tee_local $4 + (i32.sub + (get_local $4) + (get_local $3) + ) + ) (i32.const 0) ) (i32.or @@ -9289,7 +8898,7 @@ ) ) ) - (get_local $7) + (get_local $8) ) ) ) @@ -9299,7 +8908,7 @@ (get_local $0) ) ) - (func $std/math/test_modf (; 127 ;) (; has Stack IR ;) (type $FUNCSIG$ifffi) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 i32) (result i32) + (func $std/math/test_modf (; 125 ;) (; has Stack IR ;) (type $FUNCSIG$ifffi) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 i32) (result i32) (call $std/math/check (call $~lib/math/NativeMathf.mod (get_local $0) @@ -9309,7 +8918,7 @@ (f32.const 0) ) ) - (func $~lib/math/NativeMath.pow (; 128 ;) (; has Stack IR ;) (type $FFF) (param $0 f64) (param $1 f64) (result f64) + (func $~lib/math/NativeMath.pow (; 126 ;) (; has Stack IR ;) (type $FFF) (param $0 f64) (param $1 f64) (result f64) (local $2 f64) (local $3 f64) (local $4 i32) @@ -9323,12 +8932,12 @@ (local $12 i32) (local $13 f64) (local $14 f64) - (local $15 i32) - (local $16 f64) + (local $15 f64) + (local $16 i32) (local $17 i64) (local $18 i32) - (local $19 i32) - (local $20 f64) + (local $19 f64) + (local $20 i32) (block $folding-inner1 (block $folding-inner0 (set_local $18 @@ -9343,12 +8952,12 @@ ) ) ) - (set_local $7 + (set_local $20 (i32.wrap/i64 (get_local $17) ) ) - (set_local $5 + (set_local $4 (i32.and (get_local $18) (i32.const 2147483647) @@ -9357,9 +8966,9 @@ (if (i32.eqz (i32.or - (tee_local $11 + (tee_local $12 (i32.and - (tee_local $12 + (tee_local $11 (i32.wrap/i64 (i64.shr_u (tee_local $17 @@ -9374,7 +8983,7 @@ (i32.const 2147483647) ) ) - (tee_local $19 + (tee_local $7 (i32.wrap/i64 (get_local $17) ) @@ -9387,21 +8996,51 @@ ) (if (i32.eqz - (tee_local $4 + (tee_local $8 (i32.gt_s - (get_local $5) + (get_local $4) (i32.const 2146435072) ) ) ) (if - (tee_local $4 + (tee_local $8 (i32.eq - (get_local $5) + (get_local $4) (i32.const 2146435072) ) ) - (set_local $4 + (set_local $8 + (i32.ne + (get_local $20) + (i32.const 0) + ) + ) + ) + ) + (if + (i32.eqz + (get_local $8) + ) + (set_local $8 + (i32.gt_s + (get_local $12) + (i32.const 2146435072) + ) + ) + ) + (if + (i32.eqz + (get_local $8) + ) + (if + (tee_local $8 + (i32.eq + (get_local $12) + (i32.const 2146435072) + ) + ) + (set_local $8 (i32.ne (get_local $7) (i32.const 0) @@ -9410,37 +9049,7 @@ ) ) (if - (i32.eqz - (get_local $4) - ) - (set_local $4 - (i32.gt_s - (get_local $11) - (i32.const 2146435072) - ) - ) - ) - (if - (i32.eqz - (get_local $4) - ) - (if - (tee_local $4 - (i32.eq - (get_local $11) - (i32.const 2146435072) - ) - ) - (set_local $4 - (i32.ne - (get_local $19) - (i32.const 0) - ) - ) - ) - ) - (if - (get_local $4) + (get_local $8) (return (f64.add (get_local $0) @@ -9455,122 +9064,101 @@ ) (if (i32.ge_s - (get_local $11) + (get_local $12) (i32.const 1128267776) ) - (set_local $15 + (set_local $16 (i32.const 2) ) (if (i32.ge_s - (get_local $11) + (get_local $12) (i32.const 1072693248) ) - (if - (i32.gt_s - (tee_local $10 - (i32.sub - (i32.shr_s - (get_local $11) - (i32.const 20) + (block + (set_local $8 + (i32.sub + (select + (i32.const 52) + (i32.const 20) + (tee_local $5 + (i32.gt_s + (tee_local $10 + (i32.sub + (i32.shr_s + (get_local $12) + (i32.const 20) + ) + (i32.const 1023) + ) + ) + (i32.const 20) + ) ) - (i32.const 1023) ) + (get_local $10) ) - (i32.const 20) ) (if (i32.eq (i32.shl - (tee_local $4 - (i32.shr_u - (get_local $19) - (tee_local $8 - (i32.sub - (i32.const 52) - (get_local $10) + (tee_local $5 + (i32.shr_s + (tee_local $10 + (select + (get_local $7) + (get_local $12) + (get_local $5) ) ) + (get_local $8) ) ) (get_local $8) ) - (get_local $19) + (get_local $10) ) - (set_local $15 + (set_local $16 (i32.sub (i32.const 2) (i32.and - (get_local $4) + (get_local $5) (i32.const 1) ) ) ) ) - (if - (i32.eqz - (get_local $19) - ) - (if - (i32.eq - (i32.shl - (tee_local $4 - (i32.shr_s - (get_local $11) - (tee_local $8 - (i32.sub - (i32.const 20) - (get_local $10) - ) - ) - ) - ) - (get_local $8) - ) - (get_local $11) - ) - (set_local $15 - (i32.sub - (i32.const 2) - (i32.and - (get_local $4) - (i32.const 1) - ) - ) - ) - ) - ) ) ) ) ) (if (i32.eqz - (get_local $19) + (get_local $7) ) (block (if (i32.eq - (get_local $11) + (get_local $12) (i32.const 2146435072) ) (if (i32.or (i32.sub - (get_local $5) + (get_local $4) (i32.const 1072693248) ) - (get_local $7) + (get_local $20) ) (if (i32.ge_s - (get_local $5) + (get_local $4) (i32.const 1072693248) ) (block (if (i32.lt_s - (get_local $12) + (get_local $11) (i32.const 0) ) (set_local $1 @@ -9585,7 +9173,7 @@ (tee_local $0 (if (result f64) (i32.ge_s - (get_local $12) + (get_local $11) (i32.const 0) ) (f64.const 0) @@ -9603,13 +9191,13 @@ ) (if (i32.eq - (get_local $11) + (get_local $12) (i32.const 1072693248) ) (block (if (i32.ge_s - (get_local $12) + (get_local $11) (i32.const 0) ) (return @@ -9626,7 +9214,7 @@ ) (if (i32.eq - (get_local $12) + (get_local $11) (i32.const 1073741824) ) (return @@ -9638,7 +9226,7 @@ ) (if (i32.eq - (get_local $12) + (get_local $11) (i32.const 1071644672) ) (if @@ -9662,41 +9250,41 @@ ) (if (i32.eqz - (get_local $7) + (get_local $20) ) (block (if (i32.eqz - (tee_local $4 + (tee_local $5 (i32.eq - (get_local $5) + (get_local $4) (i32.const 2146435072) ) ) ) - (set_local $4 + (set_local $5 (i32.eqz - (get_local $5) + (get_local $4) ) ) ) (if (i32.eqz - (get_local $4) + (get_local $5) ) - (set_local $4 + (set_local $5 (i32.eq - (get_local $5) + (get_local $4) (i32.const 1072693248) ) ) ) (if - (get_local $4) + (get_local $5) (block (if (i32.lt_s - (get_local $12) + (get_local $11) (i32.const 0) ) (set_local $2 @@ -9714,14 +9302,14 @@ (if (i32.or (i32.sub - (get_local $5) + (get_local $4) (i32.const 1072693248) ) - (get_local $15) + (get_local $16) ) (if (i32.eq - (get_local $15) + (get_local $16) (i32.const 1) ) (set_local $2 @@ -9761,7 +9349,7 @@ (block (if (i32.eqz - (get_local $15) + (get_local $16) ) (return (f64.div @@ -9777,7 +9365,7 @@ ) (if (i32.eq - (get_local $15) + (get_local $16) (i32.const 1) ) (set_local $13 @@ -9789,26 +9377,26 @@ (set_local $2 (if (result f64) (i32.gt_s - (get_local $11) + (get_local $12) (i32.const 1105199104) ) (block (result f64) (if (i32.gt_s - (get_local $11) + (get_local $12) (i32.const 1139802112) ) (block (if (i32.le_s - (get_local $5) + (get_local $4) (i32.const 1072693247) ) (return (tee_local $0 (if (result f64) (i32.lt_s - (get_local $12) + (get_local $11) (i32.const 0) ) (f64.const inf) @@ -9819,14 +9407,14 @@ ) (if (i32.ge_s - (get_local $5) + (get_local $4) (i32.const 1072693248) ) (return (tee_local $0 (if (result f64) (i32.gt_s - (get_local $12) + (get_local $11) (i32.const 0) ) (f64.const inf) @@ -9839,14 +9427,14 @@ ) (if (i32.lt_s - (get_local $5) + (get_local $4) (i32.const 1072693247) ) (return (tee_local $0 (if (result f64) (i32.lt_s - (get_local $12) + (get_local $11) (i32.const 0) ) (f64.mul @@ -9869,14 +9457,14 @@ ) (if (i32.gt_s - (get_local $5) + (get_local $4) (i32.const 1072693248) ) (return (tee_local $0 (if (result f64) (i32.gt_s - (get_local $12) + (get_local $11) (i32.const 0) ) (f64.mul @@ -9925,7 +9513,7 @@ ) (set_local $9 (f64.add - (tee_local $16 + (tee_local $15 (f64.mul (f64.const 1.4426950216293335) (get_local $3) @@ -9958,7 +9546,7 @@ ) ) ) - (get_local $16) + (get_local $15) ) ) ) @@ -9968,14 +9556,14 @@ ) (if (i32.lt_s - (get_local $5) + (get_local $4) (i32.const 1048576) ) (block (set_local $7 (i32.const -53) ) - (set_local $5 + (set_local $4 (i32.wrap/i64 (i64.shr_u (i64.reinterpret/f64 @@ -9997,18 +9585,18 @@ (get_local $7) (i32.sub (i32.shr_s - (get_local $5) + (get_local $4) (i32.const 20) ) (i32.const 1023) ) ) ) - (set_local $5 + (set_local $4 (i32.or - (tee_local $8 + (tee_local $5 (i32.and - (get_local $5) + (get_local $4) (i32.const 1048575) ) ) @@ -10018,13 +9606,13 @@ (set_local $10 (if (result i32) (i32.le_s - (get_local $8) + (get_local $5) (i32.const 235662) ) (i32.const 0) (if (result i32) (i32.lt_s - (get_local $8) + (get_local $5) (i32.const 767610) ) (i32.const 1) @@ -10035,9 +9623,9 @@ (i32.const 1) ) ) - (set_local $5 + (set_local $4 (i32.add - (get_local $5) + (get_local $4) (i32.const -1048576) ) ) @@ -10048,7 +9636,7 @@ ) (set_local $9 (f64.mul - (tee_local $16 + (tee_local $15 (f64.sub (tee_local $2 (f64.reinterpret/i64 @@ -10061,7 +9649,7 @@ ) (i64.shl (i64.extend_s/i32 - (get_local $5) + (get_local $4) ) (i64.const 32) ) @@ -10100,7 +9688,7 @@ (i32.add (i32.or (i32.shr_s - (get_local $5) + (get_local $4) (i32.const 1) ) (i32.const 536870912) @@ -10121,7 +9709,7 @@ ) ) ) - (set_local $20 + (set_local $19 (f64.mul (f64.mul (tee_local $14 @@ -10170,7 +9758,7 @@ (get_local $6) (f64.sub (f64.sub - (get_local $16) + (get_local $15) (f64.mul (tee_local $6 (f64.reinterpret/i64 @@ -10203,9 +9791,9 @@ ) ) ) - (tee_local $20 + (tee_local $19 (f64.add - (get_local $20) + (get_local $19) (f64.mul (get_local $0) (f64.add @@ -10219,7 +9807,7 @@ ) (set_local $2 (f64.sub - (get_local $20) + (get_local $19) (f64.sub (f64.sub (tee_local $3 @@ -10240,7 +9828,7 @@ ) (set_local $0 (f64.add - (tee_local $16 + (tee_local $15 (f64.mul (get_local $6) (get_local $3) @@ -10274,7 +9862,7 @@ ) ) ) - (get_local $16) + (get_local $15) ) ) ) @@ -10282,7 +9870,7 @@ (f64.add (f64.add (f64.add - (tee_local $20 + (tee_local $19 (f64.mul (f64.const 0.9617967009544373) (get_local $0) @@ -10342,13 +9930,13 @@ ) (get_local $0) ) - (get_local $20) + (get_local $19) ) ) ) ) ) - (set_local $4 + (set_local $8 (i32.wrap/i64 (tee_local $17 (i64.reinterpret/f64 @@ -10392,7 +9980,7 @@ ) (if (i32.ge_s - (tee_local $8 + (tee_local $5 (i32.wrap/i64 (i64.shr_u (get_local $17) @@ -10406,10 +9994,10 @@ (br_if $folding-inner1 (i32.or (i32.sub - (get_local $8) + (get_local $5) (i32.const 1083179008) ) - (get_local $4) + (get_local $8) ) ) (br_if $folding-inner1 @@ -10428,7 +10016,7 @@ (if (i32.ge_s (i32.and - (get_local $8) + (get_local $5) (i32.const 2147483647) ) (i32.const 1083231232) @@ -10437,10 +10025,10 @@ (br_if $folding-inner0 (i32.or (i32.sub - (get_local $8) + (get_local $5) (i32.const -1064252416) ) - (get_local $4) + (get_local $8) ) ) (br_if $folding-inner0 @@ -10458,9 +10046,9 @@ (set_local $10 (i32.sub (i32.shr_s - (tee_local $4 + (tee_local $8 (i32.and - (get_local $8) + (get_local $5) (i32.const 2147483647) ) ) @@ -10474,7 +10062,7 @@ ) (if (i32.gt_s - (get_local $4) + (get_local $8) (i32.const 1071644672) ) (block @@ -10484,7 +10072,7 @@ (i32.and (tee_local $7 (i32.add - (get_local $8) + (get_local $5) (i32.shr_s (i32.const 1048576) (i32.add @@ -10537,7 +10125,7 @@ ) (if (i32.lt_s - (get_local $8) + (get_local $5) (i32.const 0) ) (set_local $7 @@ -10559,7 +10147,7 @@ (f64.mul (tee_local $2 (f64.add - (tee_local $16 + (tee_local $15 (f64.mul (tee_local $3 (f64.reinterpret/i64 @@ -10604,7 +10192,7 @@ (if (result f64) (i32.le_s (i32.shr_s - (tee_local $8 + (tee_local $5 (i32.add (i32.wrap/i64 (i64.shr_u @@ -10662,7 +10250,7 @@ (get_local $6) (f64.sub (get_local $2) - (get_local $16) + (get_local $15) ) ) ) @@ -10704,7 +10292,7 @@ ) (i64.shl (i64.extend_s/i32 - (get_local $8) + (get_local $5) ) (i64.const 32) ) @@ -10737,7 +10325,7 @@ (f64.const 1.e+300) ) ) - (func $std/math/test_pow (; 129 ;) (; has Stack IR ;) (type $FFFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 f64) (param $4 i32) (result i32) + (func $std/math/test_pow (; 127 ;) (; has Stack IR ;) (type $FFFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 f64) (param $4 i32) (result i32) (local $5 i32) (tee_local $4 (if (result i32) @@ -10765,7 +10353,7 @@ ) ) ) - (func $~lib/math/NativeMathf.pow (; 130 ;) (; has Stack IR ;) (type $fff) (param $0 f32) (param $1 f32) (result f32) + (func $~lib/math/NativeMathf.pow (; 128 ;) (; has Stack IR ;) (type $fff) (param $0 f32) (param $1 f32) (result f32) (local $2 f32) (local $3 f32) (local $4 i32) @@ -11953,7 +11541,7 @@ (f32.const 1.0000000031710769e-30) ) ) - (func $std/math/test_powf (; 131 ;) (; has Stack IR ;) (type $ffffii) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 f32) (param $4 i32) (result i32) + (func $std/math/test_powf (; 129 ;) (; has Stack IR ;) (type $ffffii) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 f32) (param $4 i32) (result i32) (call $std/math/check (call $~lib/math/NativeMathf.pow (get_local $0) @@ -11963,7 +11551,7 @@ (get_local $3) ) ) - (func $~lib/math/murmurHash3 (; 132 ;) (; has Stack IR ;) (type $II) (param $0 i64) (result i64) + (func $~lib/math/murmurHash3 (; 130 ;) (; has Stack IR ;) (type $II) (param $0 i64) (result i64) (i64.xor (tee_local $0 (i64.mul @@ -11994,7 +11582,55 @@ ) ) ) - (func $~lib/math/NativeMath.seedRandom (; 133 ;) (; has Stack IR ;) (type $Iv) (param $0 i64) + (func $~lib/math/splitMix32 (; 131 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) + (i32.xor + (tee_local $0 + (i32.xor + (tee_local $0 + (i32.mul + (i32.xor + (tee_local $0 + (i32.add + (get_local $0) + (i32.const 1831565813) + ) + ) + (i32.shr_u + (get_local $0) + (i32.const 15) + ) + ) + (i32.or + (get_local $0) + (i32.const 1) + ) + ) + ) + (i32.add + (get_local $0) + (i32.mul + (i32.xor + (get_local $0) + (i32.shr_u + (get_local $0) + (i32.const 7) + ) + ) + (i32.or + (get_local $0) + (i32.const 61) + ) + ) + ) + ) + ) + (i32.shr_u + (get_local $0) + (i32.const 14) + ) + ) + ) + (func $~lib/math/NativeMath.seedRandom (; 132 ;) (; has Stack IR ;) (type $Iv) (param $0 i64) (if (i64.eqz (get_local $0) @@ -12012,18 +11648,33 @@ (set_global $~lib/math/random_seeded (i32.const 1) ) - (set_global $~lib/math/random_state0 + (set_global $~lib/math/random_state0_64 (call $~lib/math/murmurHash3 (get_local $0) ) ) - (set_global $~lib/math/random_state1 + (set_global $~lib/math/random_state1_64 (call $~lib/math/murmurHash3 - (get_global $~lib/math/random_state0) + (i64.xor + (get_global $~lib/math/random_state0_64) + (i64.const -1) + ) + ) + ) + (set_global $~lib/math/random_state0_32 + (call $~lib/math/splitMix32 + (i32.wrap/i64 + (get_local $0) + ) + ) + ) + (set_global $~lib/math/random_state1_32 + (call $~lib/math/splitMix32 + (get_global $~lib/math/random_state0_32) ) ) ) - (func $~lib/math/NativeMath.random (; 134 ;) (; has Stack IR ;) (type $F) (result f64) + (func $~lib/math/NativeMath.random (; 133 ;) (; has Stack IR ;) (type $F) (result f64) (local $0 i64) (local $1 i64) (if @@ -12034,21 +11685,21 @@ (call $~lib/env/abort (i32.const 0) (i32.const 40) - (i32.const 962) + (i32.const 964) (i32.const 24) ) (unreachable) ) ) (set_local $0 - (get_global $~lib/math/random_state0) + (get_global $~lib/math/random_state0_64) ) - (set_global $~lib/math/random_state0 + (set_global $~lib/math/random_state0_64 (tee_local $1 - (get_global $~lib/math/random_state1) + (get_global $~lib/math/random_state1_64) ) ) - (set_global $~lib/math/random_state1 + (set_global $~lib/math/random_state1_64 (tee_local $0 (i64.xor (i64.xor @@ -12092,318 +11743,123 @@ (f64.const 1) ) ) - (func $~lib/math/NativeMathf.random (; 135 ;) (; has Stack IR ;) (type $f) (result f32) - (local $0 f32) - (loop $continue|0 - (br_if $continue|0 - (f32.eq - (tee_local $0 - (f32.demote/f64 - (call $~lib/math/NativeMath.random) - ) - ) - (f32.const 1) + (func $~lib/math/NativeMathf.random (; 134 ;) (; has Stack IR ;) (type $f) (result f32) + (local $0 i32) + (local $1 i32) + (if + (i32.eqz + (get_global $~lib/math/random_seeded) + ) + (block + (call $~lib/env/abort + (i32.const 0) + (i32.const 40) + (i32.const 2023) + (i32.const 24) + ) + (unreachable) + ) + ) + (set_local $0 + (i32.xor + (get_global $~lib/math/random_state1_32) + (tee_local $1 + (get_global $~lib/math/random_state0_32) ) ) ) - (get_local $0) - ) - (func $~lib/math/NativeMath.round (; 136 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) - (local $1 f64) - (local $2 i64) - (local $3 i32) - (if - (i32.ge_s - (tee_local $3 - (i32.wrap/i64 - (i64.and - (i64.shr_u - (tee_local $2 - (i64.reinterpret/f64 - (get_local $0) - ) - ) - (i64.const 52) - ) - (i64.const 2047) - ) + (set_global $~lib/math/random_state0_32 + (i32.xor + (i32.xor + (i32.rotl + (get_local $1) + (i32.const 26) ) - ) - (i32.const 1075) - ) - (return - (get_local $0) - ) - ) - (if - (i32.lt_s - (get_local $3) - (i32.const 1022) - ) - (return - (f64.mul - (f64.const 0) (get_local $0) ) + (i32.shl + (get_local $0) + (i32.const 9) + ) ) ) - (tee_local $1 - (if (result f64) - (i64.ne - (i64.shr_u - (get_local $2) - (i64.const 63) - ) - (i64.const 0) - ) - (if (result f64) - (f64.ge - (tee_local $1 - (f64.add - (f64.sub - (f64.sub - (f64.const 4503599627370496) - (get_local $0) - ) - (f64.const 4503599627370496) + (set_global $~lib/math/random_state1_32 + (i32.rotl + (get_local $0) + (i32.const 13) + ) + ) + (f32.sub + (f32.reinterpret/i32 + (i32.or + (i32.shr_u + (i32.mul + (i32.rotl + (i32.mul + (get_local $1) + (i32.const -1640531525) ) - (get_local $0) + (i32.const 5) ) + (i32.const 5) ) - (f64.const 0.5) - ) - (f64.add - (f64.sub - (get_local $0) - (get_local $1) - ) - (f64.const 1) - ) - (if (result f64) - (f64.lt - (get_local $1) - (f64.const -0.5) - ) - (f64.sub - (f64.sub - (get_local $0) - (get_local $1) - ) - (f64.const 1) - ) - (f64.sub - (get_local $0) - (get_local $1) - ) - ) - ) - (if (result f64) - (f64.gt - (tee_local $1 - (f64.sub - (f64.sub - (f64.add - (get_local $0) - (f64.const 4503599627370496) - ) - (f64.const 4503599627370496) - ) - (get_local $0) - ) - ) - (f64.const 0.5) - ) - (f64.sub - (f64.add - (get_local $1) - (get_local $0) - ) - (f64.const 1) - ) - (if (result f64) - (f64.le - (get_local $1) - (f64.const -0.5) - ) - (f64.add - (f64.add - (get_local $1) - (get_local $0) - ) - (f64.const 1) - ) - (f64.add - (get_local $1) - (get_local $0) - ) + (i32.const 9) ) + (i32.const 1065353216) ) ) + (f32.const 1) ) ) - (func $std/math/test_round (; 137 ;) (; has Stack IR ;) (type $FUNCSIG$iddi) (param $0 f64) (param $1 f64) (param $2 i32) (result i32) + (func $std/math/test_round (; 135 ;) (; has Stack IR ;) (type $FUNCSIG$iddi) (param $0 f64) (param $1 f64) (param $2 i32) (result i32) (call $std/math/check - (call $~lib/math/NativeMath.round + (f64.copysign + (f64.floor + (f64.add + (get_local $0) + (f64.const 0.5) + ) + ) (get_local $0) ) (get_local $1) (f64.const 0) ) ) - (func $~lib/math/NativeMathf.round (; 138 ;) (; has Stack IR ;) (type $ff) (param $0 f32) (result f32) - (local $1 f32) - (local $2 i32) - (local $3 i32) - (if - (i32.ge_s - (tee_local $3 - (i32.and - (i32.shr_u - (tee_local $2 - (i32.reinterpret/f32 - (get_local $0) - ) - ) - (i32.const 23) - ) - (i32.const 255) - ) - ) - (i32.const 150) - ) - (return - (get_local $0) - ) - ) - (if - (i32.lt_s - (get_local $3) - (i32.const 126) - ) - (return - (f32.mul - (f32.const 0) - (get_local $0) - ) - ) - ) - (tee_local $1 - (if (result f32) - (i32.shr_u - (get_local $2) - (i32.const 31) - ) - (if (result f32) - (f32.ge - (tee_local $1 - (f32.add - (f32.sub - (f32.sub - (f32.const 8388608) - (get_local $0) - ) - (f32.const 8388608) - ) - (get_local $0) - ) - ) - (f32.const 0.5) - ) - (f32.add - (f32.sub - (get_local $0) - (get_local $1) - ) - (f32.const 1) - ) - (if (result f32) - (f32.lt - (get_local $1) - (f32.const -0.5) - ) - (f32.sub - (f32.sub - (get_local $0) - (get_local $1) - ) - (f32.const 1) - ) - (f32.sub - (get_local $0) - (get_local $1) - ) - ) - ) - (if (result f32) - (f32.gt - (tee_local $1 - (f32.sub - (f32.sub - (f32.add - (get_local $0) - (f32.const 8388608) - ) - (f32.const 8388608) - ) - (get_local $0) - ) - ) - (f32.const 0.5) - ) - (f32.sub - (f32.add - (get_local $1) - (get_local $0) - ) - (f32.const 1) - ) - (if (result f32) - (f32.le - (get_local $1) - (f32.const -0.5) - ) - (f32.add - (f32.add - (get_local $1) - (get_local $0) - ) - (f32.const 1) - ) - (f32.add - (get_local $1) - (get_local $0) - ) - ) - ) - ) - ) - ) - (func $std/math/test_roundf (; 139 ;) (; has Stack IR ;) (type $FUNCSIG$iffi) (param $0 f32) (param $1 f32) (param $2 i32) (result i32) + (func $std/math/test_roundf (; 136 ;) (; has Stack IR ;) (type $FUNCSIG$iffi) (param $0 f32) (param $1 f32) (param $2 i32) (result i32) (call $std/math/check - (call $~lib/math/NativeMathf.round + (f32.copysign + (f32.floor + (f32.add + (get_local $0) + (f32.const 0.5) + ) + ) (get_local $0) ) (get_local $1) (f32.const 0) ) ) - (func $std/math/test_sign (; 140 ;) (; has Stack IR ;) (type $FUNCSIG$idd) (param $0 f64) (param $1 f64) (result i32) + (func $std/math/test_sign (; 137 ;) (; has Stack IR ;) (type $FUNCSIG$idd) (param $0 f64) (param $1 f64) (result i32) (local $2 i32) (if (tee_local $2 (call $std/math/check (if (result f64) (f64.gt - (f64.abs - (get_local $0) - ) + (get_local $0) (f64.const 0) ) - (f64.copysign - (f64.const 1) + (f64.const 1) + (if (result f64) + (f64.lt + (get_local $0) + (f64.const 0) + ) + (f64.const -1) (get_local $0) ) - (get_local $0) ) (get_local $1) (f64.const 0) @@ -12423,66 +11879,69 @@ ) (get_local $2) ) - (func $std/math/test_signf (; 141 ;) (; has Stack IR ;) (type $FUNCSIG$iff) (param $0 f32) (param $1 f32) (result i32) - (call $std/math/check - (if (result f32) - (f32.gt - (f32.abs - (get_local $0) - ) + (func $std/math/test_signf (; 138 ;) (; has Stack IR ;) (type $FUNCSIG$iff) (param $0 f32) (param $1 f32) (result i32) + (if + (f32.gt + (get_local $0) + (f32.const 0) + ) + (set_local $0 + (f32.const 1) + ) + (if + (f32.lt + (get_local $0) (f32.const 0) ) - (f32.copysign - (f32.const 1) - (get_local $0) + (set_local $0 + (f32.const -1) ) - (get_local $0) ) + ) + (call $std/math/check + (get_local $0) (get_local $1) (f32.const 0) ) ) - (func $~lib/math/NativeMath.rem (; 142 ;) (; has Stack IR ;) (type $FFF) (param $0 f64) (param $1 f64) (result f64) + (func $~lib/math/NativeMath.rem (; 139 ;) (; has Stack IR ;) (type $FFF) (param $0 f64) (param $1 f64) (result f64) (local $2 i64) - (local $3 i32) - (local $4 i64) - (local $5 i32) - (local $6 i32) - (local $7 i64) - (local $8 i32) - (local $9 i32) + (local $3 i64) + (local $4 i32) + (local $5 i64) + (local $6 i64) + (local $7 i32) + (local $8 i64) + (local $9 f64) (local $10 i32) + (local $11 i32) (set_local $3 - (i32.wrap/i64 - (i64.and - (i64.shr_u - (tee_local $2 - (i64.reinterpret/f64 - (get_local $0) - ) + (i64.and + (i64.shr_u + (tee_local $2 + (i64.reinterpret/f64 + (get_local $0) ) - (i64.const 52) ) - (i64.const 2047) + (i64.const 52) ) + (i64.const 2047) ) ) (set_local $6 - (i32.wrap/i64 - (i64.and - (i64.shr_u - (tee_local $7 - (i64.reinterpret/f64 - (get_local $1) - ) + (i64.and + (i64.shr_u + (tee_local $5 + (i64.reinterpret/f64 + (get_local $1) ) - (i64.const 52) ) - (i64.const 2047) + (i64.const 52) ) + (i64.const 2047) ) ) - (set_local $9 + (set_local $10 (i32.wrap/i64 (i64.shr_u (get_local $2) @@ -12490,45 +11949,45 @@ ) ) ) - (set_local $10 + (set_local $11 (i32.wrap/i64 (i64.shr_u - (get_local $7) + (get_local $5) (i64.const 63) ) ) ) (if (i32.eqz - (tee_local $5 + (tee_local $4 (i64.eq (i64.shl - (get_local $7) + (get_local $5) (i64.const 1) ) (i64.const 0) ) ) ) - (set_local $5 + (set_local $4 + (i64.eq + (get_local $3) + (i64.const 2047) + ) + ) + ) + (if + (i32.eqz + (get_local $4) + ) + (set_local $4 (call $~lib/builtins/isNaN (get_local $1) ) ) ) (if - (i32.eqz - (get_local $5) - ) - (set_local $5 - (i32.eq - (get_local $3) - (i32.const 2047) - ) - ) - ) - (if - (get_local $5) + (get_local $4) (return (f64.div (tee_local $0 @@ -12555,126 +12014,84 @@ ) (set_local $2 (if (result i64) - (get_local $3) - (i64.or - (i64.and - (get_local $2) - (i64.const 4503599627370495) - ) - (i64.const 4503599627370496) + (i64.eqz + (get_local $3) ) - (block (result i64) - (block $break|0 - (set_local $4 - (i64.shl - (get_local $2) - (i64.const 12) - ) - ) - (loop $repeat|0 - (br_if $break|0 - (i64.ne - (i64.shr_u - (get_local $4) - (i64.const 63) - ) - (i64.const 0) - ) - ) - (set_local $3 - (i32.sub + (i64.shl + (get_local $2) + (i64.add + (i64.sub + (i64.const 0) + (tee_local $3 + (i64.sub (get_local $3) - (i32.const 1) + (i64.clz + (i64.shl + (get_local $2) + (i64.const 12) + ) + ) ) ) - (set_local $4 - (i64.shl - (get_local $4) - (i64.const 1) - ) - ) - (br $repeat|0) - ) - ) - (i64.shl - (get_local $2) - (i64.extend_s/i32 - (i32.sub - (i32.const 1) - (get_local $3) - ) ) + (i64.const 1) ) ) - ) - ) - (set_local $7 - (if (result i64) - (get_local $6) (i64.or (i64.and - (get_local $7) + (get_local $2) (i64.const 4503599627370495) ) (i64.const 4503599627370496) ) - (block (result i64) - (block $break|1 - (set_local $4 - (i64.shl - (get_local $7) - (i64.const 12) - ) - ) - (loop $repeat|1 - (br_if $break|1 - (i64.ne - (i64.shr_u - (get_local $4) - (i64.const 63) - ) - (i64.const 0) - ) - ) - (set_local $6 - (i32.sub + ) + ) + (set_local $5 + (if (result i64) + (i64.eqz + (get_local $6) + ) + (i64.shl + (get_local $5) + (i64.add + (i64.sub + (i64.const 0) + (tee_local $6 + (i64.sub (get_local $6) - (i32.const 1) + (i64.clz + (i64.shl + (get_local $5) + (i64.const 12) + ) + ) ) ) - (set_local $4 - (i64.shl - (get_local $4) - (i64.const 1) - ) - ) - (br $repeat|1) ) + (i64.const 1) ) - (i64.shl - (get_local $7) - (i64.extend_s/i32 - (i32.sub - (i32.const 1) - (get_local $6) - ) - ) + ) + (i64.or + (i64.and + (get_local $5) + (i64.const 4503599627370495) ) + (i64.const 4503599627370496) ) ) ) - (block $break|2 + (block $break|0 (if - (i32.lt_s + (i64.lt_s (get_local $3) (get_local $6) ) (block - (br_if $break|2 - (i32.eq - (i32.add + (br_if $break|0 + (i64.eq + (i64.add (get_local $3) - (i32.const 1) + (i64.const 1) ) (get_local $6) ) @@ -12684,10 +12101,10 @@ ) ) ) - (block $break|3 - (loop $repeat|3 - (br_if $break|3 - (i32.le_s + (block $break|1 + (loop $repeat|1 + (br_if $break|1 + (i64.le_s (get_local $3) (get_local $6) ) @@ -12695,10 +12112,10 @@ (if (i64.eq (i64.shr_u - (tee_local $4 + (tee_local $8 (i64.sub (get_local $2) - (get_local $7) + (get_local $5) ) ) (i64.const 63) @@ -12707,11 +12124,11 @@ ) (block (set_local $2 - (get_local $4) + (get_local $8) ) - (set_local $8 + (set_local $7 (i32.add - (get_local $8) + (get_local $7) (i32.const 1) ) ) @@ -12723,28 +12140,28 @@ (i64.const 1) ) ) - (set_local $8 + (set_local $7 (i32.shl - (get_local $8) + (get_local $7) (i32.const 1) ) ) (set_local $3 - (i32.sub + (i64.sub (get_local $3) - (i32.const 1) + (i64.const 1) ) ) - (br $repeat|3) + (br $repeat|1) ) ) (if (i64.eq (i64.shr_u - (tee_local $4 + (tee_local $8 (i64.sub (get_local $2) - (get_local $7) + (get_local $5) ) ) (i64.const 63) @@ -12753,11 +12170,11 @@ ) (block (set_local $2 - (get_local $4) + (get_local $8) ) - (set_local $8 + (set_local $7 (i32.add - (get_local $8) + (get_local $7) (i32.const 1) ) ) @@ -12769,32 +12186,27 @@ (i64.const 0) ) (set_local $3 - (i32.const -60) + (i64.const -60) ) - (block $break|4 - (loop $repeat|4 - (br_if $break|4 - (i64.ne - (i64.shr_u - (get_local $2) - (i64.const 52) + (block + (set_local $3 + (i64.sub + (get_local $3) + (tee_local $8 + (i64.clz + (i64.shl + (get_local $2) + (i64.const 11) + ) ) - (i64.const 0) ) ) - (set_local $2 - (i64.shl - (get_local $2) - (i64.const 1) - ) + ) + (set_local $2 + (i64.shl + (get_local $2) + (get_local $8) ) - (set_local $3 - (i32.sub - (get_local $3) - (i32.const 1) - ) - ) - (br $repeat|4) ) ) ) @@ -12803,9 +12215,9 @@ (f64.reinterpret/i64 (tee_local $2 (if (result i64) - (i32.gt_s + (i64.gt_s (get_local $3) - (i32.const 0) + (i64.const 0) ) (i64.or (i64.sub @@ -12813,19 +12225,18 @@ (i64.const 4503599627370496) ) (i64.shl - (i64.extend_s/i32 - (get_local $3) - ) + (get_local $3) (i64.const 52) ) ) (i64.shr_u (get_local $2) - (i64.extend_s/i32 - (i32.sub - (i32.const 1) + (i64.add + (i64.sub + (i64.const 0) (get_local $3) ) + (i64.const 1) ) ) ) @@ -12833,57 +12244,57 @@ ) ) (if - (get_local $10) + (get_local $11) (set_local $1 (f64.neg (get_local $1) ) ) ) + (set_local $9 + (f64.add + (get_local $0) + (get_local $0) + ) + ) (if (i32.eqz - (tee_local $5 - (i32.eq + (tee_local $4 + (i64.eq (get_local $3) (get_local $6) ) ) ) (if - (tee_local $5 - (i32.eq - (i32.add + (tee_local $4 + (i64.eq + (i64.add (get_local $3) - (i32.const 1) + (i64.const 1) ) (get_local $6) ) ) (if (i32.eqz - (tee_local $5 + (tee_local $4 (f64.gt - (f64.mul - (f64.const 2) - (get_local $0) - ) + (get_local $9) (get_local $1) ) ) ) (if - (tee_local $5 + (tee_local $4 (f64.eq - (f64.mul - (f64.const 2) - (get_local $0) - ) + (get_local $9) (get_local $1) ) ) - (set_local $5 + (set_local $4 (i32.and - (get_local $8) + (get_local $7) (i32.const 1) ) ) @@ -12892,7 +12303,7 @@ ) ) (if - (get_local $5) + (get_local $4) (set_local $0 (f64.sub (get_local $0) @@ -12901,7 +12312,7 @@ ) ) (if - (get_local $9) + (get_local $10) (set_local $0 (f64.neg (get_local $0) @@ -12910,7 +12321,7 @@ ) (get_local $0) ) - (func $std/math/test_rem (; 143 ;) (; has Stack IR ;) (type $FUNCSIG$idddi) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 i32) (result i32) + (func $std/math/test_rem (; 140 ;) (; has Stack IR ;) (type $FUNCSIG$idddi) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 i32) (result i32) (call $std/math/check (call $~lib/math/NativeMath.rem (get_local $0) @@ -12920,7 +12331,7 @@ (f64.const 0) ) ) - (func $~lib/math/NativeMathf.rem (; 144 ;) (; has Stack IR ;) (type $fff) (param $0 f32) (param $1 f32) (result f32) + (func $~lib/math/NativeMathf.rem (; 141 ;) (; has Stack IR ;) (type $fff) (param $0 f32) (param $1 f32) (result f32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -12929,10 +12340,10 @@ (local $7 i32) (local $8 i32) (local $9 i32) - (set_local $4 + (set_local $3 (i32.and (i32.shr_u - (tee_local $3 + (tee_local $2 (i32.reinterpret/f32 (get_local $0) ) @@ -12942,10 +12353,10 @@ (i32.const 255) ) ) - (set_local $5 + (set_local $6 (i32.and (i32.shr_u - (tee_local $6 + (tee_local $5 (i32.reinterpret/f32 (get_local $1) ) @@ -12957,46 +12368,46 @@ ) (set_local $8 (i32.shr_u - (get_local $3) + (get_local $2) (i32.const 31) ) ) (set_local $9 (i32.shr_u - (get_local $6) + (get_local $5) (i32.const 31) ) ) (if (i32.eqz - (tee_local $2 + (tee_local $4 (i32.eqz (i32.shl - (get_local $6) + (get_local $5) (i32.const 1) ) ) ) ) - (set_local $2 + (set_local $4 + (i32.eq + (get_local $3) + (i32.const 255) + ) + ) + ) + (if + (i32.eqz + (get_local $4) + ) + (set_local $4 (call $~lib/builtins/isNaN (get_local $1) ) ) ) (if - (i32.eqz - (get_local $2) - ) - (set_local $2 - (i32.eq - (get_local $4) - (i32.const 255) - ) - ) - ) - (if - (get_local $2) + (get_local $4) (return (f32.div (tee_local $0 @@ -13012,7 +12423,7 @@ (if (i32.eqz (i32.shl - (get_local $3) + (get_local $2) (i32.const 1) ) ) @@ -13020,120 +12431,78 @@ (get_local $0) ) ) - (set_local $3 + (set_local $2 (if (result i32) - (get_local $4) + (get_local $3) (i32.or (i32.and - (get_local $3) + (get_local $2) (i32.const 8388607) ) (i32.const 8388608) ) - (block (result i32) - (block $break|0 - (set_local $2 - (i32.shl + (i32.shl + (get_local $2) + (i32.sub + (i32.const 1) + (tee_local $3 + (i32.sub (get_local $3) - (i32.const 9) - ) - ) - (loop $repeat|0 - (br_if $break|0 - (i32.shr_u - (get_local $2) - (i32.const 31) + (i32.clz + (i32.shl + (get_local $2) + (i32.const 9) + ) ) ) - (set_local $4 - (i32.sub - (get_local $4) - (i32.const 1) - ) - ) - (set_local $2 - (i32.shl - (get_local $2) - (i32.const 1) - ) - ) - (br $repeat|0) - ) - ) - (i32.shl - (get_local $3) - (i32.sub - (i32.const 1) - (get_local $4) ) ) ) ) ) - (set_local $6 + (set_local $5 (if (result i32) - (get_local $5) + (get_local $6) (i32.or (i32.and - (get_local $6) + (get_local $5) (i32.const 8388607) ) (i32.const 8388608) ) - (block (result i32) - (block $break|1 - (set_local $2 - (i32.shl + (i32.shl + (get_local $5) + (i32.sub + (i32.const 1) + (tee_local $6 + (i32.sub (get_local $6) - (i32.const 9) - ) - ) - (loop $repeat|1 - (br_if $break|1 - (i32.shr_u - (get_local $2) - (i32.const 31) + (i32.clz + (i32.shl + (get_local $5) + (i32.const 9) + ) ) ) - (set_local $5 - (i32.sub - (get_local $5) - (i32.const 1) - ) - ) - (set_local $2 - (i32.shl - (get_local $2) - (i32.const 1) - ) - ) - (br $repeat|1) - ) - ) - (i32.shl - (get_local $6) - (i32.sub - (i32.const 1) - (get_local $5) ) ) ) ) ) - (block $break|2 + (block $break|0 (if (i32.lt_s - (get_local $4) - (get_local $5) + (get_local $3) + (get_local $6) ) (block - (br_if $break|2 + (br_if $break|0 (i32.eq (i32.add - (get_local $4) + (get_local $3) (i32.const 1) ) - (get_local $5) + (get_local $6) ) ) (return @@ -13141,29 +12510,29 @@ ) ) ) - (block $break|3 - (loop $repeat|3 - (br_if $break|3 + (block $break|1 + (loop $repeat|1 + (br_if $break|1 (i32.le_s - (get_local $4) - (get_local $5) + (get_local $3) + (get_local $6) ) ) (if (i32.eqz (i32.shr_u - (tee_local $2 + (tee_local $4 (i32.sub - (get_local $3) - (get_local $6) + (get_local $2) + (get_local $5) ) ) (i32.const 31) ) ) (block - (set_local $3 - (get_local $2) + (set_local $2 + (get_local $4) ) (set_local $7 (i32.add @@ -13173,9 +12542,9 @@ ) ) ) - (set_local $3 + (set_local $2 (i32.shl - (get_local $3) + (get_local $2) (i32.const 1) ) ) @@ -13185,30 +12554,30 @@ (i32.const 1) ) ) - (set_local $4 + (set_local $3 (i32.sub - (get_local $4) + (get_local $3) (i32.const 1) ) ) - (br $repeat|3) + (br $repeat|1) ) ) (if (i32.eqz (i32.shr_u - (tee_local $2 + (tee_local $4 (i32.sub - (get_local $3) - (get_local $6) + (get_local $2) + (get_local $5) ) ) (i32.const 31) ) ) (block - (set_local $3 - (get_local $2) + (set_local $2 + (get_local $4) ) (set_local $7 (i32.add @@ -13219,58 +12588,56 @@ ) ) (if - (get_local $3) - (block $break|4 - (loop $repeat|4 - (br_if $break|4 - (i32.shr_u - (get_local $3) - (i32.const 23) + (get_local $2) + (block + (set_local $3 + (i32.sub + (get_local $3) + (tee_local $4 + (i32.clz + (i32.shl + (get_local $2) + (i32.const 8) + ) + ) ) ) - (set_local $3 - (i32.shl - (get_local $3) - (i32.const 1) - ) + ) + (set_local $2 + (i32.shl + (get_local $2) + (get_local $4) ) - (set_local $4 - (i32.sub - (get_local $4) - (i32.const 1) - ) - ) - (br $repeat|4) ) ) - (set_local $4 + (set_local $3 (i32.const -30) ) ) ) (set_local $0 (f32.reinterpret/i32 - (tee_local $3 + (tee_local $2 (if (result i32) (i32.gt_s - (get_local $4) + (get_local $3) (i32.const 0) ) (i32.or (i32.sub - (get_local $3) + (get_local $2) (i32.const 8388608) ) (i32.shl - (get_local $4) + (get_local $3) (i32.const 23) ) ) (i32.shr_u - (get_local $3) + (get_local $2) (i32.sub (i32.const 1) - (get_local $4) + (get_local $3) ) ) ) @@ -13287,26 +12654,26 @@ ) (if (i32.eqz - (tee_local $2 + (tee_local $4 (i32.eq - (get_local $4) - (get_local $5) + (get_local $3) + (get_local $6) ) ) ) (if - (tee_local $2 + (tee_local $4 (i32.eq (i32.add - (get_local $4) + (get_local $3) (i32.const 1) ) - (get_local $5) + (get_local $6) ) ) (if (i32.eqz - (tee_local $2 + (tee_local $4 (f32.gt (f32.mul (f32.const 2) @@ -13317,7 +12684,7 @@ ) ) (if - (tee_local $2 + (tee_local $4 (f32.eq (f32.mul (f32.const 2) @@ -13326,7 +12693,7 @@ (get_local $1) ) ) - (set_local $2 + (set_local $4 (i32.and (get_local $7) (i32.const 1) @@ -13337,7 +12704,7 @@ ) ) (if - (get_local $2) + (get_local $4) (set_local $0 (f32.sub (get_local $0) @@ -13355,7 +12722,7 @@ ) (get_local $0) ) - (func $std/math/test_remf (; 145 ;) (; has Stack IR ;) (type $FUNCSIG$ifffi) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 i32) (result i32) + (func $std/math/test_remf (; 142 ;) (; has Stack IR ;) (type $FUNCSIG$ifffi) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 i32) (result i32) (call $std/math/check (call $~lib/math/NativeMathf.rem (get_local $0) @@ -13365,46 +12732,35 @@ (f32.const 0) ) ) - (func $~lib/math/NativeMath.sinh (; 146 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) + (func $~lib/math/NativeMath.sinh (; 143 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) (local $1 f64) (local $2 f64) - (local $3 i64) - (local $4 i32) - (set_local $2 - (f64.const 0.5) - ) - (if - (i64.ne - (i64.shr_u - (tee_local $3 + (local $3 i32) + (local $4 i64) + (set_local $1 + (f64.reinterpret/i64 + (tee_local $4 + (i64.and (i64.reinterpret/f64 (get_local $0) ) - ) - (i64.const 63) - ) - (i64.const 0) - ) - (set_local $2 - (f64.const -0.5) - ) - ) - (set_local $1 - (f64.reinterpret/i64 - (tee_local $3 - (i64.and - (get_local $3) (i64.const 9223372036854775807) ) ) ) ) + (set_local $2 + (f64.copysign + (f64.const 0.5) + (get_local $0) + ) + ) (if (i32.lt_u - (tee_local $4 + (tee_local $3 (i32.wrap/i64 (i64.shr_u - (get_local $3) + (get_local $4) (i64.const 32) ) ) @@ -13419,13 +12775,13 @@ ) (if (i32.lt_u - (get_local $4) + (get_local $3) (i32.const 1072693248) ) (block (if (i32.lt_u - (get_local $4) + (get_local $3) (i32.const 1045430272) ) (return @@ -13479,8 +12835,17 @@ ) ) (set_local $1 - (call $~lib/math/expo2 - (get_local $1) + (f64.mul + (f64.mul + (call $~lib/math/NativeMath.exp + (f64.sub + (get_local $1) + (f64.const 1416.0996898839683) + ) + ) + (f64.const 2247116418577894884661631e283) + ) + (f64.const 2247116418577894884661631e283) ) ) (f64.mul @@ -13488,7 +12853,7 @@ (get_local $1) ) ) - (func $std/math/test_sinh (; 147 ;) (; has Stack IR ;) (type $FFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 i32) (result i32) + (func $std/math/test_sinh (; 144 ;) (; has Stack IR ;) (type $FFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 i32) (result i32) (local $4 i32) (tee_local $3 (if (result i32) @@ -13514,36 +12879,28 @@ ) ) ) - (func $~lib/math/NativeMathf.sinh (; 148 ;) (; has Stack IR ;) (type $ff) (param $0 f32) (result f32) + (func $~lib/math/NativeMathf.sinh (; 145 ;) (; has Stack IR ;) (type $ff) (param $0 f32) (result f32) (local $1 f32) (local $2 i32) (local $3 f32) - (set_local $3 - (f32.const 0.5) - ) - (if - (i32.shr_u - (tee_local $2 - (i32.reinterpret/f32 - (get_local $0) - ) - ) - (i32.const 31) - ) - (set_local $3 - (f32.const -0.5) - ) - ) (set_local $1 (f32.reinterpret/i32 (tee_local $2 (i32.and - (get_local $2) + (i32.reinterpret/f32 + (get_local $0) + ) (i32.const 2147483647) ) ) ) ) + (set_local $3 + (f32.copysign + (f32.const 0.5) + (get_local $0) + ) + ) (if (i32.lt_u (get_local $2) @@ -13617,8 +12974,17 @@ ) ) (set_local $1 - (call $~lib/math/expo2f - (get_local $1) + (f32.mul + (f32.mul + (call $~lib/math/NativeMathf.exp + (f32.sub + (get_local $1) + (f32.const 162.88958740234375) + ) + ) + (f32.const 1661534994731144841129758e11) + ) + (f32.const 1661534994731144841129758e11) ) ) (f32.mul @@ -13626,7 +12992,7 @@ (get_local $1) ) ) - (func $std/math/test_sinhf (; 149 ;) (; has Stack IR ;) (type $fffii) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 i32) (result i32) + (func $std/math/test_sinhf (; 146 ;) (; has Stack IR ;) (type $fffii) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 i32) (result i32) (call $std/math/check (call $~lib/math/NativeMathf.sinh (get_local $0) @@ -13635,7 +13001,7 @@ (get_local $2) ) ) - (func $std/math/test_sqrt (; 150 ;) (; has Stack IR ;) (type $FFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 i32) (result i32) + (func $std/math/test_sqrt (; 147 ;) (; has Stack IR ;) (type $FFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 i32) (result i32) (local $4 i32) (tee_local $3 (if (result i32) @@ -13661,7 +13027,7 @@ ) ) ) - (func $std/math/test_sqrtf (; 151 ;) (; has Stack IR ;) (type $fffii) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 i32) (result i32) + (func $std/math/test_sqrtf (; 148 ;) (; has Stack IR ;) (type $fffii) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 i32) (result i32) (call $std/math/check (f32.sqrt (get_local $0) @@ -13670,27 +13036,17 @@ (get_local $2) ) ) - (func $~lib/math/NativeMath.tanh (; 152 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) - (local $1 i64) + (func $~lib/math/NativeMath.tanh (; 149 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) + (local $1 f64) (local $2 i32) - (local $3 i32) - (set_local $3 - (i32.wrap/i64 - (i64.shr_u - (tee_local $1 + (local $3 i64) + (set_local $1 + (f64.reinterpret/i64 + (tee_local $3 + (i64.and (i64.reinterpret/f64 (get_local $0) ) - ) - (i64.const 63) - ) - ) - ) - (set_local $0 - (f64.reinterpret/i64 - (tee_local $1 - (i64.and - (get_local $1) (i64.const 9223372036854775807) ) ) @@ -13701,14 +13057,14 @@ (tee_local $2 (i32.wrap/i64 (i64.shr_u - (get_local $1) + (get_local $3) (i64.const 32) ) ) ) (i32.const 1071748074) ) - (set_local $0 + (set_local $1 (if (result f64) (i32.gt_u (get_local $2) @@ -13718,7 +13074,7 @@ (f64.const 1) (f64.div (f64.const 0) - (get_local $0) + (get_local $1) ) ) (f64.sub @@ -13729,7 +13085,7 @@ (call $~lib/math/NativeMath.expm1 (f64.mul (f64.const 2) - (get_local $0) + (get_local $1) ) ) (f64.const 2) @@ -13743,18 +13099,18 @@ (get_local $2) (i32.const 1070618798) ) - (set_local $0 + (set_local $1 (f64.div - (tee_local $0 + (tee_local $1 (call $~lib/math/NativeMath.expm1 (f64.mul (f64.const 2) - (get_local $0) + (get_local $1) ) ) ) (f64.add - (get_local $0) + (get_local $1) (f64.const 2) ) ) @@ -13764,20 +13120,20 @@ (get_local $2) (i32.const 1048576) ) - (set_local $0 + (set_local $1 (f64.div (f64.neg - (tee_local $0 + (tee_local $1 (call $~lib/math/NativeMath.expm1 (f64.mul (f64.const -2) - (get_local $0) + (get_local $1) ) ) ) ) (f64.add - (get_local $0) + (get_local $1) (f64.const 2) ) ) @@ -13785,17 +13141,12 @@ ) ) ) - (if - (get_local $3) - (set_local $0 - (f64.neg - (get_local $0) - ) - ) + (f64.copysign + (get_local $1) + (get_local $0) ) - (get_local $0) ) - (func $std/math/test_tanh (; 153 ;) (; has Stack IR ;) (type $FFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 i32) (result i32) + (func $std/math/test_tanh (; 150 ;) (; has Stack IR ;) (type $FFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 i32) (result i32) (local $4 i32) (tee_local $3 (if (result i32) @@ -13821,24 +13172,16 @@ ) ) ) - (func $~lib/math/NativeMathf.tanh (; 154 ;) (; has Stack IR ;) (type $ff) (param $0 f32) (result f32) - (local $1 i32) + (func $~lib/math/NativeMathf.tanh (; 151 ;) (; has Stack IR ;) (type $ff) (param $0 f32) (result f32) + (local $1 f32) (local $2 i32) - (set_local $2 - (i32.shr_u - (tee_local $1 - (i32.reinterpret/f32 - (get_local $0) - ) - ) - (i32.const 31) - ) - ) - (set_local $0 + (set_local $1 (f32.reinterpret/i32 - (tee_local $1 + (tee_local $2 (i32.and - (get_local $1) + (i32.reinterpret/f32 + (get_local $0) + ) (i32.const 2147483647) ) ) @@ -13846,20 +13189,20 @@ ) (if (i32.gt_u - (get_local $1) + (get_local $2) (i32.const 1057791828) ) - (set_local $0 + (set_local $1 (if (result f32) (i32.gt_u - (get_local $1) + (get_local $2) (i32.const 1092616192) ) (f32.add (f32.const 1) (f32.div (f32.const 0) - (get_local $0) + (get_local $1) ) ) (f32.sub @@ -13870,7 +13213,7 @@ (call $~lib/math/NativeMathf.expm1 (f32.mul (f32.const 2) - (get_local $0) + (get_local $1) ) ) (f32.const 2) @@ -13881,44 +13224,44 @@ ) (if (i32.gt_u - (get_local $1) + (get_local $2) (i32.const 1048757624) ) - (set_local $0 + (set_local $1 (f32.div - (tee_local $0 + (tee_local $1 (call $~lib/math/NativeMathf.expm1 (f32.mul (f32.const 2) - (get_local $0) + (get_local $1) ) ) ) (f32.add - (get_local $0) + (get_local $1) (f32.const 2) ) ) ) (if (i32.ge_u - (get_local $1) + (get_local $2) (i32.const 8388608) ) - (set_local $0 + (set_local $1 (f32.div (f32.neg - (tee_local $0 + (tee_local $1 (call $~lib/math/NativeMathf.expm1 (f32.mul (f32.const -2) - (get_local $0) + (get_local $1) ) ) ) ) (f32.add - (get_local $0) + (get_local $1) (f32.const 2) ) ) @@ -13926,17 +13269,12 @@ ) ) ) - (if - (get_local $2) - (set_local $0 - (f32.neg - (get_local $0) - ) - ) + (f32.copysign + (get_local $1) + (get_local $0) ) - (get_local $0) ) - (func $std/math/test_tanhf (; 155 ;) (; has Stack IR ;) (type $fffii) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 i32) (result i32) + (func $std/math/test_tanhf (; 152 ;) (; has Stack IR ;) (type $fffii) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 i32) (result i32) (call $std/math/check (call $~lib/math/NativeMathf.tanh (get_local $0) @@ -13945,7 +13283,7 @@ (get_local $2) ) ) - (func $std/math/test_trunc (; 156 ;) (; has Stack IR ;) (type $FUNCSIG$iddi) (param $0 f64) (param $1 f64) (param $2 i32) (result i32) + (func $std/math/test_trunc (; 153 ;) (; has Stack IR ;) (type $FUNCSIG$iddi) (param $0 f64) (param $1 f64) (param $2 i32) (result i32) (if (tee_local $2 (call $std/math/check @@ -13970,7 +13308,7 @@ ) (get_local $2) ) - (func $std/math/test_truncf (; 157 ;) (; has Stack IR ;) (type $FUNCSIG$iffi) (param $0 f32) (param $1 f32) (param $2 i32) (result i32) + (func $std/math/test_truncf (; 154 ;) (; has Stack IR ;) (type $FUNCSIG$iffi) (param $0 f32) (param $1 f32) (param $2 i32) (result i32) (call $std/math/check (f32.trunc (get_local $0) @@ -13979,7 +13317,7 @@ (f32.const 0) ) ) - (func $~lib/math/ipow64 (; 158 ;) (; has Stack IR ;) (type $IiI) (param $0 i64) (param $1 i32) (result i64) + (func $~lib/math/ipow64 (; 155 ;) (; has Stack IR ;) (type $IiI) (param $0 i64) (param $1 i32) (result i64) (local $2 i64) (local $3 i32) (set_local $2 @@ -14249,7 +13587,7 @@ ) (get_local $2) ) - (func $start (; 159 ;) (; has Stack IR ;) (type $v) + (func $start (; 156 ;) (; has Stack IR ;) (type $v) (local $0 i32) (local $1 i32) (local $2 f64) @@ -52724,7 +52062,7 @@ ) ) ) - (func $null (; 160 ;) (; has Stack IR ;) (type $v) + (func $null (; 157 ;) (; has Stack IR ;) (type $v) (nop) ) ) diff --git a/tests/compiler/std/math.untouched.wat b/tests/compiler/std/math.untouched.wat index ef7b982c..cf8850d3 100644 --- a/tests/compiler/std/math.untouched.wat +++ b/tests/compiler/std/math.untouched.wat @@ -19,6 +19,7 @@ (type $F (func (result f64))) (type $Iv (func (param i64))) (type $II (func (param i64) (result i64))) + (type $ii (func (param i32) (result i32))) (type $f (func (result f32))) (type $IiI (func (param i64 i32) (result i64))) (type $v (func)) @@ -87,10 +88,10 @@ (global $~lib/math/NativeMathf.SQRT2 f32 (f32.const 1.4142135381698608)) (global $NaN f64 (f64.const nan:0x8000000000000)) (global $~lib/math/random_seeded (mut i32) (i32.const 0)) - (global $~lib/math/random_state0 (mut i64) (i64.const 0)) - (global $~lib/math/random_state1 (mut i64) (i64.const 0)) - (global $~lib/builtins/f64.EPSILON f64 (f64.const 2.220446049250313e-16)) - (global $~lib/builtins/f32.EPSILON f32 (f32.const 1.1920928955078125e-07)) + (global $~lib/math/random_state0_64 (mut i64) (i64.const 0)) + (global $~lib/math/random_state1_64 (mut i64) (i64.const 0)) + (global $~lib/math/random_state0_32 (mut i32) (i32.const 0)) + (global $~lib/math/random_state1_32 (mut i32) (i32.const 0)) (global $ASC_SHRINK_LEVEL i32 (i32.const 0)) (global $HEAP_BASE i32 (i32.const 68)) (export "memory" (memory $0)) @@ -161,6 +162,8 @@ ) (func $~lib/math/NativeMath.scalbn (; 34 ;) (type $FiF) (param $0 f64) (param $1 i32) (result f64) (local $2 f64) + (local $3 i32) + (local $4 i32) (set_local $2 (get_local $0) ) @@ -195,18 +198,20 @@ ) ) (set_local $1 - (i32.sub - (get_local $1) - (i32.const 1023) - ) - ) - (if - (i32.gt_s - (get_local $1) - (i32.const 1023) - ) - (set_local $1 - (i32.const 1023) + (select + (tee_local $3 + (i32.sub + (get_local $1) + (i32.const 1023) + ) + ) + (tee_local $4 + (i32.const 1023) + ) + (i32.lt_s + (get_local $3) + (get_local $4) + ) ) ) ) @@ -221,13 +226,19 @@ (set_local $2 (f64.mul (get_local $2) - (f64.const 2.2250738585072014e-308) + (f64.mul + (f64.const 2.2250738585072014e-308) + (f64.const 9007199254740992) + ) ) ) (set_local $1 (i32.add (get_local $1) - (i32.const 1022) + (i32.sub + (i32.const 1022) + (i32.const 53) + ) ) ) (if @@ -239,22 +250,30 @@ (set_local $2 (f64.mul (get_local $2) - (f64.const 2.2250738585072014e-308) + (f64.mul + (f64.const 2.2250738585072014e-308) + (f64.const 9007199254740992) + ) ) ) (set_local $1 - (i32.add - (get_local $1) - (i32.const 1022) - ) - ) - (if - (i32.lt_s - (get_local $1) - (i32.const -1022) - ) - (set_local $1 - (i32.const -1022) + (select + (tee_local $3 + (i32.sub + (i32.add + (get_local $1) + (i32.const 1022) + ) + (i32.const 53) + ) + ) + (tee_local $4 + (i32.const -1022) + ) + (i32.gt_s + (get_local $3) + (get_local $4) + ) ) ) ) @@ -458,6 +477,8 @@ ) (func $~lib/math/NativeMathf.scalbn (; 41 ;) (type $fif) (param $0 f32) (param $1 i32) (result f32) (local $2 f32) + (local $3 i32) + (local $4 i32) (set_local $2 (get_local $0) ) @@ -492,18 +513,20 @@ ) ) (set_local $1 - (i32.sub - (get_local $1) - (i32.const 127) - ) - ) - (if - (i32.gt_s - (get_local $1) - (i32.const 127) - ) - (set_local $1 - (i32.const 127) + (select + (tee_local $3 + (i32.sub + (get_local $1) + (i32.const 127) + ) + ) + (tee_local $4 + (i32.const 127) + ) + (i32.lt_s + (get_local $3) + (get_local $4) + ) ) ) ) @@ -518,13 +541,19 @@ (set_local $2 (f32.mul (get_local $2) - (f32.const 1.1754943508222875e-38) + (f32.mul + (f32.const 1.1754943508222875e-38) + (f32.const 16777216) + ) ) ) (set_local $1 (i32.add (get_local $1) - (i32.const 126) + (i32.sub + (i32.const 126) + (i32.const 24) + ) ) ) (if @@ -536,22 +565,30 @@ (set_local $2 (f32.mul (get_local $2) - (f32.const 1.1754943508222875e-38) + (f32.mul + (f32.const 1.1754943508222875e-38) + (f32.const 16777216) + ) ) ) (set_local $1 - (i32.add - (get_local $1) - (i32.const 126) - ) - ) - (if - (i32.lt_s - (get_local $1) - (i32.const -126) - ) - (set_local $1 - (i32.const -126) + (select + (tee_local $3 + (i32.sub + (i32.add + (get_local $1) + (i32.const 126) + ) + (i32.const 24) + ) + ) + (tee_local $4 + (i32.const -126) + ) + (i32.gt_s + (get_local $3) + (get_local $4) + ) ) ) ) @@ -963,12 +1000,12 @@ ) (block (set_local $6 - (f64.mul - (f64.add - (f64.const 1) - (get_local $0) - ) + (f64.add (f64.const 0.5) + (f64.mul + (get_local $0) + (f64.const 0.5) + ) ) ) (set_local $4 @@ -1002,12 +1039,12 @@ ) ) (set_local $6 - (f64.mul - (f64.sub - (f64.const 1) - (get_local $0) - ) + (f64.sub (f64.const 0.5) + (f64.mul + (get_local $0) + (f64.const 0.5) + ) ) ) (set_local $4 @@ -1235,12 +1272,12 @@ ) (block (set_local $3 - (f32.mul - (f32.add - (f32.const 1) - (get_local $0) - ) + (f32.add (f32.const 0.5) + (f32.mul + (get_local $0) + (f32.const 0.5) + ) ) ) (set_local $5 @@ -1274,12 +1311,12 @@ ) ) (set_local $3 - (f32.mul - (f32.sub - (f32.const 1) - (get_local $0) - ) + (f32.sub (f32.const 0.5) + (f32.mul + (get_local $0) + (f32.const 0.5) + ) ) ) (set_local $5 @@ -2663,6 +2700,7 @@ (func $~lib/math/NativeMathf.acosh (; 60 ;) (type $ff) (param $0 f32) (result f32) (local $1 i32) (local $2 i32) + (local $3 f32) (set_local $1 (i32.reinterpret/f32 (get_local $0) @@ -2685,30 +2723,23 @@ ) ) ) - (return - (call $~lib/math/NativeMathf.log1p - (f32.add - (f32.sub - (get_local $0) - (f32.const 1) - ) - (f32.sqrt - (f32.add + (block + (set_local $3 + (f32.sub + (get_local $0) + (f32.const 1) + ) + ) + (return + (call $~lib/math/NativeMathf.log1p + (f32.add + (get_local $3) + (f32.sqrt (f32.mul - (f32.sub - (get_local $0) - (f32.const 1) - ) - (f32.sub - (get_local $0) - (f32.const 1) - ) - ) - (f32.mul - (f32.const 2) - (f32.sub - (get_local $0) - (f32.const 1) + (get_local $3) + (f32.add + (get_local $3) + (f32.const 2) ) ) ) @@ -2884,14 +2915,14 @@ ) ) (set_local $4 - (f64.mul - (f64.sub - (f64.const 1) + (f64.sub + (f64.const 0.5) + (f64.mul (f64.abs (get_local $0) ) + (f64.const 0.5) ) - (f64.const 0.5) ) ) (set_local $5 @@ -3037,19 +3068,19 @@ ) ) (func $~lib/math/NativeMathf.asin (; 64 ;) (type $ff) (param $0 f32) (result f32) - (local $1 i32) + (local $1 f32) (local $2 i32) (local $3 i32) (local $4 f32) (local $5 f64) (set_local $1 - (i32.reinterpret/f32 - (get_local $0) - ) + (get_local $0) ) (set_local $2 (i32.and - (get_local $1) + (i32.reinterpret/f32 + (get_local $0) + ) (i32.const 2147483647) ) ) @@ -3126,14 +3157,14 @@ ) ) (set_local $4 - (f32.mul - (f32.sub - (f32.const 1) + (f32.sub + (f32.const 0.5) + (f32.mul (f32.abs (get_local $0) ) + (f32.const 0.5) ) - (f32.const 0.5) ) ) (set_local $5 @@ -3168,18 +3199,10 @@ ) ) ) - (if - (i32.shr_u - (get_local $1) - (i32.const 31) - ) - (return - (f32.neg - (get_local $0) - ) - ) + (f32.copysign + (get_local $0) + (get_local $1) ) - (get_local $0) ) (func $std/math/test_asinf (; 65 ;) (type $fffii) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 i32) (result i32) (call $std/math/check @@ -3194,7 +3217,7 @@ (func $~lib/math/NativeMath.asinh (; 66 ;) (type $FF) (param $0 f64) (result f64) (local $1 i64) (local $2 i64) - (local $3 i64) + (local $3 f64) (set_local $1 (i64.reinterpret/f64 (get_local $0) @@ -3210,20 +3233,11 @@ ) ) (set_local $3 - (i64.shr_u - (get_local $1) - (i64.const 63) - ) - ) - (set_local $1 - (i64.and - (get_local $1) - (i64.const 9223372036854775807) - ) - ) - (set_local $0 (f64.reinterpret/i64 - (get_local $1) + (i64.and + (get_local $1) + (i64.const 9223372036854775807) + ) ) ) (if @@ -3234,10 +3248,10 @@ (i64.const 26) ) ) - (set_local $0 + (set_local $3 (f64.add (call $~lib/math/NativeMath.log - (get_local $0) + (get_local $3) ) (f64.const 0.6931471805599453) ) @@ -3250,12 +3264,12 @@ (i64.const 1) ) ) - (set_local $0 + (set_local $3 (call $~lib/math/NativeMath.log (f64.add (f64.mul (f64.const 2) - (get_local $0) + (get_local $3) ) (f64.div (f64.const 1) @@ -3263,13 +3277,13 @@ (f64.sqrt (f64.add (f64.mul - (get_local $0) - (get_local $0) + (get_local $3) + (get_local $3) ) (f64.const 1) ) ) - (get_local $0) + (get_local $3) ) ) ) @@ -3283,21 +3297,21 @@ (i64.const 26) ) ) - (set_local $0 + (set_local $3 (call $~lib/math/NativeMath.log1p (f64.add - (get_local $0) + (get_local $3) (f64.div (f64.mul - (get_local $0) - (get_local $0) + (get_local $3) + (get_local $3) ) (f64.add (f64.sqrt (f64.add (f64.mul - (get_local $0) - (get_local $0) + (get_local $3) + (get_local $3) ) (f64.const 1) ) @@ -3311,14 +3325,8 @@ ) ) ) - (if (result f64) - (i64.ne - (get_local $3) - (i64.const 0) - ) - (f64.neg - (get_local $0) - ) + (f64.copysign + (get_local $3) (get_local $0) ) ) @@ -3356,36 +3364,23 @@ ) (func $~lib/math/NativeMathf.asinh (; 68 ;) (type $ff) (param $0 f32) (result f32) (local $1 i32) - (local $2 i32) - (local $3 i32) + (local $2 f32) (set_local $1 - (i32.reinterpret/f32 - (get_local $0) - ) - ) - (set_local $2 (i32.and - (get_local $1) + (i32.reinterpret/f32 + (get_local $0) + ) (i32.const 2147483647) ) ) - (set_local $3 - (i32.shr_u - (get_local $1) - (i32.const 31) - ) - ) - (set_local $1 - (get_local $2) - ) - (set_local $0 + (set_local $2 (f32.reinterpret/i32 (get_local $1) ) ) (if (i32.ge_u - (get_local $2) + (get_local $1) (i32.add (i32.const 1065353216) (i32.shl @@ -3394,17 +3389,17 @@ ) ) ) - (set_local $0 + (set_local $2 (f32.add (call $~lib/math/NativeMathf.log - (get_local $0) + (get_local $2) ) (f32.const 0.6931471824645996) ) ) (if (i32.ge_u - (get_local $2) + (get_local $1) (i32.add (i32.const 1065353216) (i32.shl @@ -3413,12 +3408,12 @@ ) ) ) - (set_local $0 + (set_local $2 (call $~lib/math/NativeMathf.log (f32.add (f32.mul (f32.const 2) - (get_local $0) + (get_local $2) ) (f32.div (f32.const 1) @@ -3426,13 +3421,13 @@ (f32.sqrt (f32.add (f32.mul - (get_local $0) - (get_local $0) + (get_local $2) + (get_local $2) ) (f32.const 1) ) ) - (get_local $0) + (get_local $2) ) ) ) @@ -3440,7 +3435,7 @@ ) (if (i32.ge_u - (get_local $2) + (get_local $1) (i32.sub (i32.const 1065353216) (i32.shl @@ -3449,21 +3444,21 @@ ) ) ) - (set_local $0 + (set_local $2 (call $~lib/math/NativeMathf.log1p (f32.add - (get_local $0) + (get_local $2) (f32.div (f32.mul - (get_local $0) - (get_local $0) + (get_local $2) + (get_local $2) ) (f32.add (f32.sqrt (f32.add (f32.mul - (get_local $0) - (get_local $0) + (get_local $2) + (get_local $2) ) (f32.const 1) ) @@ -3477,11 +3472,8 @@ ) ) ) - (if (result f32) - (get_local $3) - (f32.neg - (get_local $0) - ) + (f32.copysign + (get_local $2) (get_local $0) ) ) @@ -3497,13 +3489,14 @@ ) (func $~lib/math/NativeMath.atan (; 70 ;) (type $FF) (param $0 f64) (result f64) (local $1 i32) - (local $2 i32) + (local $2 f64) (local $3 f64) (local $4 i32) (local $5 f64) (local $6 f64) (local $7 f64) - (local $8 i32) + (local $8 f64) + (local $9 i32) (set_local $1 (i32.wrap/i64 (i64.shr_u @@ -3515,10 +3508,7 @@ ) ) (set_local $2 - (i32.shr_u - (get_local $1) - (i32.const 31) - ) + (get_local $0) ) (set_local $1 (i32.and @@ -3549,12 +3539,9 @@ ) ) (return - (if (result f64) - (get_local $2) - (f64.neg - (get_local $3) - ) + (f64.copysign (get_local $3) + (get_local $2) ) ) ) @@ -3750,6 +3737,15 @@ ) ) ) + (set_local $8 + (f64.mul + (get_local $0) + (f64.add + (get_local $6) + (get_local $7) + ) + ) + ) (if (i32.lt_s (get_local $4) @@ -3758,13 +3754,7 @@ (return (f64.sub (get_local $0) - (f64.mul - (get_local $0) - (f64.add - (get_local $6) - (get_local $7) - ) - ) + (get_local $8) ) ) ) @@ -3774,30 +3764,30 @@ (block $case2|0 (block $case1|0 (block $case0|0 - (set_local $8 + (set_local $9 (get_local $4) ) (br_if $case0|0 (i32.eq - (get_local $8) + (get_local $9) (i32.const 0) ) ) (br_if $case1|0 (i32.eq - (get_local $8) + (get_local $9) (i32.const 1) ) ) (br_if $case2|0 (i32.eq - (get_local $8) + (get_local $9) (i32.const 2) ) ) (br_if $case3|0 (i32.eq - (get_local $8) + (get_local $9) (i32.const 3) ) ) @@ -3809,13 +3799,7 @@ (f64.const 0.4636476090008061) (f64.sub (f64.sub - (f64.mul - (get_local $0) - (f64.add - (get_local $6) - (get_local $7) - ) - ) + (get_local $8) (f64.const 2.2698777452961687e-17) ) (get_local $0) @@ -3831,13 +3815,7 @@ (f64.const 0.7853981633974483) (f64.sub (f64.sub - (f64.mul - (get_local $0) - (f64.add - (get_local $6) - (get_local $7) - ) - ) + (get_local $8) (f64.const 3.061616997868383e-17) ) (get_local $0) @@ -3853,13 +3831,7 @@ (f64.const 0.982793723247329) (f64.sub (f64.sub - (f64.mul - (get_local $0) - (f64.add - (get_local $6) - (get_local $7) - ) - ) + (get_local $8) (f64.const 1.3903311031230998e-17) ) (get_local $0) @@ -3875,13 +3847,7 @@ (f64.const 1.5707963267948966) (f64.sub (f64.sub - (f64.mul - (get_local $0) - (f64.add - (get_local $6) - (get_local $7) - ) - ) + (get_local $8) (f64.const 6.123233995736766e-17) ) (get_local $0) @@ -3893,12 +3859,9 @@ ) (unreachable) ) - (if (result f64) - (get_local $2) - (f64.neg - (get_local $3) - ) + (f64.copysign (get_local $3) + (get_local $2) ) ) (func $std/math/test_atan (; 71 ;) (type $FFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 i32) (result i32) @@ -3935,23 +3898,21 @@ ) (func $~lib/math/NativeMathf.atan (; 72 ;) (type $ff) (param $0 f32) (result f32) (local $1 i32) - (local $2 i32) + (local $2 f32) (local $3 f32) (local $4 i32) (local $5 f32) (local $6 f32) (local $7 f32) - (local $8 i32) + (local $8 f32) + (local $9 i32) (set_local $1 (i32.reinterpret/f32 (get_local $0) ) ) (set_local $2 - (i32.shr_u - (get_local $1) - (i32.const 31) - ) + (get_local $0) ) (set_local $1 (i32.and @@ -3980,12 +3941,9 @@ ) ) (return - (if (result f32) - (get_local $2) - (f32.neg - (get_local $3) - ) + (f32.copysign (get_local $3) + (get_local $2) ) ) ) @@ -4145,6 +4103,15 @@ ) ) ) + (set_local $8 + (f32.mul + (get_local $0) + (f32.add + (get_local $6) + (get_local $7) + ) + ) + ) (if (i32.lt_s (get_local $4) @@ -4153,13 +4120,7 @@ (return (f32.sub (get_local $0) - (f32.mul - (get_local $0) - (f32.add - (get_local $6) - (get_local $7) - ) - ) + (get_local $8) ) ) ) @@ -4169,30 +4130,30 @@ (block $case2|0 (block $case1|0 (block $case0|0 - (set_local $8 + (set_local $9 (get_local $4) ) (br_if $case0|0 (i32.eq - (get_local $8) + (get_local $9) (i32.const 0) ) ) (br_if $case1|0 (i32.eq - (get_local $8) + (get_local $9) (i32.const 1) ) ) (br_if $case2|0 (i32.eq - (get_local $8) + (get_local $9) (i32.const 2) ) ) (br_if $case3|0 (i32.eq - (get_local $8) + (get_local $9) (i32.const 3) ) ) @@ -4204,13 +4165,7 @@ (f32.const 0.46364760398864746) (f32.sub (f32.sub - (f32.mul - (get_local $0) - (f32.add - (get_local $6) - (get_local $7) - ) - ) + (get_local $8) (f32.const 5.01215824399992e-09) ) (get_local $0) @@ -4226,13 +4181,7 @@ (f32.const 0.7853981256484985) (f32.sub (f32.sub - (f32.mul - (get_local $0) - (f32.add - (get_local $6) - (get_local $7) - ) - ) + (get_local $8) (f32.const 3.774894707930798e-08) ) (get_local $0) @@ -4248,13 +4197,7 @@ (f32.const 0.9827936887741089) (f32.sub (f32.sub - (f32.mul - (get_local $0) - (f32.add - (get_local $6) - (get_local $7) - ) - ) + (get_local $8) (f32.const 3.447321716976148e-08) ) (get_local $0) @@ -4270,13 +4213,7 @@ (f32.const 1.570796251296997) (f32.sub (f32.sub - (f32.mul - (get_local $0) - (f32.add - (get_local $6) - (get_local $7) - ) - ) + (get_local $8) (f32.const 7.549789415861596e-08) ) (get_local $0) @@ -4288,12 +4225,9 @@ ) (unreachable) ) - (if (result f32) - (get_local $2) - (f32.neg - (get_local $3) - ) + (f32.copysign (get_local $3) + (get_local $2) ) ) (func $std/math/test_atanf (; 73 ;) (type $fffii) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 i32) (result i32) @@ -4403,15 +4337,9 @@ ) ) ) - (if (result f64) - (i64.ne - (get_local $3) - (i64.const 0) - ) - (f64.neg - (get_local $4) - ) + (f64.copysign (get_local $4) + (get_local $0) ) ) (func $std/math/test_atanh (; 75 ;) (type $FFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 i32) (result i32) @@ -4448,26 +4376,19 @@ ) (func $~lib/math/NativeMathf.atanh (; 76 ;) (type $ff) (param $0 f32) (result f32) (local $1 i32) - (local $2 i32) - (local $3 f32) + (local $2 f32) (set_local $1 (i32.reinterpret/f32 (get_local $0) ) ) - (set_local $2 - (i32.shr_u - (get_local $1) - (i32.const 31) - ) - ) (set_local $1 (i32.and (get_local $1) (i32.const 2147483647) ) ) - (set_local $3 + (set_local $2 (f32.reinterpret/i32 (get_local $1) ) @@ -4494,26 +4415,23 @@ ) ) ) - (set_local $3 + (set_local $2 (f32.mul (f32.const 0.5) (call $~lib/math/NativeMathf.log1p - (f32.add + (f32.mul (f32.mul (f32.const 2) - (get_local $3) + (get_local $2) ) - (f32.div - (f32.mul - (f32.mul - (f32.const 2) - (get_local $3) + (f32.add + (f32.const 1) + (f32.div + (get_local $2) + (f32.sub + (f32.const 1) + (get_local $2) ) - (get_local $3) - ) - (f32.sub - (f32.const 1) - (get_local $3) ) ) ) @@ -4521,17 +4439,17 @@ ) ) ) - (set_local $3 + (set_local $2 (f32.mul (f32.const 0.5) (call $~lib/math/NativeMathf.log1p (f32.mul (f32.const 2) (f32.div - (get_local $3) + (get_local $2) (f32.sub (f32.const 1) - (get_local $3) + (get_local $2) ) ) ) @@ -4539,12 +4457,9 @@ ) ) ) - (if (result f32) + (f32.copysign (get_local $2) - (f32.neg - (get_local $3) - ) - (get_local $3) + (get_local $0) ) ) (func $std/math/test_atanhf (; 77 ;) (type $fffii) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 i32) (result i32) @@ -4742,12 +4657,12 @@ ) (f64.div (f64.neg - (f64.const 3.141592653589793) + (get_global $~lib/math/NativeMath.PI) ) (f64.const 2) ) (f64.div - (f64.const 3.141592653589793) + (get_global $~lib/math/NativeMath.PI) (f64.const 2) ) ) @@ -4799,7 +4714,7 @@ ) (return (f64.div - (f64.const 3.141592653589793) + (get_global $~lib/math/NativeMath.PI) (f64.const 4) ) ) @@ -4807,7 +4722,7 @@ (return (f64.div (f64.neg - (f64.const 3.141592653589793) + (get_global $~lib/math/NativeMath.PI) ) (f64.const 4) ) @@ -4817,7 +4732,7 @@ (f64.div (f64.mul (f64.const 3) - (f64.const 3.141592653589793) + (get_global $~lib/math/NativeMath.PI) ) (f64.const 4) ) @@ -4827,7 +4742,7 @@ (f64.div (f64.mul (f64.const -3) - (f64.const 3.141592653589793) + (get_global $~lib/math/NativeMath.PI) ) (f64.const 4) ) @@ -4876,12 +4791,12 @@ ) ) (return - (f64.const 3.141592653589793) + (get_global $~lib/math/NativeMath.PI) ) ) (return (f64.neg - (f64.const 3.141592653589793) + (get_global $~lib/math/NativeMath.PI) ) ) ) @@ -4915,12 +4830,12 @@ ) (f64.div (f64.neg - (f64.const 3.141592653589793) + (get_global $~lib/math/NativeMath.PI) ) (f64.const 2) ) (f64.div - (f64.const 3.141592653589793) + (get_global $~lib/math/NativeMath.PI) (f64.const 2) ) ) @@ -5006,7 +4921,7 @@ ) (return (f64.sub - (f64.const 3.141592653589793) + (get_global $~lib/math/NativeMath.PI) (f64.sub (get_local $9) (f64.const 1.2246467991473532e-16) @@ -5020,7 +4935,7 @@ (get_local $9) (f64.const 1.2246467991473532e-16) ) - (f64.const 3.141592653589793) + (get_global $~lib/math/NativeMath.PI) ) ) ) @@ -6045,15 +5960,10 @@ (get_local $0) (f64.const 709.782712893384) ) - (block - (set_local $0 - (f64.mul - (get_local $0) - (f64.const 8988465674311579538646525e283) - ) - ) - (return + (return + (f64.mul (get_local $0) + (f64.const 8988465674311579538646525e283) ) ) ) @@ -6068,84 +5978,53 @@ (i32.const 1071001154) ) (block - (if - (i32.lt_u - (get_local $2) - (i32.const 1072734898) - ) - (if - (i32.eqz - (get_local $4) - ) - (block - (set_local $7 - (f64.sub - (get_local $0) - (f64.const 0.6931471803691238) - ) - ) - (set_local $8 - (f64.const 1.9082149292705877e-10) - ) - (set_local $3 + (set_local $3 + (select + (i32.sub + (i32.const 1) + (i32.shl + (get_local $4) (i32.const 1) ) ) - (block - (set_local $7 - (f64.add + (i32.trunc_s/f64 + (f64.add + (f64.mul + (f64.const 1.4426950408889634) + (get_local $0) + ) + (f64.copysign + (f64.const 0.5) (get_local $0) - (f64.const 0.6931471803691238) ) ) - (set_local $8 - (f64.neg - (f64.const 1.9082149292705877e-10) - ) - ) - (set_local $3 - (i32.const -1) - ) + ) + (i32.lt_u + (get_local $2) + (i32.const 1072734898) ) ) - (block - (set_local $3 - (i32.trunc_s/f64 - (f64.add - (f64.mul - (f64.const 1.4426950408889634) - (get_local $0) - ) - (if (result f64) - (get_local $4) - (f64.const -0.5) - (f64.const 0.5) - ) - ) - ) - ) - (set_local $6 - (f64.convert_s/i32 - (get_local $3) - ) - ) - (set_local $7 - (f64.sub - (get_local $0) - (f64.mul - (get_local $6) - (f64.const 0.6931471803691238) - ) - ) - ) - (set_local $8 - (f64.mul - (get_local $6) - (f64.const 1.9082149292705877e-10) - ) + ) + (set_local $6 + (f64.convert_s/i32 + (get_local $3) + ) + ) + (set_local $7 + (f64.sub + (get_local $0) + (f64.mul + (get_local $6) + (f64.const 0.6931471803691238) ) ) ) + (set_local $8 + (f64.mul + (get_local $6) + (f64.const 1.9082149292705877e-10) + ) + ) (set_local $0 (f64.sub (get_local $7) @@ -6416,47 +6295,42 @@ (i64.const 52) ) ) + (set_local $14 + (f64.reinterpret/i64 + (get_local $1) + ) + ) (if (i32.lt_s (get_local $3) (i32.const 20) ) (set_local $14 - (f64.mul - (f64.add - (f64.sub - (get_local $0) - (get_local $12) - ) - (f64.sub - (f64.const 1) - (f64.reinterpret/i64 - (get_local $1) - ) - ) + (f64.sub + (f64.sub + (f64.const 1) + (get_local $14) ) - (get_local $13) + (get_local $12) ) ) (set_local $14 - (f64.mul + (f64.sub + (f64.const 1) (f64.add - (f64.sub - (get_local $0) - (f64.add - (get_local $12) - (f64.reinterpret/i64 - (get_local $1) - ) - ) - ) - (f64.const 1) + (get_local $12) + (get_local $14) ) - (get_local $13) ) ) ) - (get_local $14) + (f64.mul + (f64.add + (get_local $0) + (get_local $14) + ) + (get_local $13) + ) ) (func $~lib/math/NativeMath.exp (; 89 ;) (type $FF) (param $0 f64) (result f64) (local $1 i32) @@ -6564,11 +6438,11 @@ ) (set_local $5 (i32.sub - (i32.sub - (i32.const 1) + (i32.const 1) + (i32.shl (get_local $2) + (i32.const 1) ) - (get_local $2) ) ) ) @@ -6688,44 +6562,11 @@ (get_local $5) ) ) - (func $~lib/math/expo2 (; 90 ;) (type $FF) (param $0 f64) (result f64) - (local $1 f64) - (set_local $1 - (f64.reinterpret/i64 - (i64.shl - (i64.extend_u/i32 - (i32.shl - (i32.add - (i32.const 1023) - (i32.div_u - (i32.const 2043) - (i32.const 2) - ) - ) - (i32.const 20) - ) - ) - (i64.const 32) - ) - ) - ) - (f64.mul - (f64.mul - (call $~lib/math/NativeMath.exp - (f64.sub - (get_local $0) - (f64.const 1416.0996898839683) - ) - ) - (get_local $1) - ) - (get_local $1) - ) - ) - (func $~lib/math/NativeMath.cosh (; 91 ;) (type $FF) (param $0 f64) (result f64) + (func $~lib/math/NativeMath.cosh (; 90 ;) (type $FF) (param $0 f64) (result f64) (local $1 i64) (local $2 i32) (local $3 f64) + (local $4 f64) (set_local $1 (i64.reinterpret/f64 (get_local $0) @@ -6784,10 +6625,10 @@ (get_local $3) (get_local $3) ) - (f64.mul + (f64.add (f64.const 2) - (f64.add - (f64.const 1) + (f64.mul + (f64.const 2) (get_local $3) ) ) @@ -6822,13 +6663,43 @@ ) ) (set_local $3 - (call $~lib/math/expo2 - (get_local $0) + (block $~lib/math/expo2|inlined.0 (result f64) + (set_local $4 + (f64.reinterpret/i64 + (i64.shl + (i64.extend_u/i32 + (i32.shl + (i32.add + (i32.const 1023) + (i32.div_u + (i32.const 2043) + (i32.const 2) + ) + ) + (i32.const 20) + ) + ) + (i64.const 32) + ) + ) + ) + (f64.mul + (f64.mul + (call $~lib/math/NativeMath.exp + (f64.sub + (get_local $0) + (f64.const 1416.0996898839683) + ) + ) + (get_local $4) + ) + (get_local $4) + ) ) ) (get_local $3) ) - (func $std/math/test_cosh (; 92 ;) (type $FFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 i32) (result i32) + (func $std/math/test_cosh (; 91 ;) (type $FFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 i32) (result i32) (local $4 i32) (if (result i32) (tee_local $4 @@ -6860,7 +6731,7 @@ (get_local $4) ) ) - (func $~lib/math/NativeMathf.expm1 (; 93 ;) (type $ff) (param $0 f32) (result f32) + (func $~lib/math/NativeMathf.expm1 (; 92 ;) (type $ff) (param $0 f32) (result f32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -6942,84 +6813,53 @@ (i32.const 1051816472) ) (block - (if - (i32.lt_u - (get_local $2) - (i32.const 1065686418) - ) - (if - (i32.eqz - (get_local $3) - ) - (block - (set_local $7 - (f32.sub - (get_local $0) - (f32.const 0.6931381225585938) - ) - ) - (set_local $8 - (f32.const 9.05800061445916e-06) - ) - (set_local $6 + (set_local $6 + (select + (i32.sub + (i32.const 1) + (i32.shl + (get_local $3) (i32.const 1) ) ) - (block - (set_local $7 - (f32.add + (i32.trunc_s/f32 + (f32.add + (f32.mul + (f32.const 1.4426950216293335) + (get_local $0) + ) + (f32.copysign + (f32.const 0.5) (get_local $0) - (f32.const 0.6931381225585938) ) ) - (set_local $8 - (f32.neg - (f32.const 9.05800061445916e-06) - ) - ) - (set_local $6 - (i32.const -1) - ) + ) + (i32.lt_u + (get_local $2) + (i32.const 1065686418) ) ) - (block - (set_local $6 - (i32.trunc_s/f32 - (f32.add - (f32.mul - (f32.const 1.4426950216293335) - (get_local $0) - ) - (if (result f32) - (get_local $3) - (f32.const -0.5) - (f32.const 0.5) - ) - ) - ) - ) - (set_local $5 - (f32.convert_s/i32 - (get_local $6) - ) - ) - (set_local $7 - (f32.sub - (get_local $0) - (f32.mul - (get_local $5) - (f32.const 0.6931381225585938) - ) - ) - ) - (set_local $8 - (f32.mul - (get_local $5) - (f32.const 9.05800061445916e-06) - ) + ) + (set_local $5 + (f32.convert_s/i32 + (get_local $6) + ) + ) + (set_local $7 + (f32.sub + (get_local $0) + (f32.mul + (get_local $5) + (f32.const 0.6931381225585938) ) ) ) + (set_local $8 + (f32.mul + (get_local $5) + (f32.const 9.05800061445916e-06) + ) + ) (set_local $0 (f32.sub (get_local $7) @@ -7271,58 +7111,52 @@ (i32.const 23) ) ) + (set_local $14 + (f32.reinterpret/i32 + (get_local $1) + ) + ) (if (i32.lt_s (get_local $6) - (i32.const 23) + (i32.const 20) ) (set_local $14 - (f32.mul - (f32.add - (f32.sub - (get_local $0) - (get_local $12) - ) - (f32.sub - (f32.const 1) - (f32.reinterpret/i32 - (get_local $1) - ) - ) + (f32.sub + (f32.sub + (f32.const 1) + (get_local $14) ) - (get_local $13) + (get_local $12) ) ) (set_local $14 - (f32.mul + (f32.sub + (f32.const 1) (f32.add - (f32.sub - (get_local $0) - (f32.add - (get_local $12) - (f32.reinterpret/i32 - (get_local $1) - ) - ) - ) - (f32.const 1) + (get_local $12) + (get_local $14) ) - (get_local $13) ) ) ) - (get_local $14) + (f32.mul + (f32.add + (get_local $0) + (get_local $14) + ) + (get_local $13) + ) ) - (func $~lib/math/NativeMathf.exp (; 94 ;) (type $ff) (param $0 f32) (result f32) + (func $~lib/math/NativeMathf.exp (; 93 ;) (type $ff) (param $0 f32) (result f32) (local $1 i32) (local $2 i32) - (local $3 i32) + (local $3 f32) (local $4 f32) - (local $5 f32) - (local $6 i32) + (local $5 i32) + (local $6 f32) (local $7 f32) (local $8 f32) - (local $9 f32) (set_local $1 (i32.reinterpret/f32 (get_local $0) @@ -7345,19 +7179,14 @@ (get_local $1) (i32.const 1118743632) ) - (block + (if + (i32.ge_u + (get_local $1) + (i32.const 1118925336) + ) (if - (if (result i32) - (tee_local $3 - (i32.ge_u - (get_local $1) - (i32.const 1118925336) - ) - ) - (i32.eqz - (get_local $2) - ) - (get_local $3) + (i32.eqz + (get_local $2) ) (block (set_local $0 @@ -7370,18 +7199,14 @@ (get_local $0) ) ) - ) - (if - (if (result i32) - (get_local $2) + (if (i32.ge_u (get_local $1) (i32.const 1120924085) ) - (get_local $2) - ) - (return - (f32.const 0) + (return + (f32.const 0) + ) ) ) ) @@ -7397,7 +7222,7 @@ (get_local $1) (i32.const 1065686418) ) - (set_local $6 + (set_local $5 (i32.trunc_s/f32 (f32.add (f32.mul @@ -7411,39 +7236,39 @@ ) ) ) - (set_local $6 + (set_local $5 (i32.sub - (i32.sub - (i32.const 1) + (i32.const 1) + (i32.shl (get_local $2) + (i32.const 1) ) - (get_local $2) ) ) ) - (set_local $4 + (set_local $3 (f32.sub (get_local $0) (f32.mul (f32.convert_s/i32 - (get_local $6) + (get_local $5) ) (f32.const 0.693145751953125) ) ) ) - (set_local $5 + (set_local $4 (f32.mul (f32.convert_s/i32 - (get_local $6) + (get_local $5) ) (f32.const 1.428606765330187e-06) ) ) (set_local $0 (f32.sub + (get_local $3) (get_local $4) - (get_local $5) ) ) ) @@ -7453,13 +7278,13 @@ (i32.const 956301312) ) (block - (set_local $6 + (set_local $5 (i32.const 0) ) - (set_local $4 + (set_local $3 (get_local $0) ) - (set_local $5 + (set_local $4 (f32.const 0) ) ) @@ -7471,28 +7296,28 @@ ) ) ) - (set_local $7 + (set_local $6 (f32.mul (get_local $0) (get_local $0) ) ) - (set_local $8 + (set_local $7 (f32.sub (get_local $0) (f32.mul - (get_local $7) + (get_local $6) (f32.add (f32.const 0.16666625440120697) (f32.mul - (get_local $7) + (get_local $6) (f32.const -2.7667332906275988e-03) ) ) ) ) ) - (set_local $9 + (set_local $8 (f32.add (f32.const 1) (f32.add @@ -7500,63 +7325,34 @@ (f32.div (f32.mul (get_local $0) - (get_local $8) + (get_local $7) ) (f32.sub (f32.const 2) - (get_local $8) + (get_local $7) ) ) - (get_local $5) + (get_local $4) ) - (get_local $4) + (get_local $3) ) ) ) (if (i32.eq - (get_local $6) + (get_local $5) (i32.const 0) ) (return - (get_local $9) + (get_local $8) ) ) (call $~lib/math/NativeMathf.scalbn - (get_local $9) - (get_local $6) + (get_local $8) + (get_local $5) ) ) - (func $~lib/math/expo2f (; 95 ;) (type $ff) (param $0 f32) (result f32) - (local $1 f32) - (set_local $1 - (f32.reinterpret/i32 - (i32.shl - (i32.add - (i32.const 127) - (i32.div_u - (i32.const 235) - (i32.const 2) - ) - ) - (i32.const 23) - ) - ) - ) - (f32.mul - (f32.mul - (call $~lib/math/NativeMathf.exp - (f32.sub - (get_local $0) - (f32.const 162.88958740234375) - ) - ) - (get_local $1) - ) - (get_local $1) - ) - ) - (func $~lib/math/NativeMathf.cosh (; 96 ;) (type $ff) (param $0 f32) (result f32) + (func $~lib/math/NativeMathf.cosh (; 94 ;) (type $ff) (param $0 f32) (result f32) (local $1 i32) (local $2 f32) (set_local $1 @@ -7609,10 +7405,10 @@ (get_local $2) (get_local $2) ) - (f32.mul + (f32.add (f32.const 2) - (f32.add - (f32.const 1) + (f32.mul + (f32.const 2) (get_local $2) ) ) @@ -7633,24 +7429,49 @@ ) ) (return - (f32.mul - (f32.const 0.5) - (f32.add + (f32.add + (f32.mul + (f32.const 0.5) + (get_local $2) + ) + (f32.div + (f32.const 0.5) (get_local $2) - (f32.div - (f32.const 1) - (get_local $2) - ) ) ) ) ) ) - (call $~lib/math/expo2f - (get_local $0) + (block $~lib/math/expo2f|inlined.0 (result f32) + (set_local $2 + (f32.reinterpret/i32 + (i32.shl + (i32.add + (i32.const 127) + (i32.div_u + (i32.const 235) + (i32.const 2) + ) + ) + (i32.const 23) + ) + ) + ) + (f32.mul + (f32.mul + (call $~lib/math/NativeMathf.exp + (f32.sub + (get_local $0) + (f32.const 162.88958740234375) + ) + ) + (get_local $2) + ) + (get_local $2) + ) ) ) - (func $std/math/test_coshf (; 97 ;) (type $fffii) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 i32) (result i32) + (func $std/math/test_coshf (; 95 ;) (type $fffii) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 i32) (result i32) (call $std/math/check (call $~lib/math/NativeMathf.cosh (get_local $0) @@ -7660,7 +7481,7 @@ (get_local $3) ) ) - (func $std/math/test_exp (; 98 ;) (type $FFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 i32) (result i32) + (func $std/math/test_exp (; 96 ;) (type $FFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 i32) (result i32) (local $4 i32) (if (result i32) (tee_local $4 @@ -7692,7 +7513,7 @@ (get_local $4) ) ) - (func $std/math/test_expf (; 99 ;) (type $fffii) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 i32) (result i32) + (func $std/math/test_expf (; 97 ;) (type $fffii) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 i32) (result i32) (call $std/math/check (call $~lib/math/NativeMathf.exp (get_local $0) @@ -7702,7 +7523,7 @@ (get_local $3) ) ) - (func $std/math/test_expm1 (; 100 ;) (type $FFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 i32) (result i32) + (func $std/math/test_expm1 (; 98 ;) (type $FFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 i32) (result i32) (local $4 i32) (if (result i32) (tee_local $4 @@ -7734,7 +7555,7 @@ (get_local $4) ) ) - (func $std/math/test_expm1f (; 101 ;) (type $fffii) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 i32) (result i32) + (func $std/math/test_expm1f (; 99 ;) (type $fffii) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 i32) (result i32) (call $std/math/check (call $~lib/math/NativeMathf.expm1 (get_local $0) @@ -7744,7 +7565,7 @@ (get_local $3) ) ) - (func $std/math/test_floor (; 102 ;) (type $FFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 i32) (result i32) + (func $std/math/test_floor (; 100 ;) (type $FFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 i32) (result i32) (local $4 i32) (if (result i32) (tee_local $4 @@ -7778,7 +7599,7 @@ (get_local $4) ) ) - (func $std/math/test_floorf (; 103 ;) (type $fffii) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 i32) (result i32) + (func $std/math/test_floorf (; 101 ;) (type $fffii) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 i32) (result i32) (call $std/math/check (block $~lib/math/NativeMathf.floor|inlined.0 (result f32) (f32.floor @@ -7790,7 +7611,7 @@ (get_local $3) ) ) - (func $~lib/math/NativeMath.hypot (; 104 ;) (type $FFF) (param $0 f64) (param $1 f64) (result f64) + (func $~lib/math/NativeMath.hypot (; 102 ;) (type $FFF) (param $0 f64) (param $1 f64) (result f64) (local $2 i64) (local $3 i64) (local $4 i64) @@ -7996,24 +7817,21 @@ ) (set_local $13 (f64.add - (f64.add - (f64.sub - (f64.mul - (get_local $10) - (get_local $10) - ) - (get_local $12) - ) + (f64.sub (f64.mul + (get_local $10) + (get_local $10) + ) + (get_local $12) + ) + (f64.mul + (f64.add (f64.mul (f64.const 2) (get_local $10) ) (get_local $11) ) - ) - (f64.mul - (get_local $11) (get_local $11) ) ) @@ -8047,24 +7865,21 @@ ) (set_local $15 (f64.add - (f64.add - (f64.sub - (f64.mul - (get_local $10) - (get_local $10) - ) - (get_local $14) - ) + (f64.sub (f64.mul + (get_local $10) + (get_local $10) + ) + (get_local $14) + ) + (f64.mul + (f64.add (f64.mul (f64.const 2) (get_local $10) ) (get_local $11) ) - ) - (f64.mul - (get_local $11) (get_local $11) ) ) @@ -8085,7 +7900,7 @@ ) ) ) - (func $std/math/test_hypot (; 105 ;) (type $FFFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 f64) (param $4 i32) (result i32) + (func $std/math/test_hypot (; 103 ;) (type $FFFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 f64) (param $4 i32) (result i32) (local $5 i32) (if (result i32) (tee_local $5 @@ -8119,7 +7934,7 @@ (get_local $5) ) ) - (func $~lib/math/NativeMathf.hypot (; 106 ;) (type $fff) (param $0 f32) (param $1 f32) (result f32) + (func $~lib/math/NativeMathf.hypot (; 104 ;) (type $fff) (param $0 f32) (param $1 f32) (result f32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -8311,7 +8126,7 @@ ) ) ) - (func $std/math/test_hypotf (; 107 ;) (type $ffffii) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 f32) (param $4 i32) (result i32) + (func $std/math/test_hypotf (; 105 ;) (type $ffffii) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 f32) (param $4 i32) (result i32) (call $std/math/check (call $~lib/math/NativeMathf.hypot (get_local $0) @@ -8322,7 +8137,7 @@ (get_local $4) ) ) - (func $std/math/test_log (; 108 ;) (type $FFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 i32) (result i32) + (func $std/math/test_log (; 106 ;) (type $FFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 i32) (result i32) (local $4 i32) (if (result i32) (tee_local $4 @@ -8354,7 +8169,7 @@ (get_local $4) ) ) - (func $std/math/test_logf (; 109 ;) (type $fffii) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 i32) (result i32) + (func $std/math/test_logf (; 107 ;) (type $fffii) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 i32) (result i32) (call $std/math/check (call $~lib/math/NativeMathf.log (get_local $0) @@ -8364,7 +8179,7 @@ (get_local $3) ) ) - (func $~lib/math/NativeMath.log10 (; 110 ;) (type $FF) (param $0 f64) (result f64) + (func $~lib/math/NativeMath.log10 (; 108 ;) (type $FF) (param $0 f64) (result f64) (local $1 i64) (local $2 i32) (local $3 i32) @@ -8733,15 +8548,12 @@ ) ) ) - (set_local $15 - (get_local $9) - ) (f64.add (get_local $18) - (get_local $15) + (get_local $9) ) ) - (func $std/math/test_log10 (; 111 ;) (type $FFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 i32) (result i32) + (func $std/math/test_log10 (; 109 ;) (type $FFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 i32) (result i32) (local $4 i32) (if (result i32) (tee_local $4 @@ -8773,7 +8585,7 @@ (get_local $4) ) ) - (func $~lib/math/NativeMathf.log10 (; 112 ;) (type $ff) (param $0 f32) (result f32) + (func $~lib/math/NativeMathf.log10 (; 110 ;) (type $ff) (param $0 f32) (result f32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -9059,7 +8871,7 @@ ) ) ) - (func $std/math/test_log10f (; 113 ;) (type $fffii) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 i32) (result i32) + (func $std/math/test_log10f (; 111 ;) (type $fffii) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 i32) (result i32) (call $std/math/check (call $~lib/math/NativeMathf.log10 (get_local $0) @@ -9069,7 +8881,7 @@ (get_local $3) ) ) - (func $std/math/test_log1p (; 114 ;) (type $FFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 i32) (result i32) + (func $std/math/test_log1p (; 112 ;) (type $FFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 i32) (result i32) (local $4 i32) (if (result i32) (tee_local $4 @@ -9101,7 +8913,7 @@ (get_local $4) ) ) - (func $std/math/test_log1pf (; 115 ;) (type $fffii) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 i32) (result i32) + (func $std/math/test_log1pf (; 113 ;) (type $fffii) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 i32) (result i32) (call $std/math/check (call $~lib/math/NativeMathf.log1p (get_local $0) @@ -9111,7 +8923,7 @@ (get_local $3) ) ) - (func $~lib/math/NativeMath.log2 (; 116 ;) (type $FF) (param $0 f64) (result f64) + (func $~lib/math/NativeMath.log2 (; 114 ;) (type $FF) (param $0 f64) (result f64) (local $1 i64) (local $2 i32) (local $3 i32) @@ -9475,7 +9287,7 @@ (get_local $15) ) ) - (func $std/math/test_log2 (; 117 ;) (type $FFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 i32) (result i32) + (func $std/math/test_log2 (; 115 ;) (type $FFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 i32) (result i32) (local $4 i32) (if (result i32) (tee_local $4 @@ -9507,7 +9319,7 @@ (get_local $4) ) ) - (func $~lib/math/NativeMathf.log2 (; 118 ;) (type $ff) (param $0 f32) (result f32) + (func $~lib/math/NativeMathf.log2 (; 116 ;) (type $ff) (param $0 f32) (result f32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -9785,7 +9597,7 @@ (get_local $15) ) ) - (func $std/math/test_log2f (; 119 ;) (type $fffii) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 i32) (result i32) + (func $std/math/test_log2f (; 117 ;) (type $fffii) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 i32) (result i32) (call $std/math/check (call $~lib/math/NativeMathf.log2 (get_local $0) @@ -9795,7 +9607,7 @@ (get_local $3) ) ) - (func $std/math/test_max (; 120 ;) (type $FFFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 f64) (param $4 i32) (result i32) + (func $std/math/test_max (; 118 ;) (type $FFFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 f64) (param $4 i32) (result i32) (local $5 i32) (if (result i32) (tee_local $5 @@ -9831,7 +9643,7 @@ (get_local $5) ) ) - (func $std/math/test_maxf (; 121 ;) (type $ffffii) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 f32) (param $4 i32) (result i32) + (func $std/math/test_maxf (; 119 ;) (type $ffffii) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 f32) (param $4 i32) (result i32) (call $std/math/check (block $~lib/math/NativeMathf.max|inlined.0 (result f32) (f32.max @@ -9844,7 +9656,7 @@ (get_local $4) ) ) - (func $std/math/test_min (; 122 ;) (type $FFFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 f64) (param $4 i32) (result i32) + (func $std/math/test_min (; 120 ;) (type $FFFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 f64) (param $4 i32) (result i32) (local $5 i32) (if (result i32) (tee_local $5 @@ -9880,7 +9692,7 @@ (get_local $5) ) ) - (func $std/math/test_minf (; 123 ;) (type $ffffii) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 f32) (param $4 i32) (result i32) + (func $std/math/test_minf (; 121 ;) (type $ffffii) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 f32) (param $4 i32) (result i32) (call $std/math/check (block $~lib/math/NativeMathf.min|inlined.0 (result f32) (f32.min @@ -9893,14 +9705,17 @@ (get_local $4) ) ) - (func $~lib/math/NativeMath.mod (; 124 ;) (type $FFF) (param $0 f64) (param $1 f64) (result f64) + (func $~lib/math/NativeMath.mod (; 122 ;) (type $FFF) (param $0 f64) (param $1 f64) (result f64) (local $2 i64) (local $3 i64) - (local $4 i32) - (local $5 i32) - (local $6 i32) - (local $7 i32) - (local $8 i64) + (local $4 i64) + (local $5 i64) + (local $6 i64) + (local $7 i64) + (local $8 i32) + (local $9 i64) + (local $10 i64) + (local $11 i64) (set_local $2 (i64.reinterpret/f64 (get_local $0) @@ -9912,65 +9727,59 @@ ) ) (set_local $4 - (i32.wrap/i64 - (i64.and - (i64.shr_u - (get_local $2) - (i64.const 52) - ) - (i64.const 2047) + (i64.and + (i64.shr_u + (get_local $2) + (i64.const 52) ) + (i64.const 2047) ) ) (set_local $5 - (i32.wrap/i64 - (i64.and - (i64.shr_u - (get_local $3) - (i64.const 52) - ) - (i64.const 2047) + (i64.and + (i64.shr_u + (get_local $3) + (i64.const 52) ) + (i64.const 2047) ) ) (set_local $6 - (i32.wrap/i64 - (i64.shr_u - (get_local $2) - (i64.const 63) - ) + (i64.shr_u + (get_local $2) + (i64.const 63) + ) + ) + (set_local $7 + (i64.shl + (get_local $3) + (i64.const 1) ) ) (if (i32.and (if (result i32) - (i32.and - (tee_local $7 - (if (result i32) - (tee_local $7 - (i64.eq - (i64.shl - (get_local $3) - (i64.const 1) - ) - (i64.const 0) - ) - ) - (get_local $7) - (block $~lib/builtins/isNaN|inlined.1 (result i32) - (f64.ne - (get_local $1) - (get_local $1) - ) + (tee_local $8 + (if (result i32) + (tee_local $8 + (i64.eq + (get_local $7) + (i64.const 0) ) ) + (get_local $8) + (i64.eq + (get_local $4) + (i64.const 2047) + ) ) - (i32.const 1) ) - (get_local $7) - (i32.eq - (get_local $4) - (i32.const 2047) + (get_local $8) + (block $~lib/builtins/isNaN|inlined.1 (result i32) + (f64.ne + (get_local $1) + (get_local $1) + ) ) ) (i32.const 1) @@ -9988,28 +9797,22 @@ ) ) ) + (set_local $9 + (i64.shl + (get_local $2) + (i64.const 1) + ) + ) (if (i64.le_u - (i64.shl - (get_local $2) - (i64.const 1) - ) - (i64.shl - (get_local $3) - (i64.const 1) - ) + (get_local $9) + (get_local $7) ) (block (if (i64.eq - (i64.shl - (get_local $2) - (i64.const 1) - ) - (i64.shl - (get_local $3) - (i64.const 1) - ) + (get_local $9) + (get_local $7) ) (return (f64.mul @@ -10024,54 +9827,30 @@ ) ) (if - (i32.eqz + (i64.eqz (get_local $4) ) (block - (block $break|0 - (set_local $8 - (i64.shl - (get_local $2) - (i64.const 12) - ) - ) - (loop $repeat|0 - (br_if $break|0 - (i32.eqz - (i64.eqz - (i64.shr_u - (get_local $8) - (i64.const 63) - ) - ) - ) - ) - (set_local $4 - (i32.sub - (get_local $4) - (i32.const 1) - ) - ) - (set_local $8 + (set_local $4 + (i64.sub + (get_local $4) + (i64.clz (i64.shl - (get_local $8) - (i64.const 1) + (get_local $2) + (i64.const 12) ) ) - (br $repeat|0) ) ) (set_local $2 (i64.shl (get_local $2) - (i64.extend_s/i32 - (i32.add - (i32.sub - (i32.const 0) - (get_local $4) - ) - (i32.const 1) + (i64.add + (i64.sub + (i64.const 0) + (get_local $4) ) + (i64.const 1) ) ) ) @@ -10098,54 +9877,30 @@ ) ) (if - (i32.eqz + (i64.eqz (get_local $5) ) (block - (block $break|1 - (set_local $8 - (i64.shl - (get_local $3) - (i64.const 12) - ) - ) - (loop $repeat|1 - (br_if $break|1 - (i32.eqz - (i64.eqz - (i64.shr_u - (get_local $8) - (i64.const 63) - ) - ) - ) - ) - (set_local $5 - (i32.sub - (get_local $5) - (i32.const 1) - ) - ) - (set_local $8 + (set_local $5 + (i64.sub + (get_local $5) + (i64.clz (i64.shl - (get_local $8) - (i64.const 1) + (get_local $3) + (i64.const 12) ) ) - (br $repeat|1) ) ) (set_local $3 (i64.shl (get_local $3) - (i64.extend_s/i32 - (i32.add - (i32.sub - (i32.const 0) - (get_local $5) - ) - (i32.const 1) + (i64.add + (i64.sub + (i64.const 0) + (get_local $5) ) + (i64.const 1) ) ) ) @@ -10171,18 +9926,18 @@ ) ) ) - (block $break|2 - (loop $repeat|2 - (br_if $break|2 + (block $break|0 + (loop $repeat|0 + (br_if $break|0 (i32.eqz - (i32.gt_s + (i64.gt_s (get_local $4) (get_local $5) ) ) ) (block - (set_local $8 + (set_local $10 (i64.sub (get_local $2) (get_local $3) @@ -10191,14 +9946,14 @@ (if (i64.eqz (i64.shr_u - (get_local $8) + (get_local $10) (i64.const 63) ) ) (block (if (i64.eqz - (get_local $8) + (get_local $10) ) (return (f64.mul @@ -10208,7 +9963,7 @@ ) ) (set_local $2 - (get_local $8) + (get_local $10) ) ) ) @@ -10220,15 +9975,15 @@ ) ) (set_local $4 - (i32.sub + (i64.sub (get_local $4) - (i32.const 1) + (i64.const 1) ) ) - (br $repeat|2) + (br $repeat|0) ) ) - (set_local $8 + (set_local $10 (i64.sub (get_local $2) (get_local $3) @@ -10237,14 +9992,14 @@ (if (i64.eqz (i64.shr_u - (get_local $8) + (get_local $10) (i64.const 63) ) ) (block (if (i64.eqz - (get_local $8) + (get_local $10) ) (return (f64.mul @@ -10254,41 +10009,34 @@ ) ) (set_local $2 - (get_local $8) + (get_local $10) ) ) ) - (block $break|3 - (loop $repeat|3 - (br_if $break|3 - (i32.eqz - (i64.eqz - (i64.shr_u - (get_local $2) - (i64.const 52) - ) - ) - ) + (set_local $11 + (i64.clz + (i64.shl + (get_local $2) + (i64.const 11) ) - (set_local $4 - (i32.sub - (get_local $4) - (i32.const 1) - ) - ) - (set_local $2 - (i64.shl - (get_local $2) - (i64.const 1) - ) - ) - (br $repeat|3) + ) + ) + (set_local $4 + (i64.sub + (get_local $4) + (get_local $11) + ) + ) + (set_local $2 + (i64.shl + (get_local $2) + (get_local $11) ) ) (if - (i32.gt_s + (i64.gt_s (get_local $4) - (i32.const 0) + (i64.const 0) ) (block (set_local $2 @@ -10304,9 +10052,7 @@ (i64.or (get_local $2) (i64.shl - (i64.extend_s/i32 - (get_local $4) - ) + (get_local $4) (i64.const 52) ) ) @@ -10315,14 +10061,12 @@ (set_local $2 (i64.shr_u (get_local $2) - (i64.extend_s/i32 - (i32.add - (i32.sub - (i32.const 0) - (get_local $4) - ) - (i32.const 1) + (i64.add + (i64.sub + (i64.const 0) + (get_local $4) ) + (i64.const 1) ) ) ) @@ -10331,9 +10075,7 @@ (i64.or (get_local $2) (i64.shl - (i64.extend_s/i32 - (get_local $6) - ) + (get_local $6) (i64.const 63) ) ) @@ -10342,7 +10084,7 @@ (get_local $2) ) ) - (func $std/math/test_mod (; 125 ;) (type $FFFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 f64) (param $4 i32) (result i32) + (func $std/math/test_mod (; 123 ;) (type $FFFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 f64) (param $4 i32) (result i32) (local $5 i32) (if (result i32) (tee_local $5 @@ -10376,7 +10118,7 @@ (get_local $5) ) ) - (func $~lib/math/NativeMathf.mod (; 126 ;) (type $fff) (param $0 f32) (param $1 f32) (result f32) + (func $~lib/math/NativeMathf.mod (; 124 ;) (type $fff) (param $0 f32) (param $1 f32) (result f32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -10384,6 +10126,9 @@ (local $6 i32) (local $7 i32) (local $8 i32) + (local $9 i32) + (local $10 i32) + (local $11 i32) (set_local $2 (i32.reinterpret/f32 (get_local $0) @@ -10418,36 +10163,36 @@ (i32.const -2147483648) ) ) + (set_local $7 + (i32.shl + (get_local $3) + (i32.const 1) + ) + ) (if (i32.and (if (result i32) - (i32.and - (tee_local $7 - (if (result i32) - (tee_local $7 - (i32.eq - (i32.shl - (get_local $3) - (i32.const 1) - ) - (i32.const 0) - ) - ) - (get_local $7) - (block $~lib/builtins/isNaN|inlined.1 (result i32) - (f32.ne - (get_local $1) - (get_local $1) - ) + (tee_local $8 + (if (result i32) + (tee_local $8 + (i32.eq + (get_local $7) + (i32.const 0) ) ) + (get_local $8) + (i32.eq + (get_local $4) + (i32.const 255) + ) ) - (i32.const 1) ) - (get_local $7) - (i32.eq - (get_local $4) - (i32.const 255) + (get_local $8) + (block $~lib/builtins/isNaN|inlined.1 (result i32) + (f32.ne + (get_local $1) + (get_local $1) + ) ) ) (i32.const 1) @@ -10465,28 +10210,22 @@ ) ) ) + (set_local $9 + (i32.shl + (get_local $2) + (i32.const 1) + ) + ) (if (i32.le_u - (i32.shl - (get_local $2) - (i32.const 1) - ) - (i32.shl - (get_local $3) - (i32.const 1) - ) + (get_local $9) + (get_local $7) ) (block (if (i32.eq - (i32.shl - (get_local $2) - (i32.const 1) - ) - (i32.shl - (get_local $3) - (i32.const 1) - ) + (get_local $9) + (get_local $7) ) (return (f32.mul @@ -10505,37 +10244,15 @@ (get_local $4) ) (block - (block $break|0 - (set_local $8 - (i32.shl - (get_local $2) - (i32.const 9) - ) - ) - (loop $repeat|0 - (br_if $break|0 - (i32.eqz - (i32.eqz - (i32.shr_u - (get_local $8) - (i32.const 31) - ) - ) - ) - ) - (set_local $4 - (i32.sub - (get_local $4) - (i32.const 1) - ) - ) - (set_local $8 + (set_local $4 + (i32.sub + (get_local $4) + (i32.clz (i32.shl - (get_local $8) - (i32.const 1) + (get_local $2) + (i32.const 9) ) ) - (br $repeat|0) ) ) (set_local $2 @@ -10577,37 +10294,15 @@ (get_local $5) ) (block - (block $break|1 - (set_local $8 - (i32.shl - (get_local $3) - (i32.const 9) - ) - ) - (loop $repeat|1 - (br_if $break|1 - (i32.eqz - (i32.eqz - (i32.shr_u - (get_local $8) - (i32.const 31) - ) - ) - ) - ) - (set_local $5 - (i32.sub - (get_local $5) - (i32.const 1) - ) - ) - (set_local $8 + (set_local $5 + (i32.sub + (get_local $5) + (i32.clz (i32.shl - (get_local $8) - (i32.const 1) + (get_local $3) + (i32.const 9) ) ) - (br $repeat|1) ) ) (set_local $3 @@ -10644,9 +10339,9 @@ ) ) ) - (block $break|2 - (loop $repeat|2 - (br_if $break|2 + (block $break|0 + (loop $repeat|0 + (br_if $break|0 (i32.eqz (i32.gt_s (get_local $4) @@ -10655,7 +10350,7 @@ ) ) (block - (set_local $8 + (set_local $10 (i32.sub (get_local $2) (get_local $3) @@ -10664,14 +10359,14 @@ (if (i32.eqz (i32.shr_u - (get_local $8) + (get_local $10) (i32.const 31) ) ) (block (if (i32.eqz - (get_local $8) + (get_local $10) ) (return (f32.mul @@ -10681,7 +10376,7 @@ ) ) (set_local $2 - (get_local $8) + (get_local $10) ) ) ) @@ -10698,10 +10393,10 @@ (i32.const 1) ) ) - (br $repeat|2) + (br $repeat|0) ) ) - (set_local $8 + (set_local $10 (i32.sub (get_local $2) (get_local $3) @@ -10710,14 +10405,14 @@ (if (i32.eqz (i32.shr_u - (get_local $8) + (get_local $10) (i32.const 31) ) ) (block (if (i32.eqz - (get_local $8) + (get_local $10) ) (return (f32.mul @@ -10727,35 +10422,28 @@ ) ) (set_local $2 - (get_local $8) + (get_local $10) ) ) ) - (block $break|3 - (loop $repeat|3 - (br_if $break|3 - (i32.eqz - (i32.eqz - (i32.shr_u - (get_local $2) - (i32.const 23) - ) - ) - ) + (set_local $11 + (i32.clz + (i32.shl + (get_local $2) + (i32.const 8) ) - (set_local $4 - (i32.sub - (get_local $4) - (i32.const 1) - ) - ) - (set_local $2 - (i32.shl - (get_local $2) - (i32.const 1) - ) - ) - (br $repeat|3) + ) + ) + (set_local $4 + (i32.sub + (get_local $4) + (get_local $11) + ) + ) + (set_local $2 + (i32.shl + (get_local $2) + (get_local $11) ) ) (if @@ -10806,7 +10494,7 @@ (get_local $2) ) ) - (func $std/math/test_modf (; 127 ;) (type $ffffii) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 f32) (param $4 i32) (result i32) + (func $std/math/test_modf (; 125 ;) (type $ffffii) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 f32) (param $4 i32) (result i32) (call $std/math/check (call $~lib/math/NativeMathf.mod (get_local $0) @@ -10817,7 +10505,7 @@ (get_local $4) ) ) - (func $~lib/math/NativeMath.pow (; 128 ;) (type $FFF) (param $0 f64) (param $1 f64) (result f64) + (func $~lib/math/NativeMath.pow (; 126 ;) (type $FFF) (param $0 f64) (param $1 f64) (result f64) (local $2 i64) (local $3 i32) (local $4 i32) @@ -10828,8 +10516,8 @@ (local $9 i32) (local $10 i32) (local $11 i32) - (local $12 f64) - (local $13 f64) + (local $12 i32) + (local $13 i32) (local $14 f64) (local $15 f64) (local $16 f64) @@ -10840,10 +10528,10 @@ (local $21 f64) (local $22 f64) (local $23 f64) - (local $24 i32) - (local $25 i32) - (local $26 f64) - (local $27 f64) + (local $24 f64) + (local $25 f64) + (local $26 i32) + (local $27 i32) (local $28 f64) (local $29 f64) (local $30 f64) @@ -10854,7 +10542,9 @@ (local $35 f64) (local $36 f64) (local $37 f64) - (local $38 i32) + (local $38 f64) + (local $39 f64) + (local $40 i32) (set_local $2 (i64.reinterpret/f64 (get_local $0) @@ -11003,78 +10693,49 @@ (i32.const 1023) ) ) - (if - (i32.gt_s + (set_local $9 + (i32.sub + (select + (i32.const 52) + (i32.const 20) + (i32.gt_s + (get_local $11) + (i32.const 20) + ) + ) (get_local $11) - (i32.const 20) ) - (block - (set_local $9 - (i32.shr_u - (get_local $6) - (i32.sub - (i32.const 52) - (get_local $11) - ) - ) - ) - (if - (i32.eq - (i32.shl - (get_local $9) - (i32.sub - (i32.const 52) - (get_local $11) - ) - ) - (get_local $6) - ) - (set_local $10 - (i32.sub - (i32.const 2) - (i32.and - (get_local $9) - (i32.const 1) - ) - ) - ) + ) + (set_local $12 + (select + (get_local $6) + (get_local $8) + (i32.gt_s + (get_local $11) + (i32.const 20) ) ) - (if - (i32.eq - (get_local $6) - (i32.const 0) + ) + (set_local $13 + (i32.shr_s + (get_local $12) + (get_local $9) + ) + ) + (if + (i32.eq + (i32.shl + (get_local $13) + (get_local $9) ) - (block - (set_local $9 - (i32.shr_s - (get_local $8) - (i32.sub - (i32.const 20) - (get_local $11) - ) - ) - ) - (if - (i32.eq - (i32.shl - (get_local $9) - (i32.sub - (i32.const 20) - (get_local $11) - ) - ) - (get_local $8) - ) - (set_local $10 - (i32.sub - (i32.const 2) - (i32.and - (get_local $9) - (i32.const 1) - ) - ) - ) + (get_local $12) + ) + (set_local $10 + (i32.sub + (i32.const 2) + (i32.and + (get_local $13) + (i32.const 1) ) ) ) @@ -11195,7 +10856,7 @@ ) ) ) - (set_local $12 + (set_local $14 (f64.abs (get_local $0) ) @@ -11207,40 +10868,40 @@ ) (if (if (result i32) - (tee_local $9 + (tee_local $13 (if (result i32) - (tee_local $9 + (tee_local $13 (i32.eq (get_local $7) (i32.const 2146435072) ) ) - (get_local $9) + (get_local $13) (i32.eq (get_local $7) (i32.const 0) ) ) ) - (get_local $9) + (get_local $13) (i32.eq (get_local $7) (i32.const 1072693248) ) ) (block - (set_local $13 - (get_local $12) + (set_local $15 + (get_local $14) ) (if (i32.lt_s (get_local $5) (i32.const 0) ) - (set_local $13 + (set_local $15 (f64.div (f64.const 1) - (get_local $13) + (get_local $15) ) ) ) @@ -11260,15 +10921,15 @@ ) (i32.const 0) ) - (set_local $13 + (set_local $15 (f64.div (f64.sub - (get_local $13) - (get_local $13) + (get_local $15) + (get_local $15) ) (f64.sub - (get_local $13) - (get_local $13) + (get_local $15) + (get_local $15) ) ) ) @@ -11277,21 +10938,21 @@ (get_local $10) (i32.const 1) ) - (set_local $13 + (set_local $15 (f64.neg - (get_local $13) + (get_local $15) ) ) ) ) ) (return - (get_local $13) + (get_local $15) ) ) ) ) - (set_local $14 + (set_local $16 (f64.const 1) ) (if @@ -11323,7 +10984,7 @@ (get_local $10) (i32.const 1) ) - (set_local $14 + (set_local $16 (f64.const -1) ) ) @@ -11400,14 +11061,14 @@ ) (f64.mul (f64.mul - (get_local $14) + (get_local $16) (f64.const 1.e+300) ) (f64.const 1.e+300) ) (f64.mul (f64.mul - (get_local $14) + (get_local $16) (f64.const 1e-300) ) (f64.const 1e-300) @@ -11428,14 +11089,14 @@ ) (f64.mul (f64.mul - (get_local $14) + (get_local $16) (f64.const 1.e+300) ) (f64.const 1.e+300) ) (f64.mul (f64.mul - (get_local $14) + (get_local $16) (f64.const 1e-300) ) (f64.const 1e-300) @@ -11443,26 +11104,26 @@ ) ) ) - (set_local $20 + (set_local $22 (f64.sub - (get_local $12) + (get_local $14) (f64.const 1) ) ) - (set_local $23 + (set_local $25 (f64.mul (f64.mul - (get_local $20) - (get_local $20) + (get_local $22) + (get_local $22) ) (f64.sub (f64.const 0.5) (f64.mul - (get_local $20) + (get_local $22) (f64.sub (f64.const 0.3333333333333333) (f64.mul - (get_local $20) + (get_local $22) (f64.const 0.25) ) ) @@ -11470,52 +11131,52 @@ ) ) ) - (set_local $21 + (set_local $23 (f64.mul (f64.const 1.4426950216293335) - (get_local $20) + (get_local $22) ) ) - (set_local $22 + (set_local $24 (f64.sub (f64.mul - (get_local $20) + (get_local $22) (f64.const 1.9259629911266175e-08) ) (f64.mul - (get_local $23) + (get_local $25) (f64.const 1.4426950408889634) ) ) ) - (set_local $15 + (set_local $17 (f64.add - (get_local $21) - (get_local $22) + (get_local $23) + (get_local $24) ) ) - (set_local $15 + (set_local $17 (f64.reinterpret/i64 (i64.and (i64.reinterpret/f64 - (get_local $15) + (get_local $17) ) (i64.const -4294967296) ) ) ) - (set_local $16 + (set_local $18 (f64.sub - (get_local $22) + (get_local $24) (f64.sub - (get_local $15) - (get_local $21) + (get_local $17) + (get_local $23) ) ) ) ) (block - (set_local $25 + (set_local $27 (i32.const 0) ) (if @@ -11524,15 +11185,15 @@ (i32.const 1048576) ) (block - (set_local $12 + (set_local $14 (f64.mul - (get_local $12) + (get_local $14) (f64.const 9007199254740992) ) ) - (set_local $25 + (set_local $27 (i32.sub - (get_local $25) + (get_local $27) (i32.const 53) ) ) @@ -11540,7 +11201,7 @@ (i32.wrap/i64 (i64.shr_u (i64.reinterpret/f64 - (get_local $12) + (get_local $14) ) (i64.const 32) ) @@ -11548,9 +11209,9 @@ ) ) ) - (set_local $25 + (set_local $27 (i32.add - (get_local $25) + (get_local $27) (i32.sub (i32.shr_s (get_local $7) @@ -11560,7 +11221,7 @@ ) ) ) - (set_local $24 + (set_local $26 (i32.and (get_local $7) (i32.const 1048575) @@ -11568,13 +11229,13 @@ ) (set_local $7 (i32.or - (get_local $24) + (get_local $26) (i32.const 1072693248) ) ) (if (i32.le_s - (get_local $24) + (get_local $26) (i32.const 235662) ) (set_local $11 @@ -11582,7 +11243,7 @@ ) (if (i32.lt_s - (get_local $24) + (get_local $26) (i32.const 767610) ) (set_local $11 @@ -11592,9 +11253,9 @@ (set_local $11 (i32.const 0) ) - (set_local $25 + (set_local $27 (i32.add - (get_local $25) + (get_local $27) (i32.const 1) ) ) @@ -11607,12 +11268,12 @@ ) ) ) - (set_local $12 + (set_local $14 (f64.reinterpret/i64 (i64.or (i64.and (i64.reinterpret/f64 - (get_local $12) + (get_local $14) ) (i64.const 4294967295) ) @@ -11625,48 +11286,48 @@ ) ) ) - (set_local $32 + (set_local $34 (select (f64.const 1.5) (f64.const 1) (get_local $11) ) ) - (set_local $21 + (set_local $23 (f64.sub - (get_local $12) - (get_local $32) + (get_local $14) + (get_local $34) ) ) - (set_local $22 + (set_local $24 (f64.div (f64.const 1) (f64.add - (get_local $12) - (get_local $32) + (get_local $14) + (get_local $34) ) ) ) - (set_local $26 + (set_local $28 (f64.mul - (get_local $21) - (get_local $22) + (get_local $23) + (get_local $24) ) ) - (set_local $28 - (get_local $26) + (set_local $30 + (get_local $28) ) - (set_local $28 + (set_local $30 (f64.reinterpret/i64 (i64.and (i64.reinterpret/f64 - (get_local $28) + (get_local $30) ) (i64.const -4294967296) ) ) ) - (set_local $30 + (set_local $32 (f64.reinterpret/i64 (i64.shl (i64.extend_s/i32 @@ -11691,65 +11352,65 @@ ) ) ) - (set_local $31 + (set_local $33 (f64.sub - (get_local $12) + (get_local $14) (f64.sub - (get_local $30) (get_local $32) + (get_local $34) + ) + ) + ) + (set_local $31 + (f64.mul + (get_local $24) + (f64.sub + (f64.sub + (get_local $23) + (f64.mul + (get_local $30) + (get_local $32) + ) + ) + (f64.mul + (get_local $30) + (get_local $33) + ) ) ) ) (set_local $29 (f64.mul - (get_local $22) - (f64.sub - (f64.sub - (get_local $21) - (f64.mul - (get_local $28) - (get_local $30) - ) - ) - (f64.mul - (get_local $28) - (get_local $31) - ) - ) + (get_local $28) + (get_local $28) ) ) - (set_local $27 - (f64.mul - (get_local $26) - (get_local $26) - ) - ) - (set_local $19 + (set_local $21 (f64.mul (f64.mul - (get_local $27) - (get_local $27) + (get_local $29) + (get_local $29) ) (f64.add (f64.const 0.5999999999999946) (f64.mul - (get_local $27) + (get_local $29) (f64.add (f64.const 0.4285714285785502) (f64.mul - (get_local $27) + (get_local $29) (f64.add (f64.const 0.33333332981837743) (f64.mul - (get_local $27) + (get_local $29) (f64.add (f64.const 0.272728123808534) (f64.mul - (get_local $27) + (get_local $29) (f64.add (f64.const 0.23066074577556175) (f64.mul - (get_local $27) + (get_local $29) (f64.const 0.20697501780033842) ) ) @@ -11763,76 +11424,147 @@ ) ) ) - (set_local $19 + (set_local $21 (f64.add - (get_local $19) + (get_local $21) (f64.mul - (get_local $29) + (get_local $31) (f64.add + (get_local $30) (get_local $28) - (get_local $26) ) ) ) ) - (set_local $27 + (set_local $29 (f64.mul - (get_local $28) - (get_local $28) + (get_local $30) + (get_local $30) ) ) - (set_local $30 + (set_local $32 (f64.add (f64.add (f64.const 3) - (get_local $27) + (get_local $29) ) - (get_local $19) + (get_local $21) ) ) - (set_local $30 + (set_local $32 (f64.reinterpret/i64 (i64.and (i64.reinterpret/f64 - (get_local $30) + (get_local $32) ) (i64.const -4294967296) ) ) ) - (set_local $31 + (set_local $33 (f64.sub - (get_local $19) + (get_local $21) (f64.sub (f64.sub - (get_local $30) + (get_local $32) (f64.const 3) ) - (get_local $27) + (get_local $29) ) ) ) - (set_local $21 + (set_local $23 (f64.mul - (get_local $28) (get_local $30) + (get_local $32) + ) + ) + (set_local $24 + (f64.add + (f64.mul + (get_local $31) + (get_local $32) + ) + (f64.mul + (get_local $33) + (get_local $28) + ) + ) + ) + (set_local $19 + (f64.add + (get_local $23) + (get_local $24) + ) + ) + (set_local $19 + (f64.reinterpret/i64 + (i64.and + (i64.reinterpret/f64 + (get_local $19) + ) + (i64.const -4294967296) + ) + ) + ) + (set_local $20 + (f64.sub + (get_local $24) + (f64.sub + (get_local $19) + (get_local $23) + ) + ) + ) + (set_local $35 + (f64.mul + (f64.const 0.9617967009544373) + (get_local $19) + ) + ) + (set_local $36 + (select + (f64.const 1.350039202129749e-08) + (f64.const 0) + (get_local $11) + ) + ) + (set_local $37 + (f64.add + (f64.add + (f64.mul + (f64.const -7.028461650952758e-09) + (get_local $19) + ) + (f64.mul + (get_local $20) + (f64.const 0.9617966939259756) + ) + ) + (get_local $36) ) ) (set_local $22 - (f64.add - (f64.mul - (get_local $29) - (get_local $30) - ) - (f64.mul - (get_local $31) - (get_local $26) - ) + (f64.convert_s/i32 + (get_local $27) + ) + ) + (set_local $38 + (select + (f64.const 0.5849624872207642) + (f64.const 0) + (get_local $11) ) ) (set_local $17 (f64.add - (get_local $21) + (f64.add + (f64.add + (get_local $35) + (get_local $37) + ) + (get_local $38) + ) (get_local $22) ) ) @@ -11848,138 +11580,67 @@ ) (set_local $18 (f64.sub - (get_local $22) - (f64.sub - (get_local $17) - (get_local $21) - ) - ) - ) - (set_local $33 - (f64.mul - (f64.const 0.9617967009544373) - (get_local $17) - ) - ) - (set_local $34 - (select - (f64.const 1.350039202129749e-08) - (f64.const 0) - (get_local $11) - ) - ) - (set_local $35 - (f64.add - (f64.add - (f64.mul - (f64.const -7.028461650952758e-09) - (get_local $17) - ) - (f64.mul - (get_local $18) - (f64.const 0.9617966939259756) - ) - ) - (get_local $34) - ) - ) - (set_local $20 - (f64.convert_s/i32 - (get_local $25) - ) - ) - (set_local $36 - (select - (f64.const 0.5849624872207642) - (f64.const 0) - (get_local $11) - ) - ) - (set_local $15 - (f64.add - (f64.add - (f64.add - (get_local $33) - (get_local $35) - ) - (get_local $36) - ) - (get_local $20) - ) - ) - (set_local $15 - (f64.reinterpret/i64 - (i64.and - (i64.reinterpret/f64 - (get_local $15) - ) - (i64.const -4294967296) - ) - ) - ) - (set_local $16 - (f64.sub - (get_local $35) + (get_local $37) (f64.sub (f64.sub (f64.sub - (get_local $15) - (get_local $20) + (get_local $17) + (get_local $22) ) - (get_local $36) + (get_local $38) ) - (get_local $33) + (get_local $35) ) ) ) ) ) - (set_local $37 + (set_local $39 (get_local $1) ) - (set_local $37 + (set_local $39 (f64.reinterpret/i64 (i64.and (i64.reinterpret/f64 - (get_local $37) + (get_local $39) ) (i64.const -4294967296) ) ) ) - (set_local $18 + (set_local $20 (f64.add (f64.mul (f64.sub (get_local $1) - (get_local $37) + (get_local $39) ) - (get_local $15) + (get_local $17) ) (f64.mul (get_local $1) - (get_local $16) + (get_local $18) ) ) ) - (set_local $17 + (set_local $19 (f64.mul - (get_local $37) - (get_local $15) + (get_local $39) + (get_local $17) ) ) - (set_local $13 + (set_local $15 (f64.add - (get_local $18) - (get_local $17) + (get_local $20) + (get_local $19) ) ) (set_local $2 (i64.reinterpret/f64 - (get_local $13) + (get_local $15) ) ) - (set_local $24 + (set_local $26 (i32.wrap/i64 (i64.shr_u (get_local $2) @@ -11987,14 +11648,14 @@ ) ) ) - (set_local $38 + (set_local $40 (i32.wrap/i64 (get_local $2) ) ) (if (i32.ge_s - (get_local $24) + (get_local $26) (i32.const 1083179008) ) (block @@ -12002,17 +11663,17 @@ (i32.ne (i32.or (i32.sub - (get_local $24) + (get_local $26) (i32.const 1083179008) ) - (get_local $38) + (get_local $40) ) (i32.const 0) ) (return (f64.mul (f64.mul - (get_local $14) + (get_local $16) (f64.const 1.e+300) ) (f64.const 1.e+300) @@ -12022,18 +11683,18 @@ (if (f64.gt (f64.add - (get_local $18) + (get_local $20) (f64.const 8.008566259537294e-17) ) (f64.sub - (get_local $13) - (get_local $17) + (get_local $15) + (get_local $19) ) ) (return (f64.mul (f64.mul - (get_local $14) + (get_local $16) (f64.const 1.e+300) ) (f64.const 1.e+300) @@ -12044,7 +11705,7 @@ (if (i32.ge_s (i32.and - (get_local $24) + (get_local $26) (i32.const 2147483647) ) (i32.const 1083231232) @@ -12054,17 +11715,17 @@ (i32.ne (i32.or (i32.sub - (get_local $24) + (get_local $26) (i32.const -1064252416) ) - (get_local $38) + (get_local $40) ) (i32.const 0) ) (return (f64.mul (f64.mul - (get_local $14) + (get_local $16) (f64.const 1e-300) ) (f64.const 1e-300) @@ -12073,16 +11734,16 @@ ) (if (f64.le - (get_local $18) + (get_local $20) (f64.sub - (get_local $13) - (get_local $17) + (get_local $15) + (get_local $19) ) ) (return (f64.mul (f64.mul - (get_local $14) + (get_local $16) (f64.const 1e-300) ) (f64.const 1e-300) @@ -12092,33 +11753,33 @@ ) ) ) - (set_local $38 + (set_local $40 (i32.and - (get_local $24) + (get_local $26) (i32.const 2147483647) ) ) (set_local $11 (i32.sub (i32.shr_s - (get_local $38) + (get_local $40) (i32.const 20) ) (i32.const 1023) ) ) - (set_local $25 + (set_local $27 (i32.const 0) ) (if (i32.gt_s - (get_local $38) + (get_local $40) (i32.const 1071644672) ) (block - (set_local $25 + (set_local $27 (i32.add - (get_local $24) + (get_local $26) (i32.shr_s (i32.const 1048576) (i32.add @@ -12132,7 +11793,7 @@ (i32.sub (i32.shr_s (i32.and - (get_local $25) + (get_local $27) (i32.const 2147483647) ) (i32.const 20) @@ -12140,15 +11801,15 @@ (i32.const 1023) ) ) - (set_local $20 + (set_local $22 (f64.const 0) ) - (set_local $20 + (set_local $22 (f64.reinterpret/i64 (i64.shl (i64.extend_s/i32 (i32.and - (get_local $25) + (get_local $27) (i32.xor (i32.shr_s (i32.const 1048575) @@ -12162,11 +11823,11 @@ ) ) ) - (set_local $25 + (set_local $27 (i32.shr_s (i32.or (i32.and - (get_local $25) + (get_local $27) (i32.const 1048575) ) (i32.const 1048576) @@ -12179,106 +11840,106 @@ ) (if (i32.lt_s - (get_local $24) + (get_local $26) (i32.const 0) ) - (set_local $25 + (set_local $27 (i32.sub (i32.const 0) - (get_local $25) + (get_local $27) ) ) ) - (set_local $17 + (set_local $19 (f64.sub - (get_local $17) - (get_local $20) + (get_local $19) + (get_local $22) ) ) ) ) - (set_local $20 + (set_local $22 (f64.add - (get_local $18) - (get_local $17) + (get_local $20) + (get_local $19) ) ) - (set_local $20 + (set_local $22 (f64.reinterpret/i64 (i64.and (i64.reinterpret/f64 - (get_local $20) + (get_local $22) ) (i64.const -4294967296) ) ) ) - (set_local $21 + (set_local $23 (f64.mul - (get_local $20) + (get_local $22) (f64.const 0.6931471824645996) ) ) - (set_local $22 + (set_local $24 (f64.add (f64.mul (f64.sub - (get_local $18) + (get_local $20) (f64.sub - (get_local $20) - (get_local $17) + (get_local $22) + (get_local $19) ) ) (f64.const 0.6931471805599453) ) (f64.mul - (get_local $20) + (get_local $22) (f64.const -1.904654299957768e-09) ) ) ) - (set_local $13 + (set_local $15 (f64.add - (get_local $21) - (get_local $22) + (get_local $23) + (get_local $24) ) ) - (set_local $23 + (set_local $25 (f64.sub - (get_local $22) + (get_local $24) (f64.sub - (get_local $13) - (get_local $21) + (get_local $15) + (get_local $23) ) ) ) - (set_local $20 + (set_local $22 (f64.mul - (get_local $13) - (get_local $13) + (get_local $15) + (get_local $15) ) ) - (set_local $15 + (set_local $17 (f64.sub - (get_local $13) + (get_local $15) (f64.mul - (get_local $20) + (get_local $22) (f64.add (f64.const 0.16666666666666602) (f64.mul - (get_local $20) + (get_local $22) (f64.add (f64.const -2.7777777777015593e-03) (f64.mul - (get_local $20) + (get_local $22) (f64.add (f64.const 6.613756321437934e-05) (f64.mul - (get_local $20) + (get_local $22) (f64.add (f64.const -1.6533902205465252e-06) (f64.mul - (get_local $20) + (get_local $22) (f64.const 4.1381367970572385e-08) ) ) @@ -12291,51 +11952,51 @@ ) ) ) - (set_local $19 + (set_local $21 (f64.sub (f64.div (f64.mul - (get_local $13) (get_local $15) + (get_local $17) ) (f64.sub - (get_local $15) + (get_local $17) (f64.const 2) ) ) (f64.add - (get_local $23) + (get_local $25) (f64.mul - (get_local $13) - (get_local $23) + (get_local $15) + (get_local $25) ) ) ) ) - (set_local $13 + (set_local $15 (f64.sub (f64.const 1) (f64.sub - (get_local $19) - (get_local $13) + (get_local $21) + (get_local $15) ) ) ) - (set_local $24 + (set_local $26 (i32.wrap/i64 (i64.shr_u (i64.reinterpret/f64 - (get_local $13) + (get_local $15) ) (i64.const 32) ) ) ) - (set_local $24 + (set_local $26 (i32.add - (get_local $24) + (get_local $26) (i32.shl - (get_local $25) + (get_local $27) (i32.const 20) ) ) @@ -12343,29 +12004,29 @@ (if (i32.le_s (i32.shr_s - (get_local $24) + (get_local $26) (i32.const 20) ) (i32.const 0) ) - (set_local $13 + (set_local $15 (call $~lib/math/NativeMath.scalbn - (get_local $13) - (get_local $25) + (get_local $15) + (get_local $27) ) ) - (set_local $13 + (set_local $15 (f64.reinterpret/i64 (i64.or (i64.and (i64.reinterpret/f64 - (get_local $13) + (get_local $15) ) (i64.const 4294967295) ) (i64.shl (i64.extend_s/i32 - (get_local $24) + (get_local $26) ) (i64.const 32) ) @@ -12374,11 +12035,11 @@ ) ) (f64.mul - (get_local $14) - (get_local $13) + (get_local $16) + (get_local $15) ) ) - (func $std/math/test_pow (; 129 ;) (type $FFFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 f64) (param $4 i32) (result i32) + (func $std/math/test_pow (; 127 ;) (type $FFFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 f64) (param $4 i32) (result i32) (local $5 i32) (if (result i32) (tee_local $5 @@ -12412,7 +12073,7 @@ (get_local $5) ) ) - (func $~lib/math/NativeMathf.pow (; 130 ;) (type $fff) (param $0 f32) (param $1 f32) (result f32) + (func $~lib/math/NativeMathf.pow (; 128 ;) (type $fff) (param $0 f32) (param $1 f32) (result f32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -13730,7 +13391,7 @@ (get_local $11) ) ) - (func $std/math/test_powf (; 131 ;) (type $ffffii) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 f32) (param $4 i32) (result i32) + (func $std/math/test_powf (; 129 ;) (type $ffffii) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 f32) (param $4 i32) (result i32) (call $std/math/check (call $~lib/math/NativeMathf.pow (get_local $0) @@ -13741,7 +13402,7 @@ (get_local $4) ) ) - (func $~lib/math/murmurHash3 (; 132 ;) (type $II) (param $0 i64) (result i64) + (func $~lib/math/murmurHash3 (; 130 ;) (type $II) (param $0 i64) (result i64) (set_local $0 (i64.xor (get_local $0) @@ -13783,7 +13444,58 @@ ) (get_local $0) ) - (func $~lib/math/NativeMath.seedRandom (; 133 ;) (type $Iv) (param $0 i64) + (func $~lib/math/splitMix32 (; 131 ;) (type $ii) (param $0 i32) (result i32) + (set_local $0 + (i32.add + (get_local $0) + (i32.const 1831565813) + ) + ) + (set_local $0 + (i32.mul + (i32.xor + (get_local $0) + (i32.shr_u + (get_local $0) + (i32.const 15) + ) + ) + (i32.or + (get_local $0) + (i32.const 1) + ) + ) + ) + (set_local $0 + (i32.xor + (get_local $0) + (i32.add + (get_local $0) + (i32.mul + (i32.xor + (get_local $0) + (i32.shr_u + (get_local $0) + (i32.const 7) + ) + ) + (i32.or + (get_local $0) + (i32.const 61) + ) + ) + ) + ) + ) + (i32.xor + (get_local $0) + (i32.shr_u + (get_local $0) + (i32.const 14) + ) + ) + ) + (func $~lib/math/NativeMath.seedRandom (; 132 ;) (type $Iv) (param $0 i64) (if (i64.eqz (get_local $0) @@ -13801,18 +13513,33 @@ (set_global $~lib/math/random_seeded (i32.const 1) ) - (set_global $~lib/math/random_state0 + (set_global $~lib/math/random_state0_64 (call $~lib/math/murmurHash3 (get_local $0) ) ) - (set_global $~lib/math/random_state1 + (set_global $~lib/math/random_state1_64 (call $~lib/math/murmurHash3 - (get_global $~lib/math/random_state0) + (i64.xor + (get_global $~lib/math/random_state0_64) + (i64.const -1) + ) + ) + ) + (set_global $~lib/math/random_state0_32 + (call $~lib/math/splitMix32 + (i32.wrap/i64 + (get_local $0) + ) + ) + ) + (set_global $~lib/math/random_state1_32 + (call $~lib/math/splitMix32 + (get_global $~lib/math/random_state0_32) ) ) ) - (func $~lib/math/NativeMath.random (; 134 ;) (type $F) (result f64) + (func $~lib/math/NativeMath.random (; 133 ;) (type $F) (result f64) (local $0 i64) (local $1 i64) (local $2 i64) @@ -13824,19 +13551,19 @@ (call $~lib/env/abort (i32.const 0) (i32.const 40) - (i32.const 962) + (i32.const 964) (i32.const 24) ) (unreachable) ) ) (set_local $0 - (get_global $~lib/math/random_state0) + (get_global $~lib/math/random_state0_64) ) (set_local $1 - (get_global $~lib/math/random_state1) + (get_global $~lib/math/random_state1_64) ) - (set_global $~lib/math/random_state0 + (set_global $~lib/math/random_state0_64 (get_local $1) ) (set_local $0 @@ -13872,7 +13599,7 @@ ) ) ) - (set_global $~lib/math/random_state1 + (set_global $~lib/math/random_state1_64 (get_local $0) ) (set_local $2 @@ -13894,374 +13621,143 @@ (f64.const 1) ) ) - (func $~lib/math/NativeMathf.random (; 135 ;) (type $f) (result f32) - (local $0 f32) - (block $break|0 - (loop $continue|0 - (set_local $0 - (f32.demote/f64 - (call $~lib/math/NativeMath.random) - ) - ) - (br_if $continue|0 - (f32.eq - (get_local $0) - (f32.const 1) - ) - ) - ) - ) - (get_local $0) - ) - (func $~lib/math/NativeMath.round (; 136 ;) (type $FF) (param $0 f64) (result f64) - (local $1 i64) - (local $2 i32) - (local $3 f64) - (set_local $1 - (i64.reinterpret/f64 - (get_local $0) - ) - ) - (set_local $2 - (i32.wrap/i64 - (i64.and - (i64.shr_u - (get_local $1) - (i64.const 52) - ) - (i64.const 2047) - ) - ) - ) - (if - (i32.ge_s - (get_local $2) - (i32.add - (i32.const 1023) - (i32.const 52) - ) - ) - (return - (get_local $0) - ) - ) - (if - (i32.lt_s - (get_local $2) - (i32.sub - (i32.const 1023) - (i32.const 1) - ) - ) - (return - (f64.mul - (f64.const 0) - (get_local $0) - ) - ) - ) - (if - (i64.ne - (i64.shr_u - (get_local $1) - (i64.const 63) - ) - (i64.const 0) - ) - (block - (set_local $3 - (f64.add - (f64.sub - (f64.sub - (f64.const 4503599627370496) - (get_local $0) - ) - (f64.const 4503599627370496) - ) - (get_local $0) - ) - ) - (if - (f64.ge - (get_local $3) - (f64.const 0.5) - ) - (set_local $3 - (f64.add - (f64.sub - (get_local $0) - (get_local $3) - ) - (f64.const 1) - ) - ) - (if - (f64.lt - (get_local $3) - (f64.const -0.5) - ) - (set_local $3 - (f64.sub - (f64.sub - (get_local $0) - (get_local $3) - ) - (f64.const 1) - ) - ) - (set_local $3 - (f64.sub - (get_local $0) - (get_local $3) - ) - ) - ) - ) - ) - (block - (set_local $3 - (f64.sub - (f64.sub - (f64.add - (get_local $0) - (f64.const 4503599627370496) - ) - (f64.const 4503599627370496) - ) - (get_local $0) - ) - ) - (if - (f64.gt - (get_local $3) - (f64.const 0.5) - ) - (set_local $3 - (f64.sub - (f64.add - (get_local $3) - (get_local $0) - ) - (f64.const 1) - ) - ) - (if - (f64.le - (get_local $3) - (f64.const -0.5) - ) - (set_local $3 - (f64.add - (f64.add - (get_local $3) - (get_local $0) - ) - (f64.const 1) - ) - ) - (set_local $3 - (f64.add - (get_local $3) - (get_local $0) - ) - ) - ) - ) - ) - ) - (get_local $3) - ) - (func $std/math/test_round (; 137 ;) (type $FFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 i32) (result i32) - (call $std/math/check - (call $~lib/math/NativeMath.round - (get_local $0) - ) - (get_local $1) - (get_local $2) - (get_local $3) - ) - ) - (func $~lib/math/NativeMathf.round (; 138 ;) (type $ff) (param $0 f32) (result f32) + (func $~lib/math/NativeMathf.random (; 134 ;) (type $f) (result f32) + (local $0 i32) (local $1 i32) (local $2 i32) - (local $3 f32) - (set_local $1 - (i32.reinterpret/f32 - (get_local $0) + (if + (i32.eqz + (get_global $~lib/math/random_seeded) ) + (block + (call $~lib/env/abort + (i32.const 0) + (i32.const 40) + (i32.const 2023) + (i32.const 24) + ) + (unreachable) + ) + ) + (set_local $0 + (get_global $~lib/math/random_state0_32) + ) + (set_local $1 + (get_global $~lib/math/random_state1_32) ) (set_local $2 - (i32.and - (i32.shr_u - (get_local $1) - (i32.const 23) + (i32.mul + (i32.rotl + (i32.mul + (get_local $0) + (i32.const -1640531525) + ) + (i32.const 5) ) - (i32.const 255) + (i32.const 5) ) ) - (if - (i32.ge_s - (get_local $2) - (i32.add - (i32.const 127) - (i32.const 23) - ) - ) - (return + (set_local $1 + (i32.xor + (get_local $1) (get_local $0) ) ) - (if - (i32.lt_s - (get_local $2) - (i32.sub - (i32.const 127) - (i32.const 1) + (set_global $~lib/math/random_state0_32 + (i32.xor + (i32.xor + (i32.rotl + (get_local $0) + (i32.const 26) + ) + (get_local $1) + ) + (i32.shl + (get_local $1) + (i32.const 9) ) ) - (return - (f32.mul - (f32.const 0) + ) + (set_global $~lib/math/random_state1_32 + (i32.rotl + (get_local $1) + (i32.const 13) + ) + ) + (f32.sub + (f32.reinterpret/i32 + (i32.or + (i32.shr_u + (get_local $2) + (i32.const 9) + ) + (i32.shl + (i32.const 127) + (i32.const 23) + ) + ) + ) + (f32.const 1) + ) + ) + (func $std/math/test_round (; 135 ;) (type $FFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 i32) (result i32) + (call $std/math/check + (block $~lib/math/NativeMath.round|inlined.0 (result f64) + (f64.copysign + (f64.floor + (f64.add + (get_local $0) + (f64.const 0.5) + ) + ) (get_local $0) ) ) - ) - (if - (i32.shr_u - (get_local $1) - (i32.const 31) - ) - (block - (set_local $3 - (f32.add - (f32.sub - (f32.sub - (f32.const 8388608) - (get_local $0) - ) - (f32.const 8388608) - ) - (get_local $0) - ) - ) - (if - (f32.ge - (get_local $3) - (f32.const 0.5) - ) - (set_local $3 - (f32.add - (f32.sub - (get_local $0) - (get_local $3) - ) - (f32.const 1) - ) - ) - (if - (f32.lt - (get_local $3) - (f32.const -0.5) - ) - (set_local $3 - (f32.sub - (f32.sub - (get_local $0) - (get_local $3) - ) - (f32.const 1) - ) - ) - (set_local $3 - (f32.sub - (get_local $0) - (get_local $3) - ) - ) - ) - ) - ) - (block - (set_local $3 - (f32.sub - (f32.sub - (f32.add - (get_local $0) - (f32.const 8388608) - ) - (f32.const 8388608) - ) - (get_local $0) - ) - ) - (if - (f32.gt - (get_local $3) - (f32.const 0.5) - ) - (set_local $3 - (f32.sub - (f32.add - (get_local $3) - (get_local $0) - ) - (f32.const 1) - ) - ) - (if - (f32.le - (get_local $3) - (f32.const -0.5) - ) - (set_local $3 - (f32.add - (f32.add - (get_local $3) - (get_local $0) - ) - (f32.const 1) - ) - ) - (set_local $3 - (f32.add - (get_local $3) - (get_local $0) - ) - ) - ) - ) - ) - ) - (get_local $3) - ) - (func $std/math/test_roundf (; 139 ;) (type $fffii) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 i32) (result i32) - (call $std/math/check - (call $~lib/math/NativeMathf.round - (get_local $0) - ) (get_local $1) (get_local $2) (get_local $3) ) ) - (func $std/math/test_sign (; 140 ;) (type $FFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 i32) (result i32) + (func $std/math/test_roundf (; 136 ;) (type $fffii) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 i32) (result i32) + (call $std/math/check + (block $~lib/math/NativeMathf.round|inlined.0 (result f32) + (f32.copysign + (f32.floor + (f32.add + (get_local $0) + (f32.const 0.5) + ) + ) + (get_local $0) + ) + ) + (get_local $1) + (get_local $2) + (get_local $3) + ) + ) + (func $std/math/test_sign (; 137 ;) (type $FFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 i32) (result i32) (local $4 i32) (if (result i32) (tee_local $4 (call $std/math/check (block $~lib/math/NativeMath.sign|inlined.0 (result f64) - (if (result f64) - (f64.gt - (f64.abs + (br $~lib/math/NativeMath.sign|inlined.0 + (if (result f64) + (f64.gt + (get_local $0) + (f64.const 0) + ) + (f64.const 1) + (if (result f64) + (f64.lt + (get_local $0) + (f64.const 0) + ) + (f64.const -1) (get_local $0) ) - (f64.const 0) ) - (f64.copysign - (f64.const 1) - (get_local $0) - ) - (get_local $0) ) ) (get_local $1) @@ -14288,21 +13784,25 @@ (get_local $4) ) ) - (func $std/math/test_signf (; 141 ;) (type $fffii) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 i32) (result i32) + (func $std/math/test_signf (; 138 ;) (type $fffii) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 i32) (result i32) (call $std/math/check (block $~lib/math/NativeMathf.sign|inlined.0 (result f32) - (if (result f32) - (f32.gt - (f32.abs + (br $~lib/math/NativeMathf.sign|inlined.0 + (if (result f32) + (f32.gt + (get_local $0) + (f32.const 0) + ) + (f32.const 1) + (if (result f32) + (f32.lt + (get_local $0) + (f32.const 0) + ) + (f32.const -1) (get_local $0) ) - (f32.const 0) ) - (f32.copysign - (f32.const 1) - (get_local $0) - ) - (get_local $0) ) ) (get_local $1) @@ -14310,17 +13810,19 @@ (get_local $3) ) ) - (func $~lib/math/NativeMath.rem (; 142 ;) (type $FFF) (param $0 f64) (param $1 f64) (result f64) + (func $~lib/math/NativeMath.rem (; 139 ;) (type $FFF) (param $0 f64) (param $1 f64) (result f64) (local $2 i64) (local $3 i64) - (local $4 i32) - (local $5 i32) + (local $4 i64) + (local $5 i64) (local $6 i32) (local $7 i32) (local $8 i32) (local $9 i64) - (local $10 i64) - (local $11 i32) + (local $10 i32) + (local $11 i64) + (local $12 i64) + (local $13 f64) (set_local $2 (i64.reinterpret/f64 (get_local $0) @@ -14332,25 +13834,21 @@ ) ) (set_local $4 - (i32.wrap/i64 - (i64.and - (i64.shr_u - (get_local $2) - (i64.const 52) - ) - (i64.const 2047) + (i64.and + (i64.shr_u + (get_local $2) + (i64.const 52) ) + (i64.const 2047) ) ) (set_local $5 - (i32.wrap/i64 - (i64.and - (i64.shr_u - (get_local $3) - (i64.const 52) - ) - (i64.const 2047) + (i64.and + (i64.shr_u + (get_local $3) + (i64.const 52) ) + (i64.const 2047) ) ) (set_local $6 @@ -14383,15 +13881,15 @@ ) ) (get_local $8) - (call $~lib/builtins/isNaN - (get_local $1) + (i64.eq + (get_local $4) + (i64.const 2047) ) ) ) (get_local $8) - (i32.eq - (get_local $4) - (i32.const 2047) + (call $~lib/builtins/isNaN + (get_local $1) ) ) (return @@ -14423,58 +13921,30 @@ (get_local $2) ) (if - (i32.eqz + (i64.eqz (get_local $4) ) (block - (block $break|0 - (set_local $10 - (i64.shl - (get_local $9) - (i64.const 12) - ) - ) - (loop $repeat|0 - (br_if $break|0 - (i32.eqz - (i64.eq - (i64.shr_u - (get_local $10) - (i64.const 63) - ) - (i64.const 0) - ) + (set_local $4 + (i64.sub + (get_local $4) + (i64.clz + (i64.shl + (get_local $9) + (i64.const 12) ) ) - (nop) - (block - (set_local $4 - (i32.sub - (get_local $4) - (i32.const 1) - ) - ) - (set_local $10 - (i64.shl - (get_local $10) - (i64.const 1) - ) - ) - ) - (br $repeat|0) ) ) (set_local $9 (i64.shl (get_local $9) - (i64.extend_s/i32 - (i32.add - (i32.sub - (i32.const 0) - (get_local $4) - ) - (i32.const 1) + (i64.add + (i64.sub + (i64.const 0) + (get_local $4) ) + (i64.const 1) ) ) ) @@ -14501,58 +13971,30 @@ ) ) (if - (i32.eqz + (i64.eqz (get_local $5) ) (block - (block $break|1 - (set_local $10 - (i64.shl - (get_local $3) - (i64.const 12) - ) - ) - (loop $repeat|1 - (br_if $break|1 - (i32.eqz - (i64.eq - (i64.shr_u - (get_local $10) - (i64.const 63) - ) - (i64.const 0) - ) + (set_local $5 + (i64.sub + (get_local $5) + (i64.clz + (i64.shl + (get_local $3) + (i64.const 12) ) ) - (nop) - (block - (set_local $5 - (i32.sub - (get_local $5) - (i32.const 1) - ) - ) - (set_local $10 - (i64.shl - (get_local $10) - (i64.const 1) - ) - ) - ) - (br $repeat|1) ) ) (set_local $3 (i64.shl (get_local $3) - (i64.extend_s/i32 - (i32.add - (i32.sub - (i32.const 0) - (get_local $5) - ) - (i32.const 1) + (i64.add + (i64.sub + (i64.const 0) + (get_local $5) ) + (i64.const 1) ) ) ) @@ -14578,44 +14020,44 @@ ) ) ) - (set_local $11 + (set_local $10 (i32.const 0) ) - (block $break|2 - (loop $continue|2 + (block $break|0 + (loop $continue|0 (if - (i32.lt_s + (i64.lt_s (get_local $4) (get_local $5) ) (block (if - (i32.eq - (i32.add + (i64.eq + (i64.add (get_local $4) - (i32.const 1) + (i64.const 1) ) (get_local $5) ) - (br $break|2) + (br $break|0) ) (return (get_local $0) ) ) ) - (block $break|3 - (loop $repeat|3 - (br_if $break|3 + (block $break|1 + (loop $repeat|1 + (br_if $break|1 (i32.eqz - (i32.gt_s + (i64.gt_s (get_local $4) (get_local $5) ) ) ) (block - (set_local $10 + (set_local $11 (i64.sub (get_local $9) (get_local $3) @@ -14624,18 +14066,18 @@ (if (i64.eq (i64.shr_u - (get_local $10) + (get_local $11) (i64.const 63) ) (i64.const 0) ) (block (set_local $9 - (get_local $10) + (get_local $11) ) - (set_local $11 + (set_local $10 (i32.add - (get_local $11) + (get_local $10) (i32.const 1) ) ) @@ -14647,23 +14089,23 @@ (i64.const 1) ) ) - (set_local $11 + (set_local $10 (i32.shl - (get_local $11) + (get_local $10) (i32.const 1) ) ) ) (set_local $4 - (i32.sub + (i64.sub (get_local $4) - (i32.const 1) + (i64.const 1) ) ) - (br $repeat|3) + (br $repeat|1) ) ) - (set_local $10 + (set_local $11 (i64.sub (get_local $9) (get_local $3) @@ -14672,18 +14114,18 @@ (if (i64.eq (i64.shr_u - (get_local $10) + (get_local $11) (i64.const 63) ) (i64.const 0) ) (block (set_local $9 - (get_local $10) + (get_local $11) ) - (set_local $11 + (set_local $10 (i32.add - (get_local $11) + (get_local $10) (i32.const 1) ) ) @@ -14695,48 +14137,39 @@ (i64.const 0) ) (set_local $4 - (i32.const -60) + (i64.const -60) ) - (block $break|4 - (loop $repeat|4 - (br_if $break|4 - (i32.eqz - (i64.eq - (i64.shr_u - (get_local $9) - (i64.const 52) - ) - (i64.const 0) - ) + (block + (set_local $12 + (i64.clz + (i64.shl + (get_local $9) + (i64.const 11) ) ) - (nop) - (block - (set_local $9 - (i64.shl - (get_local $9) - (i64.const 1) - ) - ) - (set_local $4 - (i32.sub - (get_local $4) - (i32.const 1) - ) - ) + ) + (set_local $4 + (i64.sub + (get_local $4) + (get_local $12) + ) + ) + (set_local $9 + (i64.shl + (get_local $9) + (get_local $12) ) - (br $repeat|4) ) ) ) - (br $break|2) + (br $break|0) ) (unreachable) ) (if - (i32.gt_s + (i64.gt_s (get_local $4) - (i32.const 0) + (i64.const 0) ) (block (set_local $9 @@ -14752,9 +14185,7 @@ (i64.or (get_local $9) (i64.shl - (i64.extend_s/i32 - (get_local $4) - ) + (get_local $4) (i64.const 52) ) ) @@ -14763,14 +14194,12 @@ (set_local $9 (i64.shr_u (get_local $9) - (i64.extend_s/i32 - (i32.add - (i32.sub - (i32.const 0) - (get_local $4) - ) - (i32.const 1) + (i64.add + (i64.sub + (i64.const 0) + (get_local $4) ) + (i64.const 1) ) ) ) @@ -14788,10 +14217,16 @@ ) ) ) + (set_local $13 + (f64.add + (get_local $0) + (get_local $0) + ) + ) (if (if (result i32) (tee_local $8 - (i32.eq + (i64.eq (get_local $4) (get_local $5) ) @@ -14799,10 +14234,10 @@ (get_local $8) (if (result i32) (tee_local $8 - (i32.eq - (i32.add + (i64.eq + (i64.add (get_local $4) - (i32.const 1) + (i64.const 1) ) (get_local $5) ) @@ -14810,10 +14245,7 @@ (if (result i32) (tee_local $8 (f64.gt - (f64.mul - (f64.const 2) - (get_local $0) - ) + (get_local $13) (get_local $1) ) ) @@ -14821,15 +14253,12 @@ (if (result i32) (tee_local $8 (f64.eq - (f64.mul - (f64.const 2) - (get_local $0) - ) + (get_local $13) (get_local $1) ) ) (i32.and - (get_local $11) + (get_local $10) (i32.const 1) ) (get_local $8) @@ -14838,18 +14267,10 @@ (get_local $8) ) ) - (block - (set_local $0 - (f64.sub - (get_local $0) - (get_local $1) - ) - ) - (set_local $11 - (i32.add - (get_local $11) - (i32.const 1) - ) + (set_local $0 + (f64.sub + (get_local $0) + (get_local $1) ) ) ) @@ -14861,7 +14282,7 @@ (get_local $0) ) ) - (func $std/math/test_rem (; 143 ;) (type $FFFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 f64) (param $4 i32) (result i32) + (func $std/math/test_rem (; 140 ;) (type $FFFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 f64) (param $4 i32) (result i32) (call $std/math/check (call $~lib/math/NativeMath.rem (get_local $0) @@ -14872,7 +14293,7 @@ (get_local $4) ) ) - (func $~lib/math/NativeMathf.rem (; 144 ;) (type $fff) (param $0 f32) (param $1 f32) (result f32) + (func $~lib/math/NativeMathf.rem (; 141 ;) (type $fff) (param $0 f32) (param $1 f32) (result f32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -14923,14 +14344,14 @@ (i32.const 31) ) ) - (set_local $9 + (set_local $8 (get_local $2) ) (if (if (result i32) - (tee_local $10 + (tee_local $9 (if (result i32) - (tee_local $10 + (tee_local $9 (i32.eq (i32.shl (get_local $3) @@ -14939,16 +14360,16 @@ (i32.const 0) ) ) - (get_local $10) - (call $~lib/builtins/isNaN - (get_local $1) + (get_local $9) + (i32.eq + (get_local $4) + (i32.const 255) ) ) ) - (get_local $10) - (i32.eq - (get_local $4) - (i32.const 255) + (get_local $9) + (call $~lib/builtins/isNaN + (get_local $1) ) ) (return @@ -14981,46 +14402,20 @@ (get_local $4) ) (block - (block $break|0 - (set_local $8 - (i32.shl - (get_local $9) - (i32.const 9) - ) - ) - (loop $repeat|0 - (br_if $break|0 - (i32.eqz - (i32.eq - (i32.shr_u - (get_local $8) - (i32.const 31) - ) - (i32.const 0) - ) + (set_local $4 + (i32.sub + (get_local $4) + (i32.clz + (i32.shl + (get_local $8) + (i32.const 9) ) ) - (nop) - (block - (set_local $4 - (i32.sub - (get_local $4) - (i32.const 1) - ) - ) - (set_local $8 - (i32.shl - (get_local $8) - (i32.const 1) - ) - ) - ) - (br $repeat|0) ) ) - (set_local $9 + (set_local $8 (i32.shl - (get_local $9) + (get_local $8) (i32.add (i32.sub (i32.const 0) @@ -15032,18 +14427,18 @@ ) ) (block - (set_local $9 + (set_local $8 (i32.and - (get_local $9) + (get_local $8) (i32.shr_u (i32.const -1) (i32.const 9) ) ) ) - (set_local $9 + (set_local $8 (i32.or - (get_local $9) + (get_local $8) (i32.shl (i32.const 1) (i32.const 23) @@ -15057,41 +14452,15 @@ (get_local $5) ) (block - (block $break|1 - (set_local $8 - (i32.shl - (get_local $3) - (i32.const 9) - ) - ) - (loop $repeat|1 - (br_if $break|1 - (i32.eqz - (i32.eq - (i32.shr_u - (get_local $8) - (i32.const 31) - ) - (i32.const 0) - ) + (set_local $5 + (i32.sub + (get_local $5) + (i32.clz + (i32.shl + (get_local $3) + (i32.const 9) ) ) - (nop) - (block - (set_local $5 - (i32.sub - (get_local $5) - (i32.const 1) - ) - ) - (set_local $8 - (i32.shl - (get_local $8) - (i32.const 1) - ) - ) - ) - (br $repeat|1) ) ) (set_local $3 @@ -15128,11 +14497,11 @@ ) ) ) - (set_local $11 + (set_local $10 (i32.const 0) ) - (block $break|2 - (loop $continue|2 + (block $break|0 + (loop $continue|0 (if (i32.lt_s (get_local $4) @@ -15147,16 +14516,16 @@ ) (get_local $5) ) - (br $break|2) + (br $break|0) ) (return (get_local $0) ) ) ) - (block $break|3 - (loop $repeat|3 - (br_if $break|3 + (block $break|1 + (loop $repeat|1 + (br_if $break|1 (i32.eqz (i32.gt_s (get_local $4) @@ -15165,41 +14534,41 @@ ) ) (block - (set_local $8 + (set_local $9 (i32.sub - (get_local $9) + (get_local $8) (get_local $3) ) ) (if (i32.eq (i32.shr_u - (get_local $8) + (get_local $9) (i32.const 31) ) (i32.const 0) ) (block - (set_local $9 - (get_local $8) + (set_local $8 + (get_local $9) ) - (set_local $11 + (set_local $10 (i32.add - (get_local $11) + (get_local $10) (i32.const 1) ) ) ) ) - (set_local $9 + (set_local $8 (i32.shl - (get_local $9) + (get_local $8) (i32.const 1) ) ) - (set_local $11 + (set_local $10 (i32.shl - (get_local $11) + (get_local $10) (i32.const 1) ) ) @@ -15210,30 +14579,30 @@ (i32.const 1) ) ) - (br $repeat|3) + (br $repeat|1) ) ) - (set_local $8 + (set_local $9 (i32.sub - (get_local $9) + (get_local $8) (get_local $3) ) ) (if (i32.eq (i32.shr_u - (get_local $8) + (get_local $9) (i32.const 31) ) (i32.const 0) ) (block - (set_local $9 - (get_local $8) + (set_local $8 + (get_local $9) ) - (set_local $11 + (set_local $10 (i32.add - (get_local $11) + (get_local $10) (i32.const 1) ) ) @@ -15241,45 +14610,36 @@ ) (if (i32.eq - (get_local $9) + (get_local $8) (i32.const 0) ) (set_local $4 (i32.const -30) ) - (block $break|4 - (loop $repeat|4 - (br_if $break|4 - (i32.eqz - (i32.eq - (i32.shr_u - (get_local $9) - (i32.const 23) - ) - (i32.const 0) - ) + (block + (set_local $11 + (i32.clz + (i32.shl + (get_local $8) + (i32.const 8) ) ) - (nop) - (block - (set_local $9 - (i32.shl - (get_local $9) - (i32.const 1) - ) - ) - (set_local $4 - (i32.sub - (get_local $4) - (i32.const 1) - ) - ) + ) + (set_local $4 + (i32.sub + (get_local $4) + (get_local $11) + ) + ) + (set_local $8 + (i32.shl + (get_local $8) + (get_local $11) ) - (br $repeat|4) ) ) ) - (br $break|2) + (br $break|0) ) (unreachable) ) @@ -15289,18 +14649,18 @@ (i32.const 0) ) (block - (set_local $9 + (set_local $8 (i32.sub - (get_local $9) + (get_local $8) (i32.shl (i32.const 1) (i32.const 23) ) ) ) - (set_local $9 + (set_local $8 (i32.or - (get_local $9) + (get_local $8) (i32.shl (get_local $4) (i32.const 23) @@ -15308,9 +14668,9 @@ ) ) ) - (set_local $9 + (set_local $8 (i32.shr_u - (get_local $9) + (get_local $8) (i32.add (i32.sub (i32.const 0) @@ -15323,7 +14683,7 @@ ) (set_local $0 (f32.reinterpret/i32 - (get_local $9) + (get_local $8) ) ) (if @@ -15336,15 +14696,15 @@ ) (if (if (result i32) - (tee_local $10 + (tee_local $9 (i32.eq (get_local $4) (get_local $5) ) ) - (get_local $10) + (get_local $9) (if (result i32) - (tee_local $10 + (tee_local $9 (i32.eq (i32.add (get_local $4) @@ -15354,7 +14714,7 @@ ) ) (if (result i32) - (tee_local $10 + (tee_local $9 (f32.gt (f32.mul (f32.const 2) @@ -15363,9 +14723,9 @@ (get_local $1) ) ) - (get_local $10) + (get_local $9) (if (result i32) - (tee_local $10 + (tee_local $9 (f32.eq (f32.mul (f32.const 2) @@ -15375,13 +14735,13 @@ ) ) (i32.and - (get_local $11) + (get_local $10) (i32.const 1) ) - (get_local $10) + (get_local $9) ) ) - (get_local $10) + (get_local $9) ) ) (block @@ -15391,9 +14751,9 @@ (get_local $1) ) ) - (set_local $11 + (set_local $10 (i32.add - (get_local $11) + (get_local $10) (i32.const 1) ) ) @@ -15407,7 +14767,7 @@ (get_local $0) ) ) - (func $std/math/test_remf (; 145 ;) (type $ffffii) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 f32) (param $4 i32) (result i32) + (func $std/math/test_remf (; 142 ;) (type $ffffii) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 f32) (param $4 i32) (result i32) (call $std/math/check (call $~lib/math/NativeMathf.rem (get_local $0) @@ -15418,46 +14778,27 @@ (get_local $4) ) ) - (func $~lib/math/NativeMath.sinh (; 146 ;) (type $FF) (param $0 f64) (result f64) + (func $~lib/math/NativeMath.sinh (; 143 ;) (type $FF) (param $0 f64) (result f64) (local $1 i64) (local $2 f64) - (local $3 f64) - (local $4 i32) + (local $3 i32) + (local $4 f64) (local $5 f64) - (set_local $1 - (i64.reinterpret/f64 - (get_local $0) - ) - ) - (set_local $2 - (f64.const 0.5) - ) - (if - (i64.ne - (i64.shr_u - (get_local $1) - (i64.const 63) - ) - (i64.const 0) - ) - (set_local $2 - (f64.neg - (get_local $2) - ) - ) - ) + (local $6 f64) (set_local $1 (i64.and - (get_local $1) + (i64.reinterpret/f64 + (get_local $0) + ) (i64.const 9223372036854775807) ) ) - (set_local $3 + (set_local $2 (f64.reinterpret/i64 (get_local $1) ) ) - (set_local $4 + (set_local $3 (i32.wrap/i64 (i64.shr_u (get_local $1) @@ -15465,26 +14806,32 @@ ) ) ) + (set_local $5 + (f64.copysign + (f64.const 0.5) + (get_local $0) + ) + ) (if (i32.lt_u - (get_local $4) + (get_local $3) (i32.const 1082535490) ) (block - (set_local $5 + (set_local $4 (call $~lib/math/NativeMath.expm1 - (get_local $3) + (get_local $2) ) ) (if (i32.lt_u - (get_local $4) + (get_local $3) (i32.const 1072693248) ) (block (if (i32.lt_u - (get_local $4) + (get_local $3) (i32.sub (i32.const 1072693248) (i32.shl @@ -15499,19 +14846,19 @@ ) (return (f64.mul - (get_local $2) + (get_local $5) (f64.sub (f64.mul (f64.const 2) - (get_local $5) + (get_local $4) ) (f64.div (f64.mul - (get_local $5) - (get_local $5) + (get_local $4) + (get_local $4) ) (f64.add - (get_local $5) + (get_local $4) (f64.const 1) ) ) @@ -15522,13 +14869,13 @@ ) (return (f64.mul - (get_local $2) + (get_local $5) (f64.add - (get_local $5) + (get_local $4) (f64.div - (get_local $5) + (get_local $4) (f64.add - (get_local $5) + (get_local $4) (f64.const 1) ) ) @@ -15537,20 +14884,50 @@ ) ) ) - (set_local $5 + (set_local $4 (f64.mul (f64.mul (f64.const 2) - (get_local $2) + (get_local $5) ) - (call $~lib/math/expo2 - (get_local $3) + (block $~lib/math/expo2|inlined.1 (result f64) + (set_local $6 + (f64.reinterpret/i64 + (i64.shl + (i64.extend_u/i32 + (i32.shl + (i32.add + (i32.const 1023) + (i32.div_u + (i32.const 2043) + (i32.const 2) + ) + ) + (i32.const 20) + ) + ) + (i64.const 32) + ) + ) + ) + (f64.mul + (f64.mul + (call $~lib/math/NativeMath.exp + (f64.sub + (get_local $2) + (f64.const 1416.0996898839683) + ) + ) + (get_local $6) + ) + (get_local $6) + ) ) ) ) - (get_local $5) + (get_local $4) ) - (func $std/math/test_sinh (; 147 ;) (type $FFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 i32) (result i32) + (func $std/math/test_sinh (; 144 ;) (type $FFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 i32) (result i32) (local $4 i32) (if (result i32) (tee_local $4 @@ -15582,50 +14959,40 @@ (get_local $4) ) ) - (func $~lib/math/NativeMathf.sinh (; 148 ;) (type $ff) (param $0 f32) (result f32) + (func $~lib/math/NativeMathf.sinh (; 145 ;) (type $ff) (param $0 f32) (result f32) (local $1 i32) (local $2 f32) (local $3 f32) (local $4 f32) - (set_local $1 - (i32.reinterpret/f32 - (get_local $0) - ) - ) - (set_local $2 - (f32.const 0.5) - ) - (if - (i32.shr_u - (get_local $1) - (i32.const 31) - ) - (set_local $2 - (f32.neg - (get_local $2) - ) - ) - ) + (local $5 f32) (set_local $1 (i32.and - (get_local $1) + (i32.reinterpret/f32 + (get_local $0) + ) (i32.const 2147483647) ) ) - (set_local $3 + (set_local $2 (f32.reinterpret/i32 (get_local $1) ) ) + (set_local $4 + (f32.copysign + (f32.const 0.5) + (get_local $0) + ) + ) (if (i32.lt_u (get_local $1) (i32.const 1118925335) ) (block - (set_local $4 + (set_local $3 (call $~lib/math/NativeMathf.expm1 - (get_local $3) + (get_local $2) ) ) (if @@ -15651,19 +15018,19 @@ ) (return (f32.mul - (get_local $2) + (get_local $4) (f32.sub (f32.mul (f32.const 2) - (get_local $4) + (get_local $3) ) (f32.div (f32.mul - (get_local $4) - (get_local $4) + (get_local $3) + (get_local $3) ) (f32.add - (get_local $4) + (get_local $3) (f32.const 1) ) ) @@ -15674,13 +15041,13 @@ ) (return (f32.mul - (get_local $2) + (get_local $4) (f32.add - (get_local $4) + (get_local $3) (f32.div - (get_local $4) + (get_local $3) (f32.add - (get_local $4) + (get_local $3) (f32.const 1) ) ) @@ -15689,20 +15056,45 @@ ) ) ) - (set_local $4 + (set_local $3 (f32.mul (f32.mul (f32.const 2) - (get_local $2) + (get_local $4) ) - (call $~lib/math/expo2f - (get_local $3) + (block $~lib/math/expo2f|inlined.1 (result f32) + (set_local $5 + (f32.reinterpret/i32 + (i32.shl + (i32.add + (i32.const 127) + (i32.div_u + (i32.const 235) + (i32.const 2) + ) + ) + (i32.const 23) + ) + ) + ) + (f32.mul + (f32.mul + (call $~lib/math/NativeMathf.exp + (f32.sub + (get_local $2) + (f32.const 162.88958740234375) + ) + ) + (get_local $5) + ) + (get_local $5) + ) ) ) ) - (get_local $4) + (get_local $3) ) - (func $std/math/test_sinhf (; 149 ;) (type $fffii) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 i32) (result i32) + (func $std/math/test_sinhf (; 146 ;) (type $fffii) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 i32) (result i32) (call $std/math/check (call $~lib/math/NativeMathf.sinh (get_local $0) @@ -15712,7 +15104,7 @@ (get_local $3) ) ) - (func $std/math/test_sqrt (; 150 ;) (type $FFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 i32) (result i32) + (func $std/math/test_sqrt (; 147 ;) (type $FFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 i32) (result i32) (local $4 i32) (if (result i32) (tee_local $4 @@ -15746,7 +15138,7 @@ (get_local $4) ) ) - (func $std/math/test_sqrtf (; 151 ;) (type $fffii) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 i32) (result i32) + (func $std/math/test_sqrtf (; 148 ;) (type $fffii) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 i32) (result i32) (call $std/math/check (block $~lib/math/NativeMathf.sqrt|inlined.0 (result f32) (f32.sqrt @@ -15758,9 +15150,9 @@ (get_local $3) ) ) - (func $~lib/math/NativeMath.tanh (; 152 ;) (type $FF) (param $0 f64) (result f64) + (func $~lib/math/NativeMath.tanh (; 149 ;) (type $FF) (param $0 f64) (result f64) (local $1 i64) - (local $2 i32) + (local $2 f64) (local $3 i32) (local $4 f64) (set_local $1 @@ -15768,21 +15160,13 @@ (get_local $0) ) ) - (set_local $2 - (i32.wrap/i64 - (i64.shr_u - (get_local $1) - (i64.const 63) - ) - ) - ) (set_local $1 (i64.and (get_local $1) (i64.const 9223372036854775807) ) ) - (set_local $0 + (set_local $2 (f64.reinterpret/i64 (get_local $1) ) @@ -15810,7 +15194,7 @@ (f64.const 1) (f64.div (f64.const 0) - (get_local $0) + (get_local $2) ) ) ) @@ -15819,7 +15203,7 @@ (call $~lib/math/NativeMath.expm1 (f64.mul (f64.const 2) - (get_local $0) + (get_local $2) ) ) ) @@ -15847,7 +15231,7 @@ (call $~lib/math/NativeMath.expm1 (f64.mul (f64.const 2) - (get_local $0) + (get_local $2) ) ) ) @@ -15871,7 +15255,7 @@ (call $~lib/math/NativeMath.expm1 (f64.mul (f64.const -2) - (get_local $0) + (get_local $2) ) ) ) @@ -15888,20 +15272,17 @@ ) ) (set_local $4 - (get_local $0) + (get_local $2) ) ) ) ) - (if (result f64) - (get_local $2) - (f64.neg - (get_local $4) - ) + (f64.copysign (get_local $4) + (get_local $0) ) ) - (func $std/math/test_tanh (; 153 ;) (type $FFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 i32) (result i32) + (func $std/math/test_tanh (; 150 ;) (type $FFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 i32) (result i32) (local $4 i32) (if (result i32) (tee_local $4 @@ -15933,28 +15314,22 @@ (get_local $4) ) ) - (func $~lib/math/NativeMathf.tanh (; 154 ;) (type $ff) (param $0 f32) (result f32) + (func $~lib/math/NativeMathf.tanh (; 151 ;) (type $ff) (param $0 f32) (result f32) (local $1 i32) - (local $2 i32) + (local $2 f32) (local $3 f32) (set_local $1 (i32.reinterpret/f32 (get_local $0) ) ) - (set_local $2 - (i32.shr_u - (get_local $1) - (i32.const 31) - ) - ) (set_local $1 (i32.and (get_local $1) (i32.const 2147483647) ) ) - (set_local $0 + (set_local $2 (f32.reinterpret/i32 (get_local $1) ) @@ -15974,7 +15349,7 @@ (f32.const 1) (f32.div (f32.const 0) - (get_local $0) + (get_local $2) ) ) ) @@ -15983,7 +15358,7 @@ (call $~lib/math/NativeMathf.expm1 (f32.mul (f32.const 2) - (get_local $0) + (get_local $2) ) ) ) @@ -16011,7 +15386,7 @@ (call $~lib/math/NativeMathf.expm1 (f32.mul (f32.const 2) - (get_local $0) + (get_local $2) ) ) ) @@ -16035,7 +15410,7 @@ (call $~lib/math/NativeMathf.expm1 (f32.mul (f32.const -2) - (get_local $0) + (get_local $2) ) ) ) @@ -16052,20 +15427,17 @@ ) ) (set_local $3 - (get_local $0) + (get_local $2) ) ) ) ) - (if (result f32) - (get_local $2) - (f32.neg - (get_local $3) - ) + (f32.copysign (get_local $3) + (get_local $0) ) ) - (func $std/math/test_tanhf (; 155 ;) (type $fffii) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 i32) (result i32) + (func $std/math/test_tanhf (; 152 ;) (type $fffii) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 i32) (result i32) (call $std/math/check (call $~lib/math/NativeMathf.tanh (get_local $0) @@ -16075,7 +15447,7 @@ (get_local $3) ) ) - (func $std/math/test_trunc (; 156 ;) (type $FFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 i32) (result i32) + (func $std/math/test_trunc (; 153 ;) (type $FFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 i32) (result i32) (local $4 i32) (if (result i32) (tee_local $4 @@ -16109,7 +15481,7 @@ (get_local $4) ) ) - (func $std/math/test_truncf (; 157 ;) (type $fffii) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 i32) (result i32) + (func $std/math/test_truncf (; 154 ;) (type $fffii) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 i32) (result i32) (call $std/math/check (block $~lib/math/NativeMathf.trunc|inlined.0 (result f32) (f32.trunc @@ -16121,7 +15493,7 @@ (get_local $3) ) ) - (func $~lib/math/ipow64 (; 158 ;) (type $IiI) (param $0 i64) (param $1 i32) (result i64) + (func $~lib/math/ipow64 (; 155 ;) (type $IiI) (param $0 i64) (param $1 i32) (result i64) (local $2 i64) (local $3 i32) (local $4 i32) @@ -16435,7 +15807,7 @@ ) (get_local $2) ) - (func $start (; 159 ;) (type $v) + (func $start (; 156 ;) (type $v) (local $0 i32) (local $1 f64) (local $2 i32) @@ -57016,6 +56388,6 @@ ) ) ) - (func $null (; 160 ;) (type $v) + (func $null (; 157 ;) (type $v) ) ) diff --git a/tests/compiler/std/mod.optimized.wat b/tests/compiler/std/mod.optimized.wat index d4d65701..5b859c44 100644 --- a/tests/compiler/std/mod.optimized.wat +++ b/tests/compiler/std/mod.optimized.wat @@ -21,67 +21,64 @@ (start $start) (func $~lib/math/NativeMath.mod (; 2 ;) (; has Stack IR ;) (type $FFF) (param $0 f64) (param $1 f64) (result f64) (local $2 i64) - (local $3 i32) + (local $3 i64) (local $4 i64) (local $5 i64) - (local $6 i32) + (local $6 i64) (local $7 i32) - (local $8 i32) + (local $8 i64) + (local $9 i64) (block $folding-inner0 (set_local $3 - (i32.wrap/i64 - (i64.and - (i64.shr_u - (tee_local $2 - (i64.reinterpret/f64 - (get_local $0) - ) + (i64.and + (i64.shr_u + (tee_local $2 + (i64.reinterpret/f64 + (get_local $0) ) - (i64.const 52) ) - (i64.const 2047) + (i64.const 52) ) + (i64.const 2047) ) ) (set_local $6 - (i32.wrap/i64 - (i64.and - (i64.shr_u - (tee_local $5 - (i64.reinterpret/f64 - (get_local $1) - ) + (i64.and + (i64.shr_u + (tee_local $5 + (i64.reinterpret/f64 + (get_local $1) ) - (i64.const 52) ) - (i64.const 2047) + (i64.const 52) ) + (i64.const 2047) ) ) (set_local $8 - (i32.wrap/i64 - (i64.shr_u - (get_local $2) - (i64.const 63) - ) + (i64.shr_u + (get_local $2) + (i64.const 63) ) ) (if (i32.eqz (tee_local $7 (i64.eq - (i64.shl - (get_local $5) - (i64.const 1) + (tee_local $4 + (i64.shl + (get_local $5) + (i64.const 1) + ) ) (i64.const 0) ) ) ) (set_local $7 - (f64.ne - (get_local $1) - (get_local $1) + (i64.eq + (get_local $3) + (i64.const 2047) ) ) ) @@ -90,9 +87,9 @@ (get_local $7) ) (set_local $7 - (i32.eq - (get_local $3) - (i32.const 2047) + (f64.ne + (get_local $1) + (get_local $1) ) ) ) @@ -112,26 +109,19 @@ ) (if (i64.le_u - (i64.shl - (get_local $2) - (i64.const 1) - ) - (i64.shl - (get_local $5) - (i64.const 1) + (tee_local $9 + (i64.shl + (get_local $2) + (i64.const 1) + ) ) + (get_local $4) ) (block (br_if $folding-inner0 (i64.eq - (i64.shl - (get_local $2) - (i64.const 1) - ) - (i64.shl - (get_local $5) - (i64.const 1) - ) + (get_local $9) + (get_local $4) ) ) (return @@ -141,7 +131,29 @@ ) (set_local $2 (if (result i64) - (get_local $3) + (i64.eqz + (get_local $3) + ) + (i64.shl + (get_local $2) + (i64.add + (i64.sub + (i64.const 0) + (tee_local $3 + (i64.sub + (get_local $3) + (i64.clz + (i64.shl + (get_local $2) + (i64.const 12) + ) + ) + ) + ) + ) + (i64.const 1) + ) + ) (i64.or (i64.and (get_local $2) @@ -149,55 +161,33 @@ ) (i64.const 4503599627370496) ) - (block (result i64) - (block $break|0 - (set_local $4 - (i64.shl - (get_local $2) - (i64.const 12) - ) - ) - (loop $repeat|0 - (br_if $break|0 - (i32.eqz - (i64.eqz - (i64.shr_u - (get_local $4) - (i64.const 63) - ) - ) - ) - ) - (set_local $3 - (i32.sub - (get_local $3) - (i32.const 1) - ) - ) - (set_local $4 - (i64.shl - (get_local $4) - (i64.const 1) - ) - ) - (br $repeat|0) - ) - ) - (i64.shl - (get_local $2) - (i64.extend_s/i32 - (i32.sub - (i32.const 1) - (get_local $3) - ) - ) - ) - ) ) ) (set_local $5 (if (result i64) - (get_local $6) + (i64.eqz + (get_local $6) + ) + (i64.shl + (get_local $5) + (i64.add + (i64.sub + (i64.const 0) + (tee_local $6 + (i64.sub + (get_local $6) + (i64.clz + (i64.shl + (get_local $5) + (i64.const 12) + ) + ) + ) + ) + ) + (i64.const 1) + ) + ) (i64.or (i64.and (get_local $5) @@ -205,56 +195,12 @@ ) (i64.const 4503599627370496) ) - (block (result i64) - (block $break|1 - (set_local $4 - (i64.shl - (get_local $5) - (i64.const 12) - ) - ) - (loop $repeat|1 - (br_if $break|1 - (i32.eqz - (i64.eqz - (i64.shr_u - (get_local $4) - (i64.const 63) - ) - ) - ) - ) - (set_local $6 - (i32.sub - (get_local $6) - (i32.const 1) - ) - ) - (set_local $4 - (i64.shl - (get_local $4) - (i64.const 1) - ) - ) - (br $repeat|1) - ) - ) - (i64.shl - (get_local $5) - (i64.extend_s/i32 - (i32.sub - (i32.const 1) - (get_local $6) - ) - ) - ) - ) ) ) - (block $break|2 - (loop $repeat|2 - (br_if $break|2 - (i32.le_s + (block $break|0 + (loop $repeat|0 + (br_if $break|0 + (i64.le_s (get_local $3) (get_local $6) ) @@ -289,12 +235,12 @@ ) ) (set_local $3 - (i32.sub + (i64.sub (get_local $3) - (i32.const 1) + (i64.const 1) ) ) - (br $repeat|2) + (br $repeat|0) ) ) (if @@ -320,31 +266,17 @@ ) ) ) - (block $break|3 - (loop $repeat|3 - (br_if $break|3 - (i32.eqz - (i64.eqz - (i64.shr_u - (get_local $2) - (i64.const 52) - ) + (set_local $2 + (i64.shl + (get_local $2) + (tee_local $4 + (i64.clz + (i64.shl + (get_local $2) + (i64.const 11) ) ) ) - (set_local $3 - (i32.sub - (get_local $3) - (i32.const 1) - ) - ) - (set_local $2 - (i64.shl - (get_local $2) - (i64.const 1) - ) - ) - (br $repeat|3) ) ) (return @@ -352,9 +284,14 @@ (i64.or (tee_local $2 (if (result i64) - (i32.gt_s - (get_local $3) - (i32.const 0) + (i64.gt_s + (tee_local $3 + (i64.sub + (get_local $3) + (get_local $4) + ) + ) + (i64.const 0) ) (i64.or (i64.sub @@ -362,27 +299,24 @@ (i64.const 4503599627370496) ) (i64.shl - (i64.extend_s/i32 - (get_local $3) - ) + (get_local $3) (i64.const 52) ) ) (i64.shr_u (get_local $2) - (i64.extend_s/i32 - (i32.sub - (i32.const 1) + (i64.add + (i64.sub + (i64.const 0) (get_local $3) ) + (i64.const 1) ) ) ) ) (i64.shl - (i64.extend_s/i32 - (get_local $8) - ) + (get_local $8) (i64.const 63) ) ) @@ -467,6 +401,7 @@ (local $5 i32) (local $6 i32) (local $7 i32) + (local $8 i32) (block $folding-inner0 (set_local $4 (i32.and @@ -494,7 +429,7 @@ (i32.const 255) ) ) - (set_local $7 + (set_local $8 (i32.and (get_local $2) (i32.const -2147483648) @@ -504,27 +439,15 @@ (i32.eqz (tee_local $3 (i32.eqz - (i32.shl - (get_local $5) - (i32.const 1) + (tee_local $7 + (i32.shl + (get_local $5) + (i32.const 1) + ) ) ) ) ) - (set_local $3 - (f32.ne - (get_local $1) - (get_local $1) - ) - ) - ) - (if - (i32.eqz - (i32.and - (get_local $3) - (i32.const 1) - ) - ) (set_local $3 (i32.eq (get_local $4) @@ -532,6 +455,17 @@ ) ) ) + (if + (i32.eqz + (get_local $3) + ) + (set_local $3 + (f32.ne + (get_local $1) + (get_local $1) + ) + ) + ) (if (i32.and (get_local $3) @@ -551,26 +485,19 @@ ) (if (i32.le_u - (i32.shl - (get_local $2) - (i32.const 1) - ) - (i32.shl - (get_local $5) - (i32.const 1) + (tee_local $3 + (i32.shl + (get_local $2) + (i32.const 1) + ) ) + (get_local $7) ) (block (br_if $folding-inner0 (i32.eq - (i32.shl - (get_local $2) - (i32.const 1) - ) - (i32.shl - (get_local $5) - (i32.const 1) - ) + (get_local $3) + (get_local $7) ) ) (return @@ -588,41 +515,20 @@ ) (i32.const 8388608) ) - (block (result i32) - (block $break|0 - (set_local $3 - (i32.shl - (get_local $2) - (i32.const 9) - ) - ) - (loop $repeat|0 - (br_if $break|0 - (i32.shr_u - (get_local $3) - (i32.const 31) + (i32.shl + (get_local $2) + (i32.sub + (i32.const 1) + (tee_local $4 + (i32.sub + (get_local $4) + (i32.clz + (i32.shl + (get_local $2) + (i32.const 9) + ) ) ) - (set_local $4 - (i32.sub - (get_local $4) - (i32.const 1) - ) - ) - (set_local $3 - (i32.shl - (get_local $3) - (i32.const 1) - ) - ) - (br $repeat|0) - ) - ) - (i32.shl - (get_local $2) - (i32.sub - (i32.const 1) - (get_local $4) ) ) ) @@ -638,49 +544,28 @@ ) (i32.const 8388608) ) - (block (result i32) - (block $break|1 - (set_local $3 - (i32.shl - (get_local $5) - (i32.const 9) - ) - ) - (loop $repeat|1 - (br_if $break|1 - (i32.shr_u - (get_local $3) - (i32.const 31) + (i32.shl + (get_local $5) + (i32.sub + (i32.const 1) + (tee_local $6 + (i32.sub + (get_local $6) + (i32.clz + (i32.shl + (get_local $5) + (i32.const 9) + ) ) ) - (set_local $6 - (i32.sub - (get_local $6) - (i32.const 1) - ) - ) - (set_local $3 - (i32.shl - (get_local $3) - (i32.const 1) - ) - ) - (br $repeat|1) - ) - ) - (i32.shl - (get_local $5) - (i32.sub - (i32.const 1) - (get_local $6) ) ) ) ) ) - (block $break|2 - (loop $repeat|2 - (br_if $break|2 + (block $break|0 + (loop $repeat|0 + (br_if $break|0 (i32.le_s (get_local $4) (get_local $6) @@ -721,7 +606,7 @@ (i32.const 1) ) ) - (br $repeat|2) + (br $repeat|0) ) ) (if @@ -747,27 +632,17 @@ ) ) ) - (block $break|3 - (loop $repeat|3 - (br_if $break|3 - (i32.shr_u - (get_local $2) - (i32.const 23) + (set_local $2 + (i32.shl + (get_local $2) + (tee_local $3 + (i32.clz + (i32.shl + (get_local $2) + (i32.const 8) + ) ) ) - (set_local $4 - (i32.sub - (get_local $4) - (i32.const 1) - ) - ) - (set_local $2 - (i32.shl - (get_local $2) - (i32.const 1) - ) - ) - (br $repeat|3) ) ) (return @@ -776,7 +651,12 @@ (tee_local $2 (if (result i32) (i32.gt_s - (get_local $4) + (tee_local $4 + (i32.sub + (get_local $4) + (get_local $3) + ) + ) (i32.const 0) ) (i32.or @@ -798,7 +678,7 @@ ) ) ) - (get_local $7) + (get_local $8) ) ) ) diff --git a/tests/compiler/std/mod.untouched.wat b/tests/compiler/std/mod.untouched.wat index a592ef1f..b682dd06 100644 --- a/tests/compiler/std/mod.untouched.wat +++ b/tests/compiler/std/mod.untouched.wat @@ -26,11 +26,14 @@ (func $~lib/math/NativeMath.mod (; 2 ;) (type $FFF) (param $0 f64) (param $1 f64) (result f64) (local $2 i64) (local $3 i64) - (local $4 i32) - (local $5 i32) - (local $6 i32) - (local $7 i32) - (local $8 i64) + (local $4 i64) + (local $5 i64) + (local $6 i64) + (local $7 i64) + (local $8 i32) + (local $9 i64) + (local $10 i64) + (local $11 i64) (set_local $2 (i64.reinterpret/f64 (get_local $0) @@ -42,65 +45,59 @@ ) ) (set_local $4 - (i32.wrap/i64 - (i64.and - (i64.shr_u - (get_local $2) - (i64.const 52) - ) - (i64.const 2047) + (i64.and + (i64.shr_u + (get_local $2) + (i64.const 52) ) + (i64.const 2047) ) ) (set_local $5 - (i32.wrap/i64 - (i64.and - (i64.shr_u - (get_local $3) - (i64.const 52) - ) - (i64.const 2047) + (i64.and + (i64.shr_u + (get_local $3) + (i64.const 52) ) + (i64.const 2047) ) ) (set_local $6 - (i32.wrap/i64 - (i64.shr_u - (get_local $2) - (i64.const 63) - ) + (i64.shr_u + (get_local $2) + (i64.const 63) + ) + ) + (set_local $7 + (i64.shl + (get_local $3) + (i64.const 1) ) ) (if (i32.and (if (result i32) - (i32.and - (tee_local $7 - (if (result i32) - (tee_local $7 - (i64.eq - (i64.shl - (get_local $3) - (i64.const 1) - ) - (i64.const 0) - ) - ) - (get_local $7) - (block $~lib/builtins/isNaN|inlined.1 (result i32) - (f64.ne - (get_local $1) - (get_local $1) - ) + (tee_local $8 + (if (result i32) + (tee_local $8 + (i64.eq + (get_local $7) + (i64.const 0) ) ) + (get_local $8) + (i64.eq + (get_local $4) + (i64.const 2047) + ) ) - (i32.const 1) ) - (get_local $7) - (i32.eq - (get_local $4) - (i32.const 2047) + (get_local $8) + (block $~lib/builtins/isNaN|inlined.1 (result i32) + (f64.ne + (get_local $1) + (get_local $1) + ) ) ) (i32.const 1) @@ -118,28 +115,22 @@ ) ) ) + (set_local $9 + (i64.shl + (get_local $2) + (i64.const 1) + ) + ) (if (i64.le_u - (i64.shl - (get_local $2) - (i64.const 1) - ) - (i64.shl - (get_local $3) - (i64.const 1) - ) + (get_local $9) + (get_local $7) ) (block (if (i64.eq - (i64.shl - (get_local $2) - (i64.const 1) - ) - (i64.shl - (get_local $3) - (i64.const 1) - ) + (get_local $9) + (get_local $7) ) (return (f64.mul @@ -154,54 +145,30 @@ ) ) (if - (i32.eqz + (i64.eqz (get_local $4) ) (block - (block $break|0 - (set_local $8 - (i64.shl - (get_local $2) - (i64.const 12) - ) - ) - (loop $repeat|0 - (br_if $break|0 - (i32.eqz - (i64.eqz - (i64.shr_u - (get_local $8) - (i64.const 63) - ) - ) - ) - ) - (set_local $4 - (i32.sub - (get_local $4) - (i32.const 1) - ) - ) - (set_local $8 + (set_local $4 + (i64.sub + (get_local $4) + (i64.clz (i64.shl - (get_local $8) - (i64.const 1) + (get_local $2) + (i64.const 12) ) ) - (br $repeat|0) ) ) (set_local $2 (i64.shl (get_local $2) - (i64.extend_s/i32 - (i32.add - (i32.sub - (i32.const 0) - (get_local $4) - ) - (i32.const 1) + (i64.add + (i64.sub + (i64.const 0) + (get_local $4) ) + (i64.const 1) ) ) ) @@ -228,54 +195,30 @@ ) ) (if - (i32.eqz + (i64.eqz (get_local $5) ) (block - (block $break|1 - (set_local $8 - (i64.shl - (get_local $3) - (i64.const 12) - ) - ) - (loop $repeat|1 - (br_if $break|1 - (i32.eqz - (i64.eqz - (i64.shr_u - (get_local $8) - (i64.const 63) - ) - ) - ) - ) - (set_local $5 - (i32.sub - (get_local $5) - (i32.const 1) - ) - ) - (set_local $8 + (set_local $5 + (i64.sub + (get_local $5) + (i64.clz (i64.shl - (get_local $8) - (i64.const 1) + (get_local $3) + (i64.const 12) ) ) - (br $repeat|1) ) ) (set_local $3 (i64.shl (get_local $3) - (i64.extend_s/i32 - (i32.add - (i32.sub - (i32.const 0) - (get_local $5) - ) - (i32.const 1) + (i64.add + (i64.sub + (i64.const 0) + (get_local $5) ) + (i64.const 1) ) ) ) @@ -301,18 +244,18 @@ ) ) ) - (block $break|2 - (loop $repeat|2 - (br_if $break|2 + (block $break|0 + (loop $repeat|0 + (br_if $break|0 (i32.eqz - (i32.gt_s + (i64.gt_s (get_local $4) (get_local $5) ) ) ) (block - (set_local $8 + (set_local $10 (i64.sub (get_local $2) (get_local $3) @@ -321,14 +264,14 @@ (if (i64.eqz (i64.shr_u - (get_local $8) + (get_local $10) (i64.const 63) ) ) (block (if (i64.eqz - (get_local $8) + (get_local $10) ) (return (f64.mul @@ -338,7 +281,7 @@ ) ) (set_local $2 - (get_local $8) + (get_local $10) ) ) ) @@ -350,15 +293,15 @@ ) ) (set_local $4 - (i32.sub + (i64.sub (get_local $4) - (i32.const 1) + (i64.const 1) ) ) - (br $repeat|2) + (br $repeat|0) ) ) - (set_local $8 + (set_local $10 (i64.sub (get_local $2) (get_local $3) @@ -367,14 +310,14 @@ (if (i64.eqz (i64.shr_u - (get_local $8) + (get_local $10) (i64.const 63) ) ) (block (if (i64.eqz - (get_local $8) + (get_local $10) ) (return (f64.mul @@ -384,41 +327,34 @@ ) ) (set_local $2 - (get_local $8) + (get_local $10) ) ) ) - (block $break|3 - (loop $repeat|3 - (br_if $break|3 - (i32.eqz - (i64.eqz - (i64.shr_u - (get_local $2) - (i64.const 52) - ) - ) - ) + (set_local $11 + (i64.clz + (i64.shl + (get_local $2) + (i64.const 11) ) - (set_local $4 - (i32.sub - (get_local $4) - (i32.const 1) - ) - ) - (set_local $2 - (i64.shl - (get_local $2) - (i64.const 1) - ) - ) - (br $repeat|3) + ) + ) + (set_local $4 + (i64.sub + (get_local $4) + (get_local $11) + ) + ) + (set_local $2 + (i64.shl + (get_local $2) + (get_local $11) ) ) (if - (i32.gt_s + (i64.gt_s (get_local $4) - (i32.const 0) + (i64.const 0) ) (block (set_local $2 @@ -434,9 +370,7 @@ (i64.or (get_local $2) (i64.shl - (i64.extend_s/i32 - (get_local $4) - ) + (get_local $4) (i64.const 52) ) ) @@ -445,14 +379,12 @@ (set_local $2 (i64.shr_u (get_local $2) - (i64.extend_s/i32 - (i32.add - (i32.sub - (i32.const 0) - (get_local $4) - ) - (i32.const 1) + (i64.add + (i64.sub + (i64.const 0) + (get_local $4) ) + (i64.const 1) ) ) ) @@ -461,9 +393,7 @@ (i64.or (get_local $2) (i64.shl - (i64.extend_s/i32 - (get_local $6) - ) + (get_local $6) (i64.const 63) ) ) @@ -552,6 +482,9 @@ (local $6 i32) (local $7 i32) (local $8 i32) + (local $9 i32) + (local $10 i32) + (local $11 i32) (set_local $2 (i32.reinterpret/f32 (get_local $0) @@ -586,36 +519,36 @@ (i32.const -2147483648) ) ) + (set_local $7 + (i32.shl + (get_local $3) + (i32.const 1) + ) + ) (if (i32.and (if (result i32) - (i32.and - (tee_local $7 - (if (result i32) - (tee_local $7 - (i32.eq - (i32.shl - (get_local $3) - (i32.const 1) - ) - (i32.const 0) - ) - ) - (get_local $7) - (block $~lib/builtins/isNaN|inlined.1 (result i32) - (f32.ne - (get_local $1) - (get_local $1) - ) + (tee_local $8 + (if (result i32) + (tee_local $8 + (i32.eq + (get_local $7) + (i32.const 0) ) ) + (get_local $8) + (i32.eq + (get_local $4) + (i32.const 255) + ) ) - (i32.const 1) ) - (get_local $7) - (i32.eq - (get_local $4) - (i32.const 255) + (get_local $8) + (block $~lib/builtins/isNaN|inlined.1 (result i32) + (f32.ne + (get_local $1) + (get_local $1) + ) ) ) (i32.const 1) @@ -633,28 +566,22 @@ ) ) ) + (set_local $9 + (i32.shl + (get_local $2) + (i32.const 1) + ) + ) (if (i32.le_u - (i32.shl - (get_local $2) - (i32.const 1) - ) - (i32.shl - (get_local $3) - (i32.const 1) - ) + (get_local $9) + (get_local $7) ) (block (if (i32.eq - (i32.shl - (get_local $2) - (i32.const 1) - ) - (i32.shl - (get_local $3) - (i32.const 1) - ) + (get_local $9) + (get_local $7) ) (return (f32.mul @@ -673,37 +600,15 @@ (get_local $4) ) (block - (block $break|0 - (set_local $8 - (i32.shl - (get_local $2) - (i32.const 9) - ) - ) - (loop $repeat|0 - (br_if $break|0 - (i32.eqz - (i32.eqz - (i32.shr_u - (get_local $8) - (i32.const 31) - ) - ) - ) - ) - (set_local $4 - (i32.sub - (get_local $4) - (i32.const 1) - ) - ) - (set_local $8 + (set_local $4 + (i32.sub + (get_local $4) + (i32.clz (i32.shl - (get_local $8) - (i32.const 1) + (get_local $2) + (i32.const 9) ) ) - (br $repeat|0) ) ) (set_local $2 @@ -745,37 +650,15 @@ (get_local $5) ) (block - (block $break|1 - (set_local $8 - (i32.shl - (get_local $3) - (i32.const 9) - ) - ) - (loop $repeat|1 - (br_if $break|1 - (i32.eqz - (i32.eqz - (i32.shr_u - (get_local $8) - (i32.const 31) - ) - ) - ) - ) - (set_local $5 - (i32.sub - (get_local $5) - (i32.const 1) - ) - ) - (set_local $8 + (set_local $5 + (i32.sub + (get_local $5) + (i32.clz (i32.shl - (get_local $8) - (i32.const 1) + (get_local $3) + (i32.const 9) ) ) - (br $repeat|1) ) ) (set_local $3 @@ -812,9 +695,9 @@ ) ) ) - (block $break|2 - (loop $repeat|2 - (br_if $break|2 + (block $break|0 + (loop $repeat|0 + (br_if $break|0 (i32.eqz (i32.gt_s (get_local $4) @@ -823,7 +706,7 @@ ) ) (block - (set_local $8 + (set_local $10 (i32.sub (get_local $2) (get_local $3) @@ -832,14 +715,14 @@ (if (i32.eqz (i32.shr_u - (get_local $8) + (get_local $10) (i32.const 31) ) ) (block (if (i32.eqz - (get_local $8) + (get_local $10) ) (return (f32.mul @@ -849,7 +732,7 @@ ) ) (set_local $2 - (get_local $8) + (get_local $10) ) ) ) @@ -866,10 +749,10 @@ (i32.const 1) ) ) - (br $repeat|2) + (br $repeat|0) ) ) - (set_local $8 + (set_local $10 (i32.sub (get_local $2) (get_local $3) @@ -878,14 +761,14 @@ (if (i32.eqz (i32.shr_u - (get_local $8) + (get_local $10) (i32.const 31) ) ) (block (if (i32.eqz - (get_local $8) + (get_local $10) ) (return (f32.mul @@ -895,35 +778,28 @@ ) ) (set_local $2 - (get_local $8) + (get_local $10) ) ) ) - (block $break|3 - (loop $repeat|3 - (br_if $break|3 - (i32.eqz - (i32.eqz - (i32.shr_u - (get_local $2) - (i32.const 23) - ) - ) - ) + (set_local $11 + (i32.clz + (i32.shl + (get_local $2) + (i32.const 8) ) - (set_local $4 - (i32.sub - (get_local $4) - (i32.const 1) - ) - ) - (set_local $2 - (i32.shl - (get_local $2) - (i32.const 1) - ) - ) - (br $repeat|3) + ) + ) + (set_local $4 + (i32.sub + (get_local $4) + (get_local $11) + ) + ) + (set_local $2 + (i32.shl + (get_local $2) + (get_local $11) ) ) (if diff --git a/tests/compiler/std/operator-overloading.optimized.wat b/tests/compiler/std/operator-overloading.optimized.wat index 4a9bf031..8ccf42f5 100644 --- a/tests/compiler/std/operator-overloading.optimized.wat +++ b/tests/compiler/std/operator-overloading.optimized.wat @@ -288,19 +288,15 @@ ) ) (func $~lib/math/NativeMath.scalbn (; 9 ;) (; has Stack IR ;) (type $FiF) (param $0 f64) (param $1 i32) (result f64) - (local $2 f64) - (set_local $2 - (get_local $0) - ) (if (i32.gt_s (get_local $1) (i32.const 1023) ) (block - (set_local $2 + (set_local $0 (f64.mul - (get_local $2) + (get_local $0) (f64.const 8988465674311579538646525e283) ) ) @@ -315,14 +311,14 @@ (i32.const 1023) ) (block - (set_local $2 + (set_local $0 (f64.mul - (get_local $2) + (get_local $0) (f64.const 8988465674311579538646525e283) ) ) - (if - (i32.gt_s + (set_local $1 + (select (tee_local $1 (i32.sub (get_local $1) @@ -330,9 +326,10 @@ ) ) (i32.const 1023) - ) - (set_local $1 - (i32.const 1023) + (i32.lt_s + (get_local $1) + (i32.const 1023) + ) ) ) ) @@ -344,10 +341,10 @@ (i32.const -1022) ) (block - (set_local $2 + (set_local $0 (f64.mul - (get_local $2) - (f64.const 2.2250738585072014e-308) + (get_local $0) + (f64.const 2.004168360008973e-292) ) ) (if @@ -355,30 +352,31 @@ (tee_local $1 (i32.add (get_local $1) - (i32.const 1022) + (i32.const 969) ) ) (i32.const -1022) ) (block - (set_local $2 + (set_local $0 (f64.mul - (get_local $2) - (f64.const 2.2250738585072014e-308) + (get_local $0) + (f64.const 2.004168360008973e-292) ) ) - (if - (i32.lt_s + (set_local $1 + (select (tee_local $1 (i32.add (get_local $1) - (i32.const 1022) + (i32.const 969) ) ) (i32.const -1022) - ) - (set_local $1 - (i32.const -1022) + (i32.gt_s + (get_local $1) + (i32.const -1022) + ) ) ) ) @@ -387,7 +385,7 @@ ) ) (f64.mul - (get_local $2) + (get_local $0) (f64.reinterpret/i64 (i64.shl (i64.add @@ -415,12 +413,12 @@ (local $12 i32) (local $13 f64) (local $14 f64) - (local $15 i32) - (local $16 f64) + (local $15 f64) + (local $16 i32) (local $17 i64) (local $18 i32) - (local $19 i32) - (local $20 f64) + (local $19 f64) + (local $20 i32) (block $folding-inner1 (block $folding-inner0 (set_local $18 @@ -435,12 +433,12 @@ ) ) ) - (set_local $7 + (set_local $20 (i32.wrap/i64 (get_local $17) ) ) - (set_local $5 + (set_local $4 (i32.and (get_local $18) (i32.const 2147483647) @@ -449,9 +447,9 @@ (if (i32.eqz (i32.or - (tee_local $11 + (tee_local $12 (i32.and - (tee_local $12 + (tee_local $11 (i32.wrap/i64 (i64.shr_u (tee_local $17 @@ -466,7 +464,7 @@ (i32.const 2147483647) ) ) - (tee_local $19 + (tee_local $7 (i32.wrap/i64 (get_local $17) ) @@ -479,21 +477,51 @@ ) (if (i32.eqz - (tee_local $4 + (tee_local $8 (i32.gt_s - (get_local $5) + (get_local $4) (i32.const 2146435072) ) ) ) (if - (tee_local $4 + (tee_local $8 (i32.eq - (get_local $5) + (get_local $4) (i32.const 2146435072) ) ) - (set_local $4 + (set_local $8 + (i32.ne + (get_local $20) + (i32.const 0) + ) + ) + ) + ) + (if + (i32.eqz + (get_local $8) + ) + (set_local $8 + (i32.gt_s + (get_local $12) + (i32.const 2146435072) + ) + ) + ) + (if + (i32.eqz + (get_local $8) + ) + (if + (tee_local $8 + (i32.eq + (get_local $12) + (i32.const 2146435072) + ) + ) + (set_local $8 (i32.ne (get_local $7) (i32.const 0) @@ -502,37 +530,7 @@ ) ) (if - (i32.eqz - (get_local $4) - ) - (set_local $4 - (i32.gt_s - (get_local $11) - (i32.const 2146435072) - ) - ) - ) - (if - (i32.eqz - (get_local $4) - ) - (if - (tee_local $4 - (i32.eq - (get_local $11) - (i32.const 2146435072) - ) - ) - (set_local $4 - (i32.ne - (get_local $19) - (i32.const 0) - ) - ) - ) - ) - (if - (get_local $4) + (get_local $8) (return (f64.add (get_local $0) @@ -547,122 +545,101 @@ ) (if (i32.ge_s - (get_local $11) + (get_local $12) (i32.const 1128267776) ) - (set_local $15 + (set_local $16 (i32.const 2) ) (if (i32.ge_s - (get_local $11) + (get_local $12) (i32.const 1072693248) ) - (if - (i32.gt_s - (tee_local $10 - (i32.sub - (i32.shr_s - (get_local $11) - (i32.const 20) + (block + (set_local $8 + (i32.sub + (select + (i32.const 52) + (i32.const 20) + (tee_local $5 + (i32.gt_s + (tee_local $10 + (i32.sub + (i32.shr_s + (get_local $12) + (i32.const 20) + ) + (i32.const 1023) + ) + ) + (i32.const 20) + ) ) - (i32.const 1023) ) + (get_local $10) ) - (i32.const 20) ) (if (i32.eq (i32.shl - (tee_local $4 - (i32.shr_u - (get_local $19) - (tee_local $8 - (i32.sub - (i32.const 52) - (get_local $10) + (tee_local $5 + (i32.shr_s + (tee_local $10 + (select + (get_local $7) + (get_local $12) + (get_local $5) ) ) + (get_local $8) ) ) (get_local $8) ) - (get_local $19) + (get_local $10) ) - (set_local $15 + (set_local $16 (i32.sub (i32.const 2) (i32.and - (get_local $4) + (get_local $5) (i32.const 1) ) ) ) ) - (if - (i32.eqz - (get_local $19) - ) - (if - (i32.eq - (i32.shl - (tee_local $4 - (i32.shr_s - (get_local $11) - (tee_local $8 - (i32.sub - (i32.const 20) - (get_local $10) - ) - ) - ) - ) - (get_local $8) - ) - (get_local $11) - ) - (set_local $15 - (i32.sub - (i32.const 2) - (i32.and - (get_local $4) - (i32.const 1) - ) - ) - ) - ) - ) ) ) ) ) (if (i32.eqz - (get_local $19) + (get_local $7) ) (block (if (i32.eq - (get_local $11) + (get_local $12) (i32.const 2146435072) ) (if (i32.or (i32.sub - (get_local $5) + (get_local $4) (i32.const 1072693248) ) - (get_local $7) + (get_local $20) ) (if (i32.ge_s - (get_local $5) + (get_local $4) (i32.const 1072693248) ) (block (if (i32.lt_s - (get_local $12) + (get_local $11) (i32.const 0) ) (set_local $1 @@ -677,7 +654,7 @@ (tee_local $0 (if (result f64) (i32.ge_s - (get_local $12) + (get_local $11) (i32.const 0) ) (f64.const 0) @@ -695,13 +672,13 @@ ) (if (i32.eq - (get_local $11) + (get_local $12) (i32.const 1072693248) ) (block (if (i32.ge_s - (get_local $12) + (get_local $11) (i32.const 0) ) (return @@ -718,7 +695,7 @@ ) (if (i32.eq - (get_local $12) + (get_local $11) (i32.const 1073741824) ) (return @@ -730,7 +707,7 @@ ) (if (i32.eq - (get_local $12) + (get_local $11) (i32.const 1071644672) ) (if @@ -754,41 +731,41 @@ ) (if (i32.eqz - (get_local $7) + (get_local $20) ) (block (if (i32.eqz - (tee_local $4 + (tee_local $5 (i32.eq - (get_local $5) + (get_local $4) (i32.const 2146435072) ) ) ) - (set_local $4 + (set_local $5 (i32.eqz - (get_local $5) + (get_local $4) ) ) ) (if (i32.eqz - (get_local $4) + (get_local $5) ) - (set_local $4 + (set_local $5 (i32.eq - (get_local $5) + (get_local $4) (i32.const 1072693248) ) ) ) (if - (get_local $4) + (get_local $5) (block (if (i32.lt_s - (get_local $12) + (get_local $11) (i32.const 0) ) (set_local $2 @@ -806,14 +783,14 @@ (if (i32.or (i32.sub - (get_local $5) + (get_local $4) (i32.const 1072693248) ) - (get_local $15) + (get_local $16) ) (if (i32.eq - (get_local $15) + (get_local $16) (i32.const 1) ) (set_local $2 @@ -853,7 +830,7 @@ (block (if (i32.eqz - (get_local $15) + (get_local $16) ) (return (f64.div @@ -869,7 +846,7 @@ ) (if (i32.eq - (get_local $15) + (get_local $16) (i32.const 1) ) (set_local $13 @@ -881,26 +858,26 @@ (set_local $2 (if (result f64) (i32.gt_s - (get_local $11) + (get_local $12) (i32.const 1105199104) ) (block (result f64) (if (i32.gt_s - (get_local $11) + (get_local $12) (i32.const 1139802112) ) (block (if (i32.le_s - (get_local $5) + (get_local $4) (i32.const 1072693247) ) (return (tee_local $0 (if (result f64) (i32.lt_s - (get_local $12) + (get_local $11) (i32.const 0) ) (f64.const inf) @@ -911,14 +888,14 @@ ) (if (i32.ge_s - (get_local $5) + (get_local $4) (i32.const 1072693248) ) (return (tee_local $0 (if (result f64) (i32.gt_s - (get_local $12) + (get_local $11) (i32.const 0) ) (f64.const inf) @@ -931,14 +908,14 @@ ) (if (i32.lt_s - (get_local $5) + (get_local $4) (i32.const 1072693247) ) (return (tee_local $0 (if (result f64) (i32.lt_s - (get_local $12) + (get_local $11) (i32.const 0) ) (f64.mul @@ -961,14 +938,14 @@ ) (if (i32.gt_s - (get_local $5) + (get_local $4) (i32.const 1072693248) ) (return (tee_local $0 (if (result f64) (i32.gt_s - (get_local $12) + (get_local $11) (i32.const 0) ) (f64.mul @@ -1017,7 +994,7 @@ ) (set_local $9 (f64.add - (tee_local $16 + (tee_local $15 (f64.mul (f64.const 1.4426950216293335) (get_local $3) @@ -1050,7 +1027,7 @@ ) ) ) - (get_local $16) + (get_local $15) ) ) ) @@ -1060,14 +1037,14 @@ ) (if (i32.lt_s - (get_local $5) + (get_local $4) (i32.const 1048576) ) (block (set_local $7 (i32.const -53) ) - (set_local $5 + (set_local $4 (i32.wrap/i64 (i64.shr_u (i64.reinterpret/f64 @@ -1089,18 +1066,18 @@ (get_local $7) (i32.sub (i32.shr_s - (get_local $5) + (get_local $4) (i32.const 20) ) (i32.const 1023) ) ) ) - (set_local $5 + (set_local $4 (i32.or - (tee_local $8 + (tee_local $5 (i32.and - (get_local $5) + (get_local $4) (i32.const 1048575) ) ) @@ -1110,13 +1087,13 @@ (set_local $10 (if (result i32) (i32.le_s - (get_local $8) + (get_local $5) (i32.const 235662) ) (i32.const 0) (if (result i32) (i32.lt_s - (get_local $8) + (get_local $5) (i32.const 767610) ) (i32.const 1) @@ -1127,9 +1104,9 @@ (i32.const 1) ) ) - (set_local $5 + (set_local $4 (i32.add - (get_local $5) + (get_local $4) (i32.const -1048576) ) ) @@ -1140,7 +1117,7 @@ ) (set_local $9 (f64.mul - (tee_local $16 + (tee_local $15 (f64.sub (tee_local $2 (f64.reinterpret/i64 @@ -1153,7 +1130,7 @@ ) (i64.shl (i64.extend_s/i32 - (get_local $5) + (get_local $4) ) (i64.const 32) ) @@ -1192,7 +1169,7 @@ (i32.add (i32.or (i32.shr_s - (get_local $5) + (get_local $4) (i32.const 1) ) (i32.const 536870912) @@ -1213,7 +1190,7 @@ ) ) ) - (set_local $20 + (set_local $19 (f64.mul (f64.mul (tee_local $14 @@ -1262,7 +1239,7 @@ (get_local $6) (f64.sub (f64.sub - (get_local $16) + (get_local $15) (f64.mul (tee_local $6 (f64.reinterpret/i64 @@ -1295,9 +1272,9 @@ ) ) ) - (tee_local $20 + (tee_local $19 (f64.add - (get_local $20) + (get_local $19) (f64.mul (get_local $0) (f64.add @@ -1311,7 +1288,7 @@ ) (set_local $2 (f64.sub - (get_local $20) + (get_local $19) (f64.sub (f64.sub (tee_local $3 @@ -1332,7 +1309,7 @@ ) (set_local $0 (f64.add - (tee_local $16 + (tee_local $15 (f64.mul (get_local $6) (get_local $3) @@ -1366,7 +1343,7 @@ ) ) ) - (get_local $16) + (get_local $15) ) ) ) @@ -1374,7 +1351,7 @@ (f64.add (f64.add (f64.add - (tee_local $20 + (tee_local $19 (f64.mul (f64.const 0.9617967009544373) (get_local $0) @@ -1434,13 +1411,13 @@ ) (get_local $0) ) - (get_local $20) + (get_local $19) ) ) ) ) ) - (set_local $4 + (set_local $8 (i32.wrap/i64 (tee_local $17 (i64.reinterpret/f64 @@ -1484,7 +1461,7 @@ ) (if (i32.ge_s - (tee_local $8 + (tee_local $5 (i32.wrap/i64 (i64.shr_u (get_local $17) @@ -1498,10 +1475,10 @@ (br_if $folding-inner1 (i32.or (i32.sub - (get_local $8) + (get_local $5) (i32.const 1083179008) ) - (get_local $4) + (get_local $8) ) ) (br_if $folding-inner1 @@ -1520,7 +1497,7 @@ (if (i32.ge_s (i32.and - (get_local $8) + (get_local $5) (i32.const 2147483647) ) (i32.const 1083231232) @@ -1529,10 +1506,10 @@ (br_if $folding-inner0 (i32.or (i32.sub - (get_local $8) + (get_local $5) (i32.const -1064252416) ) - (get_local $4) + (get_local $8) ) ) (br_if $folding-inner0 @@ -1550,9 +1527,9 @@ (set_local $10 (i32.sub (i32.shr_s - (tee_local $4 + (tee_local $8 (i32.and - (get_local $8) + (get_local $5) (i32.const 2147483647) ) ) @@ -1566,7 +1543,7 @@ ) (if (i32.gt_s - (get_local $4) + (get_local $8) (i32.const 1071644672) ) (block @@ -1576,7 +1553,7 @@ (i32.and (tee_local $7 (i32.add - (get_local $8) + (get_local $5) (i32.shr_s (i32.const 1048576) (i32.add @@ -1629,7 +1606,7 @@ ) (if (i32.lt_s - (get_local $8) + (get_local $5) (i32.const 0) ) (set_local $7 @@ -1651,7 +1628,7 @@ (f64.mul (tee_local $2 (f64.add - (tee_local $16 + (tee_local $15 (f64.mul (tee_local $3 (f64.reinterpret/i64 @@ -1696,7 +1673,7 @@ (if (result f64) (i32.le_s (i32.shr_s - (tee_local $8 + (tee_local $5 (i32.add (i32.wrap/i64 (i64.shr_u @@ -1754,7 +1731,7 @@ (get_local $6) (f64.sub (get_local $2) - (get_local $16) + (get_local $15) ) ) ) @@ -1796,7 +1773,7 @@ ) (i64.shl (i64.extend_s/i32 - (get_local $8) + (get_local $5) ) (i64.const 32) ) diff --git a/tests/compiler/std/operator-overloading.untouched.wat b/tests/compiler/std/operator-overloading.untouched.wat index c00e9819..e690c3d9 100644 --- a/tests/compiler/std/operator-overloading.untouched.wat +++ b/tests/compiler/std/operator-overloading.untouched.wat @@ -340,6 +340,8 @@ ) (func $~lib/math/NativeMath.scalbn (; 9 ;) (type $FiF) (param $0 f64) (param $1 i32) (result f64) (local $2 f64) + (local $3 i32) + (local $4 i32) (set_local $2 (get_local $0) ) @@ -374,18 +376,20 @@ ) ) (set_local $1 - (i32.sub - (get_local $1) - (i32.const 1023) - ) - ) - (if - (i32.gt_s - (get_local $1) - (i32.const 1023) - ) - (set_local $1 - (i32.const 1023) + (select + (tee_local $3 + (i32.sub + (get_local $1) + (i32.const 1023) + ) + ) + (tee_local $4 + (i32.const 1023) + ) + (i32.lt_s + (get_local $3) + (get_local $4) + ) ) ) ) @@ -400,13 +404,19 @@ (set_local $2 (f64.mul (get_local $2) - (f64.const 2.2250738585072014e-308) + (f64.mul + (f64.const 2.2250738585072014e-308) + (f64.const 9007199254740992) + ) ) ) (set_local $1 (i32.add (get_local $1) - (i32.const 1022) + (i32.sub + (i32.const 1022) + (i32.const 53) + ) ) ) (if @@ -418,22 +428,30 @@ (set_local $2 (f64.mul (get_local $2) - (f64.const 2.2250738585072014e-308) + (f64.mul + (f64.const 2.2250738585072014e-308) + (f64.const 9007199254740992) + ) ) ) (set_local $1 - (i32.add - (get_local $1) - (i32.const 1022) - ) - ) - (if - (i32.lt_s - (get_local $1) - (i32.const -1022) - ) - (set_local $1 - (i32.const -1022) + (select + (tee_local $3 + (i32.sub + (i32.add + (get_local $1) + (i32.const 1022) + ) + (i32.const 53) + ) + ) + (tee_local $4 + (i32.const -1022) + ) + (i32.gt_s + (get_local $3) + (get_local $4) + ) ) ) ) @@ -467,8 +485,8 @@ (local $9 i32) (local $10 i32) (local $11 i32) - (local $12 f64) - (local $13 f64) + (local $12 i32) + (local $13 i32) (local $14 f64) (local $15 f64) (local $16 f64) @@ -479,10 +497,10 @@ (local $21 f64) (local $22 f64) (local $23 f64) - (local $24 i32) - (local $25 i32) - (local $26 f64) - (local $27 f64) + (local $24 f64) + (local $25 f64) + (local $26 i32) + (local $27 i32) (local $28 f64) (local $29 f64) (local $30 f64) @@ -493,7 +511,9 @@ (local $35 f64) (local $36 f64) (local $37 f64) - (local $38 i32) + (local $38 f64) + (local $39 f64) + (local $40 i32) (set_local $2 (i64.reinterpret/f64 (get_local $0) @@ -642,78 +662,49 @@ (i32.const 1023) ) ) - (if - (i32.gt_s + (set_local $9 + (i32.sub + (select + (i32.const 52) + (i32.const 20) + (i32.gt_s + (get_local $11) + (i32.const 20) + ) + ) (get_local $11) - (i32.const 20) ) - (block - (set_local $9 - (i32.shr_u - (get_local $6) - (i32.sub - (i32.const 52) - (get_local $11) - ) - ) - ) - (if - (i32.eq - (i32.shl - (get_local $9) - (i32.sub - (i32.const 52) - (get_local $11) - ) - ) - (get_local $6) - ) - (set_local $10 - (i32.sub - (i32.const 2) - (i32.and - (get_local $9) - (i32.const 1) - ) - ) - ) + ) + (set_local $12 + (select + (get_local $6) + (get_local $8) + (i32.gt_s + (get_local $11) + (i32.const 20) ) ) - (if - (i32.eq - (get_local $6) - (i32.const 0) + ) + (set_local $13 + (i32.shr_s + (get_local $12) + (get_local $9) + ) + ) + (if + (i32.eq + (i32.shl + (get_local $13) + (get_local $9) ) - (block - (set_local $9 - (i32.shr_s - (get_local $8) - (i32.sub - (i32.const 20) - (get_local $11) - ) - ) - ) - (if - (i32.eq - (i32.shl - (get_local $9) - (i32.sub - (i32.const 20) - (get_local $11) - ) - ) - (get_local $8) - ) - (set_local $10 - (i32.sub - (i32.const 2) - (i32.and - (get_local $9) - (i32.const 1) - ) - ) - ) + (get_local $12) + ) + (set_local $10 + (i32.sub + (i32.const 2) + (i32.and + (get_local $13) + (i32.const 1) ) ) ) @@ -834,7 +825,7 @@ ) ) ) - (set_local $12 + (set_local $14 (f64.abs (get_local $0) ) @@ -846,40 +837,40 @@ ) (if (if (result i32) - (tee_local $9 + (tee_local $13 (if (result i32) - (tee_local $9 + (tee_local $13 (i32.eq (get_local $7) (i32.const 2146435072) ) ) - (get_local $9) + (get_local $13) (i32.eq (get_local $7) (i32.const 0) ) ) ) - (get_local $9) + (get_local $13) (i32.eq (get_local $7) (i32.const 1072693248) ) ) (block - (set_local $13 - (get_local $12) + (set_local $15 + (get_local $14) ) (if (i32.lt_s (get_local $5) (i32.const 0) ) - (set_local $13 + (set_local $15 (f64.div (f64.const 1) - (get_local $13) + (get_local $15) ) ) ) @@ -899,15 +890,15 @@ ) (i32.const 0) ) - (set_local $13 + (set_local $15 (f64.div (f64.sub - (get_local $13) - (get_local $13) + (get_local $15) + (get_local $15) ) (f64.sub - (get_local $13) - (get_local $13) + (get_local $15) + (get_local $15) ) ) ) @@ -916,21 +907,21 @@ (get_local $10) (i32.const 1) ) - (set_local $13 + (set_local $15 (f64.neg - (get_local $13) + (get_local $15) ) ) ) ) ) (return - (get_local $13) + (get_local $15) ) ) ) ) - (set_local $14 + (set_local $16 (f64.const 1) ) (if @@ -962,7 +953,7 @@ (get_local $10) (i32.const 1) ) - (set_local $14 + (set_local $16 (f64.const -1) ) ) @@ -1039,14 +1030,14 @@ ) (f64.mul (f64.mul - (get_local $14) + (get_local $16) (f64.const 1.e+300) ) (f64.const 1.e+300) ) (f64.mul (f64.mul - (get_local $14) + (get_local $16) (f64.const 1e-300) ) (f64.const 1e-300) @@ -1067,14 +1058,14 @@ ) (f64.mul (f64.mul - (get_local $14) + (get_local $16) (f64.const 1.e+300) ) (f64.const 1.e+300) ) (f64.mul (f64.mul - (get_local $14) + (get_local $16) (f64.const 1e-300) ) (f64.const 1e-300) @@ -1082,26 +1073,26 @@ ) ) ) - (set_local $20 + (set_local $22 (f64.sub - (get_local $12) + (get_local $14) (f64.const 1) ) ) - (set_local $23 + (set_local $25 (f64.mul (f64.mul - (get_local $20) - (get_local $20) + (get_local $22) + (get_local $22) ) (f64.sub (f64.const 0.5) (f64.mul - (get_local $20) + (get_local $22) (f64.sub (f64.const 0.3333333333333333) (f64.mul - (get_local $20) + (get_local $22) (f64.const 0.25) ) ) @@ -1109,52 +1100,52 @@ ) ) ) - (set_local $21 + (set_local $23 (f64.mul (f64.const 1.4426950216293335) - (get_local $20) + (get_local $22) ) ) - (set_local $22 + (set_local $24 (f64.sub (f64.mul - (get_local $20) + (get_local $22) (f64.const 1.9259629911266175e-08) ) (f64.mul - (get_local $23) + (get_local $25) (f64.const 1.4426950408889634) ) ) ) - (set_local $15 + (set_local $17 (f64.add - (get_local $21) - (get_local $22) + (get_local $23) + (get_local $24) ) ) - (set_local $15 + (set_local $17 (f64.reinterpret/i64 (i64.and (i64.reinterpret/f64 - (get_local $15) + (get_local $17) ) (i64.const -4294967296) ) ) ) - (set_local $16 + (set_local $18 (f64.sub - (get_local $22) + (get_local $24) (f64.sub - (get_local $15) - (get_local $21) + (get_local $17) + (get_local $23) ) ) ) ) (block - (set_local $25 + (set_local $27 (i32.const 0) ) (if @@ -1163,15 +1154,15 @@ (i32.const 1048576) ) (block - (set_local $12 + (set_local $14 (f64.mul - (get_local $12) + (get_local $14) (f64.const 9007199254740992) ) ) - (set_local $25 + (set_local $27 (i32.sub - (get_local $25) + (get_local $27) (i32.const 53) ) ) @@ -1179,7 +1170,7 @@ (i32.wrap/i64 (i64.shr_u (i64.reinterpret/f64 - (get_local $12) + (get_local $14) ) (i64.const 32) ) @@ -1187,9 +1178,9 @@ ) ) ) - (set_local $25 + (set_local $27 (i32.add - (get_local $25) + (get_local $27) (i32.sub (i32.shr_s (get_local $7) @@ -1199,7 +1190,7 @@ ) ) ) - (set_local $24 + (set_local $26 (i32.and (get_local $7) (i32.const 1048575) @@ -1207,13 +1198,13 @@ ) (set_local $7 (i32.or - (get_local $24) + (get_local $26) (i32.const 1072693248) ) ) (if (i32.le_s - (get_local $24) + (get_local $26) (i32.const 235662) ) (set_local $11 @@ -1221,7 +1212,7 @@ ) (if (i32.lt_s - (get_local $24) + (get_local $26) (i32.const 767610) ) (set_local $11 @@ -1231,9 +1222,9 @@ (set_local $11 (i32.const 0) ) - (set_local $25 + (set_local $27 (i32.add - (get_local $25) + (get_local $27) (i32.const 1) ) ) @@ -1246,12 +1237,12 @@ ) ) ) - (set_local $12 + (set_local $14 (f64.reinterpret/i64 (i64.or (i64.and (i64.reinterpret/f64 - (get_local $12) + (get_local $14) ) (i64.const 4294967295) ) @@ -1264,48 +1255,48 @@ ) ) ) - (set_local $32 + (set_local $34 (select (f64.const 1.5) (f64.const 1) (get_local $11) ) ) - (set_local $21 + (set_local $23 (f64.sub - (get_local $12) - (get_local $32) + (get_local $14) + (get_local $34) ) ) - (set_local $22 + (set_local $24 (f64.div (f64.const 1) (f64.add - (get_local $12) - (get_local $32) + (get_local $14) + (get_local $34) ) ) ) - (set_local $26 + (set_local $28 (f64.mul - (get_local $21) - (get_local $22) + (get_local $23) + (get_local $24) ) ) - (set_local $28 - (get_local $26) + (set_local $30 + (get_local $28) ) - (set_local $28 + (set_local $30 (f64.reinterpret/i64 (i64.and (i64.reinterpret/f64 - (get_local $28) + (get_local $30) ) (i64.const -4294967296) ) ) ) - (set_local $30 + (set_local $32 (f64.reinterpret/i64 (i64.shl (i64.extend_s/i32 @@ -1330,65 +1321,65 @@ ) ) ) - (set_local $31 + (set_local $33 (f64.sub - (get_local $12) + (get_local $14) (f64.sub - (get_local $30) (get_local $32) + (get_local $34) + ) + ) + ) + (set_local $31 + (f64.mul + (get_local $24) + (f64.sub + (f64.sub + (get_local $23) + (f64.mul + (get_local $30) + (get_local $32) + ) + ) + (f64.mul + (get_local $30) + (get_local $33) + ) ) ) ) (set_local $29 (f64.mul - (get_local $22) - (f64.sub - (f64.sub - (get_local $21) - (f64.mul - (get_local $28) - (get_local $30) - ) - ) - (f64.mul - (get_local $28) - (get_local $31) - ) - ) + (get_local $28) + (get_local $28) ) ) - (set_local $27 - (f64.mul - (get_local $26) - (get_local $26) - ) - ) - (set_local $19 + (set_local $21 (f64.mul (f64.mul - (get_local $27) - (get_local $27) + (get_local $29) + (get_local $29) ) (f64.add (f64.const 0.5999999999999946) (f64.mul - (get_local $27) + (get_local $29) (f64.add (f64.const 0.4285714285785502) (f64.mul - (get_local $27) + (get_local $29) (f64.add (f64.const 0.33333332981837743) (f64.mul - (get_local $27) + (get_local $29) (f64.add (f64.const 0.272728123808534) (f64.mul - (get_local $27) + (get_local $29) (f64.add (f64.const 0.23066074577556175) (f64.mul - (get_local $27) + (get_local $29) (f64.const 0.20697501780033842) ) ) @@ -1402,76 +1393,147 @@ ) ) ) - (set_local $19 + (set_local $21 (f64.add - (get_local $19) + (get_local $21) (f64.mul - (get_local $29) + (get_local $31) (f64.add + (get_local $30) (get_local $28) - (get_local $26) ) ) ) ) - (set_local $27 + (set_local $29 (f64.mul - (get_local $28) - (get_local $28) + (get_local $30) + (get_local $30) ) ) - (set_local $30 + (set_local $32 (f64.add (f64.add (f64.const 3) - (get_local $27) + (get_local $29) ) - (get_local $19) + (get_local $21) ) ) - (set_local $30 + (set_local $32 (f64.reinterpret/i64 (i64.and (i64.reinterpret/f64 - (get_local $30) + (get_local $32) ) (i64.const -4294967296) ) ) ) - (set_local $31 + (set_local $33 (f64.sub - (get_local $19) + (get_local $21) (f64.sub (f64.sub - (get_local $30) + (get_local $32) (f64.const 3) ) - (get_local $27) + (get_local $29) ) ) ) - (set_local $21 + (set_local $23 (f64.mul - (get_local $28) (get_local $30) + (get_local $32) + ) + ) + (set_local $24 + (f64.add + (f64.mul + (get_local $31) + (get_local $32) + ) + (f64.mul + (get_local $33) + (get_local $28) + ) + ) + ) + (set_local $19 + (f64.add + (get_local $23) + (get_local $24) + ) + ) + (set_local $19 + (f64.reinterpret/i64 + (i64.and + (i64.reinterpret/f64 + (get_local $19) + ) + (i64.const -4294967296) + ) + ) + ) + (set_local $20 + (f64.sub + (get_local $24) + (f64.sub + (get_local $19) + (get_local $23) + ) + ) + ) + (set_local $35 + (f64.mul + (f64.const 0.9617967009544373) + (get_local $19) + ) + ) + (set_local $36 + (select + (f64.const 1.350039202129749e-08) + (f64.const 0) + (get_local $11) + ) + ) + (set_local $37 + (f64.add + (f64.add + (f64.mul + (f64.const -7.028461650952758e-09) + (get_local $19) + ) + (f64.mul + (get_local $20) + (f64.const 0.9617966939259756) + ) + ) + (get_local $36) ) ) (set_local $22 - (f64.add - (f64.mul - (get_local $29) - (get_local $30) - ) - (f64.mul - (get_local $31) - (get_local $26) - ) + (f64.convert_s/i32 + (get_local $27) + ) + ) + (set_local $38 + (select + (f64.const 0.5849624872207642) + (f64.const 0) + (get_local $11) ) ) (set_local $17 (f64.add - (get_local $21) + (f64.add + (f64.add + (get_local $35) + (get_local $37) + ) + (get_local $38) + ) (get_local $22) ) ) @@ -1487,138 +1549,67 @@ ) (set_local $18 (f64.sub - (get_local $22) - (f64.sub - (get_local $17) - (get_local $21) - ) - ) - ) - (set_local $33 - (f64.mul - (f64.const 0.9617967009544373) - (get_local $17) - ) - ) - (set_local $34 - (select - (f64.const 1.350039202129749e-08) - (f64.const 0) - (get_local $11) - ) - ) - (set_local $35 - (f64.add - (f64.add - (f64.mul - (f64.const -7.028461650952758e-09) - (get_local $17) - ) - (f64.mul - (get_local $18) - (f64.const 0.9617966939259756) - ) - ) - (get_local $34) - ) - ) - (set_local $20 - (f64.convert_s/i32 - (get_local $25) - ) - ) - (set_local $36 - (select - (f64.const 0.5849624872207642) - (f64.const 0) - (get_local $11) - ) - ) - (set_local $15 - (f64.add - (f64.add - (f64.add - (get_local $33) - (get_local $35) - ) - (get_local $36) - ) - (get_local $20) - ) - ) - (set_local $15 - (f64.reinterpret/i64 - (i64.and - (i64.reinterpret/f64 - (get_local $15) - ) - (i64.const -4294967296) - ) - ) - ) - (set_local $16 - (f64.sub - (get_local $35) + (get_local $37) (f64.sub (f64.sub (f64.sub - (get_local $15) - (get_local $20) + (get_local $17) + (get_local $22) ) - (get_local $36) + (get_local $38) ) - (get_local $33) + (get_local $35) ) ) ) ) ) - (set_local $37 + (set_local $39 (get_local $1) ) - (set_local $37 + (set_local $39 (f64.reinterpret/i64 (i64.and (i64.reinterpret/f64 - (get_local $37) + (get_local $39) ) (i64.const -4294967296) ) ) ) - (set_local $18 + (set_local $20 (f64.add (f64.mul (f64.sub (get_local $1) - (get_local $37) + (get_local $39) ) - (get_local $15) + (get_local $17) ) (f64.mul (get_local $1) - (get_local $16) + (get_local $18) ) ) ) - (set_local $17 + (set_local $19 (f64.mul - (get_local $37) - (get_local $15) + (get_local $39) + (get_local $17) ) ) - (set_local $13 + (set_local $15 (f64.add - (get_local $18) - (get_local $17) + (get_local $20) + (get_local $19) ) ) (set_local $2 (i64.reinterpret/f64 - (get_local $13) + (get_local $15) ) ) - (set_local $24 + (set_local $26 (i32.wrap/i64 (i64.shr_u (get_local $2) @@ -1626,14 +1617,14 @@ ) ) ) - (set_local $38 + (set_local $40 (i32.wrap/i64 (get_local $2) ) ) (if (i32.ge_s - (get_local $24) + (get_local $26) (i32.const 1083179008) ) (block @@ -1641,17 +1632,17 @@ (i32.ne (i32.or (i32.sub - (get_local $24) + (get_local $26) (i32.const 1083179008) ) - (get_local $38) + (get_local $40) ) (i32.const 0) ) (return (f64.mul (f64.mul - (get_local $14) + (get_local $16) (f64.const 1.e+300) ) (f64.const 1.e+300) @@ -1661,18 +1652,18 @@ (if (f64.gt (f64.add - (get_local $18) + (get_local $20) (f64.const 8.008566259537294e-17) ) (f64.sub - (get_local $13) - (get_local $17) + (get_local $15) + (get_local $19) ) ) (return (f64.mul (f64.mul - (get_local $14) + (get_local $16) (f64.const 1.e+300) ) (f64.const 1.e+300) @@ -1683,7 +1674,7 @@ (if (i32.ge_s (i32.and - (get_local $24) + (get_local $26) (i32.const 2147483647) ) (i32.const 1083231232) @@ -1693,17 +1684,17 @@ (i32.ne (i32.or (i32.sub - (get_local $24) + (get_local $26) (i32.const -1064252416) ) - (get_local $38) + (get_local $40) ) (i32.const 0) ) (return (f64.mul (f64.mul - (get_local $14) + (get_local $16) (f64.const 1e-300) ) (f64.const 1e-300) @@ -1712,16 +1703,16 @@ ) (if (f64.le - (get_local $18) + (get_local $20) (f64.sub - (get_local $13) - (get_local $17) + (get_local $15) + (get_local $19) ) ) (return (f64.mul (f64.mul - (get_local $14) + (get_local $16) (f64.const 1e-300) ) (f64.const 1e-300) @@ -1731,33 +1722,33 @@ ) ) ) - (set_local $38 + (set_local $40 (i32.and - (get_local $24) + (get_local $26) (i32.const 2147483647) ) ) (set_local $11 (i32.sub (i32.shr_s - (get_local $38) + (get_local $40) (i32.const 20) ) (i32.const 1023) ) ) - (set_local $25 + (set_local $27 (i32.const 0) ) (if (i32.gt_s - (get_local $38) + (get_local $40) (i32.const 1071644672) ) (block - (set_local $25 + (set_local $27 (i32.add - (get_local $24) + (get_local $26) (i32.shr_s (i32.const 1048576) (i32.add @@ -1771,7 +1762,7 @@ (i32.sub (i32.shr_s (i32.and - (get_local $25) + (get_local $27) (i32.const 2147483647) ) (i32.const 20) @@ -1779,15 +1770,15 @@ (i32.const 1023) ) ) - (set_local $20 + (set_local $22 (f64.const 0) ) - (set_local $20 + (set_local $22 (f64.reinterpret/i64 (i64.shl (i64.extend_s/i32 (i32.and - (get_local $25) + (get_local $27) (i32.xor (i32.shr_s (i32.const 1048575) @@ -1801,11 +1792,11 @@ ) ) ) - (set_local $25 + (set_local $27 (i32.shr_s (i32.or (i32.and - (get_local $25) + (get_local $27) (i32.const 1048575) ) (i32.const 1048576) @@ -1818,106 +1809,106 @@ ) (if (i32.lt_s - (get_local $24) + (get_local $26) (i32.const 0) ) - (set_local $25 + (set_local $27 (i32.sub (i32.const 0) - (get_local $25) + (get_local $27) ) ) ) - (set_local $17 + (set_local $19 (f64.sub - (get_local $17) - (get_local $20) + (get_local $19) + (get_local $22) ) ) ) ) - (set_local $20 + (set_local $22 (f64.add - (get_local $18) - (get_local $17) + (get_local $20) + (get_local $19) ) ) - (set_local $20 + (set_local $22 (f64.reinterpret/i64 (i64.and (i64.reinterpret/f64 - (get_local $20) + (get_local $22) ) (i64.const -4294967296) ) ) ) - (set_local $21 + (set_local $23 (f64.mul - (get_local $20) + (get_local $22) (f64.const 0.6931471824645996) ) ) - (set_local $22 + (set_local $24 (f64.add (f64.mul (f64.sub - (get_local $18) + (get_local $20) (f64.sub - (get_local $20) - (get_local $17) + (get_local $22) + (get_local $19) ) ) (f64.const 0.6931471805599453) ) (f64.mul - (get_local $20) + (get_local $22) (f64.const -1.904654299957768e-09) ) ) ) - (set_local $13 + (set_local $15 (f64.add - (get_local $21) - (get_local $22) + (get_local $23) + (get_local $24) ) ) - (set_local $23 + (set_local $25 (f64.sub - (get_local $22) + (get_local $24) (f64.sub - (get_local $13) - (get_local $21) + (get_local $15) + (get_local $23) ) ) ) - (set_local $20 + (set_local $22 (f64.mul - (get_local $13) - (get_local $13) + (get_local $15) + (get_local $15) ) ) - (set_local $15 + (set_local $17 (f64.sub - (get_local $13) + (get_local $15) (f64.mul - (get_local $20) + (get_local $22) (f64.add (f64.const 0.16666666666666602) (f64.mul - (get_local $20) + (get_local $22) (f64.add (f64.const -2.7777777777015593e-03) (f64.mul - (get_local $20) + (get_local $22) (f64.add (f64.const 6.613756321437934e-05) (f64.mul - (get_local $20) + (get_local $22) (f64.add (f64.const -1.6533902205465252e-06) (f64.mul - (get_local $20) + (get_local $22) (f64.const 4.1381367970572385e-08) ) ) @@ -1930,51 +1921,51 @@ ) ) ) - (set_local $19 + (set_local $21 (f64.sub (f64.div (f64.mul - (get_local $13) (get_local $15) + (get_local $17) ) (f64.sub - (get_local $15) + (get_local $17) (f64.const 2) ) ) (f64.add - (get_local $23) + (get_local $25) (f64.mul - (get_local $13) - (get_local $23) + (get_local $15) + (get_local $25) ) ) ) ) - (set_local $13 + (set_local $15 (f64.sub (f64.const 1) (f64.sub - (get_local $19) - (get_local $13) + (get_local $21) + (get_local $15) ) ) ) - (set_local $24 + (set_local $26 (i32.wrap/i64 (i64.shr_u (i64.reinterpret/f64 - (get_local $13) + (get_local $15) ) (i64.const 32) ) ) ) - (set_local $24 + (set_local $26 (i32.add - (get_local $24) + (get_local $26) (i32.shl - (get_local $25) + (get_local $27) (i32.const 20) ) ) @@ -1982,29 +1973,29 @@ (if (i32.le_s (i32.shr_s - (get_local $24) + (get_local $26) (i32.const 20) ) (i32.const 0) ) - (set_local $13 + (set_local $15 (call $~lib/math/NativeMath.scalbn - (get_local $13) - (get_local $25) + (get_local $15) + (get_local $27) ) ) - (set_local $13 + (set_local $15 (f64.reinterpret/i64 (i64.or (i64.and (i64.reinterpret/f64 - (get_local $13) + (get_local $15) ) (i64.const 4294967295) ) (i64.shl (i64.extend_s/i32 - (get_local $24) + (get_local $26) ) (i64.const 32) ) @@ -2013,8 +2004,8 @@ ) ) (f64.mul - (get_local $14) - (get_local $13) + (get_local $16) + (get_local $15) ) ) (func $std/operator-overloading/Tester.pow (; 11 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)