[clang] [clang][HLSL] Add sign intrinsic part 3 (PR #101989)

Tim Gymnich via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 15 05:46:30 PDT 2024


================
@@ -18662,6 +18662,23 @@ case Builtin::BI__builtin_hlsl_elementwise_isinf: {
         llvm::FunctionType::get(IntTy, {}, false), "__hlsl_wave_get_lane_index",
         {}, false, true));
   }
+  case Builtin::BI__builtin_hlsl_elementwise_sign: {
+    Value *Op0 = EmitScalarExpr(E->getArg(0));
+    llvm::Type *Xty = Op0->getType();
+    llvm::Type *retType = llvm::Type::getInt32Ty(this->getLLVMContext());
+    if (Xty->isVectorTy()) {
+      auto *XVecTy = E->getArg(0)->getType()->getAs<VectorType>();
+      retType = llvm::VectorType::get(
+          retType, ElementCount::getFixed(XVecTy->getNumElements()));
+    }
+    if (!E->getArg(0)->getType()->hasFloatingRepresentation() &&
----------------
tgymnich wrote:

fixed 47097f

https://github.com/llvm/llvm-project/pull/101989


More information about the cfe-commits mailing list