|
| 1 | +; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5 |
| 2 | +; RUN: llc < %s -O3 -verify-machineinstrs -disable-wasm-fallthrough-return-opt -wasm-disable-explicit-locals -wasm-keep-registers -mattr=+simd128 | FileCheck %s |
| 3 | +target triple = "wasm32-unknown-unknown" |
| 4 | + |
| 5 | +define void @bitselect_first_zero(ptr %output, ptr %input) { |
| 6 | +; CHECK-LABEL: bitselect_first_zero: |
| 7 | +; CHECK: .functype bitselect_first_zero (i32, i32) -> () |
| 8 | +; CHECK-NEXT: # %bb.0: # %start |
| 9 | +; CHECK-NEXT: v128.const $push7=, 0, 0, 0, 0 |
| 10 | +; CHECK-NEXT: local.tee $push6=, $3=, $pop7 |
| 11 | +; CHECK-NEXT: v128.load $push5=, 0($1) |
| 12 | +; CHECK-NEXT: local.tee $push4=, $2=, $pop5 |
| 13 | +; CHECK-NEXT: v128.const $push0=, 2139095040, 2139095040, 2139095040, 2139095040 |
| 14 | +; CHECK-NEXT: v128.and $push1=, $2, $pop0 |
| 15 | +; CHECK-NEXT: i32x4.eq $push2=, $3, $pop1 |
| 16 | +; CHECK-NEXT: v128.bitselect $push3=, $pop6, $pop4, $pop2 |
| 17 | +; CHECK-NEXT: v128.store 0($0), $pop3 |
| 18 | +; CHECK-NEXT: return |
| 19 | +start: |
| 20 | + %input.val = load <4 x i32>, ptr %input, align 16 |
| 21 | + %0 = and <4 x i32> %input.val, splat (i32 2139095040) |
| 22 | + %1 = icmp eq <4 x i32> %0, zeroinitializer |
| 23 | + %2 = select <4 x i1> %1, <4 x i32> zeroinitializer, <4 x i32> %input.val |
| 24 | + store <4 x i32> %2, ptr %output, align 16 |
| 25 | + ret void |
| 26 | +} |
| 27 | + |
| 28 | + |
| 29 | +define void @bitselect_second_zero(ptr %output, ptr %input) { |
| 30 | +; CHECK-LABEL: bitselect_second_zero: |
| 31 | +; CHECK: .functype bitselect_second_zero (i32, i32) -> () |
| 32 | +; CHECK-NEXT: # %bb.0: # %start |
| 33 | +; CHECK-NEXT: v128.load $push7=, 0($1) |
| 34 | +; CHECK-NEXT: local.tee $push6=, $2=, $pop7 |
| 35 | +; CHECK-NEXT: v128.const $push5=, 0, 0, 0, 0 |
| 36 | +; CHECK-NEXT: local.tee $push4=, $3=, $pop5 |
| 37 | +; CHECK-NEXT: v128.const $push0=, 2139095040, 2139095040, 2139095040, 2139095040 |
| 38 | +; CHECK-NEXT: v128.and $push1=, $2, $pop0 |
| 39 | +; CHECK-NEXT: i32x4.eq $push2=, $3, $pop1 |
| 40 | +; CHECK-NEXT: v128.bitselect $push3=, $pop6, $pop4, $pop2 |
| 41 | +; CHECK-NEXT: v128.store 0($0), $pop3 |
| 42 | +; CHECK-NEXT: return |
| 43 | +start: |
| 44 | + %input.val = load <4 x i32>, ptr %input, align 16 |
| 45 | + %0 = and <4 x i32> %input.val, splat (i32 2139095040) |
| 46 | + %1 = icmp eq <4 x i32> %0, zeroinitializer |
| 47 | + %2 = select <4 x i1> %1, <4 x i32> %input.val, <4 x i32> zeroinitializer |
| 48 | + store <4 x i32> %2, ptr %output, align 16 |
| 49 | + ret void |
| 50 | +} |
0 commit comments