[clang] [llvm] [HLSL] Implement the `reflect` HLSL function (PR #122992)
Farzon Lotfi via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 15 10:06:15 PST 2025
================
@@ -0,0 +1,33 @@
+; RUN: llc -O0 -mtriple=spirv-unknown-unknown %s -o - | FileCheck %s
----------------
farzonl wrote:
This won't be a problem for opencl because they don't have a reflect api to trigger this crash. This could be a problem if folks try to target spirv32/spirv64 via c because we just exposed a clang builtin. Since we just enabled this and are so far the only users of the spirv target builtins i'm not to worried about this.
That said there are a few ways we could address this.
1. remove the reflect spirv target builtin and wait for this pr to merge: https://github.com/llvm/llvm-project/pull/122839/files then add an instcombine pattern for `I - 2 * N * dot(I, N);` to map to reflect.
2. ignore this case
3. lower the intrinsic back to `I - 2 * N * dot(I, N);` if its not targeting GLSL. (This is my least favorite option).
https://github.com/llvm/llvm-project/pull/122992
More information about the llvm-commits
mailing list