15#ifndef LLVM_LIB_CODEGEN_SELECTIONDAG_LEGALIZETYPES_H
16#define LLVM_LIB_CODEGEN_SELECTIONDAG_LEGALIZETYPES_H
67 bool isTypeLegal(EVT VT)
const {
68 return TLI.getTypeAction(*DAG.
getContext(), VT) == TargetLowering::TypeLegal;
72 bool isSimpleLegalType(EVT VT)
const {
73 return VT.isSimple() && TLI.isTypeLegal(VT);
76 EVT getSetCCResultType(EVT VT)
const {
81 bool IgnoreNodeResults(SDNode *
N)
const {
82 return N->getOpcode() == ISD::TargetConstant ||
83 N->getOpcode() == ISD::Register;
89 typedef unsigned TableId;
91 TableId NextValueId = 1;
93 SmallDenseMap<SDValue, TableId, 8> ValueToIdMap;
94 SmallDenseMap<TableId, SDValue, 8> IdToValueMap;
98 SmallDenseMap<TableId, TableId, 8> PromotedIntegers;
102 SmallDenseMap<TableId, std::pair<TableId, TableId>, 8> ExpandedIntegers;
106 SmallDenseMap<TableId, TableId, 8> SoftenedFloats;
110 SmallDenseMap<TableId, TableId, 8> PromotedFloats;
114 SmallDenseMap<TableId, TableId, 8> SoftPromotedHalfs;
118 SmallDenseMap<TableId, std::pair<TableId, TableId>, 8> ExpandedFloats;
122 SmallDenseMap<TableId, TableId, 8> ScalarizedVectors;
126 SmallDenseMap<TableId, std::pair<TableId, TableId>, 8> SplitVectors;
130 SmallDenseMap<TableId, TableId, 8> WidenedVectors;
134 SmallDenseMap<TableId, TableId, 8> ReplacedValues;
138 SmallVector<SDNode*, 128> Worklist;
140 TableId getTableId(SDValue V) {
141 assert(
V.getNode() &&
"Getting TableId on SDValue()");
143 auto I = ValueToIdMap.find(V);
144 if (
I != ValueToIdMap.end()) {
147 assert(
I->second &&
"All Ids should be nonzero");
151 ValueToIdMap.insert(std::make_pair(V, NextValueId));
152 IdToValueMap.insert(std::make_pair(NextValueId, V));
154 assert(NextValueId != 0 &&
155 "Ran out of Ids. Increase id type size or add compactification");
156 return NextValueId - 1;
159 const SDValue &getSDValue(TableId &Id) {
161 assert(Id &&
"TableId should be non-zero");
162 auto I = IdToValueMap.find(Id);
163 assert(
I != IdToValueMap.end() &&
"cannot find Id in map");
169 : TLI(dag.getTargetLoweringInfo()), DAG(dag),
170 ValueTypeActions(TLI.getValueTypeActions()) {
179 assert(Old != New &&
"node replaced with self");
180 for (
unsigned i = 0, e = Old->
getNumValues(); i != e; ++i) {
184 if (OldId != NewId) {
185 ReplacedValues[OldId] = NewId;
190 IdToValueMap.erase(OldId);
191 PromotedIntegers.erase(OldId);
192 ExpandedIntegers.erase(OldId);
193 SoftenedFloats.erase(OldId);
194 PromotedFloats.erase(OldId);
195 SoftPromotedHalfs.erase(OldId);
196 ExpandedFloats.erase(OldId);
197 ScalarizedVectors.erase(OldId);
198 SplitVectors.erase(OldId);
199 WidenedVectors.erase(OldId);
202 ValueToIdMap.erase(
SDValue(Old, i));
210 void AnalyzeNewValue(
SDValue &Val);
211 void PerformExpensiveChecks();
212 void RemapId(TableId &Id);
219 bool CustomLowerNode(
SDNode *
N,
EVT VT,
bool LegalizeResult);
229 std::pair<SDValue, SDValue> ExpandAtomic(
SDNode *
Node);
252 TableId &PromotedId = PromotedIntegers[getTableId(
Op)];
253 SDValue PromotedOp = getSDValue(PromotedId);
257 void SetPromotedInteger(SDValue Op, SDValue Result);
260 SDValue SExtPromotedInteger(SDValue Op) {
261 EVT OldVT = Op.getValueType();
263 Op = GetPromotedInteger(Op);
264 return DAG.
getNode(ISD::SIGN_EXTEND_INREG, dl, Op.getValueType(), Op,
269 SDValue ZExtPromotedInteger(SDValue Op) {
270 EVT OldVT =
Op.getValueType();
272 Op = GetPromotedInteger(Op);
277 SDValue VPSExtPromotedInteger(SDValue Op, SDValue Mask, SDValue EVL) {
278 EVT OldVT =
Op.getValueType();
280 Op = GetPromotedInteger(Op);
282 EVT VT =
Op.getValueType();
283 unsigned BitsDiff = VT.getScalarSizeInBits() - OldVT.getScalarSizeInBits();
285 SDValue Shl = DAG.
getNode(ISD::VP_SHL, dl, VT, Op, ShiftCst, Mask, EVL);
286 return DAG.
getNode(ISD::VP_SRA, dl, VT, Shl, ShiftCst, Mask, EVL);
290 SDValue VPZExtPromotedInteger(SDValue Op, SDValue Mask, SDValue EVL) {
291 EVT OldVT =
Op.getValueType();
293 Op = GetPromotedInteger(Op);
301 SDValue PromoteIntOpVectorReduction(SDNode *
N, SDValue V);
304 void PromoteIntegerResult(SDNode *
N,
unsigned ResNo);
305 SDValue PromoteIntRes_MERGE_VALUES(SDNode *
N,
unsigned ResNo);
306 SDValue PromoteIntRes_AssertSext(SDNode *
N);
307 SDValue PromoteIntRes_AssertZext(SDNode *
N);
308 SDValue PromoteIntRes_Atomic0(AtomicSDNode *
N);
309 SDValue PromoteIntRes_Atomic1(AtomicSDNode *
N);
310 SDValue PromoteIntRes_AtomicCmpSwap(AtomicSDNode *
N,
unsigned ResNo);
311 SDValue PromoteIntRes_EXTRACT_SUBVECTOR(SDNode *
N);
312 SDValue PromoteIntRes_INSERT_SUBVECTOR(SDNode *
N);
313 SDValue PromoteIntRes_VECTOR_REVERSE(SDNode *
N);
314 SDValue PromoteIntRes_VECTOR_SHUFFLE(SDNode *
N);
315 SDValue PromoteIntRes_VECTOR_SPLICE(SDNode *
N);
316 SDValue PromoteIntRes_VECTOR_INTERLEAVE_DEINTERLEAVE(SDNode *
N);
317 SDValue PromoteIntRes_BUILD_VECTOR(SDNode *
N);
318 SDValue PromoteIntRes_ScalarOp(SDNode *
N);
319 SDValue PromoteIntRes_STEP_VECTOR(SDNode *
N);
320 SDValue PromoteIntRes_EXTEND_VECTOR_INREG(SDNode *
N);
321 SDValue PromoteIntRes_INSERT_VECTOR_ELT(SDNode *
N);
322 SDValue PromoteIntRes_CONCAT_VECTORS(SDNode *
N);
323 SDValue PromoteIntRes_BITCAST(SDNode *
N);
324 SDValue PromoteIntRes_BSWAP(SDNode *
N);
325 SDValue PromoteIntRes_BITREVERSE(SDNode *
N);
326 SDValue PromoteIntRes_BUILD_PAIR(SDNode *
N);
327 SDValue PromoteIntRes_Constant(SDNode *
N);
328 SDValue PromoteIntRes_CTLZ(SDNode *
N);
329 SDValue PromoteIntRes_CTPOP_PARITY(SDNode *
N);
330 SDValue PromoteIntRes_CTTZ(SDNode *
N);
331 SDValue PromoteIntRes_VP_CttzElements(SDNode *
N);
332 SDValue PromoteIntRes_EXTRACT_VECTOR_ELT(SDNode *
N);
333 SDValue PromoteIntRes_FP_TO_XINT(SDNode *
N);
334 SDValue PromoteIntRes_FP_TO_XINT_SAT(SDNode *
N);
335 SDValue PromoteIntRes_FP_TO_FP16_BF16(SDNode *
N);
336 SDValue PromoteIntRes_STRICT_FP_TO_FP16_BF16(SDNode *
N);
337 SDValue PromoteIntRes_XRINT(SDNode *
N);
338 SDValue PromoteIntRes_FREEZE(SDNode *
N);
339 SDValue PromoteIntRes_INT_EXTEND(SDNode *
N);
340 SDValue PromoteIntRes_LOAD(LoadSDNode *
N);
341 SDValue PromoteIntRes_VP_LOAD(VPLoadSDNode *
N);
342 SDValue PromoteIntRes_MLOAD(MaskedLoadSDNode *
N);
343 SDValue PromoteIntRes_MGATHER(MaskedGatherSDNode *
N);
344 SDValue PromoteIntRes_VECTOR_COMPRESS(SDNode *
N);
345 SDValue PromoteIntRes_Overflow(SDNode *
N);
346 SDValue PromoteIntRes_FFREXP(SDNode *
N);
347 SDValue PromoteIntRes_SADDSUBO(SDNode *
N,
unsigned ResNo);
348 SDValue PromoteIntRes_CMP(SDNode *
N);
349 SDValue PromoteIntRes_Select(SDNode *
N);
350 SDValue PromoteIntRes_SELECT_CC(SDNode *
N);
351 SDValue PromoteIntRes_SETCC(SDNode *
N);
352 SDValue PromoteIntRes_SHL(SDNode *
N);
353 SDValue PromoteIntRes_SimpleIntBinOp(SDNode *
N);
354 SDValue PromoteIntRes_ZExtIntBinOp(SDNode *
N);
355 SDValue PromoteIntRes_SExtIntBinOp(SDNode *
N);
356 SDValue PromoteIntRes_UMINUMAX(SDNode *
N);
357 SDValue PromoteIntRes_SIGN_EXTEND_INREG(SDNode *
N);
358 SDValue PromoteIntRes_SRA(SDNode *
N);
359 SDValue PromoteIntRes_SRL(SDNode *
N);
360 SDValue PromoteIntRes_TRUNCATE(SDNode *
N);
361 SDValue PromoteIntRes_UADDSUBO(SDNode *
N,
unsigned ResNo);
362 SDValue PromoteIntRes_UADDSUBO_CARRY(SDNode *
N,
unsigned ResNo);
363 SDValue PromoteIntRes_SADDSUBO_CARRY(SDNode *
N,
unsigned ResNo);
364 SDValue PromoteIntRes_UNDEF(SDNode *
N);
365 SDValue PromoteIntRes_VAARG(SDNode *
N);
366 SDValue PromoteIntRes_VSCALE(SDNode *
N);
367 SDValue PromoteIntRes_XMULO(SDNode *
N,
unsigned ResNo);
368 template <
class MatchContextClass>
369 SDValue PromoteIntRes_ADDSUBSHLSAT(SDNode *
N);
370 SDValue PromoteIntRes_MULFIX(SDNode *
N);
371 SDValue PromoteIntRes_DIVFIX(SDNode *
N);
372 SDValue PromoteIntRes_GET_ROUNDING(SDNode *
N);
373 SDValue PromoteIntRes_VECREDUCE(SDNode *
N);
374 SDValue PromoteIntRes_VP_REDUCE(SDNode *
N);
375 SDValue PromoteIntRes_ABS(SDNode *
N);
376 SDValue PromoteIntRes_Rotate(SDNode *
N);
377 SDValue PromoteIntRes_FunnelShift(SDNode *
N);
378 SDValue PromoteIntRes_VPFunnelShift(SDNode *
N);
379 SDValue PromoteIntRes_IS_FPCLASS(SDNode *
N);
380 SDValue PromoteIntRes_PATCHPOINT(SDNode *
N);
383 bool PromoteIntegerOperand(SDNode *
N,
unsigned OpNo);
384 SDValue PromoteIntOp_ANY_EXTEND(SDNode *
N);
385 SDValue PromoteIntOp_ATOMIC_STORE(AtomicSDNode *
N);
386 SDValue PromoteIntOp_BITCAST(SDNode *
N);
387 SDValue PromoteIntOp_BUILD_PAIR(SDNode *
N);
388 SDValue PromoteIntOp_BR_CC(SDNode *
N,
unsigned OpNo);
389 SDValue PromoteIntOp_BRCOND(SDNode *
N,
unsigned OpNo);
390 SDValue PromoteIntOp_BUILD_VECTOR(SDNode *
N);
391 SDValue PromoteIntOp_INSERT_VECTOR_ELT(SDNode *
N,
unsigned OpNo);
392 SDValue PromoteIntOp_EXTRACT_VECTOR_ELT(SDNode *
N);
393 SDValue PromoteIntOp_EXTRACT_SUBVECTOR(SDNode *
N);
394 SDValue PromoteIntOp_INSERT_SUBVECTOR(SDNode *
N);
395 SDValue PromoteIntOp_FAKE_USE(SDNode *
N);
396 SDValue PromoteIntOp_CONCAT_VECTORS(SDNode *
N);
397 SDValue PromoteIntOp_ScalarOp(SDNode *
N);
398 SDValue PromoteIntOp_SELECT(SDNode *
N,
unsigned OpNo);
399 SDValue PromoteIntOp_SELECT_CC(SDNode *
N,
unsigned OpNo);
400 SDValue PromoteIntOp_SETCC(SDNode *
N,
unsigned OpNo);
401 SDValue PromoteIntOp_Shift(SDNode *
N);
402 SDValue PromoteIntOp_CMP(SDNode *
N);
403 SDValue PromoteIntOp_FunnelShift(SDNode *
N);
404 SDValue PromoteIntOp_SIGN_EXTEND(SDNode *
N);
405 SDValue PromoteIntOp_VP_SIGN_EXTEND(SDNode *
N);
406 SDValue PromoteIntOp_SINT_TO_FP(SDNode *
N);
407 SDValue PromoteIntOp_STRICT_SINT_TO_FP(SDNode *
N);
408 SDValue PromoteIntOp_STORE(StoreSDNode *
N,
unsigned OpNo);
409 SDValue PromoteIntOp_TRUNCATE(SDNode *
N);
410 SDValue PromoteIntOp_UINT_TO_FP(SDNode *
N);
411 SDValue PromoteIntOp_STRICT_UINT_TO_FP(SDNode *
N);
412 SDValue PromoteIntOp_ZERO_EXTEND(SDNode *
N);
413 SDValue PromoteIntOp_VP_ZERO_EXTEND(SDNode *
N);
414 SDValue PromoteIntOp_MSTORE(MaskedStoreSDNode *
N,
unsigned OpNo);
415 SDValue PromoteIntOp_MLOAD(MaskedLoadSDNode *
N,
unsigned OpNo);
416 SDValue PromoteIntOp_MSCATTER(MaskedScatterSDNode *
N,
unsigned OpNo);
417 SDValue PromoteIntOp_MGATHER(MaskedGatherSDNode *
N,
unsigned OpNo);
418 SDValue PromoteIntOp_VECTOR_COMPRESS(SDNode *
N,
unsigned OpNo);
419 SDValue PromoteIntOp_FRAMERETURNADDR(SDNode *
N);
420 SDValue PromoteIntOp_FIX(SDNode *
N);
421 SDValue PromoteIntOp_ExpOp(SDNode *
N);
422 SDValue PromoteIntOp_VECREDUCE(SDNode *
N);
423 SDValue PromoteIntOp_VP_REDUCE(SDNode *
N,
unsigned OpNo);
424 SDValue PromoteIntOp_VP_STORE(VPStoreSDNode *
N,
unsigned OpNo);
425 SDValue PromoteIntOp_SET_ROUNDING(SDNode *
N);
426 SDValue PromoteIntOp_STACKMAP(SDNode *
N,
unsigned OpNo);
427 SDValue PromoteIntOp_PATCHPOINT(SDNode *
N,
unsigned OpNo);
428 SDValue PromoteIntOp_VP_STRIDED(SDNode *
N,
unsigned OpNo);
429 SDValue PromoteIntOp_VP_SPLICE(SDNode *
N,
unsigned OpNo);
430 SDValue PromoteIntOp_VECTOR_HISTOGRAM(SDNode *
N,
unsigned OpNo);
432 void SExtOrZExtPromotedOperands(SDValue &
LHS, SDValue &
RHS);
433 void PromoteSetCCOperands(SDValue &
LHS,SDValue &
RHS, ISD::CondCode Code);
445 void GetExpandedInteger(SDValue Op, SDValue &
Lo, SDValue &
Hi);
446 void SetExpandedInteger(SDValue Op, SDValue
Lo, SDValue
Hi);
449 void ExpandIntegerResult(SDNode *
N,
unsigned ResNo);
450 void ExpandIntRes_ANY_EXTEND (SDNode *
N, SDValue &
Lo, SDValue &
Hi);
451 void ExpandIntRes_AssertSext (SDNode *
N, SDValue &
Lo, SDValue &
Hi);
452 void ExpandIntRes_AssertZext (SDNode *
N, SDValue &
Lo, SDValue &
Hi);
453 void ExpandIntRes_Constant (SDNode *
N, SDValue &
Lo, SDValue &
Hi);
454 void ExpandIntRes_ABS (SDNode *
N, SDValue &
Lo, SDValue &
Hi);
455 void ExpandIntRes_ABD (SDNode *
N, SDValue &
Lo, SDValue &
Hi);
456 void ExpandIntRes_CTLZ (SDNode *
N, SDValue &
Lo, SDValue &
Hi);
457 void ExpandIntRes_CTPOP (SDNode *
N, SDValue &
Lo, SDValue &
Hi);
458 void ExpandIntRes_CTTZ (SDNode *
N, SDValue &
Lo, SDValue &
Hi);
459 void ExpandIntRes_LOAD (LoadSDNode *
N, SDValue &
Lo, SDValue &
Hi);
460 void ExpandIntRes_READCOUNTER (SDNode *
N, SDValue &
Lo, SDValue &
Hi);
461 void ExpandIntRes_SIGN_EXTEND (SDNode *
N, SDValue &
Lo, SDValue &
Hi);
462 void ExpandIntRes_SIGN_EXTEND_INREG (SDNode *
N, SDValue &
Lo, SDValue &
Hi);
463 void ExpandIntRes_TRUNCATE (SDNode *
N, SDValue &
Lo, SDValue &
Hi);
464 void ExpandIntRes_ZERO_EXTEND (SDNode *
N, SDValue &
Lo, SDValue &
Hi);
465 void ExpandIntRes_GET_ROUNDING (SDNode *
N, SDValue &
Lo, SDValue &
Hi);
466 void ExpandIntRes_FP_TO_XINT (SDNode *
N, SDValue &
Lo, SDValue &
Hi);
467 void ExpandIntRes_FP_TO_XINT_SAT (SDNode *
N, SDValue &
Lo, SDValue &
Hi);
468 void ExpandIntRes_XROUND_XRINT (SDNode *
N, SDValue &
Lo, SDValue &
Hi);
470 void ExpandIntRes_Logical (SDNode *
N, SDValue &
Lo, SDValue &
Hi);
471 void ExpandIntRes_ADDSUB (SDNode *
N, SDValue &
Lo, SDValue &
Hi);
472 void ExpandIntRes_ADDSUBC (SDNode *
N, SDValue &
Lo, SDValue &
Hi);
473 void ExpandIntRes_ADDSUBE (SDNode *
N, SDValue &
Lo, SDValue &
Hi);
474 void ExpandIntRes_UADDSUBO_CARRY (SDNode *
N, SDValue &
Lo, SDValue &
Hi);
475 void ExpandIntRes_SADDSUBO_CARRY (SDNode *
N, SDValue &
Lo, SDValue &
Hi);
476 void ExpandIntRes_BITREVERSE (SDNode *
N, SDValue &
Lo, SDValue &
Hi);
477 void ExpandIntRes_BSWAP (SDNode *
N, SDValue &
Lo, SDValue &
Hi);
478 void ExpandIntRes_PARITY (SDNode *
N, SDValue &
Lo, SDValue &
Hi);
479 void ExpandIntRes_MUL (SDNode *
N, SDValue &
Lo, SDValue &
Hi);
480 void ExpandIntRes_SDIV (SDNode *
N, SDValue &
Lo, SDValue &
Hi);
481 void ExpandIntRes_SREM (SDNode *
N, SDValue &
Lo, SDValue &
Hi);
482 void ExpandIntRes_UDIV (SDNode *
N, SDValue &
Lo, SDValue &
Hi);
483 void ExpandIntRes_UREM (SDNode *
N, SDValue &
Lo, SDValue &
Hi);
484 void ExpandIntRes_ShiftThroughStack (SDNode *
N, SDValue &
Lo, SDValue &
Hi);
485 void ExpandIntRes_Shift (SDNode *
N, SDValue &
Lo, SDValue &
Hi);
487 void ExpandIntRes_MINMAX (SDNode *
N, SDValue &
Lo, SDValue &
Hi);
489 void ExpandIntRes_CMP (SDNode *
N, SDValue &
Lo, SDValue &
Hi);
490 void ExpandIntRes_SETCC (SDNode *
N, SDValue &
Lo, SDValue &
Hi);
492 void ExpandIntRes_SADDSUBO (SDNode *
N, SDValue &
Lo, SDValue &
Hi);
493 void ExpandIntRes_UADDSUBO (SDNode *
N, SDValue &
Lo, SDValue &
Hi);
494 void ExpandIntRes_XMULO (SDNode *
N, SDValue &
Lo, SDValue &
Hi);
495 void ExpandIntRes_AVG (SDNode *
N, SDValue &
Lo, SDValue &
Hi);
496 void ExpandIntRes_ADDSUBSAT (SDNode *
N, SDValue &
Lo, SDValue &
Hi);
497 void ExpandIntRes_SHLSAT (SDNode *
N, SDValue &
Lo, SDValue &
Hi);
498 void ExpandIntRes_MULFIX (SDNode *
N, SDValue &
Lo, SDValue &
Hi);
499 void ExpandIntRes_DIVFIX (SDNode *
N, SDValue &
Lo, SDValue &
Hi);
501 void ExpandIntRes_ATOMIC_LOAD (SDNode *
N, SDValue &
Lo, SDValue &
Hi);
502 void ExpandIntRes_VECREDUCE (SDNode *
N, SDValue &
Lo, SDValue &
Hi);
504 void ExpandIntRes_Rotate (SDNode *
N, SDValue &
Lo, SDValue &
Hi);
505 void ExpandIntRes_FunnelShift (SDNode *
N, SDValue &
Lo, SDValue &
Hi);
507 void ExpandIntRes_VSCALE (SDNode *
N, SDValue &
Lo, SDValue &
Hi);
509 void ExpandShiftByConstant(SDNode *
N,
const APInt &Amt,
510 SDValue &
Lo, SDValue &
Hi);
511 bool ExpandShiftWithKnownAmountBit(SDNode *
N, SDValue &
Lo, SDValue &
Hi);
512 bool ExpandShiftWithUnknownAmountBit(SDNode *
N, SDValue &
Lo, SDValue &
Hi);
515 bool ExpandIntegerOperand(SDNode *
N,
unsigned OpNo);
516 SDValue ExpandIntOp_BR_CC(SDNode *
N);
517 SDValue ExpandIntOp_SELECT_CC(SDNode *
N);
518 SDValue ExpandIntOp_SETCC(SDNode *
N);
519 SDValue ExpandIntOp_SETCCCARRY(SDNode *
N);
520 SDValue ExpandIntOp_Shift(SDNode *
N);
521 SDValue ExpandIntOp_CMP(SDNode *
N);
522 SDValue ExpandIntOp_STORE(StoreSDNode *
N,
unsigned OpNo);
523 SDValue ExpandIntOp_TRUNCATE(SDNode *
N);
524 SDValue ExpandIntOp_XINT_TO_FP(SDNode *
N);
525 SDValue ExpandIntOp_RETURNADDR(SDNode *
N);
526 SDValue ExpandIntOp_ATOMIC_STORE(SDNode *
N);
527 SDValue ExpandIntOp_SPLAT_VECTOR(SDNode *
N);
528 SDValue ExpandIntOp_STACKMAP(SDNode *
N,
unsigned OpNo);
529 SDValue ExpandIntOp_PATCHPOINT(SDNode *
N,
unsigned OpNo);
530 SDValue ExpandIntOp_VP_STRIDED(SDNode *
N,
unsigned OpNo);
532 void IntegerExpandSetCCOperands(SDValue &NewLHS, SDValue &NewRHS,
533 ISD::CondCode &CCCode,
const SDLoc &dl);
544 SDValue GetSoftenedFloat(SDValue Op) {
545 TableId
Id = getTableId(Op);
546 auto Iter = SoftenedFloats.find(Id);
547 if (Iter == SoftenedFloats.end()) {
548 assert(isSimpleLegalType(
Op.getValueType()) &&
549 "Operand wasn't converted to integer?");
552 SDValue SoftenedOp = getSDValue(Iter->second);
553 assert(SoftenedOp.getNode() &&
"Unconverted op in SoftenedFloats?");
556 void SetSoftenedFloat(SDValue Op, SDValue Result);
559 void SoftenFloatResult(SDNode *
N,
unsigned ResNo);
560 SDValue SoftenFloatRes_Unary(SDNode *
N, RTLIB::Libcall LC);
561 SDValue SoftenFloatRes_UnaryWithTwoFPResults(SDNode *
N, RTLIB::Libcall LC);
562 SDValue SoftenFloatRes_Binary(SDNode *
N, RTLIB::Libcall LC);
563 SDValue SoftenFloatRes_MERGE_VALUES(SDNode *
N,
unsigned ResNo);
564 SDValue SoftenFloatRes_ARITH_FENCE(SDNode *
N);
565 SDValue SoftenFloatRes_BITCAST(SDNode *
N);
566 SDValue SoftenFloatRes_BUILD_PAIR(SDNode *
N);
567 SDValue SoftenFloatRes_ConstantFP(SDNode *
N);
568 SDValue SoftenFloatRes_EXTRACT_ELEMENT(SDNode *
N);
569 SDValue SoftenFloatRes_EXTRACT_VECTOR_ELT(SDNode *
N,
unsigned ResNo);
570 SDValue SoftenFloatRes_FABS(SDNode *
N);
571 SDValue SoftenFloatRes_FACOS(SDNode *
N);
572 SDValue SoftenFloatRes_FASIN(SDNode *
N);
573 SDValue SoftenFloatRes_FATAN(SDNode *
N);
574 SDValue SoftenFloatRes_FATAN2(SDNode *
N);
575 SDValue SoftenFloatRes_FMINNUM(SDNode *
N);
576 SDValue SoftenFloatRes_FMAXNUM(SDNode *
N);
577 SDValue SoftenFloatRes_FMINIMUMNUM(SDNode *
N);
578 SDValue SoftenFloatRes_FMAXIMUMNUM(SDNode *
N);
579 SDValue SoftenFloatRes_FMINIMUM(SDNode *
N);
580 SDValue SoftenFloatRes_FMAXIMUM(SDNode *
N);
581 SDValue SoftenFloatRes_FADD(SDNode *
N);
582 SDValue SoftenFloatRes_FCBRT(SDNode *
N);
583 SDValue SoftenFloatRes_FCEIL(SDNode *
N);
584 SDValue SoftenFloatRes_FCOPYSIGN(SDNode *
N);
585 SDValue SoftenFloatRes_FCOS(SDNode *
N);
586 SDValue SoftenFloatRes_FCOSH(SDNode *
N);
587 SDValue SoftenFloatRes_FDIV(SDNode *
N);
588 SDValue SoftenFloatRes_FEXP(SDNode *
N);
589 SDValue SoftenFloatRes_FEXP2(SDNode *
N);
590 SDValue SoftenFloatRes_FEXP10(SDNode *
N);
591 SDValue SoftenFloatRes_FFLOOR(SDNode *
N);
592 SDValue SoftenFloatRes_FLOG(SDNode *
N);
593 SDValue SoftenFloatRes_FLOG2(SDNode *
N);
594 SDValue SoftenFloatRes_FLOG10(SDNode *
N);
595 SDValue SoftenFloatRes_FMA(SDNode *
N);
596 SDValue SoftenFloatRes_FMUL(SDNode *
N);
597 SDValue SoftenFloatRes_FNEARBYINT(SDNode *
N);
598 SDValue SoftenFloatRes_FNEG(SDNode *
N);
599 SDValue SoftenFloatRes_FP_EXTEND(SDNode *
N);
600 SDValue SoftenFloatRes_FP16_TO_FP(SDNode *
N);
601 SDValue SoftenFloatRes_BF16_TO_FP(SDNode *
N);
602 SDValue SoftenFloatRes_FP_ROUND(SDNode *
N);
603 SDValue SoftenFloatRes_FPOW(SDNode *
N);
604 SDValue SoftenFloatRes_ExpOp(SDNode *
N);
605 SDValue SoftenFloatRes_FFREXP(SDNode *
N);
606 SDValue SoftenFloatRes_FSINCOS(SDNode *
N);
607 SDValue SoftenFloatRes_FREEZE(SDNode *
N);
608 SDValue SoftenFloatRes_FREM(SDNode *
N);
609 SDValue SoftenFloatRes_FRINT(SDNode *
N);
610 SDValue SoftenFloatRes_FROUND(SDNode *
N);
611 SDValue SoftenFloatRes_FROUNDEVEN(SDNode *
N);
612 SDValue SoftenFloatRes_FSIN(SDNode *
N);
613 SDValue SoftenFloatRes_FSINH(SDNode *
N);
614 SDValue SoftenFloatRes_FSQRT(SDNode *
N);
615 SDValue SoftenFloatRes_FSUB(SDNode *
N);
616 SDValue SoftenFloatRes_FTAN(SDNode *
N);
617 SDValue SoftenFloatRes_FTANH(SDNode *
N);
618 SDValue SoftenFloatRes_FTRUNC(SDNode *
N);
619 SDValue SoftenFloatRes_LOAD(SDNode *
N);
620 SDValue SoftenFloatRes_ATOMIC_LOAD(SDNode *
N);
621 SDValue SoftenFloatRes_SELECT(SDNode *
N);
622 SDValue SoftenFloatRes_SELECT_CC(SDNode *
N);
623 SDValue SoftenFloatRes_UNDEF(SDNode *
N);
624 SDValue SoftenFloatRes_VAARG(SDNode *
N);
625 SDValue SoftenFloatRes_XINT_TO_FP(SDNode *
N);
626 SDValue SoftenFloatRes_VECREDUCE(SDNode *
N);
627 SDValue SoftenFloatRes_VECREDUCE_SEQ(SDNode *
N);
630 bool SoftenFloatOperand(SDNode *
N,
unsigned OpNo);
631 SDValue SoftenFloatOp_Unary(SDNode *
N, RTLIB::Libcall LC);
632 SDValue SoftenFloatOp_BITCAST(SDNode *
N);
633 SDValue SoftenFloatOp_BR_CC(SDNode *
N);
634 SDValue SoftenFloatOp_FP_ROUND(SDNode *
N);
635 SDValue SoftenFloatOp_FP_TO_XINT(SDNode *
N);
636 SDValue SoftenFloatOp_FP_TO_XINT_SAT(SDNode *
N);
637 SDValue SoftenFloatOp_LROUND(SDNode *
N);
638 SDValue SoftenFloatOp_LLROUND(SDNode *
N);
639 SDValue SoftenFloatOp_LRINT(SDNode *
N);
640 SDValue SoftenFloatOp_LLRINT(SDNode *
N);
641 SDValue SoftenFloatOp_SELECT_CC(SDNode *
N);
642 SDValue SoftenFloatOp_SETCC(SDNode *
N);
643 SDValue SoftenFloatOp_STORE(SDNode *
N,
unsigned OpNo);
644 SDValue SoftenFloatOp_ATOMIC_STORE(SDNode *
N,
unsigned OpNo);
645 SDValue SoftenFloatOp_FCOPYSIGN(SDNode *
N);
657 void GetExpandedFloat(SDValue Op, SDValue &
Lo, SDValue &
Hi);
658 void SetExpandedFloat(SDValue Op, SDValue
Lo, SDValue
Hi);
661 void ExpandFloatResult(SDNode *
N,
unsigned ResNo);
662 void ExpandFloatRes_ConstantFP(SDNode *
N, SDValue &
Lo, SDValue &
Hi);
663 void ExpandFloatRes_Unary(SDNode *
N, RTLIB::Libcall LC,
664 SDValue &
Lo, SDValue &
Hi);
665 void ExpandFloatRes_Binary(SDNode *
N, RTLIB::Libcall LC,
666 SDValue &
Lo, SDValue &
Hi);
668 void ExpandFloatRes_FABS (SDNode *
N, SDValue &
Lo, SDValue &
Hi);
669 void ExpandFloatRes_FACOS (SDNode *
N, SDValue &
Lo, SDValue &
Hi);
670 void ExpandFloatRes_FASIN (SDNode *
N, SDValue &
Lo, SDValue &
Hi);
671 void ExpandFloatRes_FATAN (SDNode *
N, SDValue &
Lo, SDValue &
Hi);
672 void ExpandFloatRes_FATAN2 (SDNode *
N, SDValue &
Lo, SDValue &
Hi);
673 void ExpandFloatRes_FMINNUM (SDNode *
N, SDValue &
Lo, SDValue &
Hi);
674 void ExpandFloatRes_FMAXNUM (SDNode *
N, SDValue &
Lo, SDValue &
Hi);
675 void ExpandFloatRes_FMINIMUMNUM(SDNode *
N, SDValue &
Lo, SDValue &
Hi);
676 void ExpandFloatRes_FMAXIMUMNUM(SDNode *
N, SDValue &
Lo, SDValue &
Hi);
677 void ExpandFloatRes_FADD (SDNode *
N, SDValue &
Lo, SDValue &
Hi);
678 void ExpandFloatRes_FCBRT (SDNode *
N, SDValue &
Lo, SDValue &
Hi);
679 void ExpandFloatRes_FCEIL (SDNode *
N, SDValue &
Lo, SDValue &
Hi);
680 void ExpandFloatRes_FCOPYSIGN (SDNode *
N, SDValue &
Lo, SDValue &
Hi);
681 void ExpandFloatRes_FCOS (SDNode *
N, SDValue &
Lo, SDValue &
Hi);
682 void ExpandFloatRes_FCOSH (SDNode *
N, SDValue &
Lo, SDValue &
Hi);
683 void ExpandFloatRes_FDIV (SDNode *
N, SDValue &
Lo, SDValue &
Hi);
684 void ExpandFloatRes_FEXP (SDNode *
N, SDValue &
Lo, SDValue &
Hi);
685 void ExpandFloatRes_FEXP2 (SDNode *
N, SDValue &
Lo, SDValue &
Hi);
686 void ExpandFloatRes_FEXP10 (SDNode *
N, SDValue &
Lo, SDValue &
Hi);
687 void ExpandFloatRes_FFLOOR (SDNode *
N, SDValue &
Lo, SDValue &
Hi);
688 void ExpandFloatRes_FLOG (SDNode *
N, SDValue &
Lo, SDValue &
Hi);
689 void ExpandFloatRes_FLOG2 (SDNode *
N, SDValue &
Lo, SDValue &
Hi);
690 void ExpandFloatRes_FLOG10 (SDNode *
N, SDValue &
Lo, SDValue &
Hi);
691 void ExpandFloatRes_FMA (SDNode *
N, SDValue &
Lo, SDValue &
Hi);
692 void ExpandFloatRes_FMUL (SDNode *
N, SDValue &
Lo, SDValue &
Hi);
693 void ExpandFloatRes_FNEARBYINT(SDNode *
N, SDValue &
Lo, SDValue &
Hi);
694 void ExpandFloatRes_FNEG (SDNode *
N, SDValue &
Lo, SDValue &
Hi);
695 void ExpandFloatRes_FP_EXTEND (SDNode *
N, SDValue &
Lo, SDValue &
Hi);
696 void ExpandFloatRes_FPOW (SDNode *
N, SDValue &
Lo, SDValue &
Hi);
697 void ExpandFloatRes_FPOWI (SDNode *
N, SDValue &
Lo, SDValue &
Hi);
698 void ExpandFloatRes_FLDEXP (SDNode *
N, SDValue &
Lo, SDValue &
Hi);
699 void ExpandFloatRes_FREEZE (SDNode *
N, SDValue &
Lo, SDValue &
Hi);
700 void ExpandFloatRes_FREM (SDNode *
N, SDValue &
Lo, SDValue &
Hi);
701 void ExpandFloatRes_FRINT (SDNode *
N, SDValue &
Lo, SDValue &
Hi);
702 void ExpandFloatRes_FROUND (SDNode *
N, SDValue &
Lo, SDValue &
Hi);
703 void ExpandFloatRes_FROUNDEVEN(SDNode *
N, SDValue &
Lo, SDValue &
Hi);
704 void ExpandFloatRes_FSIN (SDNode *
N, SDValue &
Lo, SDValue &
Hi);
705 void ExpandFloatRes_FSINH (SDNode *
N, SDValue &
Lo, SDValue &
Hi);
706 void ExpandFloatRes_FSQRT (SDNode *
N, SDValue &
Lo, SDValue &
Hi);
707 void ExpandFloatRes_FSUB (SDNode *
N, SDValue &
Lo, SDValue &
Hi);
708 void ExpandFloatRes_FTAN (SDNode *
N, SDValue &
Lo, SDValue &
Hi);
709 void ExpandFloatRes_FTANH (SDNode *
N, SDValue &
Lo, SDValue &
Hi);
710 void ExpandFloatRes_FTRUNC (SDNode *
N, SDValue &
Lo, SDValue &
Hi);
711 void ExpandFloatRes_LOAD (SDNode *
N, SDValue &
Lo, SDValue &
Hi);
712 void ExpandFloatRes_XINT_TO_FP(SDNode *
N, SDValue &
Lo, SDValue &
Hi);
716 bool ExpandFloatOperand(SDNode *
N,
unsigned OpNo);
717 SDValue ExpandFloatOp_BR_CC(SDNode *
N);
718 SDValue ExpandFloatOp_FCOPYSIGN(SDNode *
N);
719 SDValue ExpandFloatOp_FP_ROUND(SDNode *
N);
720 SDValue ExpandFloatOp_FP_TO_XINT(SDNode *
N);
721 SDValue ExpandFloatOp_LROUND(SDNode *
N);
722 SDValue ExpandFloatOp_LLROUND(SDNode *
N);
723 SDValue ExpandFloatOp_LRINT(SDNode *
N);
724 SDValue ExpandFloatOp_LLRINT(SDNode *
N);
725 SDValue ExpandFloatOp_SELECT_CC(SDNode *
N);
726 SDValue ExpandFloatOp_SETCC(SDNode *
N);
727 SDValue ExpandFloatOp_STORE(SDNode *
N,
unsigned OpNo);
729 void FloatExpandSetCCOperands(SDValue &NewLHS, SDValue &NewRHS,
730 ISD::CondCode &CCCode,
const SDLoc &dl,
731 SDValue &Chain,
bool IsSignaling =
false);
737 SDValue GetPromotedFloat(SDValue Op) {
738 TableId &PromotedId = PromotedFloats[getTableId(Op)];
739 SDValue PromotedOp = getSDValue(PromotedId);
740 assert(PromotedOp.getNode() &&
"Operand wasn't promoted?");
743 void SetPromotedFloat(SDValue Op, SDValue Result);
745 void PromoteFloatResult(SDNode *
N,
unsigned ResNo);
746 SDValue PromoteFloatRes_BITCAST(SDNode *
N);
747 SDValue PromoteFloatRes_BinOp(SDNode *
N);
748 SDValue PromoteFloatRes_UnaryWithTwoFPResults(SDNode *
N);
749 SDValue PromoteFloatRes_ConstantFP(SDNode *
N);
750 SDValue PromoteFloatRes_EXTRACT_VECTOR_ELT(SDNode *
N);
751 SDValue PromoteFloatRes_FCOPYSIGN(SDNode *
N);
752 SDValue PromoteFloatRes_FMAD(SDNode *
N);
753 SDValue PromoteFloatRes_ExpOp(SDNode *
N);
754 SDValue PromoteFloatRes_FFREXP(SDNode *
N);
755 SDValue PromoteFloatRes_FP_ROUND(SDNode *
N);
756 SDValue PromoteFloatRes_STRICT_FP_ROUND(SDNode *
N);
757 SDValue PromoteFloatRes_LOAD(SDNode *
N);
758 SDValue PromoteFloatRes_ATOMIC_LOAD(SDNode *
N);
759 SDValue PromoteFloatRes_SELECT(SDNode *
N);
760 SDValue PromoteFloatRes_SELECT_CC(SDNode *
N);
761 SDValue PromoteFloatRes_UnaryOp(SDNode *
N);
762 SDValue PromoteFloatRes_UNDEF(SDNode *
N);
763 SDValue BitcastToInt_ATOMIC_SWAP(SDNode *
N);
764 SDValue PromoteFloatRes_XINT_TO_FP(SDNode *
N);
765 SDValue PromoteFloatRes_VECREDUCE(SDNode *
N);
766 SDValue PromoteFloatRes_VECREDUCE_SEQ(SDNode *
N);
768 bool PromoteFloatOperand(SDNode *
N,
unsigned OpNo);
769 SDValue PromoteFloatOp_BITCAST(SDNode *
N,
unsigned OpNo);
770 SDValue PromoteFloatOp_FAKE_USE(SDNode *
N,
unsigned OpNo);
771 SDValue PromoteFloatOp_FCOPYSIGN(SDNode *
N,
unsigned OpNo);
772 SDValue PromoteFloatOp_FP_EXTEND(SDNode *
N,
unsigned OpNo);
773 SDValue PromoteFloatOp_STRICT_FP_EXTEND(SDNode *
N,
unsigned OpNo);
774 SDValue PromoteFloatOp_UnaryOp(SDNode *
N,
unsigned OpNo);
775 SDValue PromoteFloatOp_FP_TO_XINT_SAT(SDNode *
N,
unsigned OpNo);
776 SDValue PromoteFloatOp_STORE(SDNode *
N,
unsigned OpNo);
777 SDValue PromoteFloatOp_ATOMIC_STORE(SDNode *
N,
unsigned OpNo);
778 SDValue PromoteFloatOp_SELECT_CC(SDNode *
N,
unsigned OpNo);
779 SDValue PromoteFloatOp_SETCC(SDNode *
N,
unsigned OpNo);
785 SDValue GetSoftPromotedHalf(SDValue Op) {
786 TableId &PromotedId = SoftPromotedHalfs[getTableId(Op)];
787 SDValue PromotedOp = getSDValue(PromotedId);
788 assert(PromotedOp.getNode() &&
"Operand wasn't promoted?");
791 void SetSoftPromotedHalf(SDValue Op, SDValue Result);
793 void SoftPromoteHalfResult(SDNode *
N,
unsigned ResNo);
794 SDValue SoftPromoteHalfRes_ARITH_FENCE(SDNode *
N);
795 SDValue SoftPromoteHalfRes_BinOp(SDNode *
N);
796 SDValue SoftPromoteHalfRes_UnaryWithTwoFPResults(SDNode *
N);
797 SDValue SoftPromoteHalfRes_BITCAST(SDNode *
N);
798 SDValue SoftPromoteHalfRes_ConstantFP(SDNode *
N);
799 SDValue SoftPromoteHalfRes_EXTRACT_VECTOR_ELT(SDNode *
N);
800 SDValue SoftPromoteHalfRes_FCOPYSIGN(SDNode *
N);
801 SDValue SoftPromoteHalfRes_FMAD(SDNode *
N);
802 SDValue SoftPromoteHalfRes_ExpOp(SDNode *
N);
803 SDValue SoftPromoteHalfRes_FFREXP(SDNode *
N);
804 SDValue SoftPromoteHalfRes_FP_ROUND(SDNode *
N);
805 SDValue SoftPromoteHalfRes_LOAD(SDNode *
N);
806 SDValue SoftPromoteHalfRes_ATOMIC_LOAD(SDNode *
N);
807 SDValue SoftPromoteHalfRes_SELECT(SDNode *
N);
808 SDValue SoftPromoteHalfRes_SELECT_CC(SDNode *
N);
809 SDValue SoftPromoteHalfRes_UnaryOp(SDNode *
N);
810 SDValue SoftPromoteHalfRes_XINT_TO_FP(SDNode *
N);
811 SDValue SoftPromoteHalfRes_UNDEF(SDNode *
N);
812 SDValue SoftPromoteHalfRes_VECREDUCE(SDNode *
N);
813 SDValue SoftPromoteHalfRes_VECREDUCE_SEQ(SDNode *
N);
815 bool SoftPromoteHalfOperand(SDNode *
N,
unsigned OpNo);
816 SDValue SoftPromoteHalfOp_BITCAST(SDNode *
N);
817 SDValue SoftPromoteHalfOp_FAKE_USE(SDNode *
N,
unsigned OpNo);
818 SDValue SoftPromoteHalfOp_FCOPYSIGN(SDNode *
N,
unsigned OpNo);
819 SDValue SoftPromoteHalfOp_FP_EXTEND(SDNode *
N);
820 SDValue SoftPromoteHalfOp_FP_TO_XINT(SDNode *
N);
821 SDValue SoftPromoteHalfOp_FP_TO_XINT_SAT(SDNode *
N);
822 SDValue SoftPromoteHalfOp_SETCC(SDNode *
N);
823 SDValue SoftPromoteHalfOp_SELECT_CC(SDNode *
N,
unsigned OpNo);
824 SDValue SoftPromoteHalfOp_STORE(SDNode *
N,
unsigned OpNo);
825 SDValue SoftPromoteHalfOp_ATOMIC_STORE(SDNode *
N,
unsigned OpNo);
826 SDValue SoftPromoteHalfOp_STACKMAP(SDNode *
N,
unsigned OpNo);
827 SDValue SoftPromoteHalfOp_PATCHPOINT(SDNode *
N,
unsigned OpNo);
836 SDValue GetScalarizedVector(SDValue Op) {
837 TableId &ScalarizedId = ScalarizedVectors[getTableId(Op)];
838 SDValue ScalarizedOp = getSDValue(ScalarizedId);
839 assert(ScalarizedOp.getNode() &&
"Operand wasn't scalarized?");
842 void SetScalarizedVector(SDValue Op, SDValue Result);
845 void ScalarizeVectorResult(SDNode *
N,
unsigned ResNo);
846 SDValue ScalarizeVecRes_MERGE_VALUES(SDNode *
N,
unsigned ResNo);
847 SDValue ScalarizeVecRes_BinOp(SDNode *
N);
848 SDValue ScalarizeVecRes_CMP(SDNode *
N);
849 SDValue ScalarizeVecRes_TernaryOp(SDNode *
N);
850 SDValue ScalarizeVecRes_UnaryOp(SDNode *
N);
851 SDValue ScalarizeVecRes_StrictFPOp(SDNode *
N);
852 SDValue ScalarizeVecRes_OverflowOp(SDNode *
N,
unsigned ResNo);
853 SDValue ScalarizeVecRes_InregOp(SDNode *
N);
854 SDValue ScalarizeVecRes_VecInregOp(SDNode *
N);
856 SDValue ScalarizeVecRes_ADDRSPACECAST(SDNode *
N);
857 SDValue ScalarizeVecRes_BITCAST(SDNode *
N);
858 SDValue ScalarizeVecRes_BUILD_VECTOR(SDNode *
N);
859 SDValue ScalarizeVecRes_EXTRACT_SUBVECTOR(SDNode *
N);
860 SDValue ScalarizeVecRes_FP_ROUND(SDNode *
N);
861 SDValue ScalarizeVecRes_ExpOp(SDNode *
N);
862 SDValue ScalarizeVecRes_INSERT_VECTOR_ELT(SDNode *
N);
863 SDValue ScalarizeVecRes_LOAD(LoadSDNode *
N);
864 SDValue ScalarizeVecRes_SCALAR_TO_VECTOR(SDNode *
N);
865 SDValue ScalarizeVecRes_VSELECT(SDNode *
N);
866 SDValue ScalarizeVecRes_SELECT(SDNode *
N);
867 SDValue ScalarizeVecRes_SELECT_CC(SDNode *
N);
868 SDValue ScalarizeVecRes_SETCC(SDNode *
N);
869 SDValue ScalarizeVecRes_UNDEF(SDNode *
N);
870 SDValue ScalarizeVecRes_VECTOR_SHUFFLE(SDNode *
N);
871 SDValue ScalarizeVecRes_FP_TO_XINT_SAT(SDNode *
N);
872 SDValue ScalarizeVecRes_IS_FPCLASS(SDNode *
N);
874 SDValue ScalarizeVecRes_FIX(SDNode *
N);
875 SDValue ScalarizeVecRes_UnaryOpWithTwoResults(SDNode *
N,
unsigned ResNo);
878 bool ScalarizeVectorOperand(SDNode *
N,
unsigned OpNo);
879 SDValue ScalarizeVecOp_BITCAST(SDNode *
N);
880 SDValue ScalarizeVecOp_UnaryOp(SDNode *
N);
881 SDValue ScalarizeVecOp_UnaryOp_StrictFP(SDNode *
N);
882 SDValue ScalarizeVecOp_CONCAT_VECTORS(SDNode *
N);
883 SDValue ScalarizeVecOp_INSERT_SUBVECTOR(SDNode *
N,
unsigned OpNo);
884 SDValue ScalarizeVecOp_EXTRACT_VECTOR_ELT(SDNode *
N);
885 SDValue ScalarizeVecOp_VSELECT(SDNode *
N);
886 SDValue ScalarizeVecOp_VSETCC(SDNode *
N);
887 SDValue ScalarizeVecOp_STORE(StoreSDNode *
N,
unsigned OpNo);
888 SDValue ScalarizeVecOp_FP_ROUND(SDNode *
N,
unsigned OpNo);
889 SDValue ScalarizeVecOp_STRICT_FP_ROUND(SDNode *
N,
unsigned OpNo);
890 SDValue ScalarizeVecOp_FP_EXTEND(SDNode *
N);
891 SDValue ScalarizeVecOp_STRICT_FP_EXTEND(SDNode *
N);
892 SDValue ScalarizeVecOp_VECREDUCE(SDNode *
N);
893 SDValue ScalarizeVecOp_VECREDUCE_SEQ(SDNode *
N);
894 SDValue ScalarizeVecOp_CMP(SDNode *
N);
895 SDValue ScalarizeVecOp_FAKE_USE(SDNode *
N);
908 void GetSplitVector(SDValue Op, SDValue &
Lo, SDValue &
Hi);
909 void SetSplitVector(SDValue Op, SDValue
Lo, SDValue
Hi);
912 std::pair<SDValue, SDValue> SplitMask(SDValue Mask);
915 std::pair<SDValue, SDValue> SplitMask(SDValue Mask,
const SDLoc &
DL);
919 void IncrementPointer(MemSDNode *
N, EVT MemVT, MachinePointerInfo &MPI,
923 void SplitVectorResult(SDNode *
N,
unsigned ResNo);
924 void SplitVecRes_BinOp(SDNode *
N, SDValue &
Lo, SDValue &
Hi);
925 void SplitVecRes_TernaryOp(SDNode *
N, SDValue &
Lo, SDValue &
Hi);
926 void SplitVecRes_CMP(SDNode *
N, SDValue &
Lo, SDValue &
Hi);
927 void SplitVecRes_UnaryOp(SDNode *
N, SDValue &
Lo, SDValue &
Hi);
928 void SplitVecRes_ADDRSPACECAST(SDNode *
N, SDValue &
Lo, SDValue &
Hi);
929 void SplitVecRes_UnaryOpWithTwoResults(SDNode *
N,
unsigned ResNo, SDValue &
Lo,
931 void SplitVecRes_ExtendOp(SDNode *
N, SDValue &
Lo, SDValue &
Hi);
932 void SplitVecRes_InregOp(SDNode *
N, SDValue &
Lo, SDValue &
Hi);
933 void SplitVecRes_ExtVecInRegOp(SDNode *
N, SDValue &
Lo, SDValue &
Hi);
934 void SplitVecRes_StrictFPOp(SDNode *
N, SDValue &
Lo, SDValue &
Hi);
935 void SplitVecRes_OverflowOp(SDNode *
N,
unsigned ResNo,
936 SDValue &
Lo, SDValue &
Hi);
938 void SplitVecRes_FIX(SDNode *
N, SDValue &
Lo, SDValue &
Hi);
940 void SplitVecRes_BITCAST(SDNode *
N, SDValue &
Lo, SDValue &
Hi);
941 void SplitVecRes_BUILD_VECTOR(SDNode *
N, SDValue &
Lo, SDValue &
Hi);
942 void SplitVecRes_CONCAT_VECTORS(SDNode *
N, SDValue &
Lo, SDValue &
Hi);
943 void SplitVecRes_EXTRACT_SUBVECTOR(SDNode *
N, SDValue &
Lo, SDValue &
Hi);
944 void SplitVecRes_INSERT_SUBVECTOR(SDNode *
N, SDValue &
Lo, SDValue &
Hi);
945 void SplitVecRes_FPOp_MultiType(SDNode *
N, SDValue &
Lo, SDValue &
Hi);
946 void SplitVecRes_IS_FPCLASS(SDNode *
N, SDValue &
Lo, SDValue &
Hi);
947 void SplitVecRes_INSERT_VECTOR_ELT(SDNode *
N, SDValue &
Lo, SDValue &
Hi);
948 void SplitVecRes_LOAD(LoadSDNode *LD, SDValue &
Lo, SDValue &
Hi);
949 void SplitVecRes_VP_LOAD(VPLoadSDNode *LD, SDValue &
Lo, SDValue &
Hi);
950 void SplitVecRes_VP_STRIDED_LOAD(VPStridedLoadSDNode *SLD, SDValue &
Lo,
952 void SplitVecRes_MLOAD(MaskedLoadSDNode *MLD, SDValue &
Lo, SDValue &
Hi);
953 void SplitVecRes_Gather(MemSDNode *VPGT, SDValue &
Lo, SDValue &
Hi,
954 bool SplitSETCC =
false);
955 void SplitVecRes_VECTOR_COMPRESS(SDNode *
N, SDValue &
Lo, SDValue &
Hi);
956 void SplitVecRes_ScalarOp(SDNode *
N, SDValue &
Lo, SDValue &
Hi);
957 void SplitVecRes_VP_SPLAT(SDNode *
N, SDValue &
Lo, SDValue &
Hi);
958 void SplitVecRes_STEP_VECTOR(SDNode *
N, SDValue &
Lo, SDValue &
Hi);
959 void SplitVecRes_SETCC(SDNode *
N, SDValue &
Lo, SDValue &
Hi);
960 void SplitVecRes_VECTOR_REVERSE(SDNode *
N, SDValue &
Lo, SDValue &
Hi);
961 void SplitVecRes_VECTOR_SHUFFLE(ShuffleVectorSDNode *
N, SDValue &
Lo,
963 void SplitVecRes_VECTOR_SPLICE(SDNode *
N, SDValue &
Lo, SDValue &
Hi);
964 void SplitVecRes_VECTOR_DEINTERLEAVE(SDNode *
N);
965 void SplitVecRes_VECTOR_INTERLEAVE(SDNode *
N);
966 void SplitVecRes_VAARG(SDNode *
N, SDValue &
Lo, SDValue &
Hi);
967 void SplitVecRes_FP_TO_XINT_SAT(SDNode *
N, SDValue &
Lo, SDValue &
Hi);
968 void SplitVecRes_VP_REVERSE(SDNode *
N, SDValue &
Lo, SDValue &
Hi);
971 bool SplitVectorOperand(SDNode *
N,
unsigned OpNo);
972 SDValue SplitVecOp_VSELECT(SDNode *
N,
unsigned OpNo);
973 SDValue SplitVecOp_VECREDUCE(SDNode *
N,
unsigned OpNo);
974 SDValue SplitVecOp_VECREDUCE_SEQ(SDNode *
N);
975 SDValue SplitVecOp_VP_REDUCE(SDNode *
N,
unsigned OpNo);
976 SDValue SplitVecOp_UnaryOp(SDNode *
N);
977 SDValue SplitVecOp_TruncateHelper(SDNode *
N);
978 SDValue SplitVecOp_VECTOR_COMPRESS(SDNode *
N,
unsigned OpNo);
980 SDValue SplitVecOp_BITCAST(SDNode *
N);
981 SDValue SplitVecOp_INSERT_SUBVECTOR(SDNode *
N,
unsigned OpNo);
982 SDValue SplitVecOp_EXTRACT_SUBVECTOR(SDNode *
N);
983 SDValue SplitVecOp_EXTRACT_VECTOR_ELT(SDNode *
N);
984 SDValue SplitVecOp_ExtVecInRegOp(SDNode *
N);
985 SDValue SplitVecOp_FAKE_USE(SDNode *
N);
986 SDValue SplitVecOp_STORE(StoreSDNode *
N,
unsigned OpNo);
987 SDValue SplitVecOp_VP_STORE(VPStoreSDNode *
N,
unsigned OpNo);
988 SDValue SplitVecOp_VP_STRIDED_STORE(VPStridedStoreSDNode *
N,
unsigned OpNo);
989 SDValue SplitVecOp_MSTORE(MaskedStoreSDNode *
N,
unsigned OpNo);
990 SDValue SplitVecOp_Scatter(MemSDNode *
N,
unsigned OpNo);
991 SDValue SplitVecOp_Gather(MemSDNode *MGT,
unsigned OpNo);
992 SDValue SplitVecOp_CONCAT_VECTORS(SDNode *
N);
993 SDValue SplitVecOp_VSETCC(SDNode *
N);
994 SDValue SplitVecOp_FP_ROUND(SDNode *
N);
995 SDValue SplitVecOp_FPOpDifferentTypes(SDNode *
N);
996 SDValue SplitVecOp_CMP(SDNode *
N);
997 SDValue SplitVecOp_FP_TO_XINT_SAT(SDNode *
N);
998 SDValue SplitVecOp_VP_CttzElements(SDNode *
N);
999 SDValue SplitVecOp_VECTOR_HISTOGRAM(SDNode *
N);
1011 SDValue GetWidenedVector(SDValue Op) {
1012 TableId &WidenedId = WidenedVectors[getTableId(Op)];
1013 SDValue WidenedOp = getSDValue(WidenedId);
1014 assert(WidenedOp.getNode() &&
"Operand wasn't widened?");
1017 void SetWidenedVector(SDValue Op, SDValue Result);
1020 SDValue GetWidenedMask(SDValue Mask, ElementCount EC) {
1028 TargetLowering::TypeWidenVector &&
1029 "Unable to widen binary VP op");
1030 Mask = GetWidenedVector(Mask);
1031 assert(
Mask.getValueType().getVectorElementCount() == EC &&
1032 "Unable to widen binary VP op");
1037 void WidenVectorResult(SDNode *
N,
unsigned ResNo);
1038 SDValue WidenVecRes_MERGE_VALUES(SDNode*
N,
unsigned ResNo);
1039 SDValue WidenVecRes_ADDRSPACECAST(SDNode *
N);
1040 SDValue WidenVecRes_AssertZext(SDNode*
N);
1041 SDValue WidenVecRes_BITCAST(SDNode*
N);
1042 SDValue WidenVecRes_BUILD_VECTOR(SDNode*
N);
1043 SDValue WidenVecRes_CONCAT_VECTORS(SDNode*
N);
1044 SDValue WidenVecRes_EXTEND_VECTOR_INREG(SDNode*
N);
1045 SDValue WidenVecRes_EXTRACT_SUBVECTOR(SDNode*
N);
1046 SDValue WidenVecRes_INSERT_SUBVECTOR(SDNode *
N);
1047 SDValue WidenVecRes_INSERT_VECTOR_ELT(SDNode*
N);
1048 SDValue WidenVecRes_LOAD(SDNode*
N);
1049 SDValue WidenVecRes_VP_LOAD(VPLoadSDNode *
N);
1050 SDValue WidenVecRes_VP_STRIDED_LOAD(VPStridedLoadSDNode *
N);
1051 SDValue WidenVecRes_VECTOR_COMPRESS(SDNode *
N);
1052 SDValue WidenVecRes_MLOAD(MaskedLoadSDNode*
N);
1053 SDValue WidenVecRes_MGATHER(MaskedGatherSDNode*
N);
1054 SDValue WidenVecRes_VP_GATHER(VPGatherSDNode*
N);
1055 SDValue WidenVecRes_ScalarOp(SDNode*
N);
1056 SDValue WidenVecRes_Select(SDNode *
N);
1057 SDValue WidenVSELECTMask(SDNode *
N);
1058 SDValue WidenVecRes_SELECT_CC(SDNode*
N);
1059 SDValue WidenVecRes_SETCC(SDNode*
N);
1060 SDValue WidenVecRes_STRICT_FSETCC(SDNode*
N);
1061 SDValue WidenVecRes_UNDEF(SDNode *
N);
1062 SDValue WidenVecRes_VECTOR_SHUFFLE(ShuffleVectorSDNode *
N);
1063 SDValue WidenVecRes_VECTOR_REVERSE(SDNode *
N);
1065 SDValue WidenVecRes_Ternary(SDNode *
N);
1066 SDValue WidenVecRes_Binary(SDNode *
N);
1067 SDValue WidenVecRes_CMP(SDNode *
N);
1068 SDValue WidenVecRes_BinaryCanTrap(SDNode *
N);
1069 SDValue WidenVecRes_BinaryWithExtraScalarOp(SDNode *
N);
1070 SDValue WidenVecRes_StrictFP(SDNode *
N);
1071 SDValue WidenVecRes_OverflowOp(SDNode *
N,
unsigned ResNo);
1072 SDValue WidenVecRes_Convert(SDNode *
N);
1073 SDValue WidenVecRes_Convert_StrictFP(SDNode *
N);
1074 SDValue WidenVecRes_FP_TO_XINT_SAT(SDNode *
N);
1075 SDValue WidenVecRes_XROUND(SDNode *
N);
1076 SDValue WidenVecRes_FCOPYSIGN(SDNode *
N);
1077 SDValue WidenVecRes_UnarySameEltsWithScalarArg(SDNode *
N);
1078 SDValue WidenVecRes_ExpOp(SDNode *
N);
1079 SDValue WidenVecRes_Unary(SDNode *
N);
1080 SDValue WidenVecRes_InregOp(SDNode *
N);
1081 SDValue WidenVecRes_UnaryOpWithTwoResults(SDNode *
N,
unsigned ResNo);
1082 void ReplaceOtherWidenResults(SDNode *
N, SDNode *WidenNode,
1083 unsigned WidenResNo);
1086 bool WidenVectorOperand(SDNode *
N,
unsigned OpNo);
1087 SDValue WidenVecOp_BITCAST(SDNode *
N);
1088 SDValue WidenVecOp_CONCAT_VECTORS(SDNode *
N);
1089 SDValue WidenVecOp_EXTEND(SDNode *
N);
1090 SDValue WidenVecOp_CMP(SDNode *
N);
1091 SDValue WidenVecOp_EXTRACT_VECTOR_ELT(SDNode *
N);
1092 SDValue WidenVecOp_INSERT_SUBVECTOR(SDNode *
N);
1093 SDValue WidenVecOp_EXTRACT_SUBVECTOR(SDNode *
N);
1094 SDValue WidenVecOp_EXTEND_VECTOR_INREG(SDNode *
N);
1095 SDValue WidenVecOp_FAKE_USE(SDNode *
N);
1096 SDValue WidenVecOp_STORE(SDNode*
N);
1097 SDValue WidenVecOp_VP_STORE(SDNode *
N,
unsigned OpNo);
1098 SDValue WidenVecOp_VP_STRIDED_STORE(SDNode *
N,
unsigned OpNo);
1099 SDValue WidenVecOp_MSTORE(SDNode*
N,
unsigned OpNo);
1100 SDValue WidenVecOp_MGATHER(SDNode*
N,
unsigned OpNo);
1101 SDValue WidenVecOp_MSCATTER(SDNode*
N,
unsigned OpNo);
1102 SDValue WidenVecOp_VP_SCATTER(SDNode*
N,
unsigned OpNo);
1103 SDValue WidenVecOp_VP_SPLAT(SDNode *
N,
unsigned OpNo);
1104 SDValue WidenVecOp_SETCC(SDNode*
N);
1105 SDValue WidenVecOp_STRICT_FSETCC(SDNode*
N);
1106 SDValue WidenVecOp_VSELECT(SDNode *
N);
1108 SDValue WidenVecOp_Convert(SDNode *
N);
1109 SDValue WidenVecOp_FP_TO_XINT_SAT(SDNode *
N);
1110 SDValue WidenVecOp_UnrollVectorOp(SDNode *
N);
1111 SDValue WidenVecOp_IS_FPCLASS(SDNode *
N);
1112 SDValue WidenVecOp_VECREDUCE(SDNode *
N);
1113 SDValue WidenVecOp_VECREDUCE_SEQ(SDNode *
N);
1114 SDValue WidenVecOp_VP_REDUCE(SDNode *
N);
1115 SDValue WidenVecOp_ExpOp(SDNode *
N);
1116 SDValue WidenVecOp_VP_CttzElements(SDNode *
N);
1121 SDValue UnrollVectorOp_StrictFP(SDNode *
N,
unsigned ResNE);
1131 SDValue GenWidenVectorLoads(SmallVectorImpl<SDValue> &LdChain,
1139 SDValue GenWidenVectorExtLoads(SmallVectorImpl<SDValue> &LdChain,
1140 LoadSDNode *LD, ISD::LoadExtType ExtType);
1146 bool GenWidenVectorStores(SmallVectorImpl<SDValue> &StChain, StoreSDNode *ST);
1152 SDValue ModifyToType(SDValue InOp, EVT NVT,
bool FillWithZeroes =
false);
1156 SDValue convertMask(SDValue InMask, EVT MaskVT, EVT ToMaskVT);
1166 void GetSplitOp(SDValue Op, SDValue &
Lo, SDValue &
Hi) {
1167 if (
Op.getValueType().isVector())
1168 GetSplitVector(Op,
Lo,
Hi);
1169 else if (
Op.getValueType().isInteger())
1170 GetExpandedInteger(Op,
Lo,
Hi);
1172 GetExpandedFloat(Op,
Lo,
Hi);
1177 void GetPairElements(SDValue Pair, SDValue &
Lo, SDValue &
Hi);
1180 void SplitRes_MERGE_VALUES(SDNode *
N,
unsigned ResNo,
1181 SDValue &
Lo, SDValue &
Hi);
1182 void SplitVecRes_AssertZext (SDNode *
N, SDValue &
Lo, SDValue &
Hi);
1183 void SplitRes_ARITH_FENCE (SDNode *
N, SDValue &
Lo, SDValue &
Hi);
1184 void SplitRes_Select (SDNode *
N, SDValue &
Lo, SDValue &
Hi);
1185 void SplitRes_SELECT_CC (SDNode *
N, SDValue &
Lo, SDValue &
Hi);
1186 void SplitRes_UNDEF (SDNode *
N, SDValue &
Lo, SDValue &
Hi);
1187 void SplitRes_FREEZE (SDNode *
N, SDValue &
Lo, SDValue &
Hi);
1198 void GetExpandedOp(SDValue Op, SDValue &
Lo, SDValue &
Hi) {
1199 if (
Op.getValueType().isInteger())
1200 GetExpandedInteger(Op,
Lo,
Hi);
1202 GetExpandedFloat(Op,
Lo,
Hi);
1208 void IntegerToVector(SDValue Op,
unsigned NumElements,
1209 SmallVectorImpl<SDValue> &Ops, EVT EltVT);
1212 void ExpandRes_MERGE_VALUES (SDNode *
N,
unsigned ResNo,
1213 SDValue &
Lo, SDValue &
Hi);
1214 void ExpandRes_BITCAST (SDNode *
N, SDValue &
Lo, SDValue &
Hi);
1215 void ExpandRes_BUILD_PAIR (SDNode *
N, SDValue &
Lo, SDValue &
Hi);
1216 void ExpandRes_EXTRACT_ELEMENT (SDNode *
N, SDValue &
Lo, SDValue &
Hi);
1217 void ExpandRes_EXTRACT_VECTOR_ELT(SDNode *
N, SDValue &
Lo, SDValue &
Hi);
1218 void ExpandRes_NormalLoad (SDNode *
N, SDValue &
Lo, SDValue &
Hi);
1219 void ExpandRes_VAARG (SDNode *
N, SDValue &
Lo, SDValue &
Hi);
1222 SDValue ExpandOp_BITCAST (SDNode *
N);
1223 SDValue ExpandOp_BUILD_VECTOR (SDNode *
N);
1224 SDValue ExpandOp_EXTRACT_ELEMENT (SDNode *
N);
1225 SDValue ExpandOp_FAKE_USE(SDNode *
N);
1226 SDValue ExpandOp_INSERT_VECTOR_ELT(SDNode *
N);
1227 SDValue ExpandOp_SCALAR_TO_VECTOR (SDNode *
N);
1228 SDValue ExpandOp_NormalStore (SDNode *
N,
unsigned OpNo);
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
BlockVerifier::State From
#define LLVM_LIBRARY_VISIBILITY
This file defines the DenseMap class.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
This file describes how to lower LLVM code to machine code.
support::ulittle16_t & Lo
support::ulittle16_t & Hi
This takes an arbitrary SelectionDAG as input and hacks on it until only value types the target machi...
DAGTypeLegalizer(SelectionDAG &dag)
void NoteDeletion(SDNode *Old, SDNode *New)
SelectionDAG & getDAG() const
NodeIdFlags
This pass uses the NodeId on the SDNodes to hold information about the state of the node.
This class represents an Operation in the Expression.
Represents one node in the SelectionDAG.
unsigned getNumValues() const
Return the number of values defined/returned by this operator.
Unlike LLVM values, Selection DAG nodes may return multiple values as the result of a computation.
SDNode * getNode() const
get the SDNode which holds the desired result
This is used to represent a portion of an LLVM function in a low-level Data Dependence DAG representa...
SDValue getVPZeroExtendInReg(SDValue Op, SDValue Mask, SDValue EVL, const SDLoc &DL, EVT VT)
Return the expression required to zero extend the Op value assuming it was the smaller SrcTy value.
SDValue getShiftAmountConstant(uint64_t Val, EVT VT, const SDLoc &DL)
SDValue getZeroExtendInReg(SDValue Op, const SDLoc &DL, EVT VT)
Return the expression required to zero extend the Op value assuming it was the smaller SrcTy value.
const DataLayout & getDataLayout() const
SDValue getValueType(EVT)
SDValue getNode(unsigned Opcode, const SDLoc &DL, EVT VT, ArrayRef< SDUse > Ops)
Gets or creates the specified node.
LLVMContext * getContext() const
LegalizeTypeAction getTypeAction(MVT VT) const
LegalizeTypeAction
This enum indicates whether a types are legal for a target, and if not, what action should be used to...
This class defines information used to lower LLVM code to legal SelectionDAG operators that the targe...
constexpr std::underlying_type_t< E > Mask()
Get a bitmask with 1s in all places up to the high-order bit of E's largest value.
This is an optimization pass for GlobalISel generic memory operations.