
- define intrinsic as builtin in Builtins.td - link intrinsic in hlsl_intrinsics.h - add semantic analysis to SemaHLSL.cpp - lower to `llvm` or a `dx` intrinsic when applicable in CGBuiltin.cpp - define DXIL intrinsic in IntrinsicsDirectX.td - add DXIL op and mapping in DXIL.td - enable scalarization of intrinsic - add basic sema checking to asdouble-errors.hlsl Resolves #99081
53 lines
1.5 KiB
C++
53 lines
1.5 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) {
|
|
switch (ID) {
|
|
case Intrinsic::dx_wave_readlane:
|
|
return ScalarOpdIdx == 1;
|
|
default:
|
|
return false;
|
|
}
|
|
}
|
|
|
|
bool DirectXTTIImpl::isVectorIntrinsicWithOverloadTypeAtArg(Intrinsic::ID ID,
|
|
int ScalarOpdIdx) {
|
|
switch (ID) {
|
|
case Intrinsic::dx_asdouble:
|
|
return ScalarOpdIdx == 0;
|
|
default:
|
|
return ScalarOpdIdx == -1;
|
|
}
|
|
}
|
|
|
|
bool DirectXTTIImpl::isTargetIntrinsicTriviallyScalarizable(
|
|
Intrinsic::ID ID) const {
|
|
switch (ID) {
|
|
case Intrinsic::dx_frac:
|
|
case Intrinsic::dx_rsqrt:
|
|
case Intrinsic::dx_wave_readlane:
|
|
case Intrinsic::dx_asdouble:
|
|
case Intrinsic::dx_splitdouble:
|
|
case Intrinsic::dx_firstbituhigh:
|
|
case Intrinsic::dx_firstbitshigh:
|
|
return true;
|
|
default:
|
|
return false;
|
|
}
|
|
}
|