Skip to content

Commit

Permalink
Merge branch 'main' into hgh/libcxx/LWG4035-single_view-should-provid…
Browse files Browse the repository at this point in the history
…e-empty
  • Loading branch information
H-G-Hristov committed Jul 10, 2024
2 parents 57029ab + 24619f6 commit c655f23
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 13 deletions.
12 changes: 12 additions & 0 deletions libc/src/__support/FPUtil/nearest_integer.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,18 @@
#include "x86_64/nearest_integer.h"
#elif defined(LIBC_TARGET_ARCH_IS_AARCH64)
#include "aarch64/nearest_integer.h"
#elif defined(LIBC_TARGET_ARCH_IS_GPU)

namespace LIBC_NAMESPACE {
namespace fputil {

LIBC_INLINE float nearest_integer(float x) { return __builtin_rintf(x); }

LIBC_INLINE double nearest_integer(double x) { return __builtin_rint(x); }

} // namespace fputil
} // namespace LIBC_NAMESPACE

#else

namespace LIBC_NAMESPACE {
Expand Down
21 changes: 12 additions & 9 deletions llvm/lib/Target/RISCV/RISCVSubtarget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,29 +97,32 @@ RISCVSubtarget::RISCVSubtarget(const Triple &TT, StringRef CPU,
RVVVectorBitsMin(RVVVectorBitsMin), RVVVectorBitsMax(RVVVectorBitsMax),
FrameLowering(
initializeSubtargetDependencies(TT, CPU, TuneCPU, FS, ABIName)),
InstrInfo(*this), RegInfo(getHwMode()), TLInfo(TM, *this) {
CallLoweringInfo.reset(new RISCVCallLowering(*getTargetLowering()));
Legalizer.reset(new RISCVLegalizerInfo(*this));

auto *RBI = new RISCVRegisterBankInfo(getHwMode());
RegBankInfo.reset(RBI);
InstSelector.reset(createRISCVInstructionSelector(
*static_cast<const RISCVTargetMachine *>(&TM), *this, *RBI));
}
InstrInfo(*this), RegInfo(getHwMode()), TLInfo(TM, *this) {}

const CallLowering *RISCVSubtarget::getCallLowering() const {
if (!CallLoweringInfo)
CallLoweringInfo.reset(new RISCVCallLowering(*getTargetLowering()));
return CallLoweringInfo.get();
}

InstructionSelector *RISCVSubtarget::getInstructionSelector() const {
if (!InstSelector) {
InstSelector.reset(createRISCVInstructionSelector(
*static_cast<const RISCVTargetMachine *>(&TLInfo.getTargetMachine()),
*this, *static_cast<const RISCVRegisterBankInfo *>(getRegBankInfo())));
}
return InstSelector.get();
}

const LegalizerInfo *RISCVSubtarget::getLegalizerInfo() const {
if (!Legalizer)
Legalizer.reset(new RISCVLegalizerInfo(*this));
return Legalizer.get();
}

const RegisterBankInfo *RISCVSubtarget::getRegBankInfo() const {
if (!RegBankInfo)
RegBankInfo.reset(new RISCVRegisterBankInfo(getHwMode()));
return RegBankInfo.get();
}

Expand Down
8 changes: 4 additions & 4 deletions llvm/lib/Target/RISCV/RISCVSubtarget.h
Original file line number Diff line number Diff line change
Expand Up @@ -245,10 +245,10 @@ class RISCVSubtarget : public RISCVGenSubtargetInfo {

protected:
// GlobalISel related APIs.
std::unique_ptr<CallLowering> CallLoweringInfo;
std::unique_ptr<InstructionSelector> InstSelector;
std::unique_ptr<LegalizerInfo> Legalizer;
std::unique_ptr<RegisterBankInfo> RegBankInfo;
mutable std::unique_ptr<CallLowering> CallLoweringInfo;
mutable std::unique_ptr<InstructionSelector> InstSelector;
mutable std::unique_ptr<LegalizerInfo> Legalizer;
mutable std::unique_ptr<RegisterBankInfo> RegBankInfo;

// Return the known range for the bit length of RVV data registers as set
// at the command line. A value of 0 means nothing is known about that particular
Expand Down

0 comments on commit c655f23

Please sign in to comment.