Based on this RFC: https://discourse.llvm.org/t/rfc-allow-the-scalarizer-pass-to-scalarize-vectors-returned-in-structs/82306 LLVM intrinsics do not support out params. To get around this limitation implementers will make intrinsics return structs to capture a return type and an out param. This implementation detail should not impact scalarization since these cases should be elementwise operations. ## Three changes are needed. - The CallInst visitor needs to be updated to handle Structs - A new visitor is needed for `ExtractValue` instructions - finsh needs to be update to handle structs so that insert elements are properly propogated. ## Testing changes - Add support for `llvm.frexp` - Add support for `llvm.dx.splitdouble` fixes https://github.com/llvm/llvm-project/issues/111437
40 lines
1.1 KiB
C++
40 lines
1.1 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::isTargetIntrinsicTriviallyScalarizable(
|
|
Intrinsic::ID ID) const {
|
|
switch (ID) {
|
|
case Intrinsic::dx_frac:
|
|
case Intrinsic::dx_rsqrt:
|
|
case Intrinsic::dx_wave_readlane:
|
|
case Intrinsic::dx_splitdouble:
|
|
return true;
|
|
default:
|
|
return false;
|
|
}
|
|
}
|