Skip to content

Commit 8988148

Browse files
authored
Intrinsic: introduce minimumnum and maximumnum (#93841)
Currently, on different platform, the behaivor of llvm.minnum is different if one operand is sNaN: When we compare sNaN vs NUM: ARM/AArch64/PowerPC: follow the IEEE754-2008's minNUM: return qNaN. RISC-V/Hexagon follow the IEEE754-2019's minimumNumber: return NUM. X86: Returns NUM but not same with IEEE754-2019's minimumNumber as +0.0 is not always greater than -0.0. MIPS/LoongArch/Generic: return NUM. LIBCALL: returns qNaN. So, let's introduce llvm.minmumnum/llvm.maximumnum, which always follow IEEE754-2019's minimumNumber/maximumNumber. Half-fix: #93033
1 parent f3c4dae commit 8988148

File tree

65 files changed

+1973
-144
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+1973
-144
lines changed

llvm/docs/LangRef.rst

Lines changed: 550 additions & 0 deletions
Large diffs are not rendered by default.

llvm/include/llvm/ADT/APFloat.h

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1483,6 +1483,19 @@ inline APFloat minimum(const APFloat &A, const APFloat &B) {
14831483
return B < A ? B : A;
14841484
}
14851485

1486+
/// Implements IEEE 754-2019 minimumNumber semantics. Returns the smaller
1487+
/// of 2 arguments, not propagating NaNs and treating -0 as less than +0.
1488+
LLVM_READONLY
1489+
inline APFloat minimumnum(const APFloat &A, const APFloat &B) {
1490+
if (A.isNaN())
1491+
return B.isNaN() ? B.makeQuiet() : B;
1492+
if (B.isNaN())
1493+
return A;
1494+
if (A.isZero() && B.isZero() && (A.isNegative() != B.isNegative()))
1495+
return A.isNegative() ? A : B;
1496+
return B < A ? B : A;
1497+
}
1498+
14861499
/// Implements IEEE 754-2019 maximum semantics. Returns the larger of 2
14871500
/// arguments, propagating NaNs and treating -0 as less than +0.
14881501
LLVM_READONLY
@@ -1496,6 +1509,19 @@ inline APFloat maximum(const APFloat &A, const APFloat &B) {
14961509
return A < B ? B : A;
14971510
}
14981511

1512+
/// Implements IEEE 754-2019 maximumNumber semantics. Returns the larger
1513+
/// of 2 arguments, not propagating NaNs and treating -0 as less than +0.
1514+
LLVM_READONLY
1515+
inline APFloat maximumnum(const APFloat &A, const APFloat &B) {
1516+
if (A.isNaN())
1517+
return B.isNaN() ? B.makeQuiet() : B;
1518+
if (B.isNaN())
1519+
return A;
1520+
if (A.isZero() && B.isZero() && (A.isNegative() != B.isNegative()))
1521+
return A.isNegative() ? B : A;
1522+
return A < B ? B : A;
1523+
}
1524+
14991525
// We want the following functions to be available in the header for inlining.
15001526
// We cannot define them inline in the class definition of `DoubleAPFloat`
15011527
// because doing so would instantiate `std::unique_ptr<APFloat[]>` before

llvm/include/llvm/Analysis/TargetLibraryInfo.def

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1347,6 +1347,39 @@ TLI_DEFINE_ENUM_INTERNAL(fminl)
13471347
TLI_DEFINE_STRING_INTERNAL("fminl")
13481348
TLI_DEFINE_SIG_INTERNAL(Floating, Same, Same)
13491349

1350+
// Calls to fmaximum_num and fminimum_num library functions expand to the llvm.maximumnum and
1351+
// llvm.minimumnum intrinsics with the correct parameter types for the arguments
1352+
// (all types must match).
1353+
/// double fmaximum_num(double x, double y);
1354+
TLI_DEFINE_ENUM_INTERNAL(fmaximum_num)
1355+
TLI_DEFINE_STRING_INTERNAL("fmaximum_num")
1356+
TLI_DEFINE_SIG_INTERNAL(Floating, Same, Same)
1357+
1358+
/// float fmaximum_numf(float x, float y);
1359+
TLI_DEFINE_ENUM_INTERNAL(fmaximum_numf)
1360+
TLI_DEFINE_STRING_INTERNAL("fmaximum_numf")
1361+
TLI_DEFINE_SIG_INTERNAL(Floating, Same, Same)
1362+
1363+
/// long double fmaximum_numl(long double x, long double y);
1364+
TLI_DEFINE_ENUM_INTERNAL(fmaximum_numl)
1365+
TLI_DEFINE_STRING_INTERNAL("fmaximum_numl")
1366+
TLI_DEFINE_SIG_INTERNAL(Floating, Same, Same)
1367+
1368+
/// double fminimum_num(double x, double y);
1369+
TLI_DEFINE_ENUM_INTERNAL(fminimum_num)
1370+
TLI_DEFINE_STRING_INTERNAL("fminimum_num")
1371+
TLI_DEFINE_SIG_INTERNAL(Floating, Same, Same)
1372+
1373+
/// float fminimum_numf(float x, float y);
1374+
TLI_DEFINE_ENUM_INTERNAL(fminimum_numf)
1375+
TLI_DEFINE_STRING_INTERNAL("fminimum_numf")
1376+
TLI_DEFINE_SIG_INTERNAL(Floating, Same, Same)
1377+
1378+
/// long double fminimum_numl(long double x, long double y);
1379+
TLI_DEFINE_ENUM_INTERNAL(fminimum_numl)
1380+
TLI_DEFINE_STRING_INTERNAL("fminimum_numl")
1381+
TLI_DEFINE_SIG_INTERNAL(Floating, Same, Same)
1382+
13501383
/// double fmod(double x, double y);
13511384
TLI_DEFINE_ENUM_INTERNAL(fmod)
13521385
TLI_DEFINE_STRING_INTERNAL("fmod")

llvm/include/llvm/CodeGen/BasicTTIImpl.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1690,6 +1690,8 @@ class BasicTTIImplBase : public TargetTransformInfoImplCRTPBase<T> {
16901690
case Intrinsic::vector_reduce_fmin:
16911691
case Intrinsic::vector_reduce_fmaximum:
16921692
case Intrinsic::vector_reduce_fminimum:
1693+
case Intrinsic::vector_reduce_fmaximumnum:
1694+
case Intrinsic::vector_reduce_fminimumnum:
16931695
case Intrinsic::vector_reduce_umax:
16941696
case Intrinsic::vector_reduce_umin: {
16951697
IntrinsicCostAttributes Attrs(IID, RetTy, Args[0]->getType(), FMF, I, 1);
@@ -2016,6 +2018,12 @@ class BasicTTIImplBase : public TargetTransformInfoImplCRTPBase<T> {
20162018
case Intrinsic::maximum:
20172019
ISD = ISD::FMAXIMUM;
20182020
break;
2021+
case Intrinsic::minimumnum:
2022+
ISD = ISD::FMINIMUMNUM;
2023+
break;
2024+
case Intrinsic::maximumnum:
2025+
ISD = ISD::FMAXIMUMNUM;
2026+
break;
20192027
case Intrinsic::copysign:
20202028
ISD = ISD::FCOPYSIGN;
20212029
break;
@@ -2097,6 +2105,8 @@ class BasicTTIImplBase : public TargetTransformInfoImplCRTPBase<T> {
20972105
case Intrinsic::vector_reduce_fmin:
20982106
case Intrinsic::vector_reduce_fmaximum:
20992107
case Intrinsic::vector_reduce_fminimum:
2108+
case Intrinsic::vector_reduce_fmaximumnum:
2109+
case Intrinsic::vector_reduce_fminimumnum:
21002110
return thisT()->getMinMaxReductionCost(getMinMaxReductionIntrinsicOp(IID),
21012111
VecOpTy, ICA.getFlags(), CostKind);
21022112
case Intrinsic::abs: {

llvm/include/llvm/CodeGen/GlobalISel/CombinerHelper.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -954,8 +954,10 @@ class CombinerHelper {
954954
///
955955
/// * G_FMAXNUM
956956
/// * G_FMAXIMUM
957+
/// * G_FMAXIMUMNUM
957958
/// * G_FMINNUM
958959
/// * G_FMINIMUM
960+
/// * G_FMINIMUMNUM
959961
///
960962
/// Helper function for matchFPSelectToMinMax.
961963
unsigned getFPMinMaxOpcForSelect(CmpInst::Predicate Pred, LLT DstTy,

llvm/include/llvm/CodeGen/GlobalISel/GenericMachineInstrs.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -553,6 +553,8 @@ class GVecReduce : public GenericMachineInstr {
553553
case TargetOpcode::G_VECREDUCE_FMIN:
554554
case TargetOpcode::G_VECREDUCE_FMAXIMUM:
555555
case TargetOpcode::G_VECREDUCE_FMINIMUM:
556+
case TargetOpcode::G_VECREDUCE_FMAXIMUMNUM:
557+
case TargetOpcode::G_VECREDUCE_FMINIMUMNUM:
556558
case TargetOpcode::G_VECREDUCE_ADD:
557559
case TargetOpcode::G_VECREDUCE_MUL:
558560
case TargetOpcode::G_VECREDUCE_AND:
@@ -591,6 +593,12 @@ class GVecReduce : public GenericMachineInstr {
591593
case TargetOpcode::G_VECREDUCE_FMINIMUM:
592594
ScalarOpc = TargetOpcode::G_FMINIMUM;
593595
break;
596+
case TargetOpcode::G_VECREDUCE_FMAXIMUMNUM:
597+
ScalarOpc = TargetOpcode::G_FMAXIMUMNUM;
598+
break;
599+
case TargetOpcode::G_VECREDUCE_FMINIMUMNUM:
600+
ScalarOpc = TargetOpcode::G_FMINIMUMNUM;
601+
break;
594602
case TargetOpcode::G_VECREDUCE_ADD:
595603
ScalarOpc = TargetOpcode::G_ADD;
596604
break;
@@ -671,6 +679,8 @@ class GBinOp : public GenericMachineInstr {
671679
case TargetOpcode::G_FMAXNUM_IEEE:
672680
case TargetOpcode::G_FMINIMUM:
673681
case TargetOpcode::G_FMAXIMUM:
682+
case TargetOpcode::G_FMINIMUMNUM:
683+
case TargetOpcode::G_FMAXIMUMNUM:
674684
case TargetOpcode::G_FADD:
675685
case TargetOpcode::G_FSUB:
676686
case TargetOpcode::G_FMUL:
@@ -721,6 +731,8 @@ class GFBinOp : public GBinOp {
721731
case TargetOpcode::G_FMAXNUM_IEEE:
722732
case TargetOpcode::G_FMINIMUM:
723733
case TargetOpcode::G_FMAXIMUM:
734+
case TargetOpcode::G_FMINIMUMNUM:
735+
case TargetOpcode::G_FMAXIMUMNUM:
724736
case TargetOpcode::G_FADD:
725737
case TargetOpcode::G_FSUB:
726738
case TargetOpcode::G_FMUL:

llvm/include/llvm/CodeGen/GlobalISel/LegalizerHelper.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,7 @@ class LegalizerHelper {
403403
LegalizeResult lowerMinMax(MachineInstr &MI);
404404
LegalizeResult lowerFCopySign(MachineInstr &MI);
405405
LegalizeResult lowerFMinNumMaxNum(MachineInstr &MI);
406+
LegalizeResult lowerFMinimumNumMaximumNum(MachineInstr &MI);
406407
LegalizeResult lowerFMad(MachineInstr &MI);
407408
LegalizeResult lowerIntrinsicRound(MachineInstr &MI);
408409
LegalizeResult lowerFFloor(MachineInstr &MI);

llvm/include/llvm/CodeGen/GlobalISel/MachineIRBuilder.h

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1723,6 +1723,18 @@ class MachineIRBuilder {
17231723
return buildInstr(TargetOpcode::G_FMAXNUM_IEEE, {Dst}, {Src0, Src1}, Flags);
17241724
}
17251725

1726+
MachineInstrBuilder
1727+
buildFMinimumnum(const DstOp &Dst, const SrcOp &Src0, const SrcOp &Src1,
1728+
std::optional<unsigned> Flags = std::nullopt) {
1729+
return buildInstr(TargetOpcode::G_FMINIMUMNUM, {Dst}, {Src0, Src1}, Flags);
1730+
}
1731+
1732+
MachineInstrBuilder
1733+
buildFMaximumnum(const DstOp &Dst, const SrcOp &Src0, const SrcOp &Src1,
1734+
std::optional<unsigned> Flags = std::nullopt) {
1735+
return buildInstr(TargetOpcode::G_FMAXIMUMNUM, {Dst}, {Src0, Src1}, Flags);
1736+
}
1737+
17261738
MachineInstrBuilder buildShl(const DstOp &Dst, const SrcOp &Src0,
17271739
const SrcOp &Src1,
17281740
std::optional<unsigned> Flags = std::nullopt) {
@@ -2074,6 +2086,18 @@ class MachineIRBuilder {
20742086
return buildInstr(TargetOpcode::G_VECREDUCE_FMINIMUM, {Dst}, {Src});
20752087
}
20762088

2089+
/// Build and insert \p Res = G_VECREDUCE_FMAXIMUMNUM \p Src
2090+
MachineInstrBuilder buildVecReduceFMaximumnum(const DstOp &Dst,
2091+
const SrcOp &Src) {
2092+
return buildInstr(TargetOpcode::G_VECREDUCE_FMAXIMUMNUM, {Dst}, {Src});
2093+
}
2094+
2095+
/// Build and insert \p Res = G_VECREDUCE_FMINIMUMNUM \p Src
2096+
MachineInstrBuilder buildVecReduceFMinimumnum(const DstOp &Dst,
2097+
const SrcOp &Src) {
2098+
return buildInstr(TargetOpcode::G_VECREDUCE_FMINIMUMNUM, {Dst}, {Src});
2099+
}
2100+
20772101
/// Build and insert \p Res = G_VECREDUCE_ADD \p Src
20782102
MachineInstrBuilder buildVecReduceAdd(const DstOp &Dst, const SrcOp &Src) {
20792103
return buildInstr(TargetOpcode::G_VECREDUCE_ADD, {Dst}, {Src});

llvm/include/llvm/CodeGen/GlobalISel/Utils.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ class APFloat;
6060
case TargetOpcode::G_VECREDUCE_FMIN: \
6161
case TargetOpcode::G_VECREDUCE_FMAXIMUM: \
6262
case TargetOpcode::G_VECREDUCE_FMINIMUM: \
63+
case TargetOpcode::G_VECREDUCE_FMAXIMUMNUM: \
64+
case TargetOpcode::G_VECREDUCE_FMINIMUMNUM: \
6365
case TargetOpcode::G_VECREDUCE_ADD: \
6466
case TargetOpcode::G_VECREDUCE_MUL: \
6567
case TargetOpcode::G_VECREDUCE_AND: \
@@ -77,6 +79,8 @@ class APFloat;
7779
case TargetOpcode::G_VECREDUCE_FMIN: \
7880
case TargetOpcode::G_VECREDUCE_FMAXIMUM: \
7981
case TargetOpcode::G_VECREDUCE_FMINIMUM: \
82+
case TargetOpcode::G_VECREDUCE_FMAXIMUMNUM: \
83+
case TargetOpcode::G_VECREDUCE_FMINIMUMNUM: \
8084
case TargetOpcode::G_VECREDUCE_ADD: \
8185
case TargetOpcode::G_VECREDUCE_MUL: \
8286
case TargetOpcode::G_VECREDUCE_AND: \

llvm/include/llvm/CodeGen/ISDOpcodes.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,8 @@ enum NodeType {
436436
STRICT_LLRINT,
437437
STRICT_FMAXIMUM,
438438
STRICT_FMINIMUM,
439+
STRICT_FMAXIMUMNUM,
440+
STRICT_FMINIMUMNUM,
439441

440442
/// STRICT_FP_TO_[US]INT - Convert a floating point value to a signed or
441443
/// unsigned integer. These have the same semantics as fptosi and fptoui
@@ -999,6 +1001,11 @@ enum NodeType {
9991001
FMINIMUM,
10001002
FMAXIMUM,
10011003

1004+
/// FMINIMUMNUM/FMAXIMUMNUM - minimumnum/maximumnum that is same with
1005+
/// FMINNUM_IEEE and FMAXNUM_IEEE besides if either operand is sNaN.
1006+
FMINIMUMNUM,
1007+
FMAXIMUMNUM,
1008+
10021009
/// FSINCOS - Compute both fsin and fcos as a single operation.
10031010
FSINCOS,
10041011

@@ -1373,6 +1380,10 @@ enum NodeType {
13731380
/// llvm.minimum and llvm.maximum semantics.
13741381
VECREDUCE_FMAXIMUM,
13751382
VECREDUCE_FMINIMUM,
1383+
/// FMINIMUMNUM/FMAXIMUMNUM nodes don't propatate NaNs and signed zeroes using
1384+
/// the llvm.minimumnum and llvm.maximumnum semantics.
1385+
VECREDUCE_FMAXIMUMNUM,
1386+
VECREDUCE_FMINIMUMNUM,
13761387
/// Integer reductions may have a result type larger than the vector element
13771388
/// type. However, the reduction is performed using the vector element type
13781389
/// and the value in the top bits is unspecified.

llvm/include/llvm/CodeGen/TargetLowering.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2910,6 +2910,8 @@ class TargetLoweringBase {
29102910
case ISD::FMAXNUM_IEEE:
29112911
case ISD::FMINIMUM:
29122912
case ISD::FMAXIMUM:
2913+
case ISD::FMINIMUMNUM:
2914+
case ISD::FMAXIMUMNUM:
29132915
case ISD::AVGFLOORS:
29142916
case ISD::AVGFLOORU:
29152917
case ISD::AVGCEILS:
@@ -5130,6 +5132,8 @@ class TargetLowering : public TargetLoweringBase {
51305132
/// through to the default expansion/soften to libcall, we might introduce a
51315133
/// link-time dependency on libm into a file that originally did not have one.
51325134
SDValue createSelectForFMINNUM_FMAXNUM(SDNode *Node, SelectionDAG &DAG) const;
5135+
SDValue createSelectForFMINIMUMNUM_FMAXIMUMNUM(SDNode *Node,
5136+
SelectionDAG &DAG) const;
51335137

51345138
/// Return a reciprocal estimate value for the input operand.
51355139
/// \p Enabled is a ReciprocalEstimate enum with value either 'Unspecified' or
@@ -5261,6 +5265,9 @@ class TargetLowering : public TargetLoweringBase {
52615265
/// Expand fminimum/fmaximum into multiple comparison with selects.
52625266
SDValue expandFMINIMUM_FMAXIMUM(SDNode *N, SelectionDAG &DAG) const;
52635267

5268+
/// Expand fminimumnum/fmaximumnum into multiple comparison with selects.
5269+
SDValue expandFMINIMUMNUM_FMAXIMUMNUM(SDNode *N, SelectionDAG &DAG) const;
5270+
52645271
/// Expand FP_TO_[US]INT_SAT into FP_TO_[US]INT and selects or min/max.
52655272
/// \param N Node to expand
52665273
/// \returns The expansion result

llvm/include/llvm/IR/ConstrainedOps.def

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,8 @@ DAG_FUNCTION(maxnum, 2, 0, experimental_constrained_maxnum, FMAXNUM
8686
DAG_FUNCTION(minnum, 2, 0, experimental_constrained_minnum, FMINNUM)
8787
DAG_FUNCTION(maximum, 2, 0, experimental_constrained_maximum, FMAXIMUM)
8888
DAG_FUNCTION(minimum, 2, 0, experimental_constrained_minimum, FMINIMUM)
89+
DAG_FUNCTION(maximumnum, 2, 0, experimental_constrained_maximumnum, FMAXIMUMNUM)
90+
DAG_FUNCTION(minimumnum, 2, 0, experimental_constrained_minimumnum, FMINIMUMNUM)
8991
DAG_FUNCTION(nearbyint, 1, 1, experimental_constrained_nearbyint, FNEARBYINT)
9092
DAG_FUNCTION(pow, 2, 1, experimental_constrained_pow, FPOW)
9193
DAG_FUNCTION(powi, 2, 1, experimental_constrained_powi, FPOWI)

llvm/include/llvm/IR/IRBuilder.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1016,6 +1016,18 @@ class IRBuilderBase {
10161016
return CreateBinaryIntrinsic(Intrinsic::maximum, LHS, RHS, nullptr, Name);
10171017
}
10181018

1019+
/// Create call to the minimumnum intrinsic.
1020+
Value *CreateMinimumNum(Value *LHS, Value *RHS, const Twine &Name = "") {
1021+
return CreateBinaryIntrinsic(Intrinsic::minimumnum, LHS, RHS, nullptr,
1022+
Name);
1023+
}
1024+
1025+
/// Create call to the maximum intrinsic.
1026+
Value *CreateMaximumNum(Value *LHS, Value *RHS, const Twine &Name = "") {
1027+
return CreateBinaryIntrinsic(Intrinsic::maximumnum, LHS, RHS, nullptr,
1028+
Name);
1029+
}
1030+
10191031
/// Create call to the copysign intrinsic.
10201032
Value *CreateCopySign(Value *LHS, Value *RHS,
10211033
Instruction *FMFSource = nullptr,

llvm/include/llvm/IR/IntrinsicInst.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@ class IntrinsicInst : public CallInst {
7676
case Intrinsic::minnum:
7777
case Intrinsic::maximum:
7878
case Intrinsic::minimum:
79+
case Intrinsic::maximumnum:
80+
case Intrinsic::minimumnum:
7981
case Intrinsic::smax:
8082
case Intrinsic::smin:
8183
case Intrinsic::umax:

llvm/include/llvm/IR/Intrinsics.td

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1086,6 +1086,14 @@ def int_maximum : DefaultAttrsIntrinsic<[llvm_anyfloat_ty],
10861086
[LLVMMatchType<0>, LLVMMatchType<0>],
10871087
[IntrNoMem, IntrSpeculatable, IntrWillReturn, Commutative]
10881088
>;
1089+
def int_minimumnum : DefaultAttrsIntrinsic<[llvm_anyfloat_ty],
1090+
[LLVMMatchType<0>, LLVMMatchType<0>],
1091+
[IntrNoMem, IntrSpeculatable, IntrWillReturn, Commutative]
1092+
>;
1093+
def int_maximumnum : DefaultAttrsIntrinsic<[llvm_anyfloat_ty],
1094+
[LLVMMatchType<0>, LLVMMatchType<0>],
1095+
[IntrNoMem, IntrSpeculatable, IntrWillReturn, Commutative]
1096+
>;
10891097

10901098
// Internal interface for object size checking
10911099
def int_objectsize : DefaultAttrsIntrinsic<[llvm_anyint_ty],
@@ -1280,6 +1288,14 @@ let IntrProperties = [IntrInaccessibleMemOnly, IntrWillReturn, IntrStrictFP] in
12801288
[ LLVMMatchType<0>,
12811289
LLVMMatchType<0>,
12821290
llvm_metadata_ty ]>;
1291+
def int_experimental_constrained_maximumnum : DefaultAttrsIntrinsic<[ llvm_anyfloat_ty ],
1292+
[ LLVMMatchType<0>,
1293+
LLVMMatchType<0>,
1294+
llvm_metadata_ty ]>;
1295+
def int_experimental_constrained_minimumnum : DefaultAttrsIntrinsic<[ llvm_anyfloat_ty ],
1296+
[ LLVMMatchType<0>,
1297+
LLVMMatchType<0>,
1298+
llvm_metadata_ty ]>;
12831299
def int_experimental_constrained_ceil : DefaultAttrsIntrinsic<[ llvm_anyfloat_ty ],
12841300
[ LLVMMatchType<0>,
12851301
llvm_metadata_ty ]>;
@@ -2077,6 +2093,16 @@ let IntrProperties = [IntrNoMem, IntrNoSync, IntrWillReturn] in {
20772093
LLVMMatchType<0>,
20782094
LLVMScalarOrSameVectorWidth<0, llvm_i1_ty>,
20792095
llvm_i32_ty]>;
2096+
def int_vp_minimumnum : DefaultAttrsIntrinsic<[ llvm_anyvector_ty ],
2097+
[ LLVMMatchType<0>,
2098+
LLVMMatchType<0>,
2099+
LLVMScalarOrSameVectorWidth<0, llvm_i1_ty>,
2100+
llvm_i32_ty]>;
2101+
def int_vp_maximumnum : DefaultAttrsIntrinsic<[ llvm_anyvector_ty ],
2102+
[ LLVMMatchType<0>,
2103+
LLVMMatchType<0>,
2104+
LLVMScalarOrSameVectorWidth<0, llvm_i1_ty>,
2105+
llvm_i32_ty]>;
20802106
def int_vp_copysign : DefaultAttrsIntrinsic<[ llvm_anyvector_ty ],
20812107
[ LLVMMatchType<0>,
20822108
LLVMMatchType<0>,
@@ -2266,6 +2292,16 @@ let IntrProperties = [IntrNoMem, IntrNoSync, IntrWillReturn] in {
22662292
llvm_anyvector_ty,
22672293
LLVMScalarOrSameVectorWidth<0, llvm_i1_ty>,
22682294
llvm_i32_ty]>;
2295+
def int_vp_reduce_fmaximumnum : DefaultAttrsIntrinsic<[LLVMVectorElementType<0>],
2296+
[ LLVMVectorElementType<0>,
2297+
llvm_anyvector_ty,
2298+
LLVMScalarOrSameVectorWidth<0, llvm_i1_ty>,
2299+
llvm_i32_ty]>;
2300+
def int_vp_reduce_fminimumnum : DefaultAttrsIntrinsic<[LLVMVectorElementType<0>],
2301+
[ LLVMVectorElementType<0>,
2302+
llvm_anyvector_ty,
2303+
LLVMScalarOrSameVectorWidth<0, llvm_i1_ty>,
2304+
llvm_i32_ty]>;
22692305
}
22702306

22712307
let IntrProperties = [IntrNoMem, IntrNoSync, IntrWillReturn, ImmArg<ArgIndex<1>>] in {
@@ -2504,6 +2540,10 @@ let IntrProperties = [IntrNoMem, IntrSpeculatable] in {
25042540
[llvm_anyvector_ty]>;
25052541
def int_vector_reduce_fmaximum: DefaultAttrsIntrinsic<[LLVMVectorElementType<0>],
25062542
[llvm_anyvector_ty]>;
2543+
def int_vector_reduce_fminimumnum: DefaultAttrsIntrinsic<[LLVMVectorElementType<0>],
2544+
[llvm_anyvector_ty]>;
2545+
def int_vector_reduce_fmaximumnum: DefaultAttrsIntrinsic<[LLVMVectorElementType<0>],
2546+
[llvm_anyvector_ty]>;
25072547
}
25082548

25092549
//===----- Matrix intrinsics ---------------------------------------------===//

0 commit comments

Comments
 (0)