Skip to content

Add tests for Matrix cast #506

@farzonl

Description

@farzonl

llvm/llvm-project#162711

A new issue will need to be filed for splat casts.

The elementwise casts should cover:

  • float to int matrix or vice versa ie base type cast
  • struct to matrix cast of same element size matrix
  • array or 2d array cast to same element size matrix
  • vector to matrix of same size cast

The truncation cast should cover a case like this:
https://godbolt.org/z/ch6sa1K3P

export float fn() {
    float4x4 m = {1,2,3,4,
                  5,6,7,8,
                  9,10,11,12,
                  13,14,15,16};
    float2x2 m2 = m;
    /*
    m2 = {1,2
          5,6}
    */
    return m2[1][1]; // returns 6
}

This remains post this change to address:
https://godbolt.org/z/36bGTsfxa

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Status

Active

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions