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
47 lines
1.4 KiB
C++
47 lines
1.4 KiB
C++
//===- DirectXTargetTransformInfo.cpp - 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
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
///
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include "DirectXTargetTransformInfo.h"
|
|
#include "llvm/IR/Intrinsics.h"
|
|
#include "llvm/IR/IntrinsicsDirectX.h"
|
|
|
|
using namespace llvm;
|
|
|
|
bool DirectXTTIImpl::isTargetIntrinsicWithScalarOpAtArg(
|
|
Intrinsic::ID ID, unsigned ScalarOpdIdx) const {
|
|
switch (ID) {
|
|
case Intrinsic::dx_wave_readlane:
|
|
return ScalarOpdIdx == 1;
|
|
default:
|
|
return false;
|
|
}
|
|
}
|
|
|
|
bool DirectXTTIImpl::isTargetIntrinsicWithOverloadTypeAtArg(Intrinsic::ID ID,
|
|
int OpdIdx) const {
|
|
switch (ID) {
|
|
case Intrinsic::dx_asdouble:
|
|
case Intrinsic::dx_firstbitlow:
|
|
case Intrinsic::dx_firstbitshigh:
|
|
case Intrinsic::dx_firstbituhigh:
|
|
case Intrinsic::dx_isinf:
|
|
case Intrinsic::dx_isnan:
|
|
case Intrinsic::dx_legacyf16tof32:
|
|
case Intrinsic::dx_legacyf32tof16:
|
|
case Intrinsic::dx_wave_all_equal:
|
|
return OpdIdx == 0;
|
|
default:
|
|
// All DX intrinsics are overloaded on return type unless specified
|
|
// otherwise
|
|
return OpdIdx == -1;
|
|
}
|
|
}
|