From 90c726a606cf8f99307a41d8f889de4e1221c4f8 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Fri, 3 Feb 2023 12:32:25 -0800 Subject: [Strings] Add experimental string.hash instruction (#5480) See WebAssembly/stringref#60 --- test/lit/strings.wast | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'test') diff --git a/test/lit/strings.wast b/test/lit/strings.wast index a871811e5..63139d900 100644 --- a/test/lit/strings.wast +++ b/test/lit/strings.wast @@ -37,6 +37,8 @@ ;; CHECK: (type $ref|$array|_=>_none (func (param (ref $array)))) + ;; CHECK: (type $stringref_=>_i32 (func (param stringref) (result i32))) + ;; CHECK: (global $string-const stringref (string.const "string in a global \01\ff\00\t\t\n\n\r\r\"\"\'\'\\\\")) (global $string-const stringref (string.const "string in a global \01\ff\00\t\09\n\0a\r\0d\"\22\'\27\\\5c")) @@ -626,4 +628,15 @@ ) ) ) + + ;; CHECK: (func $string.hash (type $stringref_=>_i32) (param $ref stringref) (result i32) + ;; CHECK-NEXT: (string.hash + ;; CHECK-NEXT: (local.get $ref) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $string.hash (param $ref stringref) (result i32) + (string.hash + (local.get $ref) + ) + ) ) -- cgit v1.2.3