[clang] [HLSL] Implement the 'and' HLSL function (PR #127098)

Farzon Lotfi via cfe-commits cfe-commits at lists.llvm.org
Sat Feb 15 15:32:40 PST 2025


================
@@ -19463,6 +19463,11 @@ Value *CodeGenFunction::EmitHLSLBuiltinExpr(unsigned BuiltinID,
         CGM.getHLSLRuntime().getAllIntrinsic(), ArrayRef<Value *>{Op0}, nullptr,
         "hlsl.all");
   }
+  case Builtin::BI__builtin_hlsl_and: {
+    Value *Op0 = EmitScalarExpr(E->getArg(0));
+    Value *Op1 = EmitScalarExpr(E->getArg(1));
+    return Builder.CreateAnd(Op0, Op1, "hlsl.and");
----------------
farzonl wrote:

This is a bit cleaner than a loop unroll in HLSL. I'm fine with this.

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


More information about the cfe-commits mailing list