mirror of
https://github.com/intel/llvm.git
synced 2026-01-21 04:14:03 +08:00
[flang] Accept distinct kinds of arguments to IAND/IEOR/IOR (#69782)
As is already supported as a common extension for intrinsic functions like DIM, allow distinct kinds of integer actual arguments to the MIL-STD bit intrinsic functions IAND, IEOR, and IOR, with the kind of the result being the largest of the kinds of the operands. (Though one could make a case that IAND should return the smallest kind of its operands, that's not what other compilers do.)
This commit is contained in:
@@ -177,7 +177,7 @@ end
|
||||
or `EXTENDEDTYPE(PARENTTYPE=PARENTTYPE(1,2,3))`).
|
||||
* Some intrinsic functions are specified in the standard as requiring the
|
||||
same type and kind for their arguments (viz., ATAN with two arguments,
|
||||
ATAN2, DIM, HYPOT, MAX, MIN, MOD, and MODULO);
|
||||
ATAN2, DIM, HYPOT, IAND, IEOR, IOR, MAX, MIN, MOD, and MODULO);
|
||||
we allow distinct types to be used, promoting
|
||||
the arguments as if they were operands to an intrinsic `+` operator,
|
||||
and defining the result type accordingly.
|
||||
|
||||
@@ -170,6 +170,7 @@ static constexpr TypePattern SameType{AnyType, KindCode::same};
|
||||
// an intrinsic operation like addition. This is a nonstandard but nearly
|
||||
// universal extension feature.
|
||||
static constexpr TypePattern OperandReal{RealType, KindCode::operand};
|
||||
static constexpr TypePattern OperandInt{IntType, KindCode::operand};
|
||||
static constexpr TypePattern OperandIntOrReal{IntOrRealType, KindCode::operand};
|
||||
|
||||
// For ASSOCIATED, the first argument is a typeless pointer
|
||||
@@ -517,13 +518,15 @@ static const IntrinsicInterface genericIntrinsicFunction[]{
|
||||
SameInt, Rank::dimReduced, IntrinsicClass::transformationalFunction},
|
||||
{"iparity", {{"array", SameInt, Rank::array}, MissingDIM, OptionalMASK},
|
||||
SameInt, Rank::scalar, IntrinsicClass::transformationalFunction},
|
||||
{"iand", {{"i", SameInt}, {"j", SameInt, Rank::elementalOrBOZ}}, SameInt},
|
||||
{"iand", {{"i", OperandInt}, {"j", OperandInt, Rank::elementalOrBOZ}},
|
||||
OperandInt},
|
||||
{"iand", {{"i", BOZ}, {"j", SameInt}}, SameInt},
|
||||
{"ibclr", {{"i", SameInt}, {"pos", AnyInt}}, SameInt},
|
||||
{"ibits", {{"i", SameInt}, {"pos", AnyInt}, {"len", AnyInt}}, SameInt},
|
||||
{"ibset", {{"i", SameInt}, {"pos", AnyInt}}, SameInt},
|
||||
{"ichar", {{"c", AnyChar}, DefaultingKIND}, KINDInt},
|
||||
{"ieor", {{"i", SameInt}, {"j", SameInt, Rank::elementalOrBOZ}}, SameInt},
|
||||
{"ieor", {{"i", OperandInt}, {"j", OperandInt, Rank::elementalOrBOZ}},
|
||||
OperandInt},
|
||||
{"ieor", {{"i", BOZ}, {"j", SameInt}}, SameInt},
|
||||
{"image_status", {{"image", SameInt}, OptionalTEAM}, DefaultInt},
|
||||
{"index",
|
||||
@@ -533,7 +536,8 @@ static const IntrinsicInterface genericIntrinsicFunction[]{
|
||||
KINDInt},
|
||||
{"int", {{"a", AnyNumeric, Rank::elementalOrBOZ}, DefaultingKIND}, KINDInt},
|
||||
{"int_ptr_kind", {}, DefaultInt, Rank::scalar},
|
||||
{"ior", {{"i", SameInt}, {"j", SameInt, Rank::elementalOrBOZ}}, SameInt},
|
||||
{"ior", {{"i", OperandInt}, {"j", OperandInt, Rank::elementalOrBOZ}},
|
||||
OperandInt},
|
||||
{"ior", {{"i", BOZ}, {"j", SameInt}}, SameInt},
|
||||
{"ishft", {{"i", SameInt}, {"shift", AnyInt}}, SameInt},
|
||||
{"ishftc",
|
||||
|
||||
Reference in New Issue
Block a user