This is to inform the middle-end transform passes about the capabilities of the codegen backend. This should solve the issue where popcount loops not gets converted properly to `popc`, even if it's available (https://github.com/llvm/llvm-project/issues/171969).
23 lines
750 B
C++
23 lines
750 B
C++
//===-- SparcTargetTransformInfo.cpp - SPARC specific TTI -----------------===//
|
|
//
|
|
// 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 "SparcTargetTransformInfo.h"
|
|
#include "llvm/Support/MathExtras.h"
|
|
|
|
using namespace llvm;
|
|
|
|
#define DEBUG_TYPE "sparctti"
|
|
|
|
TargetTransformInfo::PopcntSupportKind
|
|
SparcTTIImpl::getPopcntSupport(unsigned TyWidth) const {
|
|
assert(isPowerOf2_32(TyWidth) && "Type width must be power of 2");
|
|
if (ST->usePopc())
|
|
return TTI::PSK_FastHardware;
|
|
return TTI::PSK_Software;
|
|
}
|