This pr allows us to specify if an intrinsic is `TriviallyScalarizable` by specifying it in a more idiomatic way as an intrinsic property. This was suggested here: https://github.com/llvm/llvm-project/issues/120169#issuecomment-3805670982, and would allow for the attached issue to be resolved in a similar manner by having a `TriviallyVectorizable` property as well. Assisted by: Github Copilot
54 lines
2.0 KiB
C++
54 lines
2.0 KiB
C++
//===- DirectXTargetTransformInfo.h - DirectX TTI ---------------*- C++ -*-===//
|
|
//
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
///
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#ifndef LLVM_DIRECTX_DIRECTXTARGETTRANSFORMINFO_H
|
|
#define LLVM_DIRECTX_DIRECTXTARGETTRANSFORMINFO_H
|
|
|
|
#include "DirectXSubtarget.h"
|
|
#include "DirectXTargetMachine.h"
|
|
#include "llvm/CodeGen/BasicTTIImpl.h"
|
|
#include "llvm/IR/Function.h"
|
|
|
|
namespace llvm {
|
|
class DirectXTTIImpl final : public BasicTTIImplBase<DirectXTTIImpl> {
|
|
using BaseT = BasicTTIImplBase<DirectXTTIImpl>;
|
|
using TTI = TargetTransformInfo;
|
|
|
|
friend BaseT;
|
|
|
|
const DirectXSubtarget *ST;
|
|
const DirectXTargetLowering *TLI;
|
|
|
|
const DirectXSubtarget *getST() const { return ST; }
|
|
const DirectXTargetLowering *getTLI() const { return TLI; }
|
|
|
|
public:
|
|
explicit DirectXTTIImpl(const DirectXTargetMachine *TM, const Function &F)
|
|
: BaseT(TM, F.getDataLayout()), ST(TM->getSubtargetImpl(F)),
|
|
TLI(ST->getTargetLowering()) {}
|
|
unsigned getMinVectorRegisterBitWidth() const override { return 32; }
|
|
bool isTargetIntrinsicWithScalarOpAtArg(Intrinsic::ID ID,
|
|
unsigned ScalarOpdIdx) const override;
|
|
bool isTargetIntrinsicWithOverloadTypeAtArg(Intrinsic::ID ID,
|
|
int OpdIdx) const override;
|
|
|
|
InstructionCost getPartialReductionCost(
|
|
unsigned Opcode, Type *InputTypeA, Type *InputTypeB, Type *AccumType,
|
|
ElementCount VF, TTI::PartialReductionExtendKind OpAExtend,
|
|
TTI::PartialReductionExtendKind OpBExtend, std::optional<unsigned> BinOp,
|
|
TTI::TargetCostKind CostKind,
|
|
std::optional<FastMathFlags> FMF) const override {
|
|
return InstructionCost::getInvalid();
|
|
}
|
|
};
|
|
} // namespace llvm
|
|
|
|
#endif // LLVM_DIRECTX_DIRECTXTARGETTRANSFORMINFO_H
|