Skip to content

Commit a9e4cc4

Browse files
committed
dot2add working for dxil without sema check
1 parent 2a244bb commit a9e4cc4

File tree

8 files changed

+436
-0
lines changed

8 files changed

+436
-0
lines changed

clang/include/clang/Basic/Builtins.td

+6
Original file line numberDiff line numberDiff line change
@@ -4885,6 +4885,12 @@ def HLSLDotProduct : LangBuiltin<"HLSL_LANG"> {
48854885
let Prototype = "void(...)";
48864886
}
48874887

4888+
def HLSLDot2Add : LangBuiltin<"HLSL_LANG"> {
4889+
let Spellings = ["__builtin_hlsl_dot2add"];
4890+
let Attributes = [NoThrow, Const];
4891+
let Prototype = "void(...)";
4892+
}
4893+
48884894
def HLSLDot4AddI8Packed : LangBuiltin<"HLSL_LANG"> {
48894895
let Spellings = ["__builtin_hlsl_dot4add_i8packed"];
48904896
let Attributes = [NoThrow, Const];

clang/lib/CodeGen/CGBuiltin.cpp

+10
Original file line numberDiff line numberDiff line change
@@ -19680,6 +19680,16 @@ Value *CodeGenFunction::EmitHLSLBuiltinExpr(unsigned BuiltinID,
1968019680
getDotProductIntrinsic(CGM.getHLSLRuntime(), VecTy0->getElementType()),
1968119681
ArrayRef<Value *>{Op0, Op1}, nullptr, "hlsl.dot");
1968219682
}
19683+
case Builtin::BI__builtin_hlsl_dot2add: {
19684+
Value *A = EmitScalarExpr(E->getArg(0));
19685+
Value *B = EmitScalarExpr(E->getArg(1));
19686+
Value *C = EmitScalarExpr(E->getArg(2));
19687+
19688+
Intrinsic::ID ID = CGM.getHLSLRuntime().getDot2AddIntrinsic();
19689+
return Builder.CreateIntrinsic(
19690+
/*ReturnType=*/C->getType(), ID, ArrayRef<Value *>{A, B, C}, nullptr,
19691+
"hlsl.dot2add");
19692+
}
1968319693
case Builtin::BI__builtin_hlsl_dot4add_i8packed: {
1968419694
Value *A = EmitScalarExpr(E->getArg(0));
1968519695
Value *B = EmitScalarExpr(E->getArg(1));

clang/lib/CodeGen/CGHLSLRuntime.h

+1
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ class CGHLSLRuntime {
9999
GENERATE_HLSL_INTRINSIC_FUNCTION(FDot, fdot)
100100
GENERATE_HLSL_INTRINSIC_FUNCTION(SDot, sdot)
101101
GENERATE_HLSL_INTRINSIC_FUNCTION(UDot, udot)
102+
GENERATE_HLSL_INTRINSIC_FUNCTION(Dot2Add, dot2add)
102103
GENERATE_HLSL_INTRINSIC_FUNCTION(Dot4AddI8Packed, dot4add_i8packed)
103104
GENERATE_HLSL_INTRINSIC_FUNCTION(Dot4AddU8Packed, dot4add_u8packed)
104105
GENERATE_HLSL_INTRINSIC_FUNCTION(WaveActiveAllTrue, wave_all)

0 commit comments

Comments
 (0)