Skip to content

Commit 2f3a8d0

Browse files
committed
[DAGCombine] Precommit test for isConstantSplatVectorAll
Precommit test for isConstantSplatVectorAll in VSelect
1 parent 41eac8f commit 2f3a8d0

File tree

1 file changed

+74
-0
lines changed

1 file changed

+74
-0
lines changed
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
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 <4 x i32> @bitselect_splat_first_zero_and_icmp(<4 x i32> %input) {
6+
; CHECK-LABEL: bitselect_splat_first_zero_and_icmp:
7+
; CHECK: .functype bitselect_splat_first_zero_and_icmp (v128) -> (v128)
8+
; CHECK-NEXT: # %bb.0: # %start
9+
; CHECK-NEXT: v128.const $push5=, 0, 0, 0, 0
10+
; CHECK-NEXT: local.tee $push4=, $1=, $pop5
11+
; CHECK-NEXT: v128.const $push0=, 2139095040, 2139095040, 2139095040, 2139095040
12+
; CHECK-NEXT: v128.and $push1=, $0, $pop0
13+
; CHECK-NEXT: i32x4.eq $push2=, $1, $pop1
14+
; CHECK-NEXT: v128.bitselect $push3=, $pop4, $0, $pop2
15+
; CHECK-NEXT: return $pop3
16+
start:
17+
%0 = and <4 x i32> %input, splat (i32 2139095040)
18+
%1 = icmp eq <4 x i32> %0, zeroinitializer
19+
%2 = select <4 x i1> %1, <4 x i32> zeroinitializer, <4 x i32> %input
20+
ret <4 x i32> %2
21+
}
22+
23+
24+
define <4 x i32> @bitselect_splat_second_zero_and_icmp(<4 x i32> %input) {
25+
; CHECK-LABEL: bitselect_splat_second_zero_and_icmp:
26+
; CHECK: .functype bitselect_splat_second_zero_and_icmp (v128) -> (v128)
27+
; CHECK-NEXT: # %bb.0: # %start
28+
; CHECK-NEXT: v128.const $push5=, 0, 0, 0, 0
29+
; CHECK-NEXT: local.tee $push4=, $1=, $pop5
30+
; CHECK-NEXT: v128.const $push0=, 2139095040, 2139095040, 2139095040, 2139095040
31+
; CHECK-NEXT: v128.and $push1=, $0, $pop0
32+
; CHECK-NEXT: i32x4.eq $push2=, $1, $pop1
33+
; CHECK-NEXT: v128.bitselect $push3=, $0, $pop4, $pop2
34+
; CHECK-NEXT: return $pop3
35+
start:
36+
%0 = and <4 x i32> %input, splat (i32 2139095040)
37+
%1 = icmp eq <4 x i32> %0, zeroinitializer
38+
%2 = select <4 x i1> %1, <4 x i32> %input, <4 x i32> zeroinitializer
39+
ret <4 x i32> %2
40+
}
41+
42+
43+
define <4 x i32> @bitselect_splat_first_zero_cond_input(<4 x i1> %cond, <4 x i32> %input) {
44+
; CHECK-LABEL: bitselect_splat_first_zero_cond_input:
45+
; CHECK: .functype bitselect_splat_first_zero_cond_input (v128, v128) -> (v128)
46+
; CHECK-NEXT: # %bb.0: # %start
47+
; CHECK-NEXT: v128.const $push3=, 0, 0, 0, 0
48+
; CHECK-NEXT: i32.const $push0=, 31
49+
; CHECK-NEXT: i32x4.shl $push1=, $0, $pop0
50+
; CHECK-NEXT: i32.const $push5=, 31
51+
; CHECK-NEXT: i32x4.shr_s $push2=, $pop1, $pop5
52+
; CHECK-NEXT: v128.bitselect $push4=, $pop3, $1, $pop2
53+
; CHECK-NEXT: return $pop4
54+
start:
55+
%2 = select <4 x i1> %cond, <4 x i32> zeroinitializer, <4 x i32> %input
56+
ret <4 x i32> %2
57+
}
58+
59+
define <4 x i32> @bitselect_splat_second_zero_cond_input(<4 x i1> %cond, <4 x i32> %input) {
60+
; CHECK-LABEL: bitselect_splat_second_zero_cond_input:
61+
; CHECK: .functype bitselect_splat_second_zero_cond_input (v128, v128) -> (v128)
62+
; CHECK-NEXT: # %bb.0: # %start
63+
; CHECK-NEXT: v128.const $push3=, 0, 0, 0, 0
64+
; CHECK-NEXT: i32.const $push0=, 31
65+
; CHECK-NEXT: i32x4.shl $push1=, $0, $pop0
66+
; CHECK-NEXT: i32.const $push5=, 31
67+
; CHECK-NEXT: i32x4.shr_s $push2=, $pop1, $pop5
68+
; CHECK-NEXT: v128.bitselect $push4=, $1, $pop3, $pop2
69+
; CHECK-NEXT: return $pop4
70+
start:
71+
%2 = select <4 x i1> %cond, <4 x i32> %input, <4 x i32> zeroinitializer
72+
ret <4 x i32> %2
73+
}
74+

0 commit comments

Comments
 (0)