[clang] [llvm] [HLSL] Implement `WaveReadLaneAt` intrinsic (PR #111010)

Chris B via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 10 10:51:38 PDT 2024


================
@@ -1956,6 +1956,26 @@ bool SemaHLSL::CheckBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) {
       return true;
     break;
   }
+  case Builtin::BI__builtin_hlsl_wave_read_lane_at: {
+    if (SemaRef.checkArgCount(TheCall, 2))
+      return true;
+
+    // Ensure index parameter type can be interpreted as a uint
+    ExprResult Index = TheCall->getArg(1);
+    QualType ArgTyIndex = Index.get()->getType();
+    if (!ArgTyIndex->isIntegerType()) {
+      SemaRef.Diag(TheCall->getArg(1)->getBeginLoc(),
+                   diag::err_typecheck_convert_incompatible)
+          << ArgTyIndex << SemaRef.Context.UnsignedIntTy << 1 << 0 << 0;
+      return true;
+    }
+
+    // Ensure return type is the same as the input expr type
+    ExprResult Expr = TheCall->getArg(0);
----------------
llvm-beanz wrote:

We should verify that the type of argument 0 is either a scalar or vector.

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


More information about the cfe-commits mailing list