summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/lit/help/wasm-opt.test3
-rw-r--r--test/lit/help/wasm2js.test3
-rw-r--r--test/lit/passes/signext-lowering.wast66
3 files changed, 72 insertions, 0 deletions
diff --git a/test/lit/help/wasm-opt.test b/test/lit/help/wasm-opt.test
index 4fd50abcc..2af38f982 100644
--- a/test/lit/help/wasm-opt.test
+++ b/test/lit/help/wasm-opt.test
@@ -386,6 +386,9 @@
;; CHECK-NEXT: --signature-refining apply more specific subtypes to
;; CHECK-NEXT: signature types where possible
;; CHECK-NEXT:
+;; CHECK-NEXT: --signext-lowering lower sign-ext operations to
+;; CHECK-NEXT: wasm mvp
+;; CHECK-NEXT:
;; CHECK-NEXT: --simplify-globals miscellaneous globals-related
;; CHECK-NEXT: optimizations
;; CHECK-NEXT:
diff --git a/test/lit/help/wasm2js.test b/test/lit/help/wasm2js.test
index 7a782c872..e5669563d 100644
--- a/test/lit/help/wasm2js.test
+++ b/test/lit/help/wasm2js.test
@@ -345,6 +345,9 @@
;; CHECK-NEXT: --signature-refining apply more specific subtypes to
;; CHECK-NEXT: signature types where possible
;; CHECK-NEXT:
+;; CHECK-NEXT: --signext-lowering lower sign-ext operations to
+;; CHECK-NEXT: wasm mvp
+;; CHECK-NEXT:
;; CHECK-NEXT: --simplify-globals miscellaneous globals-related
;; CHECK-NEXT: optimizations
;; CHECK-NEXT:
diff --git a/test/lit/passes/signext-lowering.wast b/test/lit/passes/signext-lowering.wast
new file mode 100644
index 000000000..f17479e53
--- /dev/null
+++ b/test/lit/passes/signext-lowering.wast
@@ -0,0 +1,66 @@
+;; NOTE: Assertions have been generated by update_lit_checks.py --all-items and should not be edited.
+
+;; RUN: wasm-opt %s --signext-lowering --enable-sign-ext -S -o - | filecheck %s
+
+(module
+ ;; CHECK: (type $0 (func))
+ (type $0 (func))
+ ;; CHECK: (func $signext
+ ;; CHECK-NEXT: (local $0 i32)
+ ;; CHECK-NEXT: (local $1 i64)
+ ;; CHECK-NEXT: (drop
+ ;; CHECK-NEXT: (i32.shr_s
+ ;; CHECK-NEXT: (i32.shl
+ ;; CHECK-NEXT: (local.get $0)
+ ;; CHECK-NEXT: (i32.const 24)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (i32.const 24)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (drop
+ ;; CHECK-NEXT: (i32.shr_s
+ ;; CHECK-NEXT: (i32.shl
+ ;; CHECK-NEXT: (local.get $0)
+ ;; CHECK-NEXT: (i32.const 16)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (i32.const 16)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (drop
+ ;; CHECK-NEXT: (i64.shr_s
+ ;; CHECK-NEXT: (i64.shl
+ ;; CHECK-NEXT: (local.get $1)
+ ;; CHECK-NEXT: (i64.const 56)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (i64.const 56)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (drop
+ ;; CHECK-NEXT: (i64.shr_s
+ ;; CHECK-NEXT: (i64.shl
+ ;; CHECK-NEXT: (local.get $1)
+ ;; CHECK-NEXT: (i64.const 48)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (i64.const 48)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (drop
+ ;; CHECK-NEXT: (i64.shr_s
+ ;; CHECK-NEXT: (i64.shl
+ ;; CHECK-NEXT: (local.get $1)
+ ;; CHECK-NEXT: (i64.const 32)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (i64.const 32)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ (func $signext (type $0)
+ (local $0 i32)
+ (local $1 i64)
+ (drop (i32.extend8_s (local.get $0)))
+ (drop (i32.extend16_s (local.get $0)))
+ (drop (i64.extend8_s (local.get $1)))
+ (drop (i64.extend16_s (local.get $1)))
+ (drop (i64.extend32_s (local.get $1)))
+ )
+)