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

David Peixotto via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 13 09:40:30 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:

I don't think this should be a special case. I think the existing pattern is confusing and I would rather not extend it here if not required and I think it would be good to update the other tests with something that is better (in my opinion).

I am also confused about how this is working. There are a number of test functions that are only defined under the `__HLSL_ENABLE_16_BIT` define,

```
#ifdef __HLSL_ENABLE_16_BIT
// CHECK: %dx.dot = mul i16 %0, %1
// CHECK: ret i16 %dx.dot
// NO_HALF: %dx.dot = mul i16 %0, %1
// NO_HALF: ret i16 %dx.dot
int16_t test_dot_short ( int16_t p0, int16_t p1 ) {
  return dot ( p0, p1 );
}
```

That define is only given on the second RUN line, but there are `CHECKS` for the first RUN line. How can those checks be passing if that define is not valid?

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


More information about the cfe-commits mailing list