;; NOTE: Assertions have been generated by update_lit_checks.py and should not be edited. ;; RUN: wasm-opt %s --optimize-for-js -all -S -o - \ ;; RUN: | filecheck %s (module ;; CHECK: (func $is-power-of-2_32 (type $1) (param $x i32) (result i32) ;; CHECK-NEXT: (i32.and ;; CHECK-NEXT: (i32.eqz ;; CHECK-NEXT: (i32.eqz ;; CHECK-NEXT: (local.get $x) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (i32.eqz ;; CHECK-NEXT: (i32.and ;; CHECK-NEXT: (local.get $x) ;; CHECK-NEXT: (i32.sub ;; CHECK-NEXT: (local.get $x) ;; CHECK-NEXT: (i32.const 1) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) (func $is-power-of-2_32 (param $x i32) (result i32) (i32.eq (i32.popcnt (local.get $x)) (i32.const 1) ) ) ;; CHECK: (func $is-power-of-2_expr_32 (type $0) (param $x i64) (result i32) ;; CHECK-NEXT: (local $1 i32) ;; CHECK-NEXT: (i32.and ;; CHECK-NEXT: (i32.eqz ;; CHECK-NEXT: (i32.eqz ;; CHECK-NEXT: (local.tee $1 ;; CHECK-NEXT: (i32.wrap_i64 ;; CHECK-NEXT: (local.get $x) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (i32.eqz ;; CHECK-NEXT: (i32.and ;; CHECK-NEXT: (local.get $1) ;; CHECK-NEXT: (i32.sub ;; CHECK-NEXT: (local.get $1) ;; CHECK-NEXT: (i32.const 1) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) (func $is-power-of-2_expr_32 (param $x i64) (result i32) (i32.eq (i32.popcnt (i32.wrap_i64 (local.get $x))) (i32.const 1) ) ) ;; CHECK: (func $is-power-of-2_64 (type $0) (param $x i64) (result i32) ;; CHECK-NEXT: (i32.and ;; CHECK-NEXT: (i32.eqz ;; CHECK-NEXT: (i64.eqz ;; CHECK-NEXT: (local.get $x) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (i64.eqz ;; CHECK-NEXT: (i64.and ;; CHECK-NEXT: (local.get $x) ;; CHECK-NEXT: (i64.sub ;; CHECK-NEXT: (local.get $x) ;; CHECK-NEXT: (i64.const 1) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) (func $is-power-of-2_64 (param $x i64) (result i32) (i64.eq (i64.popcnt (local.get $x)) (i64.const 1) ) ) )