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

Tim Gymnich via cfe-commits cfe-commits at lists.llvm.org
Sun Aug 11 05:08:23 PDT 2024


================
@@ -1108,6 +1117,14 @@ bool SemaHLSL::CheckBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) {
       return true;
     break;
   }
+  case Builtin::BI__builtin_hlsl_elementwise_sign: {
+    if (CheckFloatingOrSignedIntRepresentation(&SemaRef, TheCall))
+      return true;
+    if (SemaRef.PrepareBuiltinElementwiseMathOneArgCall(TheCall))
+      return true;
+    SetElementTypeAsReturnType(&SemaRef, TheCall, getASTContext().IntTy);
----------------
tgymnich wrote:

The return type will either be a scalar int or a int vector, based on the shape of the first argument. 

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


More information about the cfe-commits mailing list