Skip to content

Commit 57e8899

Browse files
authored
[Hexagon] Add missing patterns to select PFALSE and PTRUE (llvm#138712)
Fixes llvm#134659
1 parent 650dca5 commit 57e8899

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

llvm/lib/Target/Hexagon/HexagonPatterns.td

+5
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,12 @@ def pfalse: PatFrag<(ops), (HexagonPFALSE)>;
109109
def pnot: PatFrag<(ops node:$Pu), (xor node:$Pu, ptrue)>;
110110

111111
def: Pat<(v8i1 (HexagonPFALSE)), (C2_tfrrp (A2_tfrsi (i32 0)))>;
112+
def: Pat<(v4i1 (HexagonPFALSE)), (C2_tfrrp (A2_tfrsi (i32 0)))>;
113+
def: Pat<(v2i1 (HexagonPFALSE)), (C2_tfrrp (A2_tfrsi (i32 0)))>;
114+
112115
def: Pat<(v8i1 (HexagonPTRUE)), (C2_tfrrp (A2_tfrsi (i32 -1)))>;
116+
def: Pat<(v4i1 (HexagonPTRUE)), (C2_tfrrp (A2_tfrsi (i32 -1)))>;
117+
def: Pat<(v2i1 (HexagonPTRUE)), (C2_tfrrp (A2_tfrsi (i32 -1)))>;
113118

114119
def valign: PatFrag<(ops node:$Vt, node:$Vs, node:$Ru),
115120
(HexagonVALIGN node:$Vt, node:$Vs, node:$Ru)>;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
; RUN: llc -march=hexagon -debug-only=isel 2>&1 < %s - | FileCheck %s
2+
3+
; CHECK: [[R0:%[0-9]+]]:intregs = A2_tfrsi 0
4+
; CHECK-NEXT: predregs = C2_tfrrp killed [[R0]]:intregs
5+
6+
define fastcc i16 @test(ptr %0, { <4 x i32>, <4 x i1> } %1, <4 x i1> %2) {
7+
Entry:
8+
%3 = alloca [16 x i8], i32 0, align 16
9+
%4 = alloca [16 x i8], i32 0, align 16
10+
store <4 x i32> <i32 1, i32 2, i32 3, i32 4>, ptr %4, align 16
11+
store <4 x i32> <i32 5, i32 6, i32 7, i32 8>, ptr %3, align 16
12+
%5 = load <4 x i32>, ptr %4, align 16
13+
%6 = load <4 x i32>, ptr %3, align 16
14+
%7 = call { <4 x i32>, <4 x i1> } @llvm.sadd.with.overflow.v4i32(<4 x i32> %5, <4 x i32> %6)
15+
%8 = call i1 @llvm.vector.reduce.or.v4i1(<4 x i1> %2)
16+
br i1 %8, label %OverflowFail, label %OverflowOk
17+
18+
OverflowFail: ; preds = %Entry
19+
store volatile i32 0, ptr null, align 4
20+
unreachable
21+
22+
OverflowOk: ; preds = %Entry
23+
%9 = extractvalue { <4 x i32>, <4 x i1> } %7, 0
24+
store <4 x i32> %9, ptr %0, align 16
25+
ret i16 0
26+
}
27+
28+
declare { <4 x i32>, <4 x i1> } @llvm.sadd.with.overflow.v4i32(<4 x i32>, <4 x i32>) #0
29+
declare i1 @llvm.vector.reduce.or.v4i1(<4 x i1>) #0

0 commit comments

Comments
 (0)