summaryrefslogtreecommitdiff
path: root/test/lit/strings.wast
diff options
context:
space:
mode:
authorJérôme Vouillon <jerome.vouillon@gmail.com>2023-05-12 23:43:09 +0200
committerGitHub <noreply@github.com>2023-05-12 14:43:09 -0700
commit71a151240241fd50c42d88fe0ba9800c03527387 (patch)
treede98957b6f5341c3b14147c0cf6e1753d38940fe /test/lit/strings.wast
parentd7b14a67ca4e9b111d5733239af88328cb779030 (diff)
downloadbinaryen-71a151240241fd50c42d88fe0ba9800c03527387.tar.gz
binaryen-71a151240241fd50c42d88fe0ba9800c03527387.tar.bz2
binaryen-71a151240241fd50c42d88fe0ba9800c03527387.zip
[Strings] Adopt new instruction binary encoding (#5714)
See WebAssembly/stringref#46. This format is already adopted by V8: https://chromium-review.googlesource.com/c/v8/v8/+/3892695. The text format is left unchanged (see #5607 for a discussion on the subject). I have also added support for string.encode_lossy_utf8 and string.encode_lossy_utf8 array (by allowing the replace policy for Binaryen's string.encode_wtf8 instruction).
Diffstat (limited to 'test/lit/strings.wast')
-rw-r--r--test/lit/strings.wast34
1 files changed, 34 insertions, 0 deletions
diff --git a/test/lit/strings.wast b/test/lit/strings.wast
index 1e38ff894..dcb1bffd2 100644
--- a/test/lit/strings.wast
+++ b/test/lit/strings.wast
@@ -184,6 +184,14 @@
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: (drop
+ ;; CHECK-NEXT: (i32.eqz
+ ;; CHECK-NEXT: (string.encode_wtf8 replace
+ ;; CHECK-NEXT: (local.get $ref)
+ ;; CHECK-NEXT: (i32.const 10)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (drop
;; CHECK-NEXT: (string.encode_wtf8 utf8
;; CHECK-NEXT: (local.get $ref)
;; CHECK-NEXT: (i32.const 20)
@@ -206,6 +214,14 @@
)
)
(drop
+ (i32.eqz ;; validate the output is i32
+ (string.encode_wtf8 replace
+ (local.get $ref)
+ (i32.const 10)
+ )
+ )
+ )
+ (drop
(string.encode_wtf8 utf8
(local.get $ref)
(i32.const 20)
@@ -546,6 +562,15 @@
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: (drop
+ ;; CHECK-NEXT: (i32.eqz
+ ;; CHECK-NEXT: (string.encode_wtf8_array replace
+ ;; CHECK-NEXT: (local.get $ref)
+ ;; CHECK-NEXT: (local.get $array)
+ ;; CHECK-NEXT: (i32.const 10)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (drop
;; CHECK-NEXT: (string.encode_wtf8_array utf8
;; CHECK-NEXT: (local.get $ref)
;; CHECK-NEXT: (local.get $array)
@@ -571,6 +596,15 @@
)
)
(drop
+ (i32.eqz ;; validate the output is i32
+ (string.encode_wtf8_array replace
+ (local.get $ref)
+ (local.get $array)
+ (i32.const 10)
+ )
+ )
+ )
+ (drop
(string.encode_wtf8_array utf8
(local.get $ref)
(local.get $array)