Page MenuHomePhabricator

[Matrix] Implement * binary operator for MatrixType.
ClosedPublic

Authored by fhahn on Mar 25 2020, 11:37 AM.

Details

Summary

This patch implements the * binary operator for values of
MatrixType. It adds support for matrix * matrix, scalar * matrix and
matrix * scalar.

For the matrix, matrix case, the number of columns of the first operand
must match the number of rows of the second. For the scalar,matrix variants,
the element type of the matrix must match the scalar type.

Diff Detail

Event Timeline

fhahn created this revision.Mar 25 2020, 11:37 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 25 2020, 11:37 AM
fhahn updated this revision to Diff 254601.Apr 2 2020, 12:41 PM

Implement conversion for matrix/scalar variants.

fhahn updated this revision to Diff 254602.Apr 2 2020, 12:43 PM

clang-format

Herald added a project: Restricted Project. · View Herald TranscriptApr 28 2020, 3:26 AM
fhahn updated this revision to Diff 267627.Jun 1 2020, 8:24 AM

Ping :)

Updated the patch to include the feedback from D76793 (adding overloads, conversions, more targeted tests)

Your IRGen test cases cover a lot of ground, but please add more Sema test cases that go over the basics: element types matching, column/row counts matching, multiplication by inappropriate scalars, etc. Otherwise LGTM!

clang/lib/Sema/SemaExpr.cpp
11599

You never actually do anything with these that cares about having gotten the unqualified type.

fhahn updated this revision to Diff 269027.Jun 6 2020, 1:44 PM
fhahn marked 2 inline comments as done.

Your IRGen test cases cover a lot of ground, but please add more Sema test cases that go over the basics: element types matching, column/row counts matching, multiplication by inappropriate scalars, etc. Otherwise LGTM!

Oh, of course! I think some of those might have been accidentally dropped when moving patches around. I've added the additional Sema tests.

fhahn added inline comments.Jun 6 2020, 1:46 PM
clang/lib/Sema/SemaExpr.cpp
11599

Ah right! I think that was still a left-over from the manual conversion code. Dropped!

rjmccall accepted this revision.Jun 6 2020, 2:10 PM

Thanks, LGTM!

This revision is now accepted and ready to land.Jun 6 2020, 2:10 PM
This revision was automatically updated to reflect the committed changes.