[clang] [HLSL] Add _m and _<numeric> based accessors to hlsl::matrix (PR #163220)
Farzon Lotfi via cfe-commits
cfe-commits at lists.llvm.org
Tue Oct 14 07:43:42 PDT 2025
farzonl wrote:
> This needs a new AST node, it can't be done as the existing MatrixSubscriptExpr.
>
> Consider this example:
>
> ```
> export void fn() {
> float2x2 M = {1,2,3,4};
> float2 V = M._m00_m01; // produces a vector.
> M._m10_m01 = 1.xx; // prodces a swizzled vector l-value!
> }
> ```
>
> [Compiler Explorer](https://godbolt.org/z/ThPdvqbM3)
I was thinking this wouldn't be to hard to do by generating multiple MatrixSubscriptExpr(s) but your second point about retain source information to recreate this construct would still not be possible.
https://github.com/llvm/llvm-project/pull/163220
More information about the cfe-commits
mailing list