LLVM 23.0.0git
X86ISelLowering.h
Go to the documentation of this file.
1//===-- X86ISelLowering.h - X86 DAG Lowering Interface ----------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This file defines the interfaces that X86 uses to lower LLVM code into a
10// selection DAG.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef LLVM_LIB_TARGET_X86_X86ISELLOWERING_H
15#define LLVM_LIB_TARGET_X86_X86ISELLOWERING_H
16
19
20namespace llvm {
21 class X86Subtarget;
22 class X86TargetMachine;
23
24 namespace X86ISD {
25 // X86 Specific DAG Nodes
26 enum NodeType : unsigned {
27 // Start the numbering where the builtin ops leave off.
29
30 /// Bit scan forward.
32 /// Bit scan reverse.
34
35 /// X86 funnel/double shift i16 instructions. These correspond to
36 /// X86::SHLDW and X86::SHRDW instructions which have different amt
37 /// modulo rules to generic funnel shifts.
38 /// NOTE: The operand order matches ISD::FSHL/FSHR not SHLD/SHRD.
41
42 /// Bitwise logical AND of floating point values. This corresponds
43 /// to X86::ANDPS or X86::ANDPD.
45
46 /// Bitwise logical OR of floating point values. This corresponds
47 /// to X86::ORPS or X86::ORPD.
49
50 /// Bitwise logical XOR of floating point values. This corresponds
51 /// to X86::XORPS or X86::XORPD.
53
54 /// Bitwise logical ANDNOT of floating point values. This
55 /// corresponds to X86::ANDNPS or X86::ANDNPD.
57
58 /// These operations represent an abstract X86 call
59 /// instruction, which includes a bunch of information. In particular the
60 /// operands of these node are:
61 ///
62 /// #0 - The incoming token chain
63 /// #1 - The callee
64 /// #2 - The number of arg bytes the caller pushes on the stack.
65 /// #3 - The number of arg bytes the callee pops off the stack.
66 /// #4 - The value to pass in AL/AX/EAX (optional)
67 /// #5 - The value to pass in DL/DX/EDX (optional)
68 ///
69 /// The result values of these nodes are:
70 ///
71 /// #0 - The outgoing token chain
72 /// #1 - The first register result value (optional)
73 /// #2 - The second register result value (optional)
74 ///
76
77 /// Same as call except it adds the NoTrack prefix.
79
80 // Pseudo for a OBJC call that gets emitted together with a special
81 // marker instruction.
83
84 // Psuedo for a call to a global address that must be called via a memory
85 // address (i.e., not loaded into a register then called).
87
88 /// The same as ISD::CopyFromReg except that this node makes it explicit
89 /// that it may lower to an x87 FPU stack pop. Optimizations should be more
90 /// cautious when handling this node than a normal CopyFromReg to avoid
91 /// removing a required FPU stack pop. A key requirement is optimizations
92 /// should not optimize any users of a chain that contains a
93 /// POP_FROM_X87_REG to use a chain from a point earlier than the
94 /// POP_FROM_X87_REG (which may remove a required FPU stack pop).
96
97 // Pseudo for a call to an imported function to ensure the correct machine
98 // instruction is emitted for Import Call Optimization.
100
101 /// X86 compare and logical compare instructions.
106
107 // X86 compare with Intrinsics similar to COMI.
110
111 /// X86 bit-test instructions.
113
114 /// X86 SetCC. Operand 0 is condition code, and operand 1 is the EFLAGS
115 /// operand, usually produced by a CMP instruction.
117
118 /// X86 Select
120
121 // Same as SETCC except it's materialized with a sbb and the value is all
122 // one's or all zero's.
123 SETCC_CARRY, // R = carry_bit ? ~0 : 0
124
125 /// X86 FP SETCC, implemented with CMP{cc}SS/CMP{cc}SD.
126 /// Operands are two FP values to compare; result is a mask of
127 /// 0s or 1s. Generally DTRT for C/C++ with NaNs.
129
130 /// X86 FP SETCC, similar to above, but with output as an i1 mask and
131 /// and a version with SAE.
134
135 /// X86 conditional moves. Operand 0 and operand 1 are the two values
136 /// to select from. Operand 2 is the condition code, and operand 3 is the
137 /// flag operand produced by a CMP or TEST instruction.
139
140 /// X86 conditional branches. Operand 0 is the chain operand, operand 1
141 /// is the block to branch if condition is true, operand 2 is the
142 /// condition code, and operand 3 is the flag operand produced by a CMP
143 /// or TEST instruction.
145
146 /// BRIND node with NoTrack prefix. Operand 0 is the chain operand and
147 /// operand 1 is the target address.
149
150 /// Return with a glue operand. Operand 0 is the chain operand, operand
151 /// 1 is the number of bytes of stack to pop.
153
154 /// Return from interrupt. Operand 0 is the number of bytes to pop.
156
157 /// Repeat fill, corresponds to X86::REP_STOSx.
159
160 /// Repeat move, corresponds to X86::REP_MOVSx.
162
163 /// On Darwin, this node represents the result of the popl
164 /// at function entry, used for PIC code.
166
167 /// A wrapper node for TargetConstantPool, TargetJumpTable,
168 /// TargetExternalSymbol, TargetGlobalAddress, TargetGlobalTLSAddress,
169 /// MCSymbol and TargetBlockAddress.
171
172 /// Special wrapper used under X86-64 PIC mode for RIP
173 /// relative displacements.
175
176 /// Copies a 64-bit value from an MMX vector to the low word
177 /// of an XMM vector, with the high word zero filled.
179
180 /// Copies a 64-bit value from the low word of an XMM vector
181 /// to an MMX vector.
183
184 /// Copies a 32-bit value from the low word of a MMX
185 /// vector to a GPR.
187
188 /// Copies a GPR into the low 32-bit word of a MMX vector
189 /// and zero out the high word.
191
192 /// Extract an 8-bit value from a vector and zero extend it to
193 /// i32, corresponds to X86::PEXTRB.
195
196 /// Extract a 16-bit value from a vector and zero extend it to
197 /// i32, corresponds to X86::PEXTRW.
199
200 /// Insert any element of a 4 x float vector into any element
201 /// of a destination 4 x floatvector.
203
204 /// Insert the lower 8-bits of a 32-bit value to a vector,
205 /// corresponds to X86::PINSRB.
207
208 /// Insert the lower 16-bits of a 32-bit value to a vector,
209 /// corresponds to X86::PINSRW.
211
212 /// Shuffle 16 8-bit values within a vector.
214
215 /// Compute Sum of Absolute Differences.
217 /// Compute Double Block Packed Sum-Absolute-Differences
219
220 /// Bitwise Logical AND NOT of Packed FP values.
222
223 /// Blend where the selector is an immediate.
225
226 /// Dynamic (non-constant condition) vector blend where only the sign bits
227 /// of the condition elements are used. This is used to enforce that the
228 /// condition mask is not valid for generic VSELECT optimizations. This
229 /// is also used to implement the intrinsics.
230 /// Operands are in VSELECT order: MASK, TRUE, FALSE
232
233 /// Combined add and sub on an FP vector.
235
236 // FP vector ops with rounding mode.
256
257 // FP vector get exponent.
262 // Extract Normalized Mantissas.
267 // FP Scale.
272
273 /// Integer horizontal add/sub.
276
277 /// Integer horizontal saturating add/sub.
280
281 /// Floating point horizontal add/sub.
284
285 // Detect Conflicts Within a Vector
287
288 /// Floating point max and min.
291
292 /// Commutative FMIN and FMAX.
295
296 /// Scalar intrinsic floating point max and min.
299
300 /// Floating point reciprocal-sqrt and reciprocal approximation.
301 /// Note that these typically require refinement
302 /// in order to obtain suitable precision.
305
306 // AVX-512 reciprocal approximations with a little more precision.
311
312 // Thread Local Storage.
314
315 // Thread Local Storage. A call to get the start address
316 // of the TLS block for the current module.
318
319 // Thread Local Storage. When calling to an OS provided
320 // thunk at the address from an earlier relocation.
322
323 // Thread Local Storage. A descriptor containing pointer to
324 // code and to argument to get the TLS offset for the symbol.
326
327 // Exception Handling helpers.
329
330 // SjLj exception handling setjmp.
332
333 // SjLj exception handling longjmp.
335
336 // SjLj exception handling dispatch.
338
339 /// Tail call return. See X86TargetLowering::LowerCall for
340 /// the list of operands.
342
343 // Psuedo for a tail call return to a global address that must be called via
344 // a memory address (i.e., not loaded into a register then called).
346
347 // Vector move to low scalar and zero higher vector elements.
349
350 // Vector integer truncate.
352 // Vector integer truncate with unsigned/signed saturation.
355
356 // Masked version of the above. Used when less than a 128-bit result is
357 // produced since the mask only applies to the lower elements and can't
358 // be represented by a select.
359 // SRC, PASSTHRU, MASK
363
364 // Vector FP extend.
369
370 // Vector FP round.
372 // Convert TWO packed single data to one packed data
378
379 // Masked version of above. Used for v2f64->v4f32.
380 // SRC, PASSTHRU, MASK
382
383 // 128-bit vector logical left / right shift
386
387 // Vector shift elements
391
392 // Vector variable shift
396
397 // Vector shift elements by immediate
401
402 // Shifts of mask registers.
405
406 // Bit rotate by immediate
409
410 // Vector packed double/float comparison.
412
413 // Vector integer comparisons.
416
417 // v8i16 Horizontal minimum and position.
419
421
422 /// Vector comparison generating mask bits for fp and
423 /// integer signed and unsigned data types.
425 // Vector mask comparison generating mask bits for FP values.
427 // Vector mask comparison with SAE for FP values.
429
430 // Arithmetic operations with FLAGS results.
440
441 // Bit field extract.
444
445 // Zero High Bits Starting with Specified Bit Position.
447
448 // Parallel extract and deposit.
451
452 // X86-specific multiply by immediate.
454
455 // Vector sign bit extraction.
457
458 // Vector bitwise comparisons.
460
461 // Vector packed fp sign bitwise comparisons.
463
464 // OR/AND test for masks.
467
468 // ADD for masks.
470
471 // Several flavors of instructions with vector shuffle behaviors.
472 // Saturated signed/unnsigned packing.
475 // Intra-lane alignr.
477 // AVX512 inter-lane alignr.
483 // VBMI2 Concat & Shift.
486
487 // Shuffle Packed Values at 128-bit granularity.
503
504 // Variable Permute (VPERM).
505 // Res = VPERMV MaskV, V0
507
508 // 3-op Variable Permute (VPERMT2).
509 // Res = VPERMV3 V0, MaskV, V1
511
512 // Bitwise ternary logic.
514 // Fix Up Special Packed Float32/64 values.
519 // Range Restriction Calculation For Packed Pairs of Float32/64 values.
524 // Reduce - Perform Reduction Transformation on scalar\packed FP.
529 // RndScale - Round FP Values To Include A Given Number Of Fraction Bits.
530 // Also used by the legacy (V)ROUND intrinsics where we mask out the
531 // scaling part of the immediate.
536 // Tests Types Of a FP Values for packed types.
538 // Tests Types Of a FP Values for scalar types.
540
541 // Broadcast (splat) scalar or element 0 of a vector. If the operand is
542 // a vector, this node may change the vector length as part of the splat.
544 // Broadcast mask to vector.
546
547 /// SSE4A Extraction and Insertion.
550
551 // XOP arithmetic/logical shifts.
554 // XOP signed/unsigned integer comparisons.
557 // XOP packed permute bytes.
559 // XOP two source permutation.
561
562 // Vector multiply packed unsigned doubleword integers.
564 // Vector multiply packed signed doubleword integers.
566 // Vector Multiply Packed UnsignedIntegers with Round and Scale.
568
569 // Multiply and Add Packed Integers.
572
573 // AVX512IFMA multiply and add.
574 // NOTE: These are different than the instruction and perform
575 // op0 x op1 + op2.
578
579 // VNNI
584
585 // FMA nodes.
586 // We use the target independent ISD::FMA for the non-inverted case.
592
593 // FMA with rounding mode.
600
601 // AVX512-FP16 complex addition and multiplication.
606
611
616
621
628
635
640
649
651
673
674 // Compress and expand.
677
678 // Bits shuffle
680
681 // Convert Unsigned/Integer to Floating-Point Value with rounding mode.
688
689 // Vector float/double to signed/unsigned integer.
694 // Scalar float/double to signed/unsigned integer.
699
700 // Vector float/double to signed/unsigned integer with truncation.
705
706 // Saturation enabled Vector float/double to signed/unsigned
707 // integer with truncation.
712 // Masked versions of above. Used for v2f64 to v4i32.
713 // SRC, PASSTHRU, MASK
716
717 // Scalar float/double to signed/unsigned integer with truncation.
722
723 // Vector signed/unsigned integer to float/double.
726
727 // Scalar float/double to signed/unsigned integer with saturation.
732
733 // Masked versions of above. Used for v2f64->v4f32.
734 // SRC, PASSTHRU, MASK
741
742 // Custom handling for FP_TO_xINT_SAT
745
746 // Vector float to bfloat16.
747 // Convert packed single data to packed BF16 data
749 // Masked version of above.
750 // SRC, PASSTHRU, MASK
752
753 // Dot product of BF16/FP16 pairs to accumulated into
754 // packed single precision.
757
758 // A stack checking function call. On Windows it's _chkstk call.
760
761 // For allocating variable amounts of stack space when using
762 // segmented stacks. Check if the current stacklet has enough space, and
763 // falls back to heap allocation if not.
765
766 // For allocating stack space when using stack clash protector.
767 // Allocation is performed by block, and each block is probed.
769
770 // Memory barriers.
772
773 // Get a random integer and indicate whether it is valid in CF.
775
776 // Get a NIST SP800-90B & C compliant random integer and
777 // indicate whether it is valid in CF.
779
780 // Protection keys
781 // RDPKRU - Operand 0 is chain. Operand 1 is value for ECX.
782 // WRPKRU - Operand 0 is chain. Operand 1 is value for EDX. Operand 2 is
783 // value for ECX.
786
787 // SSE42 string comparisons.
788 // These nodes produce 3 results, index, mask, and flags. X86ISelDAGToDAG
789 // will emit one or two instructions based on which results are used. If
790 // flags and index/mask this allows us to use a single instruction since
791 // we won't have to pick and opcode for flags. Instead we can rely on the
792 // DAG to CSE everything and decide at isel.
795
796 // Test if in transactional execution.
798
799 // Conversions between float and half-float.
804
805 // Masked version of above.
806 // SRC, RND, PASSTHRU, MASK
809
810 // Galois Field Arithmetic Instructions
814
815 // Carry-less multiplication
817
818 // LWP insert record.
820
821 // User level wait
824
825 // Enqueue Stores Instructions
828
829 // For avx512-vp2intersect
831
832 // User level interrupts - testui
834
835 // Perform an FP80 add after changing precision control in FPCW.
837
838 // Conditional compare instructions
841
842 /// X86 strict FP compare instructions.
846
847 // Vector packed double/float comparison.
849
850 /// Vector comparison generating mask bits for fp and
851 /// integer signed and unsigned data types.
853
854 // Vector float/double to signed/unsigned integer with truncation.
857
858 // Vector FP extend.
860
861 // Vector FP round.
863
864 // RndScale - Round FP Values To Include A Given Number Of Fraction Bits.
865 // Also used by the legacy (V)ROUND intrinsics where we mask out the
866 // scaling part of the immediate.
868
869 // Vector signed/unsigned integer to float/double.
872
873 // Strict FMA nodes.
877
878 // Conversions between float and half-float.
881
882 // Perform an FP80 add after changing precision control in FPCW.
884
885 /// Floating point max and min.
889
890 // Compare and swap.
896
897 /// LOCK-prefixed arithmetic read-modify-write instructions.
898 /// EFLAGS, OUTCHAIN = LADD(INCHAIN, PTR, RHS)
910
911 /// RAO arithmetic instructions.
912 /// OUTCHAIN = AADD(INCHAIN, PTR, RHS)
917
918 // Load, scalar_to_vector, and zero extend.
920
921 // extract_vector_elt, store.
923
924 // scalar broadcast from memory.
926
927 // subvector broadcast from memory.
929
930 // Store FP control word into i16 memory.
932
933 // Load FP control word from i16 memory.
935
936 // Store x87 FPU environment into memory.
938
939 // Load x87 FPU environment from memory.
941
942 /// This instruction implements FP_TO_SINT with the
943 /// integer destination in memory and a FP reg source. This corresponds
944 /// to the X86::FIST*m instructions and the rounding mode change stuff. It
945 /// has two inputs (token chain and address) and two outputs (int value
946 /// and token chain). Memory VT specifies the type to store to.
948
949 /// This instruction implements SINT_TO_FP with the
950 /// integer source in memory and FP reg result. This corresponds to the
951 /// X86::FILD*m instructions. It has two inputs (token chain and address)
952 /// and two outputs (FP value and token chain). The integer source type is
953 /// specified by the memory VT.
955
956 /// This instruction implements a fp->int store from FP stack
957 /// slots. This corresponds to the fist instruction. It takes a
958 /// chain operand, value to store, address, and glue. The memory VT
959 /// specifies the type to store as.
961
962 /// This instruction implements an extending load to FP stack slots.
963 /// This corresponds to the X86::FLD32m / X86::FLD64m. It takes a chain
964 /// operand, and ptr to load from. The memory VT specifies the type to
965 /// load from.
967
968 /// This instruction implements a truncating store from FP stack
969 /// slots. This corresponds to the X86::FST32m / X86::FST64m. It takes a
970 /// chain operand, value to store, address, and glue. The memory VT
971 /// specifies the type to store as.
973
974 /// These instructions grab the address of the next argument
975 /// from a va_list. (reads and modifies the va_list in memory)
978
979 // Vector truncating store with unsigned/signed saturation
982 // Vector truncating masked store with unsigned/signed saturation
985
986 // X86 specific gather and scatter
989
990 // Key locker nodes that produce flags.
999
1000 /// Compare and Add if Condition is Met. Compare value in operand 2 with
1001 /// value in memory of operand 1. If condition of operand 4 is met, add
1002 /// value operand 3 to m32 and write new value in operand 1. Operand 2 is
1003 /// always updated with the original value from operand 1.
1005
1006 // Save xmm argument registers to the stack, according to %al. An operator
1007 // is needed so that this can be expanded with control flow.
1009
1010 // Conditional load/store instructions
1014 };
1015 } // end namespace X86ISD
1016
1017 namespace X86 {
1018 /// Current rounding mode is represented in bits 11:10 of FPSR. These
1019 /// values are same as corresponding constants for rounding mode used
1020 /// in glibc.
1022 rmInvalid = -1, // For handle Invalid rounding mode
1023 rmToNearest = 0, // FE_TONEAREST
1024 rmDownward = 1 << 10, // FE_DOWNWARD
1025 rmUpward = 2 << 10, // FE_UPWARD
1026 rmTowardZero = 3 << 10, // FE_TOWARDZERO
1027 rmMask = 3 << 10 // Bit mask selecting rounding mode
1028 };
1029 }
1030
1031 /// Define some predicates that are used for node matching.
1032 namespace X86 {
1033 /// Returns true if Elt is a constant zero or floating point constant +0.0.
1034 bool isZeroNode(SDValue Elt);
1035
1036 /// Returns true of the given offset can be
1037 /// fit into displacement field of the instruction.
1039 bool hasSymbolicDisplacement);
1040
1041 /// Determines whether the callee is required to pop its
1042 /// own arguments. Callee pop is necessary to support tail calls.
1043 bool isCalleePop(CallingConv::ID CallingConv,
1044 bool is64Bit, bool IsVarArg, bool GuaranteeTCO);
1045
1046 /// If Op is a constant whose elements are all the same constant or
1047 /// undefined, return true and return the constant value in \p SplatVal.
1048 /// If we have undef bits that don't cover an entire element, we treat these
1049 /// as zero if AllowPartialUndefs is set, else we fail and return false.
1050 bool isConstantSplat(SDValue Op, APInt &SplatVal,
1051 bool AllowPartialUndefs = true);
1052
1053 /// Check if Op is a load operation that could be folded into some other x86
1054 /// instruction as a memory operand. Example: vpaddd (%rdi), %xmm0, %xmm0.
1055 bool mayFoldLoad(SDValue Op, const X86Subtarget &Subtarget,
1056 bool AssumeSingleUse = false,
1057 bool IgnoreAlignment = false);
1058
1059 /// Check if Op is a load operation that could be folded into a vector splat
1060 /// instruction as a memory operand. Example: vbroadcastss 16(%rdi), %xmm2.
1062 const X86Subtarget &Subtarget,
1063 bool AssumeSingleUse = false);
1064
1065 /// Check if Op is a value that could be used to fold a store into some
1066 /// other x86 instruction as a memory operand. Ex: pextrb $0, %xmm0, (%rdi).
1068
1069 /// Check if Op is an operation that could be folded into a zero extend x86
1070 /// instruction.
1072
1073 /// True if the target supports the extended frame for async Swift
1074 /// functions.
1075 bool isExtendedSwiftAsyncFrameSupported(const X86Subtarget &Subtarget,
1076 const MachineFunction &MF);
1077
1078 /// Convert LLVM rounding mode to X86 rounding mode.
1079 int getRoundingModeX86(unsigned RM);
1080
1081 } // end namespace X86
1082
1083 //===--------------------------------------------------------------------===//
1084 // X86 Implementation of the TargetLowering interface
1085 class X86TargetLowering final : public TargetLowering {
1086 // Copying needed for an outgoing byval argument.
1087 enum ByValCopyKind {
1088 // Argument is already in the correct location, no copy needed.
1089 NoCopy,
1090 // Argument value is currently in the local stack frame, needs copying to
1091 // outgoing arguemnt area.
1092 CopyOnce,
1093 // Argument value is currently in the outgoing argument area, but not at
1094 // the correct offset, so needs copying via a temporary in local stack
1095 // space.
1096 CopyViaTemp,
1097 };
1098
1099 public:
1100 explicit X86TargetLowering(const X86TargetMachine &TM,
1101 const X86Subtarget &STI);
1102
1103 unsigned getJumpTableEncoding() const override;
1104 bool useSoftFloat() const override;
1105
1106 void markLibCallAttributes(MachineFunction *MF, unsigned CC,
1107 ArgListTy &Args) const override;
1108
1109 MVT getScalarShiftAmountTy(const DataLayout &, EVT VT) const override {
1110 return MVT::i8;
1111 }
1112
1113 const MCExpr *
1115 const MachineBasicBlock *MBB, unsigned uid,
1116 MCContext &Ctx) const override;
1117
1118 /// Returns relocation base for the given PIC jumptable.
1120 SelectionDAG &DAG) const override;
1121 const MCExpr *
1123 unsigned JTI, MCContext &Ctx) const override;
1124
1125 /// Return the desired alignment for ByVal aggregate
1126 /// function arguments in the caller parameter area. For X86, aggregates
1127 /// that contains are placed at 16-byte boundaries while the rest are at
1128 /// 4-byte boundaries.
1129 Align getByValTypeAlignment(Type *Ty, const DataLayout &DL) const override;
1130
1131 EVT getOptimalMemOpType(LLVMContext &Context, const MemOp &Op,
1132 const AttributeList &FuncAttributes) const override;
1133
1134 /// Returns true if it's safe to use load / store of the
1135 /// specified type to expand memcpy / memset inline. This is mostly true
1136 /// for all types except for some special cases. For example, on X86
1137 /// targets without SSE2 f64 load / store are done with fldl / fstpl which
1138 /// also does type conversion. Note the specified type doesn't have to be
1139 /// legal as the hook is used before type legalization.
1140 bool isSafeMemOpType(MVT VT) const override;
1141
1142 bool isMemoryAccessFast(EVT VT, Align Alignment) const;
1143
1144 /// Returns true if the target allows unaligned memory accesses of the
1145 /// specified type. Returns whether it is "fast" in the last argument.
1146 bool allowsMisalignedMemoryAccesses(EVT VT, unsigned AS, Align Alignment,
1148 unsigned *Fast) const override;
1149
1150 /// This function returns true if the memory access is aligned or if the
1151 /// target allows this specific unaligned memory access. If the access is
1152 /// allowed, the optional final parameter returns a relative speed of the
1153 /// access (as defined by the target).
1154 bool allowsMemoryAccess(
1155 LLVMContext &Context, const DataLayout &DL, EVT VT, unsigned AddrSpace,
1156 Align Alignment,
1158 unsigned *Fast = nullptr) const override;
1159
1161 const MachineMemOperand &MMO,
1162 unsigned *Fast) const {
1163 return allowsMemoryAccess(Context, DL, VT, MMO.getAddrSpace(),
1164 MMO.getAlign(), MMO.getFlags(), Fast);
1165 }
1166
1167 /// Provide custom lowering hooks for some operations.
1168 ///
1169 SDValue LowerOperation(SDValue Op, SelectionDAG &DAG) const override;
1170
1171 /// Replace the results of node with an illegal result
1172 /// type with new values built out of custom code.
1173 ///
1175 SelectionDAG &DAG) const override;
1176
1177 SDValue PerformDAGCombine(SDNode *N, DAGCombinerInfo &DCI) const override;
1178
1179 bool preferABDSToABSWithNSW(EVT VT) const override;
1180
1181 bool preferSextInRegOfTruncate(EVT TruncVT, EVT VT,
1182 EVT ExtVT) const override;
1183
1185 EVT VT) const override;
1186
1187 /// Return true if the target has native support for
1188 /// the specified value type and it is 'desirable' to use the type for the
1189 /// given node type. e.g. On x86 i16 is legal, but undesirable since i16
1190 /// instruction encodings are longer and some i16 instructions are slow.
1191 bool isTypeDesirableForOp(unsigned Opc, EVT VT) const override;
1192
1193 /// Return true if the target has native support for the
1194 /// specified value type and it is 'desirable' to use the type. e.g. On x86
1195 /// i16 is legal, but undesirable since i16 instruction encodings are longer
1196 /// and some i16 instructions are slow.
1197 bool IsDesirableToPromoteOp(SDValue Op, EVT &PVT) const override;
1198
1199 /// Return prefered fold type, Abs if this is a vector, AddAnd if its an
1200 /// integer, None otherwise.
1203 const SDNode *SETCC0,
1204 const SDNode *SETCC1) const override;
1205
1206 /// Return the newly negated expression if the cost is not expensive and
1207 /// set the cost in \p Cost to indicate that if it is cheaper or neutral to
1208 /// do the negation.
1210 bool LegalOperations, bool ForCodeSize,
1212 unsigned Depth) const override;
1213
1216 MachineBasicBlock *MBB) const override;
1217
1218 /// This method returns the name of a target specific DAG node.
1219 const char *getTargetNodeName(unsigned Opcode) const override;
1220
1221 /// Do not merge vector stores after legalization because that may conflict
1222 /// with x86-specific store splitting optimizations.
1223 bool mergeStoresAfterLegalization(EVT MemVT) const override {
1224 return !MemVT.isVector();
1225 }
1226
1227 bool canMergeStoresTo(unsigned AddressSpace, EVT MemVT,
1228 const MachineFunction &MF) const override;
1229
1230 bool isCheapToSpeculateCttz(Type *Ty) const override;
1231
1232 bool isCheapToSpeculateCtlz(Type *Ty) const override;
1233
1234 bool isCtlzFast() const override;
1235
1236 bool isMultiStoresCheaperThanBitsMerge(EVT LTy, EVT HTy) const override {
1237 // If the pair to store is a mixture of float and int values, we will
1238 // save two bitwise instructions and one float-to-int instruction and
1239 // increase one store instruction. There is potentially a more
1240 // significant benefit because it avoids the float->int domain switch
1241 // for input value. So It is more likely a win.
1242 if ((LTy.isFloatingPoint() && HTy.isInteger()) ||
1243 (LTy.isInteger() && HTy.isFloatingPoint()))
1244 return true;
1245 // If the pair only contains int values, we will save two bitwise
1246 // instructions and increase one store instruction (costing one more
1247 // store buffer). Since the benefit is more blurred so we leave
1248 // such pair out until we get testcase to prove it is a win.
1249 return false;
1250 }
1251
1252 bool isMaskAndCmp0FoldingBeneficial(const Instruction &AndI) const override;
1253
1254 bool hasAndNotCompare(SDValue Y) const override;
1255
1256 bool hasAndNot(SDValue Y) const override;
1257
1258 bool hasBitTest(SDValue X, SDValue Y) const override;
1259
1262 unsigned OldShiftOpcode, unsigned NewShiftOpcode,
1263 SelectionDAG &DAG) const override;
1264
1266 EVT VT, unsigned ShiftOpc, bool MayTransformRotate,
1267 const APInt &ShiftOrRotateAmt,
1268 const std::optional<APInt> &AndMask) const override;
1269
1270 bool preferScalarizeSplat(SDNode *N) const override;
1271
1272 CondMergingParams
1274 const Value *Rhs) const override;
1275
1276 bool shouldFoldConstantShiftPairToMask(const SDNode *N) const override;
1277
1278 bool shouldFoldMaskToVariableShiftPair(SDValue Y) const override;
1279
1280 bool
1282 unsigned KeptBits) const override {
1283 // For vectors, we don't have a preference..
1284 if (XVT.isVector())
1285 return false;
1286
1287 auto VTIsOk = [](EVT VT) -> bool {
1288 return VT == MVT::i8 || VT == MVT::i16 || VT == MVT::i32 ||
1289 VT == MVT::i64;
1290 };
1291
1292 // We are ok with KeptBitsVT being byte/word/dword, what MOVS supports.
1293 // XVT will be larger than KeptBitsVT.
1294 MVT KeptBitsVT = MVT::getIntegerVT(KeptBits);
1295 return VTIsOk(XVT) && VTIsOk(KeptBitsVT);
1296 }
1297
1300 unsigned ExpansionFactor) const override;
1301
1302 bool shouldSplatInsEltVarIndex(EVT VT) const override;
1303
1304 bool shouldConvertFpToSat(unsigned Op, EVT FPVT, EVT VT) const override {
1305 // Converting to sat variants holds little benefit on X86 as we will just
1306 // need to saturate the value back using fp arithmatic.
1308 }
1309
1310 bool convertSetCCLogicToBitwiseLogic(EVT VT) const override {
1311 return VT.isScalarInteger();
1312 }
1313
1314 /// Vector-sized comparisons are fast using PCMPEQ + PMOVMSK or PTEST.
1315 MVT hasFastEqualityCompare(unsigned NumBits) const override;
1316
1317 /// Return the value type to use for ISD::SETCC.
1319 EVT VT) const override;
1320
1322 const APInt &DemandedElts,
1323 TargetLoweringOpt &TLO) const override;
1324
1325 /// Determine which of the bits specified in Mask are known to be either
1326 /// zero or one and return them in the KnownZero/KnownOne bitsets.
1328 KnownBits &Known,
1329 const APInt &DemandedElts,
1330 const SelectionDAG &DAG,
1331 unsigned Depth = 0) const override;
1332
1333 /// Determine the number of bits in the operation that are sign bits.
1335 const APInt &DemandedElts,
1336 const SelectionDAG &DAG,
1337 unsigned Depth) const override;
1338
1340 const APInt &DemandedElts,
1341 APInt &KnownUndef,
1342 APInt &KnownZero,
1343 TargetLoweringOpt &TLO,
1344 unsigned Depth) const override;
1345
1347 const APInt &DemandedElts,
1348 unsigned MaskIndex,
1349 TargetLoweringOpt &TLO,
1350 unsigned Depth) const;
1351
1353 const APInt &DemandedBits,
1354 const APInt &DemandedElts,
1355 KnownBits &Known,
1356 TargetLoweringOpt &TLO,
1357 unsigned Depth) const override;
1358
1360 SDValue Op, const APInt &DemandedBits, const APInt &DemandedElts,
1361 SelectionDAG &DAG, unsigned Depth) const override;
1362
1364 SDValue Op, const APInt &DemandedElts, const SelectionDAG &DAG,
1365 bool PoisonOnly, unsigned Depth) const override;
1366
1368 SDValue Op, const APInt &DemandedElts, const SelectionDAG &DAG,
1369 bool PoisonOnly, bool ConsiderFlags, unsigned Depth) const override;
1370
1371 bool isSplatValueForTargetNode(SDValue Op, const APInt &DemandedElts,
1372 APInt &UndefElts, const SelectionDAG &DAG,
1373 unsigned Depth) const override;
1374
1376 // Peek through bitcasts/extracts/inserts to see if we have a vector
1377 // load/broadcast from memory.
1378 while (Op.getOpcode() == ISD::BITCAST ||
1379 Op.getOpcode() == ISD::EXTRACT_SUBVECTOR ||
1380 (Op.getOpcode() == ISD::INSERT_SUBVECTOR &&
1381 Op.getOperand(0).isUndef()))
1382 Op = Op.getOperand(Op.getOpcode() == ISD::INSERT_SUBVECTOR ? 1 : 0);
1383
1384 return Op.getOpcode() == X86ISD::VBROADCAST_LOAD ||
1385 Op.getOpcode() == X86ISD::SUBV_BROADCAST_LOAD ||
1386 (Op.getOpcode() == ISD::LOAD &&
1389 }
1390
1391 bool isTargetCanonicalSelect(SDNode *N) const override;
1392
1393 const Constant *getTargetConstantFromLoad(LoadSDNode *LD) const override;
1394
1395 SDValue unwrapAddress(SDValue N) const override;
1396
1398
1399 ConstraintType getConstraintType(StringRef Constraint) const override;
1400
1401 /// Examine constraint string and operand type and determine a weight value.
1402 /// The operand object must already have been set up with the operand type.
1404 getSingleConstraintMatchWeight(AsmOperandInfo &Info,
1405 const char *Constraint) const override;
1406
1407 const char *LowerXConstraint(EVT ConstraintVT) const override;
1408
1409 /// Lower the specified operand into the Ops vector. If it is invalid, don't
1410 /// add anything to Ops. If hasMemory is true it means one of the asm
1411 /// constraint of the inline asm instruction being processed is 'm'.
1413 std::vector<SDValue> &Ops,
1414 SelectionDAG &DAG) const override;
1415
1417 getInlineAsmMemConstraint(StringRef ConstraintCode) const override {
1418 if (ConstraintCode == "v")
1420 return TargetLowering::getInlineAsmMemConstraint(ConstraintCode);
1421 }
1422
1423 /// Handle Lowering flag assembly outputs.
1425 const SDLoc &DL,
1426 const AsmOperandInfo &Constraint,
1427 SelectionDAG &DAG) const override;
1428
1429 /// Given a physical register constraint
1430 /// (e.g. {edx}), return the register number and the register class for the
1431 /// register. This should only be used for C_Register constraints. On
1432 /// error, this returns a register number of 0.
1433 std::pair<unsigned, const TargetRegisterClass *>
1435 StringRef Constraint, MVT VT) const override;
1436
1437 /// Return true if the addressing mode represented
1438 /// by AM is legal for this target, for a load/store of the specified type.
1439 bool isLegalAddressingMode(const DataLayout &DL, const AddrMode &AM,
1440 Type *Ty, unsigned AS,
1441 Instruction *I = nullptr) const override;
1442
1443 bool addressingModeSupportsTLS(const GlobalValue &GV) const override;
1444
1445 /// Return true if the specified immediate is legal
1446 /// icmp immediate, that is the target has icmp instructions which can
1447 /// compare a register against the immediate without having to materialize
1448 /// the immediate into a register.
1449 bool isLegalICmpImmediate(int64_t Imm) const override;
1450
1451 /// Return true if the specified immediate is legal
1452 /// add immediate, that is the target has add instructions which can
1453 /// add a register and the immediate without having to materialize
1454 /// the immediate into a register.
1455 bool isLegalAddImmediate(int64_t Imm) const override;
1456
1457 bool isLegalStoreImmediate(int64_t Imm) const override;
1458
1459 /// Add x86-specific opcodes to the default list.
1460 bool isBinOp(unsigned Opcode) const override;
1461
1462 /// Returns true if the opcode is a commutative binary operation.
1463 bool isCommutativeBinOp(unsigned Opcode) const override;
1464
1465 /// Return true if it's free to truncate a value of
1466 /// type Ty1 to type Ty2. e.g. On x86 it's free to truncate a i32 value in
1467 /// register EAX to i16 by referencing its sub-register AX.
1468 bool isTruncateFree(Type *Ty1, Type *Ty2) const override;
1469 bool isTruncateFree(EVT VT1, EVT VT2) const override;
1470
1471 bool allowTruncateForTailCall(Type *Ty1, Type *Ty2) const override;
1472
1473 /// Return true if any actual instruction that defines a
1474 /// value of type Ty1 implicit zero-extends the value to Ty2 in the result
1475 /// register. This does not necessarily include registers defined in
1476 /// unknown ways, such as incoming arguments, or copies from unknown
1477 /// virtual registers. Also, if isTruncateFree(Ty2, Ty1) is true, this
1478 /// does not necessarily apply to truncate instructions. e.g. on x86-64,
1479 /// all instructions that define 32-bit values implicit zero-extend the
1480 /// result out to 64 bits.
1481 bool isZExtFree(Type *Ty1, Type *Ty2) const override;
1482 bool isZExtFree(EVT VT1, EVT VT2) const override;
1483 bool isZExtFree(SDValue Val, EVT VT2) const override;
1484
1485 bool shouldConvertPhiType(Type *From, Type *To) const override;
1486
1487 /// Return true if folding a vector load into ExtVal (a sign, zero, or any
1488 /// extend node) is profitable.
1489 bool isVectorLoadExtDesirable(SDValue) const override;
1490
1491 /// Return true if an FMA operation is faster than a pair of fmul and fadd
1492 /// instructions. fmuladd intrinsics will be expanded to FMAs when this
1493 /// method returns true, otherwise fmuladd is expanded to fmul + fadd.
1495 EVT VT) const override;
1496
1497 /// Return true if it's profitable to narrow operations of type SrcVT to
1498 /// DestVT. e.g. on x86, it's profitable to narrow from i32 to i8 but not
1499 /// from i32 to i16.
1500 bool isNarrowingProfitable(SDNode *N, EVT SrcVT, EVT DestVT) const override;
1501
1502 bool shouldFoldSelectWithIdentityConstant(unsigned BinOpcode, EVT VT,
1503 unsigned SelectOpcode, SDValue X,
1504 SDValue Y) const override;
1505
1506 /// Given an intrinsic, checks if on the target the intrinsic will need to map
1507 /// to a MemIntrinsicNode (touches memory). If this is the case, it returns
1508 /// true and stores the intrinsic information into the IntrinsicInfo that was
1509 /// passed to the function.
1510 bool getTgtMemIntrinsic(IntrinsicInfo &Info, const CallBase &I,
1511 MachineFunction &MF,
1512 unsigned Intrinsic) const override;
1513
1514 /// Returns true if the target can instruction select the
1515 /// specified FP immediate natively. If false, the legalizer will
1516 /// materialize the FP immediate as a load from a constant pool.
1517 bool isFPImmLegal(const APFloat &Imm, EVT VT,
1518 bool ForCodeSize) const override;
1519
1520 /// Targets can use this to indicate that they only support *some*
1521 /// VECTOR_SHUFFLE operations, those with specific masks. By default, if a
1522 /// target supports the VECTOR_SHUFFLE node, all mask values are assumed to
1523 /// be legal.
1524 bool isShuffleMaskLegal(ArrayRef<int> Mask, EVT VT) const override;
1525
1526 /// Similar to isShuffleMaskLegal. Targets can use this to indicate if there
1527 /// is a suitable VECTOR_SHUFFLE that can be used to replace a VAND with a
1528 /// constant pool entry.
1529 bool isVectorClearMaskLegal(ArrayRef<int> Mask, EVT VT) const override;
1530
1531 /// Returns true if lowering to a jump table is allowed.
1532 bool areJTsAllowed(const Function *Fn) const override;
1533
1535 EVT ConditionVT) const override;
1536
1537 /// If true, then instruction selection should
1538 /// seek to shrink the FP constant of the specified type to a smaller type
1539 /// in order to save space and / or reduce runtime.
1540 bool ShouldShrinkFPConstant(EVT VT) const override;
1541
1542 /// Return true if we believe it is correct and profitable to reduce the
1543 /// load node to a smaller type.
1544 bool
1546 std::optional<unsigned> ByteOffset) const override;
1547
1548 /// Return true if the specified scalar FP type is computed in an SSE
1549 /// register, not on the X87 floating point stack.
1550 bool isScalarFPTypeInSSEReg(EVT VT) const;
1551
1552 /// Returns true if it is beneficial to convert a load of a constant
1553 /// to just the constant itself.
1555 Type *Ty) const override;
1556
1557 bool reduceSelectOfFPConstantLoads(EVT CmpOpVT) const override;
1558
1559 bool convertSelectOfConstantsToMath(EVT VT) const override;
1560
1561 bool decomposeMulByConstant(LLVMContext &Context, EVT VT,
1562 SDValue C) const override;
1563
1564 /// Return true if EXTRACT_SUBVECTOR is cheap for this result type
1565 /// with this index.
1566 bool isExtractSubvectorCheap(EVT ResVT, EVT SrcVT,
1567 unsigned Index) const override;
1568
1569 /// Scalar ops always have equal or better analysis/performance/power than
1570 /// the vector equivalent, so this always makes sense if the scalar op is
1571 /// supported.
1572 bool shouldScalarizeBinop(SDValue) const override;
1573
1574 /// Extract of a scalar FP value from index 0 of a vector is free.
1575 bool isExtractVecEltCheap(EVT VT, unsigned Index) const override {
1576 EVT EltVT = VT.getScalarType();
1577 return (EltVT == MVT::f32 || EltVT == MVT::f64) && Index == 0;
1578 }
1579
1580 /// Overflow nodes should get combined/lowered to optimal instructions
1581 /// (they should allow eliminating explicit compares by getting flags from
1582 /// math ops).
1583 bool shouldFormOverflowOp(unsigned Opcode, EVT VT,
1584 bool MathUsed) const override;
1585
1586 bool storeOfVectorConstantIsCheap(bool IsZero, EVT MemVT, unsigned NumElem,
1587 unsigned AddrSpace) const override {
1588 // If we can replace more than 2 scalar stores, there will be a reduction
1589 // in instructions even after we add a vector constant load.
1590 return IsZero || NumElem > 2;
1591 }
1592
1593 bool isLoadBitCastBeneficial(EVT LoadVT, EVT BitcastVT,
1594 const SelectionDAG &DAG,
1595 const MachineMemOperand &MMO) const override;
1596
1597 Register getRegisterByName(const char* RegName, LLT VT,
1598 const MachineFunction &MF) const override;
1599
1600 /// If a physical register, this returns the register that receives the
1601 /// exception address on entry to an EH pad.
1602 Register
1603 getExceptionPointerRegister(const Constant *PersonalityFn) const override;
1604
1605 /// If a physical register, this returns the register that receives the
1606 /// exception typeid on entry to a landing pad.
1607 Register
1608 getExceptionSelectorRegister(const Constant *PersonalityFn) const override;
1609
1610 bool needsFixedCatchObjects() const override;
1611
1612 /// This method returns a target specific FastISel object,
1613 /// or null if the target does not support "fast" ISel.
1614 FastISel *
1616 const TargetLibraryInfo *libInfo,
1617 const LibcallLoweringInfo *libcallLowering) const override;
1618
1619 /// If the target has a standard location for the stack protector cookie,
1620 /// returns the address of that location. Otherwise, returns nullptr.
1621 Value *getIRStackGuard(IRBuilderBase &IRB) const override;
1622
1623 bool useLoadStackGuardNode(const Module &M) const override;
1624 bool useStackGuardXorFP() const override;
1625 void insertSSPDeclarations(Module &M) const override;
1627 const SDLoc &DL) const override;
1628
1629
1630 /// Return true if the target stores SafeStack pointer at a fixed offset in
1631 /// some non-standard address space, and populates the address space and
1632 /// offset as appropriate.
1633 Value *getSafeStackPointerLocation(IRBuilderBase &IRB) const override;
1634
1635 std::pair<SDValue, SDValue> BuildFILD(EVT DstVT, EVT SrcVT, const SDLoc &DL,
1636 SDValue Chain, SDValue Pointer,
1637 MachinePointerInfo PtrInfo,
1638 Align Alignment,
1639 SelectionDAG &DAG) const;
1640
1641 /// Customize the preferred legalization strategy for certain types.
1642 LegalizeTypeAction getPreferredVectorAction(MVT VT) const override;
1643
1645 EVT VT) const override;
1646
1648 CallingConv::ID CC,
1649 EVT VT) const override;
1650
1652 LLVMContext &Context, CallingConv::ID CC, EVT VT, EVT &IntermediateVT,
1653 unsigned &NumIntermediates, MVT &RegisterVT) const override;
1654
1656 Type *Ty, CallingConv::ID CallConv, bool isVarArg,
1657 const DataLayout &DL) const override;
1658
1659 bool isIntDivCheap(EVT VT, AttributeList Attr) const override;
1660
1661 bool supportSwiftError() const override;
1662
1663 bool supportKCFIBundles() const override { return true; }
1664
1667 const TargetInstrInfo *TII) const override;
1668
1669 bool hasStackProbeSymbol(const MachineFunction &MF) const override;
1670 bool hasInlineStackProbe(const MachineFunction &MF) const override;
1671 StringRef getStackProbeSymbolName(const MachineFunction &MF) const override;
1672
1673 unsigned getStackProbeSize(const MachineFunction &MF) const;
1674
1675 bool hasVectorBlend() const override { return true; }
1676
1677 unsigned getMaxSupportedInterleaveFactor() const override { return 4; }
1678
1680 unsigned OpNo) const override;
1681
1682 SDValue visitMaskedLoad(SelectionDAG &DAG, const SDLoc &DL, SDValue Chain,
1683 MachineMemOperand *MMO, SDValue &NewLoad,
1684 SDValue Ptr, SDValue PassThru,
1685 SDValue Mask) const override;
1687 MachineMemOperand *MMO, SDValue Ptr, SDValue Val,
1688 SDValue Mask) const override;
1689
1690 /// Lower interleaved load(s) into target specific
1691 /// instructions/intrinsics.
1692 bool lowerInterleavedLoad(Instruction *Load, Value *Mask,
1694 ArrayRef<unsigned> Indices, unsigned Factor,
1695 const APInt &GapMask) const override;
1696
1697 /// Lower interleaved store(s) into target specific
1698 /// instructions/intrinsics.
1699 bool lowerInterleavedStore(Instruction *Store, Value *Mask,
1700 ShuffleVectorInst *SVI, unsigned Factor,
1701 const APInt &GapMask) const override;
1702
1704 int JTI, SelectionDAG &DAG) const override;
1705
1706 Align getPrefLoopAlignment(MachineLoop *ML) const override;
1707
1708 EVT getTypeToTransformTo(LLVMContext &Context, EVT VT) const override {
1709 if (VT == MVT::f80)
1710 return EVT::getIntegerVT(Context, 96);
1711 return TargetLoweringBase::getTypeToTransformTo(Context, VT);
1712 }
1713
1714 protected:
1715 std::pair<const TargetRegisterClass *, uint8_t>
1717 MVT VT) const override;
1718
1719 private:
1720 /// Keep a reference to the X86Subtarget around so that we can
1721 /// make the right decision when generating code for different targets.
1722 const X86Subtarget &Subtarget;
1723
1724 /// A list of legal FP immediates.
1725 std::vector<APFloat> LegalFPImmediates;
1726
1727 /// Indicate that this x86 target can instruction
1728 /// select the specified FP immediate natively.
1729 void addLegalFPImmediate(const APFloat& Imm) {
1730 LegalFPImmediates.push_back(Imm);
1731 }
1732
1733 SDValue LowerCallResult(SDValue Chain, SDValue InGlue,
1734 CallingConv::ID CallConv, bool isVarArg,
1735 const SmallVectorImpl<ISD::InputArg> &Ins,
1736 const SDLoc &dl, SelectionDAG &DAG,
1737 SmallVectorImpl<SDValue> &InVals,
1738 uint32_t *RegMask) const;
1739 SDValue LowerMemArgument(SDValue Chain, CallingConv::ID CallConv,
1740 const SmallVectorImpl<ISD::InputArg> &ArgInfo,
1741 const SDLoc &dl, SelectionDAG &DAG,
1742 const CCValAssign &VA, MachineFrameInfo &MFI,
1743 unsigned i) const;
1744 SDValue LowerMemOpCallTo(SDValue Chain, SDValue StackPtr, SDValue Arg,
1745 const SDLoc &dl, SelectionDAG &DAG,
1746 const CCValAssign &VA,
1747 ISD::ArgFlagsTy Flags, bool isByval) const;
1748
1749 // Call lowering helpers.
1750
1751 /// Check whether the call is eligible for sibling call optimization.
1752 bool
1753 isEligibleForSiblingCallOpt(TargetLowering::CallLoweringInfo &CLI,
1754 CCState &CCInfo,
1755 SmallVectorImpl<CCValAssign> &ArgLocs) const;
1756 SDValue EmitTailCallLoadRetAddr(SelectionDAG &DAG, SDValue &OutRetAddr,
1757 SDValue Chain, bool IsTailCall,
1758 bool Is64Bit, int FPDiff,
1759 const SDLoc &dl) const;
1760
1761 unsigned GetAlignedArgumentStackSize(unsigned StackSize,
1762 SelectionDAG &DAG) const;
1763
1764 unsigned getAddressSpace() const;
1765
1766 SDValue FP_TO_INTHelper(SDValue Op, SelectionDAG &DAG, bool IsSigned,
1767 SDValue &Chain) const;
1768 SDValue LRINT_LLRINTHelper(SDNode *N, SelectionDAG &DAG) const;
1769
1770 SDValue LowerBUILD_VECTOR(SDValue Op, SelectionDAG &DAG) const;
1771 SDValue LowerVSELECT(SDValue Op, SelectionDAG &DAG) const;
1772 SDValue LowerEXTRACT_VECTOR_ELT(SDValue Op, SelectionDAG &DAG) const;
1773 SDValue LowerINSERT_VECTOR_ELT(SDValue Op, SelectionDAG &DAG) const;
1774
1775 unsigned getGlobalWrapperKind(const GlobalValue *GV,
1776 const unsigned char OpFlags) const;
1777 SDValue LowerConstantPool(SDValue Op, SelectionDAG &DAG) const;
1778 SDValue LowerBlockAddress(SDValue Op, SelectionDAG &DAG) const;
1779 SDValue LowerGlobalAddress(SDValue Op, SelectionDAG &DAG) const;
1780 SDValue LowerGlobalTLSAddress(SDValue Op, SelectionDAG &DAG) const;
1781 SDValue LowerExternalSymbol(SDValue Op, SelectionDAG &DAG) const;
1782
1783 /// Creates target global address or external symbol nodes for calls or
1784 /// other uses.
1785 SDValue LowerGlobalOrExternal(SDValue Op, SelectionDAG &DAG, bool ForCall,
1786 bool *IsImpCall) const;
1787
1788 SDValue LowerSINT_TO_FP(SDValue Op, SelectionDAG &DAG) const;
1789 SDValue LowerUINT_TO_FP(SDValue Op, SelectionDAG &DAG) const;
1790 SDValue LowerTRUNCATE(SDValue Op, SelectionDAG &DAG) const;
1791 SDValue LowerFP_TO_INT(SDValue Op, SelectionDAG &DAG) const;
1792 SDValue LowerFP_TO_INT_SAT(SDValue Op, SelectionDAG &DAG) const;
1793 SDValue LowerLRINT_LLRINT(SDValue Op, SelectionDAG &DAG) const;
1794 SDValue LowerSETCC(SDValue Op, SelectionDAG &DAG) const;
1795 SDValue LowerSETCCCARRY(SDValue Op, SelectionDAG &DAG) const;
1796 SDValue LowerSELECT(SDValue Op, SelectionDAG &DAG) const;
1797 SDValue LowerBRCOND(SDValue Op, SelectionDAG &DAG) const;
1798 SDValue LowerJumpTable(SDValue Op, SelectionDAG &DAG) const;
1799 SDValue LowerDYNAMIC_STACKALLOC(SDValue Op, SelectionDAG &DAG) const;
1800 SDValue LowerVASTART(SDValue Op, SelectionDAG &DAG) const;
1801 SDValue LowerVAARG(SDValue Op, SelectionDAG &DAG) const;
1802 SDValue LowerRETURNADDR(SDValue Op, SelectionDAG &DAG) const;
1803 SDValue LowerADDROFRETURNADDR(SDValue Op, SelectionDAG &DAG) const;
1804 SDValue LowerFRAMEADDR(SDValue Op, SelectionDAG &DAG) const;
1805 SDValue LowerFRAME_TO_ARGS_OFFSET(SDValue Op, SelectionDAG &DAG) const;
1806 ByValCopyKind ByValNeedsCopyForTailCall(SelectionDAG &DAG, SDValue Src,
1807 SDValue Dst,
1808 ISD::ArgFlagsTy Flags) const;
1809 SDValue LowerEH_RETURN(SDValue Op, SelectionDAG &DAG) const;
1810 SDValue lowerEH_SJLJ_SETJMP(SDValue Op, SelectionDAG &DAG) const;
1811 SDValue lowerEH_SJLJ_LONGJMP(SDValue Op, SelectionDAG &DAG) const;
1812 SDValue lowerEH_SJLJ_SETUP_DISPATCH(SDValue Op, SelectionDAG &DAG) const;
1813 SDValue LowerINIT_TRAMPOLINE(SDValue Op, SelectionDAG &DAG) const;
1814 SDValue LowerGET_ROUNDING(SDValue Op, SelectionDAG &DAG) const;
1815 SDValue LowerSET_ROUNDING(SDValue Op, SelectionDAG &DAG) const;
1816 SDValue LowerGET_FPENV_MEM(SDValue Op, SelectionDAG &DAG) const;
1817 SDValue LowerSET_FPENV_MEM(SDValue Op, SelectionDAG &DAG) const;
1818 SDValue LowerRESET_FPENV(SDValue Op, SelectionDAG &DAG) const;
1819 SDValue LowerWin64_i128OP(SDValue Op, SelectionDAG &DAG) const;
1820 SDValue LowerWin64_FP_TO_INT128(SDValue Op, SelectionDAG &DAG,
1821 SDValue &Chain) const;
1822 SDValue LowerWin64_INT128_TO_FP(SDValue Op, SelectionDAG &DAG) const;
1823 SDValue LowerGC_TRANSITION(SDValue Op, SelectionDAG &DAG) const;
1824 SDValue LowerINTRINSIC_WO_CHAIN(SDValue Op, SelectionDAG &DAG) const;
1825 SDValue lowerFaddFsub(SDValue Op, SelectionDAG &DAG) const;
1826 SDValue LowerFP_EXTEND(SDValue Op, SelectionDAG &DAG) const;
1827 SDValue LowerFP_ROUND(SDValue Op, SelectionDAG &DAG) const;
1828 SDValue LowerFP_TO_BF16(SDValue Op, SelectionDAG &DAG) const;
1829
1830 SDValue
1831 LowerFormalArguments(SDValue Chain, CallingConv::ID CallConv, bool isVarArg,
1832 const SmallVectorImpl<ISD::InputArg> &Ins,
1833 const SDLoc &dl, SelectionDAG &DAG,
1834 SmallVectorImpl<SDValue> &InVals) const override;
1835 SDValue LowerCall(CallLoweringInfo &CLI,
1836 SmallVectorImpl<SDValue> &InVals) const override;
1837
1838 SDValue LowerReturn(SDValue Chain, CallingConv::ID CallConv, bool isVarArg,
1839 const SmallVectorImpl<ISD::OutputArg> &Outs,
1840 const SmallVectorImpl<SDValue> &OutVals,
1841 const SDLoc &dl, SelectionDAG &DAG) const override;
1842
1843 bool supportSplitCSR(MachineFunction *MF) const override {
1844 return MF->getFunction().getCallingConv() == CallingConv::CXX_FAST_TLS &&
1845 MF->getFunction().hasFnAttribute(Attribute::NoUnwind);
1846 }
1847 void initializeSplitCSR(MachineBasicBlock *Entry) const override;
1848 void insertCopiesSplitCSR(
1849 MachineBasicBlock *Entry,
1850 const SmallVectorImpl<MachineBasicBlock *> &Exits) const override;
1851
1852 bool isUsedByReturnOnly(SDNode *N, SDValue &Chain) const override;
1853
1854 bool mayBeEmittedAsTailCall(const CallInst *CI) const override;
1855
1856 EVT getTypeForExtReturn(LLVMContext &Context, EVT VT,
1857 ISD::NodeType ExtendKind) const override;
1858
1859 bool CanLowerReturn(CallingConv::ID CallConv, MachineFunction &MF,
1860 bool isVarArg,
1861 const SmallVectorImpl<ISD::OutputArg> &Outs,
1862 LLVMContext &Context,
1863 const Type *RetTy) const override;
1864
1865 const MCPhysReg *getScratchRegisters(CallingConv::ID CC) const override;
1867
1869 shouldExpandAtomicLoadInIR(LoadInst *LI) const override;
1871 shouldExpandAtomicStoreInIR(StoreInst *SI) const override;
1873 shouldExpandAtomicRMWInIR(const AtomicRMWInst *AI) const override;
1875 shouldExpandLogicAtomicRMWInIR(const AtomicRMWInst *AI) const;
1876 void emitBitTestAtomicRMWIntrinsic(AtomicRMWInst *AI) const override;
1877 void emitCmpArithAtomicRMWIntrinsic(AtomicRMWInst *AI) const override;
1878
1879 LoadInst *
1880 lowerIdempotentRMWIntoFencedLoad(AtomicRMWInst *AI) const override;
1881
1882 bool needsCmpXchgNb(Type *MemType) const;
1883
1884 void SetupEntryBlockForSjLj(MachineInstr &MI, MachineBasicBlock *MBB,
1885 MachineBasicBlock *DispatchBB, int FI) const;
1886
1887 // Utility function to emit the low-level va_arg code for X86-64.
1888 MachineBasicBlock *
1889 EmitVAARGWithCustomInserter(MachineInstr &MI, MachineBasicBlock *MBB) const;
1890
1891 /// Utility function to emit the xmm reg save portion of va_start.
1892 MachineBasicBlock *EmitLoweredCascadedSelect(MachineInstr &MI1,
1893 MachineInstr &MI2,
1894 MachineBasicBlock *BB) const;
1895
1896 MachineBasicBlock *EmitLoweredSelect(MachineInstr &I,
1897 MachineBasicBlock *BB) const;
1898
1899 MachineBasicBlock *EmitLoweredCatchRet(MachineInstr &MI,
1900 MachineBasicBlock *BB) const;
1901
1902 MachineBasicBlock *EmitLoweredSegAlloca(MachineInstr &MI,
1903 MachineBasicBlock *BB) const;
1904
1905 MachineBasicBlock *EmitLoweredProbedAlloca(MachineInstr &MI,
1906 MachineBasicBlock *BB) const;
1907
1908 MachineBasicBlock *EmitLoweredTLSCall(MachineInstr &MI,
1909 MachineBasicBlock *BB) const;
1910
1911 MachineBasicBlock *EmitLoweredIndirectThunk(MachineInstr &MI,
1912 MachineBasicBlock *BB) const;
1913
1914 MachineBasicBlock *emitEHSjLjSetJmp(MachineInstr &MI,
1915 MachineBasicBlock *MBB) const;
1916
1917 void emitSetJmpShadowStackFix(MachineInstr &MI,
1918 MachineBasicBlock *MBB) const;
1919
1920 MachineBasicBlock *emitEHSjLjLongJmp(MachineInstr &MI,
1921 MachineBasicBlock *MBB) const;
1922
1923 MachineBasicBlock *emitLongJmpShadowStackFix(MachineInstr &MI,
1924 MachineBasicBlock *MBB) const;
1925
1926 MachineBasicBlock *EmitSjLjDispatchBlock(MachineInstr &MI,
1927 MachineBasicBlock *MBB) const;
1928
1929 MachineBasicBlock *emitPatchableEventCall(MachineInstr &MI,
1930 MachineBasicBlock *MBB) const;
1931
1932 /// Emit flags for the given setcc condition and operands. Also returns the
1933 /// corresponding X86 condition code constant in X86CC.
1934 SDValue emitFlagsForSetcc(SDValue Op0, SDValue Op1, ISD::CondCode CC,
1935 const SDLoc &dl, SelectionDAG &DAG,
1936 SDValue &X86CC) const;
1937
1938 bool optimizeFMulOrFDivAsShiftAddBitcast(SDNode *N, SDValue FPConst,
1939 SDValue IntPow2) const override;
1940
1941 /// Check if replacement of SQRT with RSQRT should be disabled.
1942 bool isFsqrtCheap(SDValue Op, SelectionDAG &DAG) const override;
1943
1944 /// Use rsqrt* to speed up sqrt calculations.
1945 SDValue getSqrtEstimate(SDValue Op, SelectionDAG &DAG, int Enabled,
1946 int &RefinementSteps, bool &UseOneConstNR,
1947 bool Reciprocal) const override;
1948
1949 /// Use rcp* to speed up fdiv calculations.
1950 SDValue getRecipEstimate(SDValue Op, SelectionDAG &DAG, int Enabled,
1951 int &RefinementSteps) const override;
1952
1953 /// Reassociate floating point divisions into multiply by reciprocal.
1954 unsigned combineRepeatedFPDivisors() const override;
1955
1956 SDValue BuildSDIVPow2(SDNode *N, const APInt &Divisor, SelectionDAG &DAG,
1957 SmallVectorImpl<SDNode *> &Created) const override;
1958
1959 SDValue getMOVL(SelectionDAG &DAG, const SDLoc &dl, MVT VT, SDValue V1,
1960 SDValue V2) const;
1961 };
1962
1963 namespace X86 {
1964 FastISel *createFastISel(FunctionLoweringInfo &funcInfo,
1965 const TargetLibraryInfo *libInfo,
1966 const LibcallLoweringInfo *libcallLowering);
1967 } // end namespace X86
1968
1969 // X86 specific Gather/Scatter nodes.
1970 // The class has the same order of operands as MaskedGatherScatterSDNode for
1971 // convenience.
1973 public:
1974 // This is a intended as a utility and should never be directly created.
1977
1978 const SDValue &getBasePtr() const { return getOperand(3); }
1979 const SDValue &getIndex() const { return getOperand(4); }
1980 const SDValue &getMask() const { return getOperand(2); }
1981 const SDValue &getScale() const { return getOperand(5); }
1982
1983 static bool classof(const SDNode *N) {
1984 return N->getOpcode() == X86ISD::MGATHER ||
1985 N->getOpcode() == X86ISD::MSCATTER;
1986 }
1987 };
1988
1990 public:
1991 const SDValue &getPassThru() const { return getOperand(1); }
1992
1993 static bool classof(const SDNode *N) {
1994 return N->getOpcode() == X86ISD::MGATHER;
1995 }
1996 };
1997
1999 public:
2000 const SDValue &getValue() const { return getOperand(1); }
2001
2002 static bool classof(const SDNode *N) {
2003 return N->getOpcode() == X86ISD::MSCATTER;
2004 }
2005 };
2006
2007 /// Generate unpacklo/unpackhi shuffle mask.
2008 void createUnpackShuffleMask(EVT VT, SmallVectorImpl<int> &Mask, bool Lo,
2009 bool Unary);
2010
2011 /// Similar to unpacklo/unpackhi, but without the 128-bit lane limitation
2012 /// imposed by AVX and specific to the unary pattern. Example:
2013 /// v8iX Lo --> <0, 0, 1, 1, 2, 2, 3, 3>
2014 /// v8iX Hi --> <4, 4, 5, 5, 6, 6, 7, 7>
2015 void createSplat2ShuffleMask(MVT VT, SmallVectorImpl<int> &Mask, bool Lo);
2016
2017} // end namespace llvm
2018
2019#endif // LLVM_LIB_TARGET_X86_X86ISELLOWERING_H
static SDValue LowerBRCOND(SDValue Op, SelectionDAG &DAG)
return SDValue()
static SDValue LowerVASTART(SDValue Op, SelectionDAG &DAG)
static SDValue LowerEXTRACT_VECTOR_ELT(SDValue Op, SelectionDAG &DAG, const ARMSubtarget *ST)
static SDValue LowerFP_TO_INT_SAT(SDValue Op, SelectionDAG &DAG, const ARMSubtarget *Subtarget)
static SDValue LowerSETCCCARRY(SDValue Op, SelectionDAG &DAG)
MachineBasicBlock & MBB
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
MachineBasicBlock MachineBasicBlock::iterator MBBI
Function Alias Analysis Results
Analysis containing CSE Info
Definition CSEInfo.cpp:27
const HexagonInstrInfo * TII
IRTranslator LLVM IR MI
const AbstractManglingParser< Derived, Alloc >::OperatorInfo AbstractManglingParser< Derived, Alloc >::Ops[]
#define RegName(no)
#define I(x, y, z)
Definition MD5.cpp:57
Register const TargetRegisterInfo * TRI
static unsigned getAddressSpace(const Value *V, unsigned MaxLookup)
static void LowerMemOpCallTo(SelectionDAG &DAG, MachineFunction &MF, SDValue Chain, SDValue Arg, SDValue PtrOff, int SPDiff, unsigned ArgOffset, bool isPPC64, bool isTailCall, bool isVector, SmallVectorImpl< SDValue > &MemOpChains, SmallVectorImpl< TailCallArgumentInfo > &TailCallArguments, const SDLoc &dl)
LowerMemOpCallTo - Store the argument to the stack or remember it in case of tail calls.
const SmallVectorImpl< MachineOperand > & Cond
static SDValue LowerUINT_TO_FP(SDValue Op, SelectionDAG &DAG, const SparcTargetLowering &TLI, bool hasHardQuad)
static SDValue LowerDYNAMIC_STACKALLOC(SDValue Op, SelectionDAG &DAG, const SparcSubtarget *Subtarget)
static SDValue LowerFRAMEADDR(SDValue Op, SelectionDAG &DAG, const SparcSubtarget *Subtarget)
static SDValue LowerVAARG(SDValue Op, SelectionDAG &DAG)
static SDValue LowerRETURNADDR(SDValue Op, SelectionDAG &DAG, const SparcTargetLowering &TLI, const SparcSubtarget *Subtarget)
static SDValue LowerSINT_TO_FP(SDValue Op, SelectionDAG &DAG, const SparcTargetLowering &TLI, bool hasHardQuad)
static TableGen::Emitter::Opt Y("gen-skeleton-entry", EmitSkeleton, "Generate example skeleton entry")
static TableGen::Emitter::OptClass< SkeletonEmitter > X("gen-skeleton-class", "Generate example skeleton class")
This file describes how to lower LLVM code to machine code.
static bool is64Bit(const char *name)
static SDValue LowerCallResult(SDValue Chain, SDValue InGlue, const SmallVectorImpl< CCValAssign > &RVLocs, const SDLoc &dl, SelectionDAG &DAG, SmallVectorImpl< SDValue > &InVals)
LowerCallResult - Lower the result values of a call into the appropriate copies out of appropriate ph...
Class for arbitrary precision integers.
Definition APInt.h:78
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition ArrayRef.h:40
Base class for all callable instructions (InvokeInst and CallInst) Holds everything related to callin...
This is an important base class in LLVM.
Definition Constant.h:43
A parsed version of the target data layout string in and methods for querying it.
Definition DataLayout.h:64
This is a fast-path instruction selection class that generates poor code and doesn't support illegal ...
Definition FastISel.h:66
FunctionLoweringInfo - This contains information that is global to a function that is used when lower...
Common base class shared among various IRBuilders.
Definition IRBuilder.h:114
This is an important class for using LLVM in a threaded context.
Definition LLVMContext.h:68
Tracks which library functions to use for a particular subtarget.
This class is used to represent ISD::LOAD nodes.
Context object for machine code objects.
Definition MCContext.h:83
Base class for the full range of assembler expressions which are needed for parsing.
Definition MCExpr.h:34
Machine Value Type.
static MVT getIntegerVT(unsigned BitWidth)
Instructions::iterator instr_iterator
Representation of each machine instruction.
A description of a memory reference used in the backend.
unsigned getAddrSpace() const
Flags
Flags values. These may be or'd together.
Flags getFlags() const
Return the raw flags of the source value,.
LLVM_ABI Align getAlign() const
Return the minimum known alignment in bytes of the actual memory reference.
MemIntrinsicSDNode(unsigned Opc, unsigned Order, const DebugLoc &dl, SDVTList VTs, EVT MemoryVT, MachineMemOperand *MMO)
A Module instance is used to store all the information related to an LLVM module.
Definition Module.h:67
Wrapper class representing virtual and physical registers.
Definition Register.h:20
Wrapper class for IR location info (IR ordering and DebugLoc) to be passed into SDNode creation funct...
Represents one node in the SelectionDAG.
const SDValue & getOperand(unsigned Num) const
Unlike LLVM values, Selection DAG nodes may return multiple values as the result of a computation.
This is used to represent a portion of an LLVM function in a low-level Data Dependence DAG representa...
This instruction constructs a fixed permutation of two input vectors.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
StringRef - Represent a constant reference to a string, i.e.
Definition StringRef.h:55
TargetInstrInfo - Interface to description of machine instruction set.
Provides information about what library functions are available for the current target.
ShiftLegalizationStrategy
Return the preferred strategy to legalize tihs SHIFT instruction, with ExpansionFactor being the recu...
virtual EVT getTypeToTransformTo(LLVMContext &Context, EVT VT) const
For types supported by the target, this is an identity function.
bool isOperationLegalOrCustom(unsigned Op, EVT VT, bool LegalOnly=false) const
Return true if the specified operation is legal on this target or can be made legal with custom lower...
AtomicExpansionKind
Enum that specifies what an atomic load/AtomicRMWInst is expanded to, if at all.
AndOrSETCCFoldKind
Enum of different potentially desirable ways to fold (and/or (setcc ...), (setcc ....
NegatibleCost
Enum that specifies when a float negation is beneficial.
std::vector< ArgListEntry > ArgListTy
virtual InlineAsm::ConstraintCode getInlineAsmMemConstraint(StringRef ConstraintCode) const
virtual bool isTargetCanonicalConstantNode(SDValue Op) const
Returns true if the given Opc is considered a canonical constant for the target, which should not be ...
TargetLowering(const TargetLowering &)=delete
virtual ArrayRef< MCPhysReg > getRoundingControlRegisters() const
Returns a 0 terminated array of rounding control registers that can be attached into strict FP call.
virtual unsigned combineRepeatedFPDivisors() const
Indicate whether this target prefers to combine FDIVs with the same divisor.
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
The instances of the Type class are immutable: once they are created, they are never changed.
Definition Type.h:45
LLVM Value Representation.
Definition Value.h:75
const SDValue & getPassThru() const
static bool classof(const SDNode *N)
static bool classof(const SDNode *N)
const SDValue & getValue() const
static bool classof(const SDNode *N)
bool shouldFormOverflowOp(unsigned Opcode, EVT VT, bool MathUsed) const override
Overflow nodes should get combined/lowered to optimal instructions (they should allow eliminating exp...
Align getPrefLoopAlignment(MachineLoop *ML) const override
Return the preferred loop alignment.
std::pair< const TargetRegisterClass *, uint8_t > findRepresentativeClass(const TargetRegisterInfo *TRI, MVT VT) const override
Return the largest legal super-reg register class of the register class for the specified type and it...
bool isLegalAddImmediate(int64_t Imm) const override
Return true if the specified immediate is legal add immediate, that is the target has add instruction...
bool preferSextInRegOfTruncate(EVT TruncVT, EVT VT, EVT ExtVT) const override
SDValue PerformDAGCombine(SDNode *N, DAGCombinerInfo &DCI) const override
This method will be invoked for all target nodes and for any target-independent nodes that the target...
SDValue getPICJumpTableRelocBase(SDValue Table, SelectionDAG &DAG) const override
Returns relocation base for the given PIC jumptable.
bool preferABDSToABSWithNSW(EVT VT) const override
bool isCheapToSpeculateCtlz(Type *Ty) const override
Return true if it is cheap to speculate a call to intrinsic ctlz.
bool isMultiStoresCheaperThanBitsMerge(EVT LTy, EVT HTy) const override
Return true if it is cheaper to split the store of a merged int val from a pair of smaller values int...
unsigned getJumpTableEncoding() const override
Return the entry encoding for a jump table in the current function.
std::pair< SDValue, SDValue > BuildFILD(EVT DstVT, EVT SrcVT, const SDLoc &DL, SDValue Chain, SDValue Pointer, MachinePointerInfo PtrInfo, Align Alignment, SelectionDAG &DAG) const
bool shouldTransformSignedTruncationCheck(EVT XVT, unsigned KeptBits) const override
Should we tranform the IR-optimal check for whether given truncation down into KeptBits would be trun...
bool SimplifyDemandedVectorEltsForTargetNode(SDValue Op, const APInt &DemandedElts, APInt &KnownUndef, APInt &KnownZero, TargetLoweringOpt &TLO, unsigned Depth) const override
Attempt to simplify any target nodes based on the demanded vector elements, returning true on success...
bool isMemoryAccessFast(EVT VT, Align Alignment) const
SDValue LowerAsmOutputForConstraint(SDValue &Chain, SDValue &Flag, const SDLoc &DL, const AsmOperandInfo &Constraint, SelectionDAG &DAG) const override
Handle Lowering flag assembly outputs.
bool supportKCFIBundles() const override
Return true if the target supports kcfi operand bundles.
const char * LowerXConstraint(EVT ConstraintVT) const override
Try to replace an X constraint, which matches anything, with another that has more specific requireme...
SDValue SimplifyMultipleUseDemandedBitsForTargetNode(SDValue Op, const APInt &DemandedBits, const APInt &DemandedElts, SelectionDAG &DAG, unsigned Depth) const override
More limited version of SimplifyDemandedBits that can be used to "lookthrough" ops that don't contrib...
bool useLoadStackGuardNode(const Module &M) const override
If this function returns true, SelectionDAGBuilder emits a LOAD_STACK_GUARD node when it is lowering ...
bool isSplatValueForTargetNode(SDValue Op, const APInt &DemandedElts, APInt &UndefElts, const SelectionDAG &DAG, unsigned Depth) const override
Return true if vector Op has the same value across all DemandedElts, indicating any elements which ma...
bool convertSelectOfConstantsToMath(EVT VT) const override
Return true if a select of constants (select Cond, C1, C2) should be transformed into simple math ops...
ConstraintType getConstraintType(StringRef Constraint) const override
Given a constraint letter, return the type of constraint for this target.
bool hasVectorBlend() const override
Return true if the target has a vector blend instruction.
Register getExceptionSelectorRegister(const Constant *PersonalityFn) const override
If a physical register, this returns the register that receives the exception typeid on entry to a la...
bool useSoftFloat() const override
InlineAsm::ConstraintCode getInlineAsmMemConstraint(StringRef ConstraintCode) const override
ShiftLegalizationStrategy preferredShiftLegalizationStrategy(SelectionDAG &DAG, SDNode *N, unsigned ExpansionFactor) const override
SDValue LowerOperation(SDValue Op, SelectionDAG &DAG) const override
Provide custom lowering hooks for some operations.
bool isLegalStoreImmediate(int64_t Imm) const override
Return true if the specified immediate is legal for the value input of a store instruction.
SDValue visitMaskedStore(SelectionDAG &DAG, const SDLoc &DL, SDValue Chain, MachineMemOperand *MMO, SDValue Ptr, SDValue Val, SDValue Mask) const override
SDValue getNegatedExpression(SDValue Op, SelectionDAG &DAG, bool LegalOperations, bool ForCodeSize, NegatibleCost &Cost, unsigned Depth) const override
Return the newly negated expression if the cost is not expensive and set the cost in Cost to indicate...
bool isTypeDesirableForOp(unsigned Opc, EVT VT) const override
Return true if the target has native support for the specified value type and it is 'desirable' to us...
const MCExpr * getPICJumpTableRelocBaseExpr(const MachineFunction *MF, unsigned JTI, MCContext &Ctx) const override
This returns the relocation base for the given PIC jumptable, the same as getPICJumpTableRelocBase,...
bool isCtlzFast() const override
Return true if ctlz instruction is fast.
Register getRegisterByName(const char *RegName, LLT VT, const MachineFunction &MF) const override
Return the register ID of the name passed in.
bool isSafeMemOpType(MVT VT) const override
Returns true if it's safe to use load / store of the specified type to expand memcpy / memset inline.
bool shouldProduceAndByConstByHoistingConstFromShiftsLHSOfAnd(SDValue X, ConstantSDNode *XC, ConstantSDNode *CC, SDValue Y, unsigned OldShiftOpcode, unsigned NewShiftOpcode, SelectionDAG &DAG) const override
Given the pattern (X & (C l>>/<< Y)) ==/!= 0 return true if it should be transformed into: ((X <</l>>...
bool functionArgumentNeedsConsecutiveRegisters(Type *Ty, CallingConv::ID CallConv, bool isVarArg, const DataLayout &DL) const override
For some targets, an LLVM struct type must be broken down into multiple simple types,...
MVT getScalarShiftAmountTy(const DataLayout &, EVT VT) const override
Return the type to use for a scalar shift opcode, given the shifted amount type.
Value * getIRStackGuard(IRBuilderBase &IRB) const override
If the target has a standard location for the stack protector cookie, returns the address of that loc...
bool supportSwiftError() const override
Return true if the target supports swifterror attribute.
bool storeOfVectorConstantIsCheap(bool IsZero, EVT MemVT, unsigned NumElem, unsigned AddrSpace) const override
Return true if it is expected to be cheaper to do a store of vector constant with the given size and ...
Align getByValTypeAlignment(Type *Ty, const DataLayout &DL) const override
Return the desired alignment for ByVal aggregate function arguments in the caller parameter area.
bool isCheapToSpeculateCttz(Type *Ty) const override
Return true if it is cheap to speculate a call to intrinsic cttz.
bool shouldSplatInsEltVarIndex(EVT VT) const override
Return true if inserting a scalar into a variable element of an undef vector is more efficiently hand...
bool isInlineAsmTargetBranch(const SmallVectorImpl< StringRef > &AsmStrs, unsigned OpNo) const override
On x86, return true if the operand with index OpNo is a CALL or JUMP instruction, which can use eithe...
MVT hasFastEqualityCompare(unsigned NumBits) const override
Vector-sized comparisons are fast using PCMPEQ + PMOVMSK or PTEST.
bool SimplifyDemandedVectorEltsForTargetShuffle(SDValue Op, const APInt &DemandedElts, unsigned MaskIndex, TargetLoweringOpt &TLO, unsigned Depth) const
bool isLegalICmpImmediate(int64_t Imm) const override
Return true if the specified immediate is legal icmp immediate, that is the target has icmp instructi...
bool hasInlineStackProbe(const MachineFunction &MF) const override
Returns true if stack probing through inline assembly is requested.
MachineBasicBlock * EmitInstrWithCustomInserter(MachineInstr &MI, MachineBasicBlock *MBB) const override
This method should be implemented by targets that mark instructions with the 'usesCustomInserter' fla...
unsigned preferedOpcodeForCmpEqPiecesOfOperand(EVT VT, unsigned ShiftOpc, bool MayTransformRotate, const APInt &ShiftOrRotateAmt, const std::optional< APInt > &AndMask) const override
bool isXAndYEqZeroPreferableToXAndYEqY(ISD::CondCode Cond, EVT VT) const override
bool canMergeStoresTo(unsigned AddressSpace, EVT MemVT, const MachineFunction &MF) const override
Returns if it's reasonable to merge stores to MemVT size.
bool hasAndNot(SDValue Y) const override
Return true if the target has a bitwise and-not operation: X = ~A & B This can be used to simplify se...
bool getTgtMemIntrinsic(IntrinsicInfo &Info, const CallBase &I, MachineFunction &MF, unsigned Intrinsic) const override
Given an intrinsic, checks if on the target the intrinsic will need to map to a MemIntrinsicNode (tou...
bool SimplifyDemandedBitsForTargetNode(SDValue Op, const APInt &DemandedBits, const APInt &DemandedElts, KnownBits &Known, TargetLoweringOpt &TLO, unsigned Depth) const override
Attempt to simplify any target nodes based on the demanded bits/elts, returning true on success.
bool shouldConvertConstantLoadToIntImm(const APInt &Imm, Type *Ty) const override
Returns true if it is beneficial to convert a load of a constant to just the constant itself.
bool shouldReduceLoadWidth(SDNode *Load, ISD::LoadExtType ExtTy, EVT NewVT, std::optional< unsigned > ByteOffset) const override
Return true if we believe it is correct and profitable to reduce the load node to a smaller type.
bool allowsMemoryAccess(LLVMContext &Context, const DataLayout &DL, EVT VT, const MachineMemOperand &MMO, unsigned *Fast) const
bool preferScalarizeSplat(SDNode *N) const override
bool shouldConvertFpToSat(unsigned Op, EVT FPVT, EVT VT) const override
Should we generate fp_to_si_sat and fp_to_ui_sat from type FPVT to type VT from min(max(fptoi)) satur...
std::pair< unsigned, const TargetRegisterClass * > getRegForInlineAsmConstraint(const TargetRegisterInfo *TRI, StringRef Constraint, MVT VT) const override
Given a physical register constraint (e.g.
MVT getRegisterTypeForCallingConv(LLVMContext &Context, CallingConv::ID CC, EVT VT) const override
Certain combinations of ABIs, Targets and features require that types are legal for some operations a...
bool lowerInterleavedStore(Instruction *Store, Value *Mask, ShuffleVectorInst *SVI, unsigned Factor, const APInt &GapMask) const override
Lower interleaved store(s) into target specific instructions/intrinsics.
bool allowsMisalignedMemoryAccesses(EVT VT, unsigned AS, Align Alignment, MachineMemOperand::Flags Flags, unsigned *Fast) const override
Returns true if the target allows unaligned memory accesses of the specified type.
bool isNarrowingProfitable(SDNode *N, EVT SrcVT, EVT DestVT) const override
Return true if it's profitable to narrow operations of type SrcVT to DestVT.
bool isFPImmLegal(const APFloat &Imm, EVT VT, bool ForCodeSize) const override
Returns true if the target can instruction select the specified FP immediate natively.
MachineInstr * EmitKCFICheck(MachineBasicBlock &MBB, MachineBasicBlock::instr_iterator &MBBI, const TargetInstrInfo *TII) const override
bool isLoadBitCastBeneficial(EVT LoadVT, EVT BitcastVT, const SelectionDAG &DAG, const MachineMemOperand &MMO) const override
Return true if the following transform is beneficial: fold (conv (load x)) -> (load (conv*)x) On arch...
unsigned getMaxSupportedInterleaveFactor() const override
Get the maximum supported factor for interleaved memory accesses.
bool lowerInterleavedLoad(Instruction *Load, Value *Mask, ArrayRef< ShuffleVectorInst * > Shuffles, ArrayRef< unsigned > Indices, unsigned Factor, const APInt &GapMask) const override
Lower interleaved load(s) into target specific instructions/intrinsics.
bool hasAndNotCompare(SDValue Y) const override
Return true if the target should transform: (X & Y) == Y ---> (~X & Y) == 0 (X & Y) !...
bool reduceSelectOfFPConstantLoads(EVT CmpOpVT) const override
Return true if it is profitable to convert a select of FP constants into a constant pool load whose a...
EVT getOptimalMemOpType(LLVMContext &Context, const MemOp &Op, const AttributeList &FuncAttributes) const override
It returns EVT::Other if the type should be determined using generic target-independent logic.
StringRef getStackProbeSymbolName(const MachineFunction &MF) const override
Returns the name of the symbol used to emit stack probes or the empty string if not applicable.
bool hasBitTest(SDValue X, SDValue Y) const override
Return true if the target has a bit-test instruction: (X & (1 << Y)) ==/!= 0 This knowledge can be us...
bool allowTruncateForTailCall(Type *Ty1, Type *Ty2) const override
Return true if a truncation from FromTy to ToTy is permitted when deciding whether a call is in tail ...
unsigned getVectorTypeBreakdownForCallingConv(LLVMContext &Context, CallingConv::ID CC, EVT VT, EVT &IntermediateVT, unsigned &NumIntermediates, MVT &RegisterVT) const override
Certain targets such as MIPS require that some types such as vectors are always broken down into scal...
bool isShuffleMaskLegal(ArrayRef< int > Mask, EVT VT) const override
Targets can use this to indicate that they only support some VECTOR_SHUFFLE operations,...
bool useStackGuardXorFP() const override
If this function returns true, stack protection checks should XOR the frame pointer (or whichever poi...
unsigned ComputeNumSignBitsForTargetNode(SDValue Op, const APInt &DemandedElts, const SelectionDAG &DAG, unsigned Depth) const override
Determine the number of bits in the operation that are sign bits.
bool shouldScalarizeBinop(SDValue) const override
Scalar ops always have equal or better analysis/performance/power than the vector equivalent,...
void markLibCallAttributes(MachineFunction *MF, unsigned CC, ArgListTy &Args) const override
bool isTruncateFree(Type *Ty1, Type *Ty2) const override
Return true if it's free to truncate a value of type Ty1 to type Ty2.
bool shouldFoldConstantShiftPairToMask(const SDNode *N) const override
Return true if it is profitable to fold a pair of shifts into a mask.
Value * getSafeStackPointerLocation(IRBuilderBase &IRB) const override
Return true if the target stores SafeStack pointer at a fixed offset in some non-standard address spa...
bool decomposeMulByConstant(LLVMContext &Context, EVT VT, SDValue C) const override
Return true if it is profitable to transform an integer multiplication-by-constant into simpler opera...
bool areJTsAllowed(const Function *Fn) const override
Returns true if lowering to a jump table is allowed.
bool isCommutativeBinOp(unsigned Opcode) const override
Returns true if the opcode is a commutative binary operation.
bool isScalarFPTypeInSSEReg(EVT VT) const
Return true if the specified scalar FP type is computed in an SSE register, not on the X87 floating p...
const char * getTargetNodeName(unsigned Opcode) const override
This method returns the name of a target specific DAG node.
MVT getPreferredSwitchConditionType(LLVMContext &Context, EVT ConditionVT) const override
Returns preferred type for switch condition.
SDValue visitMaskedLoad(SelectionDAG &DAG, const SDLoc &DL, SDValue Chain, MachineMemOperand *MMO, SDValue &NewLoad, SDValue Ptr, SDValue PassThru, SDValue Mask) const override
bool isFMAFasterThanFMulAndFAdd(const MachineFunction &MF, EVT VT) const override
Return true if an FMA operation is faster than a pair of fmul and fadd instructions.
bool isExtractSubvectorCheap(EVT ResVT, EVT SrcVT, unsigned Index) const override
Return true if EXTRACT_SUBVECTOR is cheap for this result type with this index.
unsigned getNumRegistersForCallingConv(LLVMContext &Context, CallingConv::ID CC, EVT VT) const override
Certain targets require unusual breakdowns of certain types.
bool convertSetCCLogicToBitwiseLogic(EVT VT) const override
Use bitwise logic to make pairs of compares more efficient.
bool isVectorClearMaskLegal(ArrayRef< int > Mask, EVT VT) const override
Similar to isShuffleMaskLegal.
ConstraintWeight getSingleConstraintMatchWeight(AsmOperandInfo &Info, const char *Constraint) const override
Examine constraint string and operand type and determine a weight value.
bool isIntDivCheap(EVT VT, AttributeList Attr) const override
Return true if integer divide is usually cheaper than a sequence of several shifts,...
LegalizeTypeAction getPreferredVectorAction(MVT VT) const override
Customize the preferred legalization strategy for certain types.
bool shouldConvertPhiType(Type *From, Type *To) const override
Given a set in interconnected phis of type 'From' that are loaded/stored or bitcast to type 'To',...
bool hasStackProbeSymbol(const MachineFunction &MF) const override
Returns true if stack probing through a function call is requested.
bool isZExtFree(Type *Ty1, Type *Ty2) const override
Return true if any actual instruction that defines a value of type Ty1 implicit zero-extends the valu...
bool allowsMemoryAccess(LLVMContext &Context, const DataLayout &DL, EVT VT, unsigned AddrSpace, Align Alignment, MachineMemOperand::Flags Flags=MachineMemOperand::MONone, unsigned *Fast=nullptr) const override
This function returns true if the memory access is aligned or if the target allows this specific unal...
bool isTargetCanonicalConstantNode(SDValue Op) const override
Returns true if the given Opc is considered a canonical constant for the target, which should not be ...
bool isLegalAddressingMode(const DataLayout &DL, const AddrMode &AM, Type *Ty, unsigned AS, Instruction *I=nullptr) const override
Return true if the addressing mode represented by AM is legal for this target, for a load/store of th...
SDValue emitStackGuardXorFP(SelectionDAG &DAG, SDValue Val, const SDLoc &DL) const override
bool mergeStoresAfterLegalization(EVT MemVT) const override
Do not merge vector stores after legalization because that may conflict with x86-specific store split...
TargetLowering::AndOrSETCCFoldKind isDesirableToCombineLogicOpOfSETCC(const SDNode *LogicOp, const SDNode *SETCC0, const SDNode *SETCC1) const override
Return prefered fold type, Abs if this is a vector, AddAnd if its an integer, None otherwise.
bool shouldFoldMaskToVariableShiftPair(SDValue Y) const override
There are two ways to clear extreme bits (either low or high): Mask: x & (-1 << y) (the instcombine c...
bool shouldFoldSelectWithIdentityConstant(unsigned BinOpcode, EVT VT, unsigned SelectOpcode, SDValue X, SDValue Y) const override
Return true if pulling a binary operation into a select with an identity constant is profitable.
bool addressingModeSupportsTLS(const GlobalValue &GV) const override
Returns true if the targets addressing mode can target thread local storage (TLS).
SDValue getReturnAddressFrameIndex(SelectionDAG &DAG) const
bool targetShrinkDemandedConstant(SDValue Op, const APInt &DemandedBits, const APInt &DemandedElts, TargetLoweringOpt &TLO) const override
Register getExceptionPointerRegister(const Constant *PersonalityFn) const override
If a physical register, this returns the register that receives the exception address on entry to an ...
SDValue expandIndirectJTBranch(const SDLoc &dl, SDValue Value, SDValue Addr, int JTI, SelectionDAG &DAG) const override
Expands target specific indirect branch for the case of JumpTable expansion.
void computeKnownBitsForTargetNode(const SDValue Op, KnownBits &Known, const APInt &DemandedElts, const SelectionDAG &DAG, unsigned Depth=0) const override
Determine which of the bits specified in Mask are known to be either zero or one and return them in t...
bool isBinOp(unsigned Opcode) const override
Add x86-specific opcodes to the default list.
bool isGuaranteedNotToBeUndefOrPoisonForTargetNode(SDValue Op, const APInt &DemandedElts, const SelectionDAG &DAG, bool PoisonOnly, unsigned Depth) const override
Return true if this function can prove that Op is never poison and, if PoisonOnly is false,...
bool IsDesirableToPromoteOp(SDValue Op, EVT &PVT) const override
Return true if the target has native support for the specified value type and it is 'desirable' to us...
SDValue unwrapAddress(SDValue N) const override
CondMergingParams getJumpConditionMergingParams(Instruction::BinaryOps Opc, const Value *Lhs, const Value *Rhs) const override
EVT getSetCCResultType(const DataLayout &DL, LLVMContext &Context, EVT VT) const override
Return the value type to use for ISD::SETCC.
X86TargetLowering(const X86TargetMachine &TM, const X86Subtarget &STI)
bool isTargetCanonicalSelect(SDNode *N) const override
Return true if the given select/vselect should be considered canonical and not be transformed.
bool isVectorLoadExtDesirable(SDValue) const override
Return true if folding a vector load into ExtVal (a sign, zero, or any extend node) is profitable.
FastISel * createFastISel(FunctionLoweringInfo &funcInfo, const TargetLibraryInfo *libInfo, const LibcallLoweringInfo *libcallLowering) const override
This method returns a target specific FastISel object, or null if the target does not support "fast" ...
const Constant * getTargetConstantFromLoad(LoadSDNode *LD) const override
This method returns the constant pool value that will be loaded by LD.
EVT getTypeToTransformTo(LLVMContext &Context, EVT VT) const override
For types supported by the target, this is an identity function.
bool canCreateUndefOrPoisonForTargetNode(SDValue Op, const APInt &DemandedElts, const SelectionDAG &DAG, bool PoisonOnly, bool ConsiderFlags, unsigned Depth) const override
Return true if Op can create undef or poison from non-undef & non-poison operands.
void insertSSPDeclarations(Module &M) const override
Inserts necessary declarations for SSP (stack protection) purpose.
const MCExpr * LowerCustomJumpTableEntry(const MachineJumpTableInfo *MJTI, const MachineBasicBlock *MBB, unsigned uid, MCContext &Ctx) const override
unsigned getStackProbeSize(const MachineFunction &MF) const
bool ShouldShrinkFPConstant(EVT VT) const override
If true, then instruction selection should seek to shrink the FP constant of the specified type to a ...
void ReplaceNodeResults(SDNode *N, SmallVectorImpl< SDValue > &Results, SelectionDAG &DAG) const override
Replace the results of node with an illegal result type with new values built out of custom code.
bool isMaskAndCmp0FoldingBeneficial(const Instruction &AndI) const override
Return if the target supports combining a chain like:
void LowerAsmOperandForConstraint(SDValue Op, StringRef Constraint, std::vector< SDValue > &Ops, SelectionDAG &DAG) const override
Lower the specified operand into the Ops vector.
bool needsFixedCatchObjects() const override
bool isExtractVecEltCheap(EVT VT, unsigned Index) const override
Extract of a scalar FP value from index 0 of a vector is free.
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
Definition CallingConv.h:24
@ CXX_FAST_TLS
Used for access functions.
Definition CallingConv.h:72
@ Fast
Attempts to make calls as fast as possible (e.g.
Definition CallingConv.h:41
@ C
The default llvm calling convention, compatible with C.
Definition CallingConv.h:34
NodeType
ISD::NodeType enum - This enum defines the target-independent operators for a SelectionDAG.
Definition ISDOpcodes.h:41
@ INSERT_SUBVECTOR
INSERT_SUBVECTOR(VECTOR1, VECTOR2, IDX) - Returns a vector with VECTOR2 inserted into VECTOR1.
Definition ISDOpcodes.h:600
@ LOAD
LOAD and STORE have token chains as their first operand, then the same operands as an LLVM load/store...
@ BITCAST
BITCAST - This operator converts between integer, vector and FP values, as if the value was stored to...
Definition ISDOpcodes.h:992
@ BUILTIN_OP_END
BUILTIN_OP_END - This must be the last enum value in this list.
@ EXTRACT_SUBVECTOR
EXTRACT_SUBVECTOR(VECTOR, IDX) - Returns a subvector from VECTOR.
Definition ISDOpcodes.h:614
CondCode
ISD::CondCode enum - These are ordered carefully to make the bitfields below work out,...
LoadExtType
LoadExtType enum - This enum defines the three variants of LOADEXT (load with extension).
This namespace contains an enum with a value for every intrinsic/builtin function known by LLVM.
@ FST
This instruction implements a truncating store from FP stack slots.
@ REP_MOVS
Repeat move, corresponds to X86::REP_MOVSx.
@ CMPM
Vector comparison generating mask bits for fp and integer signed and unsigned data types.
@ FMAX
Floating point max and min.
@ BT
X86 bit-test instructions.
@ HADD
Integer horizontal add/sub.
@ MOVQ2DQ
Copies a 64-bit value from an MMX vector to the low word of an XMM vector, with the high word zero fi...
@ BLENDI
Blend where the selector is an immediate.
@ CMP
X86 compare and logical compare instructions.
@ BLENDV
Dynamic (non-constant condition) vector blend where only the sign bits of the condition elements are ...
@ ADDSUB
Combined add and sub on an FP vector.
@ RET_GLUE
Return with a glue operand.
@ STRICT_FMAX
Floating point max and min.
@ STRICT_CMPM
Vector comparison generating mask bits for fp and integer signed and unsigned data types.
@ FHADD
Floating point horizontal add/sub.
@ FMAXS
Scalar intrinsic floating point max and min.
@ BSR
Bit scan reverse.
@ IRET
Return from interrupt. Operand 0 is the number of bytes to pop.
@ HADDS
Integer horizontal saturating add/sub.
@ SETCC
X86 SetCC.
@ NT_BRIND
BRIND node with NoTrack prefix.
@ SELECTS
X86 Select.
@ FSETCCM
X86 FP SETCC, similar to above, but with output as an i1 mask and and a version with SAE.
@ PEXTRB
Extract an 8-bit value from a vector and zero extend it to i32, corresponds to X86::PEXTRB.
@ FXOR
Bitwise logical XOR of floating point values.
@ BRCOND
X86 conditional branches.
@ FSETCC
X86 FP SETCC, implemented with CMP{cc}SS/CMP{cc}SD.
@ PINSRB
Insert the lower 8-bits of a 32-bit value to a vector, corresponds to X86::PINSRB.
@ REP_STOS
Repeat fill, corresponds to X86::REP_STOSx.
@ INSERTPS
Insert any element of a 4 x float vector into any element of a destination 4 x floatvector.
@ PSHUFB
Shuffle 16 8-bit values within a vector.
@ PEXTRW
Extract a 16-bit value from a vector and zero extend it to i32, corresponds to X86::PEXTRW.
@ CALL
These operations represent an abstract X86 call instruction, which includes a bunch of information.
@ AADD
RAO arithmetic instructions.
@ FANDN
Bitwise logical ANDNOT of floating point values.
@ GlobalBaseReg
On Darwin, this node represents the result of the popl at function entry, used for PIC code.
@ FMAXC
Commutative FMIN and FMAX.
@ EXTRQI
SSE4A Extraction and Insertion.
@ FLD
This instruction implements an extending load to FP stack slots.
@ TC_RETURN
Tail call return.
@ PSADBW
Compute Sum of Absolute Differences.
@ FOR
Bitwise logical OR of floating point values.
@ FIST
This instruction implements a fp->int store from FP stack slots.
@ FP_TO_INT_IN_MEM
This instruction implements FP_TO_SINT with the integer destination in memory and a FP reg source.
@ LADD
LOCK-prefixed arithmetic read-modify-write instructions.
@ DBPSADBW
Compute Double Block Packed Sum-Absolute-Differences.
@ MMX_MOVW2D
Copies a GPR into the low 32-bit word of a MMX vector and zero out the high word.
@ Wrapper
A wrapper node for TargetConstantPool, TargetJumpTable, TargetExternalSymbol, TargetGlobalAddress,...
@ PINSRW
Insert the lower 16-bits of a 32-bit value to a vector, corresponds to X86::PINSRW.
@ CMPCCXADD
Compare and Add if Condition is Met.
@ NT_CALL
Same as call except it adds the NoTrack prefix.
@ MMX_MOVD2W
Copies a 32-bit value from the low word of a MMX vector to a GPR.
@ FILD
This instruction implements SINT_TO_FP with the integer source in memory and FP reg result.
@ MOVDQ2Q
Copies a 64-bit value from the low word of an XMM vector to an MMX vector.
@ ANDNP
Bitwise Logical AND NOT of Packed FP values.
@ BSF
Bit scan forward.
@ POP_FROM_X87_REG
The same as ISD::CopyFromReg except that this node makes it explicit that it may lower to an x87 FPU ...
@ VAARG_64
These instructions grab the address of the next argument from a va_list.
@ FAND
Bitwise logical AND of floating point values.
@ CMOV
X86 conditional moves.
@ WrapperRIP
Special wrapper used under X86-64 PIC mode for RIP relative displacements.
@ FIRST_STRICTFP_OPCODE
X86 strict FP compare instructions.
@ FSHL
X86 funnel/double shift i16 instructions.
@ FRSQRT
Floating point reciprocal-sqrt and reciprocal approximation.
Define some predicates that are used for node matching.
RoundingMode
Current rounding mode is represented in bits 11:10 of FPSR.
FastISel * createFastISel(FunctionLoweringInfo &funcInfo, const TargetLibraryInfo *libInfo, const LibcallLoweringInfo *libcallLowering)
bool mayFoldLoadIntoBroadcastFromMem(SDValue Op, MVT EltVT, const X86Subtarget &Subtarget, bool AssumeSingleUse=false)
Check if Op is a load operation that could be folded into a vector splat instruction as a memory oper...
bool isZeroNode(SDValue Elt)
Returns true if Elt is a constant zero or floating point constant +0.0.
bool mayFoldIntoZeroExtend(SDValue Op)
Check if Op is an operation that could be folded into a zero extend x86 instruction.
bool mayFoldIntoStore(SDValue Op)
Check if Op is a value that could be used to fold a store into some other x86 instruction as a memory...
bool isExtendedSwiftAsyncFrameSupported(const X86Subtarget &Subtarget, const MachineFunction &MF)
True if the target supports the extended frame for async Swift functions.
int getRoundingModeX86(unsigned RM)
Convert LLVM rounding mode to X86 rounding mode.
bool isCalleePop(CallingConv::ID CallingConv, bool is64Bit, bool IsVarArg, bool GuaranteeTCO)
Determines whether the callee is required to pop its own arguments.
bool mayFoldLoad(SDValue Op, const X86Subtarget &Subtarget, bool AssumeSingleUse=false, bool IgnoreAlignment=false)
Check if Op is a load operation that could be folded into some other x86 instruction as a memory oper...
bool isOffsetSuitableForCodeModel(int64_t Offset, CodeModel::Model M, bool hasSymbolicDisplacement)
Returns true of the given offset can be fit into displacement field of the instruction.
bool isConstantSplat(SDValue Op, APInt &SplatVal, bool AllowPartialUndefs)
If Op is a constant whose elements are all the same constant or undefined, return true and return the...
This is an optimization pass for GlobalISel generic memory operations.
Definition Types.h:26
@ Offset
Definition DWP.cpp:532
InstructionCost Cost
void createUnpackShuffleMask(EVT VT, SmallVectorImpl< int > &Mask, bool Lo, bool Unary)
Generate unpacklo/unpackhi shuffle mask.
void createSplat2ShuffleMask(MVT VT, SmallVectorImpl< int > &Mask, bool Lo)
Similar to unpacklo/unpackhi, but without the 128-bit lane limitation imposed by AVX and specific to ...
uint16_t MCPhysReg
An unsigned integer type large enough to represent all physical registers, but not necessarily virtua...
Definition MCRegister.h:21
DWARFExpression::Operation Op
ArrayRef(const T &OneElt) -> ArrayRef< T >
decltype(auto) cast(const From &Val)
cast<X> - Return the argument parameter cast to the specified type.
Definition Casting.h:559
#define N
This struct is a compact representation of a valid (non-zero power of two) alignment.
Definition Alignment.h:39
Extended Value Type.
Definition ValueTypes.h:35
bool isFloatingPoint() const
Return true if this is a FP or a vector FP type.
Definition ValueTypes.h:147
static EVT getIntegerVT(LLVMContext &Context, unsigned BitWidth)
Returns the EVT that represents an integer with the given number of bits.
Definition ValueTypes.h:65
bool isVector() const
Return true if this is a vector value type.
Definition ValueTypes.h:168
EVT getScalarType() const
If this is a vector type, return the element type, otherwise return this.
Definition ValueTypes.h:323
bool isScalarInteger() const
Return true if this is an integer, but not a vector.
Definition ValueTypes.h:157
bool isInteger() const
Return true if this is an integer or a vector integer type.
Definition ValueTypes.h:152
This class contains a discriminated union of information about pointers in memory operands,...