Skip to content

Commit 604902c

Browse files
committed
Move AArch64ISD selection into TableGen
1 parent e0898a0 commit 604902c

File tree

2 files changed

+12
-27
lines changed

2 files changed

+12
-27
lines changed

llvm/lib/Target/AArch64/AArch64ISelDAGToDAG.cpp

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,6 @@ class AArch64DAGToDAGISel : public SelectionDAGISel {
424424
void SelectPostStoreLane(SDNode *N, unsigned NumVecs, unsigned Opc);
425425
void SelectPredicatedStore(SDNode *N, unsigned NumVecs, unsigned Scale,
426426
unsigned Opc_rr, unsigned Opc_ri);
427-
void SelectFCVT_FPTOINT_Half(SDNode *N, unsigned Opc);
428427
std::tuple<unsigned, SDValue, SDValue>
429428
findAddrModeSVELoadStore(SDNode *N, unsigned Opc_rr, unsigned Opc_ri,
430429
const SDValue &OldBase, const SDValue &OldOffset,
@@ -2537,24 +2536,6 @@ void AArch64DAGToDAGISel::SelectPostStoreLane(SDNode *N, unsigned NumVecs,
25372536
ReplaceNode(N, St);
25382537
}
25392538

2540-
// Select f16 -> i16 conversions
2541-
// Since i16 is an illegal type, we return the converted bit pattern in a f32
2542-
// which can then be bitcast to i32 and truncated as needed.
2543-
void AArch64DAGToDAGISel::SelectFCVT_FPTOINT_Half(SDNode *N, unsigned int Opc) {
2544-
SDLoc DL(N);
2545-
SDValue SrcVal = N->getOperand(0);
2546-
SDNode *Cvt = CurDAG->getMachineNode(Opc, DL, MVT::f16, SrcVal);
2547-
SDValue Sign = CurDAG->getTargetConstant(-1, DL, MVT::i64);
2548-
SDValue Hsub = CurDAG->getTargetConstant(AArch64::hsub, DL, MVT::i32);
2549-
SDNode *SubregToReg = CurDAG->getMachineNode(
2550-
TargetOpcode::SUBREG_TO_REG, DL, MVT::v8f16, Sign, SDValue(Cvt, 0), Hsub);
2551-
SDValue Ssub = CurDAG->getTargetConstant(AArch64::ssub, DL, MVT::i32);
2552-
SDNode *Extract =
2553-
CurDAG->getMachineNode(TargetOpcode::EXTRACT_SUBREG, DL, MVT::f32,
2554-
SDValue(SubregToReg, 0), Ssub);
2555-
ReplaceNode(N, Extract);
2556-
}
2557-
25582539
static bool isBitfieldExtractOpFromAnd(SelectionDAG *CurDAG, SDNode *N,
25592540
unsigned &Opc, SDValue &Opd0,
25602541
unsigned &LSB, unsigned &MSB,
@@ -7378,14 +7359,6 @@ void AArch64DAGToDAGISel::Select(SDNode *Node) {
73787359
}
73797360
break;
73807361
}
7381-
case AArch64ISD::FCVTZS_HALF: {
7382-
SelectFCVT_FPTOINT_Half(Node, AArch64::FCVTZSv1f16);
7383-
return;
7384-
}
7385-
case AArch64ISD::FCVTZU_HALF: {
7386-
SelectFCVT_FPTOINT_Half(Node, AArch64::FCVTZUv1f16);
7387-
return;
7388-
}
73897362
}
73907363

73917364
// Select the default instruction

llvm/lib/Target/AArch64/AArch64InstrInfo.td

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6542,6 +6542,18 @@ defm USQADD : SIMDTwoScalarBHSDTied< 1, 0b00011, "usqadd",
65426542
def : Pat<(v1i64 (AArch64vashr (v1i64 V64:$Rn), (i32 63))),
65436543
(CMLTv1i64rz V64:$Rn)>;
65446544

6545+
// f16 -> s16 conversions leave the bit pattern in a f32
6546+
class F16ToS16ScalarPat<SDNode cvt_isd, BaseSIMDTwoScalar instr>
6547+
: Pat<(f32 (cvt_isd (f16 FPR16:$Rn))),
6548+
(EXTRACT_SUBREG
6549+
(v8f16 (SUBREG_TO_REG (i64 0), (instr FPR16:$Rn), hsub)),
6550+
ssub)>;
6551+
6552+
let Predicates = [HasFullFP16] in {
6553+
def : F16ToS16ScalarPat<AArch64fcvtzs_half, FCVTZSv1f16>;
6554+
def : F16ToS16ScalarPat<AArch64fcvtzu_half, FCVTZUv1f16>;
6555+
}
6556+
65456557
// Round FP64 to BF16.
65466558
let Predicates = [HasNEONandIsStreamingSafe, HasBF16] in
65476559
def : Pat<(bf16 (any_fpround (f64 FPR64:$Rn))),

0 commit comments

Comments
 (0)