[PATCH] D106005: [Docs] Define matrix initialisation in MatrixTypes documentation

2022-09-26 Thread Saurabh Jha via Phabricator via cfe-commits
SaurabhJha abandoned this revision.
SaurabhJha added a subscriber: Florian.
SaurabhJha added a comment.

> @SaurabhJha did you ever get a chance to create a patch?

Hey @Florian, sorry I dropped the ball here. I don't think I would be able to 
spend time on this so abandoning this revision.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D106005/new/

https://reviews.llvm.org/D106005

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D106005: [Docs] Define matrix initialisation in MatrixTypes documentation

2022-09-26 Thread Florian Hahn via Phabricator via cfe-commits
fhahn added a comment.
Herald added a project: All.

In D106005#2904865 , @SaurabhJha 
wrote:

> In D106005#2904424 , @fhahn wrote:
>
>> In D106005#2896080 , @SaurabhJha 
>> wrote:
>>
>>> In D106005#2895716 , @fhahn wrote:
>>>
 Thank you very much for working on this! Are you planning on implementing 
 the new specification as well? It would probably be good to land the 
 update to the spec in close succession to the implementation, to avoid 
 confusing users.
>>>
>>> Yes, that's my plan. Once this is in, I will start working on the 
>>> implementation right away.
>>
>> Ok cool! I think the latest version looks good (modulo making sure the new 
>> lines are limited to 80 chars per line). @rjmccall can you think of any 
>> scenarios where defining initializers with one expression and broadcasting 
>> them might cause issues?
>>
>> With respect to ordering the patches, I think it would be good to put up a 
>> patch implementing the newly added parts, commit it and then land the patch 
>> that adds it to the docs. WDYT?
>
> Yeah, sounds good. I will create a patch for implementing initialisation.

@SaurabhJha did you ever get a chance to create a patch?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D106005/new/

https://reviews.llvm.org/D106005

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D106005: [Docs] Define matrix initialisation in MatrixTypes documentation

2021-07-26 Thread Saurabh Jha via Phabricator via cfe-commits
SaurabhJha added a comment.

In D106005#2904424 , @fhahn wrote:

> In D106005#2896080 , @SaurabhJha 
> wrote:
>
>> In D106005#2895716 , @fhahn wrote:
>>
>>> Thank you very much for working on this! Are you planning on implementing 
>>> the new specification as well? It would probably be good to land the update 
>>> to the spec in close succession to the implementation, to avoid confusing 
>>> users.
>>
>> Yes, that's my plan. Once this is in, I will start working on the 
>> implementation right away.
>
> Ok cool! I think the latest version looks good (modulo making sure the new 
> lines are limited to 80 chars per line). @rjmccall can you think of any 
> scenarios where defining initializers with one expression and broadcasting 
> them might cause issues?
>
> With respect to ordering the patches, I think it would be good to put up a 
> patch implementing the newly added parts, commit it and then land the patch 
> that adds it to the docs. WDYT?

Yeah, sounds good. I will create a patch for implementing initialisation.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D106005/new/

https://reviews.llvm.org/D106005

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D106005: [Docs] Define matrix initialisation in MatrixTypes documentation

2021-07-26 Thread Florian Hahn via Phabricator via cfe-commits
fhahn added a comment.

In D106005#2896080 , @SaurabhJha 
wrote:

> In D106005#2895716 , @fhahn wrote:
>
>> Thank you very much for working on this! Are you planning on implementing 
>> the new specification as well? It would probably be good to land the update 
>> to the spec in close succession to the implementation, to avoid confusing 
>> users.
>
> Yes, that's my plan. Once this is in, I will start working on the 
> implementation right away.

Ok cool! I think the latest version looks good (modulo making sure the new 
lines are limited to 80 chars per line). @rjmccall can you think of any 
scenarios where defining initializers with one expression and broadcasting them 
might cause issues?

With respect to ordering the patches, I think it would be good to put up a 
patch implementing the newly added parts, commit it and then land the patch 
that adds it to the docs. WDYT?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D106005/new/

https://reviews.llvm.org/D106005

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D106005: [Docs] Define matrix initialisation in MatrixTypes documentation

2021-07-22 Thread Saurabh Jha via Phabricator via cfe-commits
SaurabhJha updated this revision to Diff 360886.
SaurabhJha added a comment.

Add documentation for matrix broadcast initialization


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D106005/new/

https://reviews.llvm.org/D106005

Files:
  clang/docs/MatrixTypes.rst


Index: clang/docs/MatrixTypes.rst
===
--- clang/docs/MatrixTypes.rst
+++ clang/docs/MatrixTypes.rst
@@ -266,6 +266,25 @@
   }
 
 
+Initialization Syntax
+-
+A value of a matrix type M can be initialized with an initializer list:
+
+.. code-block:: c++
+
+  constexpr M m1 = {};
+  constexpr M m2 = {x};
+  constexpr M m2 = {{a, b, c}, {d, e, f}};
+
+If the initializer list is empty, all elements of the matrix are 
zero-initialized.
+
+If the initializer list has just one expression, all elements of the matrix 
will be initialized using that expression.
+
+Otherwise, the initializer list must consist of M::rows initializer lists, 
each of which must consist of
+M::columns expressions, each of which is used to initialize the corresponding 
element of the matrix. For example,
+m[i][j] is initialized by the jth expression of the ith initializer list in 
the initializer. Element designators are
+not allowed.
+
 TODOs
 -
 
@@ -274,9 +293,6 @@
 convenient. The alternative is using template deduction to extract this
 information. Also add spelling for C.
 
-Future Work: Initialization syntax.
-
-
 Decisions for the Implementation in Clang
 =
 


Index: clang/docs/MatrixTypes.rst
===
--- clang/docs/MatrixTypes.rst
+++ clang/docs/MatrixTypes.rst
@@ -266,6 +266,25 @@
   }
 
 
+Initialization Syntax
+-
+A value of a matrix type M can be initialized with an initializer list:
+
+.. code-block:: c++
+
+  constexpr M m1 = {};
+  constexpr M m2 = {x};
+  constexpr M m2 = {{a, b, c}, {d, e, f}};
+
+If the initializer list is empty, all elements of the matrix are zero-initialized.
+
+If the initializer list has just one expression, all elements of the matrix will be initialized using that expression.
+
+Otherwise, the initializer list must consist of M::rows initializer lists, each of which must consist of
+M::columns expressions, each of which is used to initialize the corresponding element of the matrix. For example,
+m[i][j] is initialized by the jth expression of the ith initializer list in the initializer. Element designators are
+not allowed.
+
 TODOs
 -
 
@@ -274,9 +293,6 @@
 convenient. The alternative is using template deduction to extract this
 information. Also add spelling for C.
 
-Future Work: Initialization syntax.
-
-
 Decisions for the Implementation in Clang
 =
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D106005: [Docs] Define matrix initialisation in MatrixTypes documentation

2021-07-22 Thread Saurabh Jha via Phabricator via cfe-commits
SaurabhJha added a comment.

In D106005#2895716 , @fhahn wrote:

> Thank you very much for working on this! Are you planning on implementing the 
> new specification as well? It would probably be good to land the update to 
> the spec in close succession to the implementation, to avoid confusing users.

Yes, that's my plan. Once this is in, I will start working on the 
implementation right away.




Comment at: clang/docs/MatrixTypes.rst:279
+The number of constituent arrays must equal the number rows in the matrix type 
M and the number of elements
+in each constituent array must equal the number of columns in the matrix type.
+

fhahn wrote:
> SaurabhJha wrote:
> > rjmccall wrote:
> > > This is contradicted by your first example.  I think you want to say 
> > > something like
> > > 
> > > > A value of matrix type `M` can be initialized with an initializer list:
> > > >
> > > > (examples)
> > > >
> > > > If the initializer list is empty, all elements of the matrix are 
> > > > zero-initialized.  Otherwise, the initializer list must consist of 
> > > > `M::rows` initializer lists, each of which must consist of `M::columns` 
> > > > expressions, each of which is used to initialize the corresponding 
> > > > element of the matrix (that is, `m[i][j]` is initialized by the `j`th 
> > > > expression of the `i`th initializer list in the initializer).  Element 
> > > > designators are not allowed.
> > > 
> > > That's assuming you want to allow `{}`, but I think that's probably a 
> > > good idea.  At the very least, you already have to define how objects of 
> > > static storage duration are zero-initialized, and having a way to do that 
> > > explicitly always seems wise to me.
> > That sounds great @rjmccall, thanks for your suggestions.
> > 
> > I think I got confused between whether to allow `{}` but as you suggested, 
> > I think we should.
> That looks good, thanks! 
> 
> Another thing to consider is whether we would like to provide a convenient 
> syntax to initialise all elements with an user-specified value, i.e. should 
> we allow something like `m = {99};`, which would broadcast 99 to all elements 
> of the matrix?
That sounds good. Do we have a way to infer the number of rows and columns for 
a matrix object `m` so that we could broadcast correctly? I will amend the docs 
later today.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D106005/new/

https://reviews.llvm.org/D106005

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D106005: [Docs] Define matrix initialisation in MatrixTypes documentation

2021-07-22 Thread Florian Hahn via Phabricator via cfe-commits
fhahn added a comment.

Thank you very much for working on this! Are you planning on implementing the 
new specification as well? It would probably be good to land the update to the 
spec in close succession to the implementation, to avoid confusing users.




Comment at: clang/docs/MatrixTypes.rst:279
+The number of constituent arrays must equal the number rows in the matrix type 
M and the number of elements
+in each constituent array must equal the number of columns in the matrix type.
+

SaurabhJha wrote:
> rjmccall wrote:
> > This is contradicted by your first example.  I think you want to say 
> > something like
> > 
> > > A value of matrix type `M` can be initialized with an initializer list:
> > >
> > > (examples)
> > >
> > > If the initializer list is empty, all elements of the matrix are 
> > > zero-initialized.  Otherwise, the initializer list must consist of 
> > > `M::rows` initializer lists, each of which must consist of `M::columns` 
> > > expressions, each of which is used to initialize the corresponding 
> > > element of the matrix (that is, `m[i][j]` is initialized by the `j`th 
> > > expression of the `i`th initializer list in the initializer).  Element 
> > > designators are not allowed.
> > 
> > That's assuming you want to allow `{}`, but I think that's probably a good 
> > idea.  At the very least, you already have to define how objects of static 
> > storage duration are zero-initialized, and having a way to do that 
> > explicitly always seems wise to me.
> That sounds great @rjmccall, thanks for your suggestions.
> 
> I think I got confused between whether to allow `{}` but as you suggested, I 
> think we should.
That looks good, thanks! 

Another thing to consider is whether we would like to provide a convenient 
syntax to initialise all elements with an user-specified value, i.e. should we 
allow something like `m = {99};`, which would broadcast 99 to all elements of 
the matrix?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D106005/new/

https://reviews.llvm.org/D106005

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D106005: [Docs] Define matrix initialisation in MatrixTypes documentation

2021-07-22 Thread Saurabh Jha via Phabricator via cfe-commits
SaurabhJha updated this revision to Diff 360716.
SaurabhJha added a comment.

Address second round of comments


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D106005/new/

https://reviews.llvm.org/D106005

Files:
  clang/docs/MatrixTypes.rst


Index: clang/docs/MatrixTypes.rst
===
--- clang/docs/MatrixTypes.rst
+++ clang/docs/MatrixTypes.rst
@@ -266,6 +266,20 @@
   }
 
 
+Initialization Syntax
+-
+A value of a matrix type M can be initialized with an initializer list:
+
+.. code-block:: c++
+
+  constexpr M m1 = {};
+  constexpr M m2 = {{a, b, c}, {d, e, f}};
+
+If the initializer list is empty, all elements of the matrix are 
zero-initialized. Otherwise, the initializer list
+must consist of M::rows initializer lists, each of which must consist of 
M::columns expressions, each of which is used
+to initialize the corresponding element of the matrix. For example, m[i][j] is 
initialized by the jth expression of the
+ith initializer list in the initializer. Element designators are not allowed.
+
 TODOs
 -
 
@@ -274,9 +288,6 @@
 convenient. The alternative is using template deduction to extract this
 information. Also add spelling for C.
 
-Future Work: Initialization syntax.
-
-
 Decisions for the Implementation in Clang
 =
 


Index: clang/docs/MatrixTypes.rst
===
--- clang/docs/MatrixTypes.rst
+++ clang/docs/MatrixTypes.rst
@@ -266,6 +266,20 @@
   }
 
 
+Initialization Syntax
+-
+A value of a matrix type M can be initialized with an initializer list:
+
+.. code-block:: c++
+
+  constexpr M m1 = {};
+  constexpr M m2 = {{a, b, c}, {d, e, f}};
+
+If the initializer list is empty, all elements of the matrix are zero-initialized. Otherwise, the initializer list
+must consist of M::rows initializer lists, each of which must consist of M::columns expressions, each of which is used
+to initialize the corresponding element of the matrix. For example, m[i][j] is initialized by the jth expression of the
+ith initializer list in the initializer. Element designators are not allowed.
+
 TODOs
 -
 
@@ -274,9 +288,6 @@
 convenient. The alternative is using template deduction to extract this
 information. Also add spelling for C.
 
-Future Work: Initialization syntax.
-
-
 Decisions for the Implementation in Clang
 =
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D106005: [Docs] Define matrix initialisation in MatrixTypes documentation

2021-07-22 Thread Saurabh Jha via Phabricator via cfe-commits
SaurabhJha added inline comments.



Comment at: clang/docs/MatrixTypes.rst:279
+The number of constituent arrays must equal the number rows in the matrix type 
M and the number of elements
+in each constituent array must equal the number of columns in the matrix type.
+

rjmccall wrote:
> This is contradicted by your first example.  I think you want to say 
> something like
> 
> > A value of matrix type `M` can be initialized with an initializer list:
> >
> > (examples)
> >
> > If the initializer list is empty, all elements of the matrix are 
> > zero-initialized.  Otherwise, the initializer list must consist of 
> > `M::rows` initializer lists, each of which must consist of `M::columns` 
> > expressions, each of which is used to initialize the corresponding element 
> > of the matrix (that is, `m[i][j]` is initialized by the `j`th expression of 
> > the `i`th initializer list in the initializer).  Element designators are 
> > not allowed.
> 
> That's assuming you want to allow `{}`, but I think that's probably a good 
> idea.  At the very least, you already have to define how objects of static 
> storage duration are zero-initialized, and having a way to do that explicitly 
> always seems wise to me.
That sounds great @rjmccall, thanks for your suggestions.

I think I got confused between whether to allow `{}` but as you suggested, I 
think we should.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D106005/new/

https://reviews.llvm.org/D106005

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D106005: [Docs] Define matrix initialisation in MatrixTypes documentation

2021-07-21 Thread John McCall via Phabricator via cfe-commits
rjmccall added inline comments.



Comment at: clang/docs/MatrixTypes.rst:279
+The number of constituent arrays must equal the number rows in the matrix type 
M and the number of elements
+in each constituent array must equal the number of columns in the matrix type.
+

This is contradicted by your first example.  I think you want to say something 
like

> A value of matrix type `M` can be initialized with an initializer list:
>
> (examples)
>
> If the initializer list is empty, all elements of the matrix are 
> zero-initialized.  Otherwise, the initializer list must consist of `M::rows` 
> initializer lists, each of which must consist of `M::columns` expressions, 
> each of which is used to initialize the corresponding element of the matrix 
> (that is, `m[i][j]` is initialized by the `j`th expression of the `i`th 
> initializer list in the initializer).  Element designators are not allowed.

That's assuming you want to allow `{}`, but I think that's probably a good 
idea.  At the very least, you already have to define how objects of static 
storage duration are zero-initialized, and having a way to do that explicitly 
always seems wise to me.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D106005/new/

https://reviews.llvm.org/D106005

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D106005: [Docs] Define matrix initialisation in MatrixTypes documentation

2021-07-21 Thread Saurabh Jha via Phabricator via cfe-commits
SaurabhJha updated this revision to Diff 360524.
SaurabhJha added a comment.

Updated docs to address comments


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D106005/new/

https://reviews.llvm.org/D106005

Files:
  clang/docs/MatrixTypes.rst


Index: clang/docs/MatrixTypes.rst
===
--- clang/docs/MatrixTypes.rst
+++ clang/docs/MatrixTypes.rst
@@ -266,6 +266,18 @@
   }
 
 
+Initialization Syntax
+-
+A value of a matrix type M can be initialised using aggregate initialization 
syntax:
+
+.. code-block:: c++
+
+  constexpr M m1 = {};
+  constexpr M m2 = {{a, b, c}, {d, e, f}};
+
+The number of constituent arrays must equal the number rows in the matrix type 
M and the number of elements
+in each constituent array must equal the number of columns in the matrix type.
+
 TODOs
 -
 
@@ -274,9 +286,6 @@
 convenient. The alternative is using template deduction to extract this
 information. Also add spelling for C.
 
-Future Work: Initialization syntax.
-
-
 Decisions for the Implementation in Clang
 =
 


Index: clang/docs/MatrixTypes.rst
===
--- clang/docs/MatrixTypes.rst
+++ clang/docs/MatrixTypes.rst
@@ -266,6 +266,18 @@
   }
 
 
+Initialization Syntax
+-
+A value of a matrix type M can be initialised using aggregate initialization syntax:
+
+.. code-block:: c++
+
+  constexpr M m1 = {};
+  constexpr M m2 = {{a, b, c}, {d, e, f}};
+
+The number of constituent arrays must equal the number rows in the matrix type M and the number of elements
+in each constituent array must equal the number of columns in the matrix type.
+
 TODOs
 -
 
@@ -274,9 +286,6 @@
 convenient. The alternative is using template deduction to extract this
 information. Also add spelling for C.
 
-Future Work: Initialization syntax.
-
-
 Decisions for the Implementation in Clang
 =
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D106005: [Docs] Define matrix initialisation in MatrixTypes documentation

2021-07-20 Thread Saurabh Jha via Phabricator via cfe-commits
SaurabhJha added inline comments.



Comment at: clang/docs/MatrixTypes.rst:271
+-
+An empty value of a matrix type M can be initialised using this syntax:
+

SaurabhJha wrote:
> fhahn wrote:
> > is there a reason we need to allow 'empty' initialisation? What does it 
> > mean? 
> By empty, I meant this `{}` initialisation which was in the test case. I got 
> the term wrong but seems like we do want to support `{}` initialisation, 
> right?
I meant this test case 
https://github.com/llvm/llvm-project/blob/3323a628ec821b8b75d3b60bf1510931f97d3883/clang/test/CodeGenCXX/matrix-type-builtins.cpp#L78


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D106005/new/

https://reviews.llvm.org/D106005

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D106005: [Docs] Define matrix initialisation in MatrixTypes documentation

2021-07-20 Thread Saurabh Jha via Phabricator via cfe-commits
SaurabhJha added inline comments.



Comment at: clang/docs/MatrixTypes.rst:271
+-
+An empty value of a matrix type M can be initialised using this syntax:
+

fhahn wrote:
> is there a reason we need to allow 'empty' initialisation? What does it mean? 
By empty, I meant this `{}` initialisation which was in the test case. I got 
the term wrong but seems like we do want to support `{}` initialisation, right?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D106005/new/

https://reviews.llvm.org/D106005

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D106005: [Docs] Define matrix initialisation in MatrixTypes documentation

2021-07-20 Thread Florian Hahn via Phabricator via cfe-commits
fhahn added inline comments.



Comment at: clang/docs/MatrixTypes.rst:271
+-
+An empty value of a matrix type M can be initialised using this syntax:
+

is there a reason we need to allow 'empty' initialisation? What does it mean? 


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D106005/new/

https://reviews.llvm.org/D106005

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D106005: [Docs] Define matrix initialisation in MatrixTypes documentation

2021-07-19 Thread Saurabh Jha via Phabricator via cfe-commits
SaurabhJha added a comment.

Ping :)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D106005/new/

https://reviews.llvm.org/D106005

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D106005: [Docs] Define matrix initialisation in MatrixTypes documentation

2021-07-14 Thread Saurabh Jha via Phabricator via cfe-commits
SaurabhJha created this revision.
SaurabhJha requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

As part of https://bugs.llvm.org/show_bug.cgi?id=46251, this patch adds 
definition of matrix initialisation. I am not very familiar with this part of 
C++
so please let me know if I am wrong here, which I suspect I am.

I have been trying to follow the reference documentation 
https://en.cppreference.com/w/cpp/language/initialization and the commented out 
test in the
bugzilla ticket 
https://github.com/llvm/llvm-project/blob/3323a628ec821b8b75d3b60bf1510931f97d3883/clang/test/CodeGenCXX/matrix-type-builtins.cpp#L78


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D106005

Files:
  clang/docs/MatrixTypes.rst


Index: clang/docs/MatrixTypes.rst
===
--- clang/docs/MatrixTypes.rst
+++ clang/docs/MatrixTypes.rst
@@ -266,6 +266,22 @@
   }
 
 
+Initialization Syntax
+-
+An empty value of a matrix type M can be initialised using this syntax:
+
+.. code-block:: c++
+
+  constexpr M m = {};
+
+A non-empty value of a matrix type M can be initialised using the nested 
initialisation syntax:
+
+.. code-block: c++
+  constexpr M m = {{a, b, c}, {d, e, f}}
+
+where the number of constituent arrays must equal the number rows in the 
matrix type M and the number of elements
+in each constituent array must equal the number of columns in the matrix type.
+
 TODOs
 -
 
@@ -274,9 +290,6 @@
 convenient. The alternative is using template deduction to extract this
 information. Also add spelling for C.
 
-Future Work: Initialization syntax.
-
-
 Decisions for the Implementation in Clang
 =
 


Index: clang/docs/MatrixTypes.rst
===
--- clang/docs/MatrixTypes.rst
+++ clang/docs/MatrixTypes.rst
@@ -266,6 +266,22 @@
   }
 
 
+Initialization Syntax
+-
+An empty value of a matrix type M can be initialised using this syntax:
+
+.. code-block:: c++
+
+  constexpr M m = {};
+
+A non-empty value of a matrix type M can be initialised using the nested initialisation syntax:
+
+.. code-block: c++
+  constexpr M m = {{a, b, c}, {d, e, f}}
+
+where the number of constituent arrays must equal the number rows in the matrix type M and the number of elements
+in each constituent array must equal the number of columns in the matrix type.
+
 TODOs
 -
 
@@ -274,9 +290,6 @@
 convenient. The alternative is using template deduction to extract this
 information. Also add spelling for C.
 
-Future Work: Initialization syntax.
-
-
 Decisions for the Implementation in Clang
 =
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits