[clang] Enable matrices in HLSL (PR #111415)
Greg Roth via cfe-commits
cfe-commits at lists.llvm.org
Thu Oct 10 14:03:23 PDT 2024
================
@@ -17,12 +17,12 @@ void add(sx10x10_t a, sx5x10_t b, sx10x5_t c) {
// expected-error at -1 {{assigning to 'sx10x10_t' (aka 'float __attribute__((matrix_type(10, 10)))') from incompatible type 'sx5x10_t' (aka 'float __attribute__((matrix_type(5, 10)))')}}
a = b + &c;
- // expected-error at -1 {{invalid operands to binary expression ('sx5x10_t' (aka 'float __attribute__((matrix_type(5, 10)))') and 'sx10x5_t *' (aka 'float __attribute__((matrix_type(10, 5)))*'))}}
- // expected-error at -2 {{casting 'sx10x5_t *' (aka 'float __attribute__((matrix_type(10, 5)))*') to incompatible type 'float'}}
+ // expected-error at -1 {{invalid operands to binary expression ('sx5x10_t' (aka 'float __attribute__((matrix_type(5, 10)))') and 'sx10x5_t *' (aka 'float * __attribute__((matrix_type(10, 5)))'))}}
----------------
pow2clk wrote:
hi @fhahn!
Thanks for taking a look at this!
It was intentional, but this is the consequence of the change I commented on [here](https://github.com/llvm/llvm-project/pull/111415/files#r1790670980) hoping you'd weigh in on. I made the change this way in TypePrinter because it was more convenient to insert the HLSL printing style that way, but I can maintain the previous behavior. The reason I thought that perhaps the alternate position of `*` might be correct or preferable is because it is the way that vectors are printed with an admittedly contrived and double erroneous [example](https://godbolt.org/z/Wjzzx7sov).
At any rate, we can defer the discussion of whether the vector printing should conform with the matrix printing or vice versa for later. For now, I'll implement the printing so that it maintains previous behavior.
https://github.com/llvm/llvm-project/pull/111415
More information about the cfe-commits
mailing list