xref: /llvm-project/llvm/test/CodeGen/PowerPC/vec-icmpeq-v2i64-p7.ll (revision 69b056d5638bbe3c8098b5d3a4980eb9929b9bbe)
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2; RUN: llc -verify-machineinstrs -mcpu=pwr7 -mtriple=powerpc-aix- < %s | \
3; RUN:   FileCheck %s
4; RUN: llc -verify-machineinstrs -mcpu=pwr7 -mtriple=powerpc64le-- < %s | \
5; RUN:   FileCheck %s --check-prefix=CHECK_LE
6; RUN: llc -verify-machineinstrs -mcpu=pwr8 -mtriple=powerpc64le-- < %s | \
7; RUN:   FileCheck %s --check-prefix=CHECK_P8LE
8define i1 @shufeq(<2 x i64> %a) #0 {
9; CHECK-LABEL: shufeq:
10; CHECK:       # %bb.0: # %entry
11; CHECK-NEXT:    xxswapd 35, 34
12; CHECK-NEXT:    lwz 3, L..C0(2) # %const.0
13; CHECK-NEXT:    vcmpequw 2, 2, 3
14; CHECK-NEXT:    lxvw4x 35, 0, 3
15; CHECK-NEXT:    addi 3, 1, -16
16; CHECK-NEXT:    vperm 3, 2, 2, 3
17; CHECK-NEXT:    xxland 0, 35, 34
18; CHECK-NEXT:    stxvw4x 0, 0, 3
19; CHECK-NEXT:    lwz 3, -12(1)
20; CHECK-NEXT:    blr
21;
22; CHECK_LE-LABEL: shufeq:
23; CHECK_LE:       # %bb.0: # %entry
24; CHECK_LE-NEXT:    addis 3, 2, .LCPI0_0@toc@ha
25; CHECK_LE-NEXT:    xxswapd 35, 34
26; CHECK_LE-NEXT:    addi 3, 3, .LCPI0_0@toc@l
27; CHECK_LE-NEXT:    lxvd2x 0, 0, 3
28; CHECK_LE-NEXT:    addi 3, 1, -16
29; CHECK_LE-NEXT:    vcmpequw 2, 2, 3
30; CHECK_LE-NEXT:    xxswapd 36, 0
31; CHECK_LE-NEXT:    vperm 3, 2, 2, 4
32; CHECK_LE-NEXT:    xxland 0, 35, 34
33; CHECK_LE-NEXT:    xxswapd 0, 0
34; CHECK_LE-NEXT:    stxvd2x 0, 0, 3
35; CHECK_LE-NEXT:    ld 3, -16(1)
36; CHECK_LE-NEXT:    blr
37;
38; CHECK_P8LE-LABEL: shufeq:
39; CHECK_P8LE:       # %bb.0: # %entry
40; CHECK_P8LE-NEXT:    xxswapd 35, 34
41; CHECK_P8LE-NEXT:    vcmpequd 2, 2, 3
42; CHECK_P8LE-NEXT:    xxswapd 0, 34
43; CHECK_P8LE-NEXT:    mffprd 3, 0
44; CHECK_P8LE-NEXT:    blr
45entry:
46  %0 = shufflevector <2 x i64> %a, <2 x i64> poison, <2 x i32> <i32 1, i32 undef>
47  %1 = icmp eq <2 x i64> %a, %0
48  %2 = extractelement <2 x i1> %1, i32 0
49  ret i1 %2
50}
51
52define i1 @shufne(<2 x i64> %a) #0 {
53; CHECK-LABEL: shufne:
54; CHECK:       # %bb.0: # %entry
55; CHECK-NEXT:    xxswapd 35, 34
56; CHECK-NEXT:    lwz 3, L..C1(2) # %const.0
57; CHECK-NEXT:    vcmpequw 2, 2, 3
58; CHECK-NEXT:    lxvw4x 35, 0, 3
59; CHECK-NEXT:    addi 3, 1, -16
60; CHECK-NEXT:    vperm 3, 2, 2, 3
61; CHECK-NEXT:    xxland 0, 35, 34
62; CHECK-NEXT:    stxvw4x 0, 0, 3
63; CHECK-NEXT:    lwz 3, -12(1)
64; CHECK-NEXT:    blr
65;
66; CHECK_LE-LABEL: shufne:
67; CHECK_LE:       # %bb.0: # %entry
68; CHECK_LE-NEXT:    addis 3, 2, .LCPI1_0@toc@ha
69; CHECK_LE-NEXT:    xxswapd 35, 34
70; CHECK_LE-NEXT:    addi 3, 3, .LCPI1_0@toc@l
71; CHECK_LE-NEXT:    lxvd2x 0, 0, 3
72; CHECK_LE-NEXT:    addi 3, 1, -16
73; CHECK_LE-NEXT:    vcmpequw 2, 2, 3
74; CHECK_LE-NEXT:    xxswapd 36, 0
75; CHECK_LE-NEXT:    vperm 3, 2, 2, 4
76; CHECK_LE-NEXT:    xxland 0, 35, 34
77; CHECK_LE-NEXT:    xxswapd 0, 0
78; CHECK_LE-NEXT:    stxvd2x 0, 0, 3
79; CHECK_LE-NEXT:    ld 3, -16(1)
80; CHECK_LE-NEXT:    blr
81;
82; CHECK_P8LE-LABEL: shufne:
83; CHECK_P8LE:       # %bb.0: # %entry
84; CHECK_P8LE-NEXT:    xxswapd 35, 34
85; CHECK_P8LE-NEXT:    vcmpequd 2, 2, 3
86; CHECK_P8LE-NEXT:    xxswapd 0, 34
87; CHECK_P8LE-NEXT:    mffprd 3, 0
88; CHECK_P8LE-NEXT:    blr
89entry:
90  %0 = shufflevector <2 x i64> %a, <2 x i64> poison, <2 x i32> <i32 1, i32 undef>
91  %1 = icmp eq <2 x i64> %a, %0
92  %2 = extractelement <2 x i1> %1, i32 0
93  ret i1 %2
94}
95
96define <2 x i64> @cmpeq(<2 x i64> noundef %a, <2 x i64> noundef %b) {
97; CHECK-LABEL: cmpeq:
98; CHECK:       # %bb.0: # %entry
99; CHECK-NEXT:    lwz 3, L..C2(2) # %const.0
100; CHECK-NEXT:    vcmpequw 2, 2, 3
101; CHECK-NEXT:    lxvw4x 35, 0, 3
102; CHECK-NEXT:    vperm 3, 2, 2, 3
103; CHECK-NEXT:    xxland 34, 35, 34
104; CHECK-NEXT:    blr
105;
106; CHECK_LE-LABEL: cmpeq:
107; CHECK_LE:       # %bb.0: # %entry
108; CHECK_LE-NEXT:    addis 3, 2, .LCPI2_0@toc@ha
109; CHECK_LE-NEXT:    vcmpequw 2, 2, 3
110; CHECK_LE-NEXT:    addi 3, 3, .LCPI2_0@toc@l
111; CHECK_LE-NEXT:    lxvd2x 0, 0, 3
112; CHECK_LE-NEXT:    xxswapd 36, 0
113; CHECK_LE-NEXT:    vperm 3, 2, 2, 4
114; CHECK_LE-NEXT:    xxland 34, 35, 34
115; CHECK_LE-NEXT:    blr
116;
117; CHECK_P8LE-LABEL: cmpeq:
118; CHECK_P8LE:       # %bb.0: # %entry
119; CHECK_P8LE-NEXT:    vcmpequd 2, 2, 3
120; CHECK_P8LE-NEXT:    blr
121entry:
122  %cmp = icmp eq <2 x i64> %a, %b
123  %sext = sext <2 x i1> %cmp to <2 x i64>
124  ret <2 x i64> %sext
125}
126
127define <2 x i64> @cmpne(<2 x i64> noundef %a, <2 x i64> noundef %b) {
128; CHECK-LABEL: cmpne:
129; CHECK:       # %bb.0: # %entry
130; CHECK-NEXT:    lwz 3, L..C3(2) # %const.0
131; CHECK-NEXT:    vcmpequw 2, 2, 3
132; CHECK-NEXT:    lxvw4x 35, 0, 3
133; CHECK-NEXT:    xxlnor 34, 34, 34
134; CHECK-NEXT:    vperm 3, 2, 2, 3
135; CHECK-NEXT:    xxlor 34, 35, 34
136; CHECK-NEXT:    blr
137;
138; CHECK_LE-LABEL: cmpne:
139; CHECK_LE:       # %bb.0: # %entry
140; CHECK_LE-NEXT:    addis 3, 2, .LCPI3_0@toc@ha
141; CHECK_LE-NEXT:    vcmpequw 2, 2, 3
142; CHECK_LE-NEXT:    addi 3, 3, .LCPI3_0@toc@l
143; CHECK_LE-NEXT:    lxvd2x 0, 0, 3
144; CHECK_LE-NEXT:    xxlnor 34, 34, 34
145; CHECK_LE-NEXT:    xxswapd 36, 0
146; CHECK_LE-NEXT:    vperm 3, 2, 2, 4
147; CHECK_LE-NEXT:    xxlor 34, 35, 34
148; CHECK_LE-NEXT:    blr
149;
150; CHECK_P8LE-LABEL: cmpne:
151; CHECK_P8LE:       # %bb.0: # %entry
152; CHECK_P8LE-NEXT:    vcmpequd 2, 2, 3
153; CHECK_P8LE-NEXT:    xxlnor 34, 34, 34
154; CHECK_P8LE-NEXT:    blr
155entry:
156  %cmp = icmp ne <2 x i64> %a, %b
157  %sext = sext <2 x i1> %cmp to <2 x i64>
158  ret <2 x i64> %sext
159}
160
161