1 //===- DirectXTargetTransformInfo.cpp - DirectX TTI ---------------*- C++ 2 //-*-===// 3 // 4 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 5 // See https://llvm.org/LICENSE.txt for license information. 6 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 7 // 8 //===----------------------------------------------------------------------===// 9 /// 10 //===----------------------------------------------------------------------===// 11 12 #include "DirectXTargetTransformInfo.h" 13 #include "llvm/IR/Intrinsics.h" 14 #include "llvm/IR/IntrinsicsDirectX.h" 15 16 using namespace llvm; 17 18 bool DirectXTTIImpl::isTargetIntrinsicWithScalarOpAtArg(Intrinsic::ID ID, 19 unsigned ScalarOpdIdx) { 20 switch (ID) { 21 case Intrinsic::dx_wave_readlane: 22 return ScalarOpdIdx == 1; 23 default: 24 return false; 25 } 26 } 27 28 bool DirectXTTIImpl::isTargetIntrinsicTriviallyScalarizable( 29 Intrinsic::ID ID) const { 30 switch (ID) { 31 case Intrinsic::dx_frac: 32 case Intrinsic::dx_rsqrt: 33 case Intrinsic::dx_wave_readlane: 34 return true; 35 default: 36 return false; 37 } 38 } 39