From 8388a33e84c0730f5a7c7e89bd089ad7c9db9455 Mon Sep 17 00:00:00 2001 From: Sam Clegg Date: Thu, 3 Nov 2022 15:06:32 -0700 Subject: Update default features to match new llvm defaults (#5212) See: https://reviews.llvm.org/D125728 --- test/lit/passes/optimize-instructions-default.wast | 130 +++++++++++++++++++++ 1 file changed, 130 insertions(+) create mode 100644 test/lit/passes/optimize-instructions-default.wast (limited to 'test/lit/passes/optimize-instructions-default.wast') diff --git a/test/lit/passes/optimize-instructions-default.wast b/test/lit/passes/optimize-instructions-default.wast new file mode 100644 index 000000000..ab40b4dd5 --- /dev/null +++ b/test/lit/passes/optimize-instructions-default.wast @@ -0,0 +1,130 @@ +;; NOTE: Assertions have been generated by update_lit_checks.py and should not be edited. +;; RUN: wasm-opt %s --optimize-instructions -S -o - | filecheck %s + +(module + ;; CHECK: (func $duplicate-elimination (param $x i32) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (i32.extend8_s + ;; CHECK-NEXT: (local.get $x) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (i32.extend16_s + ;; CHECK-NEXT: (local.get $x) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $duplicate-elimination (param $x i32) + (drop (i32.extend8_s (i32.extend8_s (local.get $x)))) + (drop (i32.extend16_s (i32.extend16_s (local.get $x)))) + ) + + ;; i64(x) << 56 >> 56 ==> i64.extend8_s(x) + ;; i64(x) << 48 >> 48 ==> i64.extend16_s(x) + ;; i64(x) << 32 >> 32 ==> i64.extend32_s(x) + ;; i64.extend_i32_s(i32.wrap_i64(x)) ==> i64.extend32_s(x) + + ;; CHECK: (func $i64-sign-extentions (param $x i64) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (i64.extend8_s + ;; CHECK-NEXT: (local.get $x) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (i64.extend16_s + ;; CHECK-NEXT: (local.get $x) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (i64.extend32_s + ;; CHECK-NEXT: (local.get $x) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (i64.shr_s + ;; CHECK-NEXT: (i64.shl + ;; CHECK-NEXT: (local.get $x) + ;; CHECK-NEXT: (i64.const 16) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i64.const 16) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (i64.extend32_s + ;; CHECK-NEXT: (local.get $x) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $i64-sign-extentions (param $x i64) + (drop (i64.shr_s (i64.shl (local.get $x) (i64.const 56)) (i64.const 56))) + (drop (i64.shr_s (i64.shl (local.get $x) (i64.const 48)) (i64.const 48))) + (drop (i64.shr_s (i64.shl (local.get $x) (i64.const 32)) (i64.const 32))) + (drop (i64.shr_s (i64.shl (local.get $x) (i64.const 16)) (i64.const 16))) ;; skip + (drop (i64.extend_i32_s (i32.wrap_i64 (local.get $x)))) + ) + + ;; i32(x) << 24 >> 24 ==> i32.extend8_s(x) + ;; i32(x) << 16 >> 16 ==> i32.extend16_s(x) + + ;; CHECK: (func $i32-sign-extentions (param $x i32) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (i32.extend8_s + ;; CHECK-NEXT: (local.get $x) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (i32.extend16_s + ;; CHECK-NEXT: (local.get $x) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (i32.shr_s + ;; CHECK-NEXT: (i32.shl + ;; CHECK-NEXT: (local.get $x) + ;; CHECK-NEXT: (i32.const 8) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.const 8) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (i32.and + ;; CHECK-NEXT: (local.get $x) + ;; CHECK-NEXT: (i32.const 255) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (i32.and + ;; CHECK-NEXT: (local.get $x) + ;; CHECK-NEXT: (i32.const 65535) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (i32.shr_s + ;; CHECK-NEXT: (i32.shl + ;; CHECK-NEXT: (local.get $x) + ;; CHECK-NEXT: (i32.const 16) + ;; 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 $x) + ;; CHECK-NEXT: (i32.const 24) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.const 16) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $i32-sign-extentions (param $x i32) + (drop (i32.shr_s (i32.shl (local.get $x) (i32.const 24)) (i32.const 24))) + (drop (i32.shr_s (i32.shl (local.get $x) (i32.const 16)) (i32.const 16))) + + (drop (i32.shr_s (i32.shl (local.get $x) (i32.const 8)) (i32.const 8))) ;; skip + (drop (i32.shr_u (i32.shl (local.get $x) (i32.const 24)) (i32.const 24))) ;; skip + (drop (i32.shr_u (i32.shl (local.get $x) (i32.const 16)) (i32.const 16))) ;; skip + (drop (i32.shr_s (i32.shl (local.get $x) (i32.const 16)) (i32.const 24))) ;; skip + (drop (i32.shr_s (i32.shl (local.get $x) (i32.const 24)) (i32.const 16))) ;; skip + ) +) -- cgit v1.2.3