[clang] [llvm] [HLSL] Implementation of dot intrinsic (PR #81190)

David Peixotto via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 15 20:45:39 PST 2024


================
@@ -0,0 +1,202 @@
+// RUN: %clang_cc1 -std=hlsl2021 -finclude-default-header -x hlsl -triple \
+// RUN:   dxil-pc-shadermodel6.3-library %s -fnative-half-type \
+// RUN:   -emit-llvm -disable-llvm-passes -O3 -o - | FileCheck %s
+// RUN: %clang_cc1 -std=hlsl2021 -finclude-default-header -x hlsl -triple \
+// RUN:   dxil-pc-shadermodel6.3-library %s -emit-llvm -disable-llvm-passes \
+// RUN:   -D__HLSL_ENABLE_16_BIT -o - | FileCheck %s --check-prefix=NO_HALF
----------------
dmpots wrote:

The test looks much better now and makes a lot more sense to me.

I still think we are missing out on opportunities to strengthen our testing. The two RUN lines are checking the cases where we have native 16-bit types or not. There are many CHECKS here that are only being validated when 16-bit types are enabled, but are fully valid when 16-bit types are not enabled.

For example,
```
// CHECK: %dx.dot = mul i32 %0, %1
// CHECK: ret i32 %dx.dot
int test_dot_int ( int p0, int p1 ) {
  return dot ( p0, p1 );
}
```
is equally valid whether 16-bit types are enabled or not, but we only check it when 16-bit types are enabled. 

If we used 3 different check prefixes (`CHECK`, `NO_HALF`, `NATIVE_HALF`) then it would give better coverage and make it clearer where we expect the differences to be.

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


More information about the llvm-commits mailing list