Skip to content

Commit c9c9bf0

Browse files
committed
[DAG] WidenVectorOperand - add basic handling for *_EXTEND_VECTOR_INREG nodes
Fixes Issue llvm#70208
1 parent 2d292ab commit c9c9bf0

File tree

3 files changed

+36
-0
lines changed

3 files changed

+36
-0
lines changed

llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1000,6 +1000,7 @@ class LLVM_LIBRARY_VISIBILITY DAGTypeLegalizer {
10001000
SDValue WidenVecOp_EXTRACT_VECTOR_ELT(SDNode *N);
10011001
SDValue WidenVecOp_INSERT_SUBVECTOR(SDNode *N);
10021002
SDValue WidenVecOp_EXTRACT_SUBVECTOR(SDNode *N);
1003+
SDValue WidenVecOp_EXTEND_VECTOR_INREG(SDNode *N);
10031004
SDValue WidenVecOp_STORE(SDNode* N);
10041005
SDValue WidenVecOp_VP_STORE(SDNode *N, unsigned OpNo);
10051006
SDValue WidenVecOp_VP_STRIDED_STORE(SDNode *N, unsigned OpNo);

llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5959,6 +5959,11 @@ bool DAGTypeLegalizer::WidenVectorOperand(SDNode *N, unsigned OpNo) {
59595959
case ISD::EXPERIMENTAL_VP_STRIDED_STORE:
59605960
Res = WidenVecOp_VP_STRIDED_STORE(N, OpNo);
59615961
break;
5962+
case ISD::ANY_EXTEND_VECTOR_INREG:
5963+
case ISD::SIGN_EXTEND_VECTOR_INREG:
5964+
case ISD::ZERO_EXTEND_VECTOR_INREG:
5965+
Res = WidenVecOp_EXTEND_VECTOR_INREG(N);
5966+
break;
59625967
case ISD::MSTORE: Res = WidenVecOp_MSTORE(N, OpNo); break;
59635968
case ISD::MGATHER: Res = WidenVecOp_MGATHER(N, OpNo); break;
59645969
case ISD::MSCATTER: Res = WidenVecOp_MSCATTER(N, OpNo); break;
@@ -6377,6 +6382,11 @@ SDValue DAGTypeLegalizer::WidenVecOp_EXTRACT_VECTOR_ELT(SDNode *N) {
63776382
N->getValueType(0), InOp, N->getOperand(1));
63786383
}
63796384

6385+
SDValue DAGTypeLegalizer::WidenVecOp_EXTEND_VECTOR_INREG(SDNode *N) {
6386+
SDValue InOp = GetWidenedVector(N->getOperand(0));
6387+
return DAG.getNode(N->getOpcode(), SDLoc(N), N->getValueType(0), InOp);
6388+
}
6389+
63806390
SDValue DAGTypeLegalizer::WidenVecOp_STORE(SDNode *N) {
63816391
// We have to widen the value, but we want only to store the original
63826392
// vector type.

llvm/test/CodeGen/PowerPC/pr70208.ll

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 3
2+
; RUN: llc -verify-machineinstrs -mtriple=ppc64le-unknown-linux-gnu < %s | FileCheck %s
3+
4+
define <4 x i64> @widget(<8 x i16> %call) {
5+
; CHECK-LABEL: widget:
6+
; CHECK: # %bb.0:
7+
; CHECK-NEXT: addis 3, 2, .LCPI0_0@toc@ha
8+
; CHECK-NEXT: xxlxor 32, 32, 32
9+
; CHECK-NEXT: addi 3, 3, .LCPI0_0@toc@l
10+
; CHECK-NEXT: lxvd2x 0, 0, 3
11+
; CHECK-NEXT: addis 3, 2, .LCPI0_1@toc@ha
12+
; CHECK-NEXT: addi 3, 3, .LCPI0_1@toc@l
13+
; CHECK-NEXT: xxswapd 35, 0
14+
; CHECK-NEXT: lxvd2x 0, 0, 3
15+
; CHECK-NEXT: vperm 4, 0, 2, 3
16+
; CHECK-NEXT: xxswapd 37, 0
17+
; CHECK-NEXT: vperm 3, 0, 2, 5
18+
; CHECK-NEXT: vmr 2, 4
19+
; CHECK-NEXT: blr
20+
%bitcast = bitcast <8 x i16> %call to <16 x i8>
21+
%shufflevector = shufflevector <16 x i8> <i8 poison, i8 poison, i8 0, i8 0, i8 poison, i8 poison, i8 0, i8 0, i8 poison, i8 poison, i8 0, i8 0, i8 poison, i8 poison, i8 0, i8 0>, <16 x i8> %bitcast, <16 x i32> <i32 16, i32 17, i32 2, i32 3, i32 18, i32 19, i32 6, i32 7, i32 20, i32 21, i32 10, i32 11, i32 22, i32 23, i32 14, i32 15>
22+
%bitcast1 = bitcast <16 x i8> %shufflevector to <4 x i32>
23+
%zext = zext <4 x i32> %bitcast1 to <4 x i64>
24+
ret <4 x i64> %zext
25+
}

0 commit comments

Comments
 (0)