MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / Clamp

Method Clamp

tensorflow/compiler/xla/service/cpu/vector_support_library.cc:107–123  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

105}
106
107llvm::Value* VectorSupportLibrary::Clamp(llvm::Value* a,
108 const llvm::APFloat& low,
109 const llvm::APFloat& high) {
110 CHECK(!low.isNaN());
111 CHECK(!high.isNaN());
112 CHECK(low.compare(high) == llvm::APFloat::cmpLessThan);
113
114 AssertCorrectTypes({a});
115 llvm::Type* type = a->getType();
116 CHECK(scalar_type_->isFloatingPointTy());
117
118 llvm::Value* low_value = GetConstantFloat(type, low);
119 llvm::Value* high_value = GetConstantFloat(type, high);
120 a = b_->CreateSelect(b_->CreateFCmpUGE(a, low_value), a, low_value);
121 a = b_->CreateSelect(b_->CreateFCmpULE(a, high_value), a, high_value);
122 return a;
123}
124
125llvm::Value* VectorSupportLibrary::FCmpEQMask(llvm::Value* lhs,
126 llvm::Value* rhs) {

Callers 1

GenerateVF32ExpFunction · 0.45

Calls 2

compareMethod · 0.45
getTypeMethod · 0.45

Tested by

no test coverage detected