Skip to content

Commit 39c3e04

Browse files
Remove shared opcode & subsequent changes
1 parent 3671057 commit 39c3e04

File tree

16 files changed

+6848
-6921
lines changed

16 files changed

+6848
-6921
lines changed

llvm/docs/GlobalISel/GenericOpcode.rst

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -536,12 +536,6 @@ G_FPTRUNC
536536

537537
Convert a floating point value to a narrower type.
538538

539-
G_FPTRUNC_ODD
540-
^^^^^^^^^^^^^
541-
542-
Convert a floating point value to a narrower type using round-to-odd rounding
543-
mode.
544-
545539
G_FPTOSI, G_FPTOUI, G_SITOFP, G_UITOFP
546540
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
547541

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

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1332,21 +1332,6 @@ class LLVM_ABI MachineIRBuilder {
13321332
buildFPTrunc(const DstOp &Res, const SrcOp &Op,
13331333
std::optional<unsigned> Flags = std::nullopt);
13341334

1335-
/// Build and insert \p Res = G_FPTRUNC_ODD \p Op
1336-
///
1337-
/// G_FPTRUNC_ODD converts a floating-point value into one with a smaller type
1338-
/// using round to odd.
1339-
///
1340-
/// \pre setBasicBlock or setMI must have been called.
1341-
/// \pre \p Res must be a generic virtual register with scalar or vector type.
1342-
/// \pre \p Op must be a generic virtual register with scalar or vector type.
1343-
/// \pre \p Res must be smaller than \p Op
1344-
///
1345-
/// \return The newly created instruction.
1346-
MachineInstrBuilder
1347-
buildFPTruncOdd(const DstOp &Res, const SrcOp &Op,
1348-
std::optional<unsigned> Flags = std::nullopt);
1349-
13501335
/// Build and insert \p Res = G_TRUNC \p Op
13511336
///
13521337
/// G_TRUNC extracts the low bits of a type. For a vector type each element is

llvm/include/llvm/Support/TargetOpcodes.def

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -692,9 +692,6 @@ HANDLE_TARGET_OPCODE(G_FPEXT)
692692
/// Generic float to signed-int conversion
693693
HANDLE_TARGET_OPCODE(G_FPTRUNC)
694694

695-
/// Generic float to signed-int conversion using round to odd
696-
HANDLE_TARGET_OPCODE(G_FPTRUNC_ODD)
697-
698695
/// Generic float to signed-int conversion
699696
HANDLE_TARGET_OPCODE(G_FPTOSI)
700697

llvm/include/llvm/Target/GenericOpcodes.td

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -782,12 +782,6 @@ def G_FPTRUNC : GenericInstruction {
782782
let hasSideEffects = false;
783783
}
784784

785-
def G_FPTRUNC_ODD : GenericInstruction {
786-
let OutOperandList = (outs type0:$dst);
787-
let InOperandList = (ins type1:$src);
788-
let hasSideEffects = false;
789-
}
790-
791785
def G_FPTOSI : GenericInstruction {
792786
let OutOperandList = (outs type0:$dst);
793787
let InOperandList = (ins type1:$src);

llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp

Lines changed: 3 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -5595,7 +5595,6 @@ LegalizerHelper::fewerElementsVector(MachineInstr &MI, unsigned TypeIdx,
55955595
case G_ANYEXT:
55965596
case G_FPEXT:
55975597
case G_FPTRUNC:
5598-
case G_FPTRUNC_ODD:
55995598
case G_SITOFP:
56005599
case G_UITOFP:
56015600
case G_FPTOSI:
@@ -8477,8 +8476,7 @@ LegalizerHelper::lowerFPTOINT_SAT(MachineInstr &MI) {
84778476
return Legalized;
84788477
}
84798478

8480-
// f64 -> f16 conversion using round-to-nearest-even rounding mode for scalars
8481-
// and round-to-odd for vectors.
8479+
// f64 -> f16 conversion using round-to-nearest-even rounding mode.
84828480
LegalizerHelper::LegalizeResult
84838481
LegalizerHelper::lowerFPTRUNC_F64_TO_F16(MachineInstr &MI) {
84848482
const LLT S1 = LLT::scalar(1);
@@ -8488,28 +8486,8 @@ LegalizerHelper::lowerFPTRUNC_F64_TO_F16(MachineInstr &MI) {
84888486
assert(MRI.getType(Dst).getScalarType() == LLT::scalar(16) &&
84898487
MRI.getType(Src).getScalarType() == LLT::scalar(64));
84908488

8491-
if (MRI.getType(Src).isVector()) {
8492-
LLT SrcTy = MRI.getType(Src);
8493-
8494-
LLT MidTy = LLT::fixed_vector(SrcTy.getNumElements(), LLT::scalar(32));
8495-
8496-
// Check if G_FPTRUNC_ODD has been added to the legalizer and the resultant
8497-
// types can be legalized.
8498-
auto LegalizeAction =
8499-
LI.getAction({TargetOpcode::G_FPTRUNC_ODD, {MidTy, SrcTy}}).Action;
8500-
8501-
if (LegalizeAction == LegalizeActions::Unsupported ||
8502-
LegalizeAction == LegalizeActions::NotFound)
8503-
return UnableToLegalize;
8504-
8505-
MIRBuilder.setInstrAndDebugLoc(MI);
8506-
8507-
MachineInstrBuilder Mid = MIRBuilder.buildFPTruncOdd(MidTy, Src);
8508-
MIRBuilder.buildFPTrunc(Dst, Mid.getReg(0));
8509-
8510-
MI.eraseFromParent();
8511-
return Legalized;
8512-
}
8489+
if (MRI.getType(Src).isVector())
8490+
return UnableToLegalize;
85138491

85148492
if (MI.getFlag(MachineInstr::FmAfn)) {
85158493
unsigned Flags = MI.getFlags();

llvm/lib/CodeGen/GlobalISel/MachineIRBuilder.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -936,12 +936,6 @@ MachineIRBuilder::buildFPTrunc(const DstOp &Res, const SrcOp &Op,
936936
return buildInstr(TargetOpcode::G_FPTRUNC, Res, Op, Flags);
937937
}
938938

939-
MachineInstrBuilder
940-
MachineIRBuilder::buildFPTruncOdd(const DstOp &Res, const SrcOp &Op,
941-
std::optional<unsigned> Flags) {
942-
return buildInstr(TargetOpcode::G_FPTRUNC_ODD, Res, Op, Flags);
943-
}
944-
945939
MachineInstrBuilder MachineIRBuilder::buildICmp(CmpInst::Predicate Pred,
946940
const DstOp &Res,
947941
const SrcOp &Op0,

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

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -831,11 +831,6 @@ AArch64LegalizerInfo::AArch64LegalizerInfo(const AArch64Subtarget &ST)
831831
.clampNumElements(1, v2s64, v2s64)
832832
.scalarize(0);
833833

834-
getActionDefinitionsBuilder(G_FPTRUNC_ODD)
835-
.legalFor({{s16, s32}, {s32, s64}, {v4s16, v4s32}, {v2s32, v2s64}})
836-
.clampMaxNumElements(1, s32, 4)
837-
.clampMaxNumElements(1, s64, 2);
838-
839834
getActionDefinitionsBuilder(G_FPEXT)
840835
.legalFor(
841836
{{s32, s16}, {s64, s16}, {s64, s32}, {v4s32, v4s16}, {v2s64, v2s32}})

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -560,9 +560,6 @@
560560
# DEBUG-NEXT: G_FPTRUNC (opcode {{[0-9]+}}): 2 type indices, 0 imm indices
561561
# DEBUG-NEXT: .. type index coverage check SKIPPED: user-defined predicate detected
562562
# DEBUG-NEXT: .. imm index coverage check SKIPPED: user-defined predicate detected
563-
# DEBUG-NEXT: G_FPTRUNC_ODD (opcode 204): 2 type indices, 0 imm indices
564-
# DEBUG-NEXT: .. the first uncovered type index: 2, OK
565-
# DEBUG-NEXT: .. the first uncovered imm index: 0, OK
566563
# DEBUG-NEXT: G_FPTOSI (opcode {{[0-9]+}}): 2 type indices, 0 imm indices
567564
# DEBUG-NEXT: .. type index coverage check SKIPPED: user-defined predicate detected
568565
# DEBUG-NEXT: .. imm index coverage check SKIPPED: user-defined predicate detected

llvm/test/CodeGen/MIR2Vec/Inputs/reference_x86_vocab_print.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,6 @@ Key: G_FPTOSI_SAT: [ 0.00 0.00 ]
423423
Key: G_FPTOUI: [ 0.00 0.00 ]
424424
Key: G_FPTOUI_SAT: [ 0.00 0.00 ]
425425
Key: G_FPTRUNC: [ 0.00 0.00 ]
426-
Key: G_FPTRUNC_ODD: [ 0.00 0.00 ]
427426
Key: G_FRAME_INDEX: [ 0.00 0.00 ]
428427
Key: G_FREEZE: [ 0.00 0.00 ]
429428
Key: G_FREM: [ 0.00 0.00 ]

llvm/test/CodeGen/MIR2Vec/Inputs/reference_x86_vocab_wo=0.5_print.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,6 @@ Key: G_FPTOSI_SAT: [ 0.00 0.00 ]
423423
Key: G_FPTOUI: [ 0.00 0.00 ]
424424
Key: G_FPTOUI_SAT: [ 0.00 0.00 ]
425425
Key: G_FPTRUNC: [ 0.00 0.00 ]
426-
Key: G_FPTRUNC_ODD: [ 0.00 0.00 ]
427426
Key: G_FRAME_INDEX: [ 0.00 0.00 ]
428427
Key: G_FREEZE: [ 0.00 0.00 ]
429428
Key: G_FREM: [ 0.00 0.00 ]

0 commit comments

Comments
 (0)