Issue 168755
Summary [Matrix] [HLSL] add a ICK_HLSL_Matrix_Truncation to handle matrix truncations in HLSL
Labels clang:frontend, HLSL
Assignees farzonl
Reporter farzonl
    > These are the truncation tests we should support:
> https://godbolt.org/z/73vj6jMs7
> 
> essentially if the src is bigger than the dest even if destination is a scalar we should truncate. this should be handled via a new `ICK_HLSL_Matrix_Truncation`. tha should behave similarly to `ICK_HLSL_Vector_Truncation` since they share the same spec.
> 
> ```hlsl
> export int3x3 trunc_cast(int4x4 i44) {
>     int3x3 i33 = (int3x3)i44;
>     return i33;
> }
> 
> export int3x2 trunc_cast2(int4x4 i44) {
>     int3x2 i32 = (int3x2)i44;
>     return i32;
> }
> 
> export int2x3 trunc_cast3(int4x4 i44) {
>     int2x3 i23 = (int2x3)i44;
> return i23;
> }
> 
> export int2x2 trunc_cast4(int4x4 i44) {
>     int2x2 i22 = (int2x2)i44;
>     return i22;
> }
> 
> export int2x1 trunc_cast5(int4x4 i44) {
>     int2x1 i21 = (int2x1)i44;
>     return i21;
> }
> 
> export int trunc_cast6(int4x4 i44) {
>     int i21 = (int)i44;
>     return i21;
> }
> ``` 

 _Originally posted by @farzonl in [#162711](https://github.com/llvm/llvm-project/issues/162711#issuecomment-3554166872)_
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to