Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
4845052
[AMDGPU] expand-fp: Change frem expansion criterion
frederik-h Sep 12, 2025
534b3e2
Revert Operation Action for frem to Expand
frederik-h Sep 12, 2025
7dee6b1
Merge remote-tracking branch 'upstream/main' into expand-fp-frem-expa…
frederik-h Sep 12, 2025
61ca19c
[AMDGPU] expand-fp: Add early exit for targets that don't require any…
frederik-h Sep 16, 2025
0a30d40
Merge remote-tracking branch 'upstream/main' into expand-fp-frem-expa…
frederik-h Sep 16, 2025
c1814f0
Review changes
frederik-h Sep 16, 2025
a752a2f
fixup! Review changes
frederik-h Sep 16, 2025
307252a
Try fix Windows build problem
frederik-h Sep 16, 2025
4728696
Furhter fixup for Windows build
frederik-h Sep 16, 2025
77d862b
Change ISD::FREM legalization actions from Expand to LibCall for scal…
frederik-h Oct 2, 2025
df7066c
expand-fp: always expand frem if legalization action is "Expand"
frederik-h Oct 16, 2025
53fdc7a
Merge remote-tracking branch 'upstream/main' into expand-fp-frem-expa…
frederik-h Oct 16, 2025
a33ab1d
Revert deletion of comment line
frederik-h Oct 16, 2025
a58e1c7
Add back deleted line
frederik-h Oct 16, 2025
1ea0b3a
clang-format changes
frederik-h Oct 16, 2025
4d5d984
Replace two function uses by better llvm alternatives
frederik-h Oct 17, 2025
17f470b
trigger CI
frederik-h Oct 17, 2025
4225845
Merge remote-tracking branch 'upstream/main' into expand-fp-frem-expa…
frederik-h Oct 17, 2025
961689b
Merge remote-tracking branch 'upstream/main' into expand-fp-frem-expa…
frederik-h Oct 20, 2025
1a59160
Merge remote-tracking branch 'upstream/main' into expand-fp-frem-expa…
frederik-h Oct 20, 2025
1f6811d
fixup! Merge remote-tracking branch 'upstream/main' into expand-fp-fr…
frederik-h Oct 20, 2025
91cf7ce
trigger build
frederik-h Oct 20, 2025
48665e5
Merge remote-tracking branch 'upstream/main' into expand-fp-frem-expa…
frederik-h Oct 20, 2025
f2b7181
Trigger CI
frederik-h Oct 21, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions llvm/include/llvm/CodeGen/TargetLowering.h
Original file line number Diff line number Diff line change
Expand Up @@ -1468,6 +1468,10 @@ class LLVM_ABI TargetLoweringBase {
getOperationAction(Op, VT) == Legal;
}

bool isOperationLibCall(unsigned Op, EVT VT) const {
return getOperationAction(Op, VT) == LibCall;
}

/// Return how this load with extension should be treated: either it is legal,
/// needs to be promoted to a larger size, needs to be expanded to some other
/// code sequence, or the target has a custom expander for it.
Expand Down
107 changes: 60 additions & 47 deletions llvm/lib/CodeGen/ExpandFp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,54 @@ class FRemExpander {
/// Constant 1 of type \p ExTy.
Value *One;

/// The frem argument/return types that can be expanded by this class.
// TODO The expansion could work for other floating point types
// as well, but this would require additional testing.
static constexpr std::array<MVT, 3> ExpandableTypes{MVT::f16, MVT::f32,
MVT::f64};

/// Libcalls for frem instructions of the type at the corresponding
/// positions of ExpandableTypes.
static constexpr std::array<RTLIB::Libcall, 3> FremLibcalls{
RTLIB::REM_F32, RTLIB::REM_F32, RTLIB::REM_F64};

/// Return the Libcall for frem instructions of expandable type \p VT or
/// std::nullopt if \p VT is not expandable.
static std::optional<RTLIB::Libcall> getFremLibcallForType(EVT VT) {
MVT V = VT.getSimpleVT();
for (unsigned I = 0; I < ExpandableTypes.size(); I++)
if (ExpandableTypes[I] == V)
return FremLibcalls[I];

return {};
};

public:
static bool canExpandType(Type *Ty) {
// TODO The expansion should work for other floating point types
// as well, but this would require additional testing.
return Ty->isIEEELikeFPTy() && !Ty->isBFloatTy() && !Ty->isFP128Ty();
EVT VT = EVT::getEVT(Ty);
assert(VT.isSimple() && "Can expand only simple types");

return is_contained(ExpandableTypes, VT.getSimpleVT());
}

static bool shouldExpandFremType(const TargetLowering &TLI, EVT VT) {
assert(!VT.isVector() && "Cannot handle vector type; must scalarize first");
return (TLI.getOperationAction(ISD::FREM, VT) ==
TargetLowering::LegalizeAction::Expand);
}

static bool shouldExpandFremType(const TargetLowering &TLI, Type *Ty) {
// Consider scalar type for simplicity. It seems unlikely that a
// vector type can be legalized without expansion if the scalar
// type cannot.
return shouldExpandFremType(TLI, EVT::getEVT(Ty->getScalarType()));
}

/// Return true if the pass should expand "frem" instructions of some any for
/// the target represented by \p TLI.
static bool shouldExpandAnyFremType(const TargetLowering &TLI) {
return any_of(ExpandableTypes,
[&](MVT V) { return shouldExpandFremType(TLI, EVT(V)); });
}

static FRemExpander create(IRBuilder<> &B, Type *Ty) {
Expand Down Expand Up @@ -952,36 +995,6 @@ static void scalarize(Instruction *I,
I->eraseFromParent();
}

// This covers all floating point types; more than we need here.
// TODO Move somewhere else for general use?
/// Return the Libcall for a frem instruction of
/// type \p Ty.
static RTLIB::Libcall fremToLibcall(Type *Ty) {
assert(Ty->isFloatingPointTy());
if (Ty->isFloatTy() || Ty->is16bitFPTy())
return RTLIB::REM_F32;
if (Ty->isDoubleTy())
return RTLIB::REM_F64;
if (Ty->isFP128Ty())
return RTLIB::REM_F128;
if (Ty->isX86_FP80Ty())
return RTLIB::REM_F80;
if (Ty->isPPC_FP128Ty())
return RTLIB::REM_PPCF128;

llvm_unreachable("Unknown floating point type");
}

/* Return true if, according to \p LibInfo, the target either directly
supports the frem instruction for the \p Ty, has a custom lowering,
or uses a libcall. */
static bool targetSupportsFrem(const TargetLowering &TLI, Type *Ty) {
if (!TLI.isOperationExpand(ISD::FREM, EVT::getEVT(Ty)))
return true;

return TLI.getLibcallName(fremToLibcall(Ty->getScalarType()));
}

static void addToWorklist(Instruction &I,
SmallVector<Instruction *, 4> &Worklist) {
if (I.getOperand(0)->getType()->isVectorTy())
Expand All @@ -999,7 +1012,11 @@ static bool runImpl(Function &F, const TargetLowering &TLI,
if (ExpandFpConvertBits != llvm::IntegerType::MAX_INT_BITS)
MaxLegalFpConvertBitWidth = ExpandFpConvertBits;

if (MaxLegalFpConvertBitWidth >= llvm::IntegerType::MAX_INT_BITS)
bool DisableExpandLargeFp =
MaxLegalFpConvertBitWidth >= llvm::IntegerType::MAX_INT_BITS;
bool DisableFrem = !FRemExpander::shouldExpandAnyFremType(TLI);

if (DisableExpandLargeFp && DisableFrem)
return false;

auto ShouldHandleInst = [&](Instruction &I) {
Expand All @@ -1010,21 +1027,17 @@ static bool runImpl(Function &F, const TargetLowering &TLI,

switch (I.getOpcode()) {
case Instruction::FRem:
return !targetSupportsFrem(TLI, Ty) &&
FRemExpander::canExpandType(Ty->getScalarType());

return !DisableFrem && FRemExpander::shouldExpandFremType(TLI, Ty);
case Instruction::FPToUI:
case Instruction::FPToSI: {
auto *IntTy = cast<IntegerType>(Ty->getScalarType());
return IntTy->getIntegerBitWidth() > MaxLegalFpConvertBitWidth;
}

case Instruction::FPToSI:
return !DisableExpandLargeFp &&
cast<IntegerType>(Ty->getScalarType())->getIntegerBitWidth() >
MaxLegalFpConvertBitWidth;
case Instruction::UIToFP:
case Instruction::SIToFP: {
auto *IntTy =
cast<IntegerType>(I.getOperand(0)->getType()->getScalarType());
return IntTy->getIntegerBitWidth() > MaxLegalFpConvertBitWidth;
}
case Instruction::SIToFP:
return !DisableExpandLargeFp &&
cast<IntegerType>(I.getOperand(0)->getType()->getScalarType())
->getIntegerBitWidth() > MaxLegalFpConvertBitWidth;
}

return false;
Expand Down
3 changes: 2 additions & 1 deletion llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4809,7 +4809,8 @@ void DAGTypeLegalizer::WidenVectorResult(SDNode *N, unsigned ResNo) {
EVT VT = N->getValueType(0);
EVT WideVecVT = TLI.getTypeToTransformTo(*DAG.getContext(), VT);
if (!TLI.isOperationLegalOrCustomOrPromote(N->getOpcode(), WideVecVT) &&
TLI.isOperationExpand(N->getOpcode(), VT.getScalarType())) {
(TLI.isOperationExpand(N->getOpcode(), VT.getScalarType()) ||
TLI.isOperationLibCall(N->getOpcode(), VT.getScalarType()))) {
Res = DAG.UnrollVectorOp(N, WideVecVT.getVectorNumElements());
if (N->getNumValues() > 1)
ReplaceOtherWidenResults(N, Res.getNode(), ResNo);
Expand Down
10 changes: 5 additions & 5 deletions llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -534,9 +534,9 @@ AArch64TargetLowering::AArch64TargetLowering(const TargetMachine &TM,
setOperationAction(ISD::SRA_PARTS, MVT::i64, Custom);
setOperationAction(ISD::SRL_PARTS, MVT::i64, Custom);

setOperationAction(ISD::FREM, MVT::f32, Expand);
setOperationAction(ISD::FREM, MVT::f64, Expand);
setOperationAction(ISD::FREM, MVT::f80, Expand);
setOperationAction(ISD::FREM, MVT::f32, LibCall);
setOperationAction(ISD::FREM, MVT::f64, LibCall);
setOperationAction(ISD::FREM, MVT::f80, LibCall);

setOperationAction(ISD::BUILD_PAIR, MVT::i64, Expand);

Expand All @@ -559,7 +559,7 @@ AArch64TargetLowering::AArch64TargetLowering(const TargetMachine &TM,
setOperationAction(ISD::FMUL, MVT::f128, LibCall);
setOperationAction(ISD::FNEG, MVT::f128, Expand);
setOperationAction(ISD::FPOW, MVT::f128, Expand);
setOperationAction(ISD::FREM, MVT::f128, Expand);
setOperationAction(ISD::FREM, MVT::f128, LibCall);
setOperationAction(ISD::FRINT, MVT::f128, Expand);
setOperationAction(ISD::FSIN, MVT::f128, Expand);
setOperationAction(ISD::FSINCOS, MVT::f128, Expand);
Expand Down Expand Up @@ -734,8 +734,8 @@ AArch64TargetLowering::AArch64TargetLowering(const TargetMachine &TM,
setOperationAction(ISD::SSUBO_CARRY, MVT::i32, Custom);
setOperationAction(ISD::SSUBO_CARRY, MVT::i64, Custom);

setOperationAction(ISD::FSIN, MVT::f32, Expand);
setOperationAction(ISD::FSIN, MVT::f64, Expand);
setOperationAction(ISD::FSIN, MVT::f32, Expand);
setOperationAction(ISD::FCOS, MVT::f32, Expand);
setOperationAction(ISD::FCOS, MVT::f64, Expand);
setOperationAction(ISD::FPOW, MVT::f32, Expand);
Expand Down
1 change: 0 additions & 1 deletion llvm/lib/Target/AMDGPU/AMDGPUISelLowering.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ class AMDGPUTargetLowering : public TargetLowering {
/// Split a vector store into multiple scalar stores.
/// \returns The resulting chain.

SDValue LowerFREM(SDValue Op, SelectionDAG &DAG) const;
SDValue LowerFCEIL(SDValue Op, SelectionDAG &DAG) const;
SDValue LowerFTRUNC(SDValue Op, SelectionDAG &DAG) const;
SDValue LowerFRINT(SDValue Op, SelectionDAG &DAG) const;
Expand Down
6 changes: 3 additions & 3 deletions llvm/lib/Target/ARM/ARMISelLowering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -895,7 +895,7 @@ ARMTargetLowering::ARMTargetLowering(const TargetMachine &TM_,
setOperationAction(ISD::FMUL, MVT::f64, Expand);
setOperationAction(ISD::FMA, MVT::f64, Expand);
setOperationAction(ISD::FDIV, MVT::f64, Expand);
setOperationAction(ISD::FREM, MVT::f64, Expand);
setOperationAction(ISD::FREM, MVT::f64, LibCall);
setOperationAction(ISD::FCOPYSIGN, MVT::f64, Expand);
setOperationAction(ISD::FGETSIGN, MVT::f64, Expand);
setOperationAction(ISD::FNEG, MVT::f64, Expand);
Expand Down Expand Up @@ -1260,8 +1260,8 @@ ARMTargetLowering::ARMTargetLowering(const TargetMachine &TM_,
setOperationAction(ISD::FCOS, MVT::f64, Expand);
setOperationAction(ISD::FSINCOS, MVT::f64, Expand);
setOperationAction(ISD::FSINCOS, MVT::f32, Expand);
setOperationAction(ISD::FREM, MVT::f64, Expand);
setOperationAction(ISD::FREM, MVT::f32, Expand);
setOperationAction(ISD::FREM, MVT::f64, LibCall);
setOperationAction(ISD::FREM, MVT::f32, LibCall);
if (!Subtarget->useSoftFloat() && Subtarget->hasVFP2Base() &&
!Subtarget->isThumb1Only()) {
setOperationAction(ISD::FCOPYSIGN, MVT::f64, Custom);
Expand Down
6 changes: 3 additions & 3 deletions llvm/lib/Target/CSKY/CSKYISelLowering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,15 +117,15 @@ CSKYTargetLowering::CSKYTargetLowering(const TargetMachine &TM,
};

ISD::NodeType FPOpToExpand[] = {
ISD::FSIN, ISD::FCOS, ISD::FSINCOS, ISD::FPOW,
ISD::FREM, ISD::FCOPYSIGN, ISD::FP16_TO_FP, ISD::FP_TO_FP16};
ISD::FSIN, ISD::FCOS, ISD::FSINCOS, ISD::FPOW,
ISD::FCOPYSIGN, ISD::FP16_TO_FP, ISD::FP_TO_FP16};

if (STI.useHardFloat()) {

MVT AllVTy[] = {MVT::f32, MVT::f64};

for (auto VT : AllVTy) {
setOperationAction(ISD::FREM, VT, Expand);
setOperationAction(ISD::FREM, VT, LibCall);
setOperationAction(ISD::SELECT_CC, VT, Expand);
setOperationAction(ISD::BR_CC, VT, Expand);

Expand Down
11 changes: 6 additions & 5 deletions llvm/lib/Target/Hexagon/HexagonISelLowering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1661,13 +1661,14 @@ HexagonTargetLowering::HexagonTargetLowering(const TargetMachine &TM,
for (MVT VT : MVT::integer_valuetypes())
setOperationAction(IntExpOp, VT, Expand);
}
for (MVT VT : MVT::fp_valuetypes())
for (unsigned FPExpOp : {ISD::FDIV, ISD::FSQRT, ISD::FSIN, ISD::FCOS,
ISD::FSINCOS, ISD::FPOW, ISD::FCOPYSIGN}) {

for (unsigned FPExpOp :
{ISD::FDIV, ISD::FREM, ISD::FSQRT, ISD::FSIN, ISD::FCOS, ISD::FSINCOS,
ISD::FPOW, ISD::FCOPYSIGN}) {
for (MVT VT : MVT::fp_valuetypes())
setOperationAction(FPExpOp, VT, Expand);
}
for (MVT VT : MVT::fp_valuetypes())
setOperationAction(ISD::FREM, VT, LibCall);
}

// No extending loads from i32.
for (MVT VT : MVT::integer_valuetypes()) {
Expand Down
4 changes: 2 additions & 2 deletions llvm/lib/Target/LoongArch/LoongArchISelLowering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ LoongArchTargetLowering::LoongArchTargetLowering(const TargetMachine &TM,
setOperationAction(ISD::FCOS, MVT::f32, Expand);
setOperationAction(ISD::FSINCOS, MVT::f32, Expand);
setOperationAction(ISD::FPOW, MVT::f32, Expand);
setOperationAction(ISD::FREM, MVT::f32, Expand);
setOperationAction(ISD::FREM, MVT::f32, LibCall);
setOperationAction(ISD::FP16_TO_FP, MVT::f32,
Subtarget.isSoftFPABI() ? LibCall : Custom);
setOperationAction(ISD::FP_TO_FP16, MVT::f32,
Expand Down Expand Up @@ -283,7 +283,7 @@ LoongArchTargetLowering::LoongArchTargetLowering(const TargetMachine &TM,
setOperationAction(ISD::FCOS, MVT::f64, Expand);
setOperationAction(ISD::FSINCOS, MVT::f64, Expand);
setOperationAction(ISD::FPOW, MVT::f64, Expand);
setOperationAction(ISD::FREM, MVT::f64, Expand);
setOperationAction(ISD::FREM, MVT::f64, LibCall);
setOperationAction(ISD::FP16_TO_FP, MVT::f64, Expand);
setOperationAction(ISD::FP_TO_FP16, MVT::f64,
Subtarget.isSoftFPABI() ? LibCall : Custom);
Expand Down
4 changes: 2 additions & 2 deletions llvm/lib/Target/Mips/MipsISelLowering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -467,8 +467,8 @@ MipsTargetLowering::MipsTargetLowering(const MipsTargetMachine &TM,
setOperationAction(ISD::FEXP, MVT::f32, Expand);
setOperationAction(ISD::FMA, MVT::f32, Expand);
setOperationAction(ISD::FMA, MVT::f64, Expand);
setOperationAction(ISD::FREM, MVT::f32, Expand);
setOperationAction(ISD::FREM, MVT::f64, Expand);
setOperationAction(ISD::FREM, MVT::f32, LibCall);
setOperationAction(ISD::FREM, MVT::f64, LibCall);

// Lower f16 conversion operations into library calls
setOperationAction(ISD::FP16_TO_FP, MVT::f32, Expand);
Expand Down
8 changes: 4 additions & 4 deletions llvm/lib/Target/PowerPC/PPCISelLowering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ PPCTargetLowering::PPCTargetLowering(const PPCTargetMachine &TM,
setOperationAction(ISD::FTRUNC, MVT::ppcf128, Expand);
setOperationAction(ISD::FRINT, MVT::ppcf128, Expand);
setOperationAction(ISD::FNEARBYINT, MVT::ppcf128, Expand);
setOperationAction(ISD::FREM, MVT::ppcf128, Expand);
setOperationAction(ISD::FREM, MVT::ppcf128, LibCall);

// PowerPC has no SREM/UREM instructions unless we are on P9
// On P9 we may use a hardware instruction to compute the remainder.
Expand Down Expand Up @@ -403,12 +403,12 @@ PPCTargetLowering::PPCTargetLowering(const PPCTargetMachine &TM,
setOperationAction(ISD::FSIN , MVT::f64, Expand);
setOperationAction(ISD::FCOS , MVT::f64, Expand);
setOperationAction(ISD::FSINCOS, MVT::f64, Expand);
setOperationAction(ISD::FREM , MVT::f64, Expand);
setOperationAction(ISD::FREM, MVT::f64, LibCall);
setOperationAction(ISD::FPOW , MVT::f64, Expand);
setOperationAction(ISD::FSIN , MVT::f32, Expand);
setOperationAction(ISD::FCOS , MVT::f32, Expand);
setOperationAction(ISD::FSINCOS, MVT::f32, Expand);
setOperationAction(ISD::FREM , MVT::f32, Expand);
setOperationAction(ISD::FREM, MVT::f32, LibCall);
setOperationAction(ISD::FPOW , MVT::f32, Expand);

// MASS transformation for LLVM intrinsics with replicating fast-math flag
Expand Down Expand Up @@ -1208,7 +1208,7 @@ PPCTargetLowering::PPCTargetLowering(const PPCTargetMachine &TM,
setOperationAction(ISD::FCOS, MVT::f128, Expand);
setOperationAction(ISD::FPOW, MVT::f128, Expand);
setOperationAction(ISD::FPOWI, MVT::f128, Expand);
setOperationAction(ISD::FREM, MVT::f128, Expand);
setOperationAction(ISD::FREM, MVT::f128, LibCall);
}

if (Subtarget.hasP8Altivec()) {
Expand Down
8 changes: 5 additions & 3 deletions llvm/lib/Target/RISCV/RISCVISelLowering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -460,9 +460,9 @@ RISCVTargetLowering::RISCVTargetLowering(const TargetMachine &TM,
ISD::SETUGE, ISD::SETULT, ISD::SETULE, ISD::SETUNE, ISD::SETGT,
ISD::SETGE, ISD::SETNE, ISD::SETO, ISD::SETUO};

static const unsigned FPOpToExpand[] = {
ISD::FSIN, ISD::FCOS, ISD::FSINCOS, ISD::FPOW,
ISD::FREM};
static const unsigned FPOpToExpand[] = {ISD::FSIN, ISD::FCOS, ISD::FSINCOS,
ISD::FPOW};
static const unsigned FPOpToLibCall[] = {ISD::FREM};

static const unsigned FPRndMode[] = {
ISD::FCEIL, ISD::FFLOOR, ISD::FTRUNC, ISD::FRINT, ISD::FROUND,
Expand Down Expand Up @@ -558,6 +558,7 @@ RISCVTargetLowering::RISCVTargetLowering(const TargetMachine &TM,
setOperationAction(ISD::SELECT, MVT::f32, Custom);
setOperationAction(ISD::BR_CC, MVT::f32, Expand);
setOperationAction(FPOpToExpand, MVT::f32, Expand);
setOperationAction(FPOpToLibCall, MVT::f32, LibCall);
setLoadExtAction(ISD::EXTLOAD, MVT::f32, MVT::f16, Expand);
setTruncStoreAction(MVT::f32, MVT::f16, Expand);
setLoadExtAction(ISD::EXTLOAD, MVT::f32, MVT::bf16, Expand);
Expand Down Expand Up @@ -616,6 +617,7 @@ RISCVTargetLowering::RISCVTargetLowering(const TargetMachine &TM,
setLoadExtAction(ISD::EXTLOAD, MVT::f64, MVT::f32, Expand);
setTruncStoreAction(MVT::f64, MVT::f32, Expand);
setOperationAction(FPOpToExpand, MVT::f64, Expand);
setOperationAction(FPOpToLibCall, MVT::f64, LibCall);
setLoadExtAction(ISD::EXTLOAD, MVT::f64, MVT::f16, Expand);
setTruncStoreAction(MVT::f64, MVT::f16, Expand);
setLoadExtAction(ISD::EXTLOAD, MVT::f64, MVT::bf16, Expand);
Expand Down
6 changes: 3 additions & 3 deletions llvm/lib/Target/Sparc/SparcISelLowering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1795,18 +1795,18 @@ SparcTargetLowering::SparcTargetLowering(const TargetMachine &TM,
setOperationAction(ISD::FSIN , MVT::f128, Expand);
setOperationAction(ISD::FCOS , MVT::f128, Expand);
setOperationAction(ISD::FSINCOS, MVT::f128, Expand);
setOperationAction(ISD::FREM , MVT::f128, Expand);
setOperationAction(ISD::FREM, MVT::f128, LibCall);
setOperationAction(ISD::FMA , MVT::f128, Expand);
setOperationAction(ISD::FSIN , MVT::f64, Expand);
setOperationAction(ISD::FCOS , MVT::f64, Expand);
setOperationAction(ISD::FSINCOS, MVT::f64, Expand);
setOperationAction(ISD::FREM , MVT::f64, Expand);
setOperationAction(ISD::FREM, MVT::f64, LibCall);
setOperationAction(ISD::FMA, MVT::f64,
Subtarget->isUA2007() ? Legal : Expand);
setOperationAction(ISD::FSIN , MVT::f32, Expand);
setOperationAction(ISD::FCOS , MVT::f32, Expand);
setOperationAction(ISD::FSINCOS, MVT::f32, Expand);
setOperationAction(ISD::FREM , MVT::f32, Expand);
setOperationAction(ISD::FREM, MVT::f32, LibCall);
setOperationAction(ISD::FMA, MVT::f32,
Subtarget->isUA2007() ? Legal : Expand);
setOperationAction(ISD::ROTL , MVT::i32, Expand);
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/Target/SystemZ/SystemZISelLowering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,7 @@ SystemZTargetLowering::SystemZTargetLowering(const TargetMachine &TM,
setOperationAction(ISD::FSIN, VT, Expand);
setOperationAction(ISD::FCOS, VT, Expand);
setOperationAction(ISD::FSINCOS, VT, Expand);
setOperationAction(ISD::FREM, VT, Expand);
setOperationAction(ISD::FREM, VT, LibCall);
setOperationAction(ISD::FPOW, VT, Expand);

// Special treatment.
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/Target/VE/VEISelLowering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ void VETargetLowering::initSPUActions() {
// VE doesn't have following floating point operations.
for (MVT VT : MVT::fp_valuetypes()) {
setOperationAction(ISD::FNEG, VT, Expand);
setOperationAction(ISD::FREM, VT, Expand);
setOperationAction(ISD::FREM, VT, LibCall);
}

// VE doesn't have fdiv of f128.
Expand Down
Loading