Skip to content

Commit ef0b8cf

Browse files
committed
[AArch64][GISel] Expand coverage of FAdd and FSub.
This adds some more extensive test coverage for fadd/fsub through global isel, switching the opcodes to use the more complete ActionDefinitions to handle more cases.
1 parent 879e801 commit ef0b8cf

File tree

4 files changed

+1088
-10
lines changed

4 files changed

+1088
-10
lines changed

llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4831,6 +4831,7 @@ LegalizerHelper::moreElementsVector(MachineInstr &MI, unsigned TypeIdx,
48314831
case TargetOpcode::G_SUB:
48324832
case TargetOpcode::G_MUL:
48334833
case TargetOpcode::G_FADD:
4834+
case TargetOpcode::G_FSUB:
48344835
case TargetOpcode::G_FMUL:
48354836
case TargetOpcode::G_UADDSAT:
48364837
case TargetOpcode::G_USUBSAT:

llvm/lib/Target/AArch64/GISel/AArch64LegalizerInfo.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ AArch64LegalizerInfo::AArch64LegalizerInfo(const AArch64Subtarget &ST)
235235
.clampScalar(1, s32, s64)
236236
.widenScalarToNextPow2(0);
237237

238-
getActionDefinitionsBuilder({G_FADD, G_FSUB, G_FMUL, G_FDIV, G_FNEG})
238+
getActionDefinitionsBuilder({G_FMUL, G_FDIV, G_FNEG})
239239
.legalFor({MinFPScalar, s32, s64, v2s64, v4s32, v2s32})
240240
.clampScalar(0, MinFPScalar, s64)
241241
.clampNumElements(0, v2s32, v4s32)
@@ -948,10 +948,10 @@ AArch64LegalizerInfo::AArch64LegalizerInfo(const AArch64Subtarget &ST)
948948
// TODO: Vector types.
949949
getActionDefinitionsBuilder({G_SADDSAT, G_SSUBSAT}).lowerIf(isScalar(0));
950950

951-
getActionDefinitionsBuilder({G_FABS, G_FSQRT, G_FMAXNUM, G_FMINNUM, G_FMAXIMUM,
952-
G_FMINIMUM, G_FCEIL, G_FFLOOR, G_FRINT,
953-
G_FNEARBYINT, G_INTRINSIC_TRUNC,
954-
G_INTRINSIC_ROUND, G_INTRINSIC_ROUNDEVEN})
951+
getActionDefinitionsBuilder(
952+
{G_FADD, G_FSUB, G_FABS, G_FSQRT, G_FMAXNUM, G_FMINNUM, G_FMAXIMUM,
953+
G_FMINIMUM, G_FCEIL, G_FFLOOR, G_FRINT, G_FNEARBYINT, G_INTRINSIC_TRUNC,
954+
G_INTRINSIC_ROUND, G_INTRINSIC_ROUNDEVEN})
955955
.legalFor({MinFPScalar, s32, s64, v2s32, v4s32, v2s64})
956956
.legalIf([=](const LegalityQuery &Query) {
957957
const auto &Ty = Query.Types[0];

llvm/test/CodeGen/AArch64/GlobalISel/legalizer-info-validation.mir

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -431,14 +431,13 @@
431431
# DEBUG-NEXT: .. type index coverage check SKIPPED: no rules defined
432432
# DEBUG-NEXT: .. imm index coverage check SKIPPED: no rules defined
433433
# DEBUG-NEXT: G_FADD (opcode {{[0-9]+}}): 1 type index, 0 imm indices
434-
# DEBUG-NEXT: .. the first uncovered type index: 1, OK
435-
# DEBUG-NEXT: .. the first uncovered imm index: 0, OK
434+
# DEBUG-NEXT: .. type index coverage check SKIPPED: user-defined predicate detected
435+
# DEBUG-NEXT: .. imm index coverage check SKIPPED: user-defined predicate detected
436436
# DEBUG-NEXT: G_FSUB (opcode {{[0-9]+}}): 1 type index, 0 imm indices
437437
# DEBUG-NEXT: .. opcode {{[0-9]+}} is aliased to {{[0-9]+}}
438-
# DEBUG-NEXT: .. the first uncovered type index: 1, OK
439-
# DEBUG-NEXT: .. the first uncovered imm index: 0, OK
438+
# DEBUG-NEXT: .. type index coverage check SKIPPED: user-defined predicate detected
439+
# DEBUG-NEXT: .. imm index coverage check SKIPPED: user-defined predicate detected
440440
# DEBUG-NEXT: G_FMUL (opcode {{[0-9]+}}): 1 type index, 0 imm indices
441-
# DEBUG-NEXT: .. opcode {{[0-9]+}} is aliased to {{[0-9]+}}
442441
# DEBUG-NEXT: .. the first uncovered type index: 1, OK
443442
# DEBUG-NEXT: .. the first uncovered imm index: 0, OK
444443
# DEBUG-NEXT: G_FMA (opcode {{[0-9]+}}): 1 type index, 0 imm indices
@@ -512,6 +511,7 @@
512511
# DEBUG-NEXT: .. type index coverage check SKIPPED: user-defined predicate detected
513512
# DEBUG-NEXT: .. imm index coverage check SKIPPED: user-defined predicate detected
514513
# DEBUG-NEXT: G_FABS (opcode {{[0-9]+}}): 1 type index, 0 imm indices
514+
# DEBUG-NEXT: .. opcode {{[0-9]+}} is aliased to {{[0-9]+}}
515515
# DEBUG-NEXT: .. type index coverage check SKIPPED: user-defined predicate detected
516516
# DEBUG-NEXT: .. imm index coverage check SKIPPED: user-defined predicate detected
517517
# DEBUG-NEXT: G_FCOPYSIGN (opcode {{[0-9]+}}): 2 type indices

0 commit comments

Comments
 (0)