<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
</head>
<body>
<div class="moz-cite-prefix">FYI, the patch for boolean "vector_size" types in Clang, including documentation and implementation, is now on Phabricator:<br>
<br>
<a class="moz-txt-link-freetext" href="https://reviews.llvm.org/D81083">https://reviews.llvm.org/D81083</a><br>
<br>
- Simon<br>
<br>
<br>
On 5/18/20 3:15 PM, Simon Moll via cfe-dev wrote:<br>
</div>
<blockquote type="cite" cite="mid:4dc086294bde4425882a2a9f9a2e0c21@EUX13SRV2.EU.NEC.COM">
<div class="moz-cite-prefix">Ok. So the next step would be an RFC/spec for the C,C++ language semantics this type would have.
<br>
<br>
What would this spec be based on? Is there any authoritative documentation for 'vector_size' beyond what's in the GCC and Clang docs?<br>
<br>
GCC: <a class="moz-txt-link-freetext" href="https://gcc.gnu.org/onlinedocs/gcc/Vector-Extensions.html" moz-do-not-send="true">
https://gcc.gnu.org/onlinedocs/gcc/Vector-Extensions.html</a><br>
Clang: <a class="moz-txt-link-freetext" href="https://clang.llvm.org/docs/LanguageExtensions.html" moz-do-not-send="true">
https://clang.llvm.org/docs/LanguageExtensions.html</a><br>
<br>
If not, i will update the Clang docs and put it on Phabricator for review.<br>
<br>
Thanks<br>
- Simon<br>
<br>
<br>
On 5/15/20 6:01 PM, Keane, Erich via cfe-dev wrote:<br>
</div>
<blockquote type="cite" cite="mid:SN6PR11MB294378C8C36DAE58EF7B8C64F0BD0@SN6PR11MB2943.namprd11.prod.outlook.com">
<meta name="Generator" content="Microsoft Word 15 (filtered
medium)">
<!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
p.msonormal0, li.msonormal0, div.msonormal0
{mso-style-name:msonormal;
margin:0in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
span.EmailStyle20
{mso-style-type:personal-reply;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
<div class="WordSection1">
<p class="MsoNormal">I’m not sure, I haven’t experimented with GCC enough to know.
<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div style="border:none;border-top:solid #E1E1E1
1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b>From:</b> Finkel, Hal J. <a class="moz-txt-link-rfc2396E" href="mailto:hfinkel@anl.gov" moz-do-not-send="true">
<hfinkel@anl.gov></a> <br>
<b>Sent:</b> Friday, May 15, 2020 8:54 AM<br>
<b>To:</b> Richard Sandiford <a class="moz-txt-link-rfc2396E" href="mailto:richard.sandiford@arm.com" moz-do-not-send="true">
<richard.sandiford@arm.com></a>; Keane, Erich via cfe-dev <a class="moz-txt-link-rfc2396E" href="mailto:cfe-dev@lists.llvm.org" moz-do-not-send="true">
<cfe-dev@lists.llvm.org></a>; Keane, Erich <a class="moz-txt-link-rfc2396E" href="mailto:erich.keane@intel.com" moz-do-not-send="true">
<erich.keane@intel.com></a><br>
<b>Cc:</b> Erich Focht <a class="moz-txt-link-rfc2396E" href="mailto:Erich.Focht@EMEA.NEC.COM" moz-do-not-send="true">
<Erich.Focht@EMEA.NEC.COM></a>; MARUKAWA KAZUSHI <a class="moz-txt-link-rfc2396E" href="mailto:marukawa@nec.com" moz-do-not-send="true">
<marukawa@nec.com></a>; ISHIZAKA KAZUHISA <a class="moz-txt-link-rfc2396E" href="mailto:ishizaka@nec.com" moz-do-not-send="true">
<ishizaka@nec.com></a><br>
<b>Subject:</b> Re: [cfe-dev] [RFC] Opt-in vector of bool type<o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<blockquote style="border:none #C8C8C8 1.0pt;border-left:solid
#C8C8C8 2.25pt;padding:0in 0in 0in
6.0pt;margin-left:4.8pt;margin-top:5.0pt;margin-bottom:5.0pt">
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;color:black"><o:p> </o:p></span></p>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;color:black"><o:p> </o:p></span></p>
</div>
<div class="MsoNormal" style="text-align:center" align="center"><span style="color:#666666">
<hr width="98%" size="2" align="center">
</span></div>
<div id="divRplyFwdMsg">
<p class="MsoNormal"><b><span style="color:black">From:</span></b><span style="color:black"> cfe-dev <<a href="mailto:cfe-dev-bounces@lists.llvm.org" moz-do-not-send="true">cfe-dev-bounces@lists.llvm.org</a>> on behalf of Keane, Erich via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org" moz-do-not-send="true">cfe-dev@lists.llvm.org</a>><br>
<b>Sent:</b> Friday, May 15, 2020 9:43 AM<br>
<b>To:</b> Richard Sandiford <<a href="mailto:richard.sandiford@arm.com" moz-do-not-send="true">richard.sandiford@arm.com</a>>; Keane, Erich via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org" moz-do-not-send="true">cfe-dev@lists.llvm.org</a>><br>
<b>Cc:</b> Erich Focht <<a href="mailto:Erich.Focht@EMEA.NEC.COM" moz-do-not-send="true">Erich.Focht@EMEA.NEC.COM</a>>; MARUKAWA KAZUSHI <<a href="mailto:marukawa@nec.com" moz-do-not-send="true">marukawa@nec.com</a>>; ISHIZAKA KAZUHISA <<a href="mailto:ishizaka@nec.com" moz-do-not-send="true">ishizaka@nec.com</a>><br>
<b>Subject:</b> Re: [cfe-dev] [RFC] Opt-in vector of bool type</span><span style="color:#666666">
<o:p></o:p></span></p>
<div>
<p class="MsoNormal"><span style="color:#666666"> <o:p></o:p></span></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"><span style="color:#666666">Right, I mentioned that:<br>
> Note we don't allow taking a non-const ref or address of a vector element, but GCC does, though presumably that is something we should fix.<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="color:#666666"><o:p> </o:p></span></p>
</div>
</div>
</div>
</blockquote>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">I think that this is another thing that falls into the category of: only if we can define the semantics in a way that makes sense. For example, are the addresses of two adjacent vector elements adjacent? Can you do pointer arithmetic to
get from one to the other?<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal"> -Hal<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<blockquote style="border:none #C8C8C8 1.0pt;border-left:solid
#C8C8C8 2.25pt;padding:0in 0in 0in
6.0pt;margin-left:4.8pt;margin-top:5.0pt;margin-bottom:5.0pt">
<div>
<div>
<div>
<p class="MsoNormal"><span style="color:#666666"><br>
<br>
-----Original Message-----<br>
From: Richard Sandiford <<a href="mailto:richard.sandiford@arm.com" moz-do-not-send="true">richard.sandiford@arm.com</a>>
<br>
Sent: Friday, May 15, 2020 7:41 AM<br>
To: Keane, Erich via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org" moz-do-not-send="true">cfe-dev@lists.llvm.org</a>><br>
Cc: Simon Moll <<a href="mailto:Simon.Moll@EMEA.NEC.COM" moz-do-not-send="true">Simon.Moll@EMEA.NEC.COM</a>>; Craig Topper <<a href="mailto:craig.topper@gmail.com" moz-do-not-send="true">craig.topper@gmail.com</a>>; Keane, Erich <<a href="mailto:erich.keane@intel.com" moz-do-not-send="true">erich.keane@intel.com</a>>;
MARUKAWA KAZUSHI <<a href="mailto:marukawa@nec.com" moz-do-not-send="true">marukawa@nec.com</a>>; ISHIZAKA KAZUHISA <<a href="mailto:ishizaka@nec.com" moz-do-not-send="true">ishizaka@nec.com</a>>; Erich Focht <<a href="mailto:Erich.Focht@EMEA.NEC.COM" moz-do-not-send="true">Erich.Focht@EMEA.NEC.COM</a>><br>
Subject: Re: [cfe-dev] [RFC] Opt-in vector of bool type<br>
<br>
"Keane, Erich via cfe-dev" <<a href="mailto:cfe-dev@lists.llvm.org" moz-do-not-send="true">cfe-dev@lists.llvm.org</a>> writes:<br>
>> The way i see it you are open to supporting this feature in Clang but there are LLVM bugs for <N x i1> types, which we may hit more often as a result, and then there is this unrelated Clang lvalue bug for attribute((vector_size)).<br>
><br>
> I don't take this as a proper summary of my position. I was warning you about the issues in LLVM, however the biggest issue is the fact that a vector of i1s isn't individually addressable. Unless you have a way to produce an address for each individual element
(which we don't, and is why std::vector<bool> uses a proxy return type), I don't think this fits in the type system.<br>
<br>
FWIW, I think taking the address of a vector_size element is already an error in clang. E.g.<br>
<br>
-----------------------------------------------------------------<br>
typedef unsigned int vec __attribute__((vector_size(16))); vec v; unsigned int *foo(void) { return &v[1]; }<br>
-----------------------------------------------------------------<br>
<br>
gives:<br>
<br>
-----------------------------------------------------------------<br>
foo.c:3:34: error: address of vector element requested unsigned int *foo(void) { return &v[1]; }<br>
^~~~~<br>
1 error generated.<br>
-----------------------------------------------------------------<br>
<br>
GCC does accept this, but like others have said, I think the natural thing would be to make it an error for bools even if it isn't for other types. The set of operations supported by a vector type is inevitably going to be influenced by the element type.<br>
<br>
Definitely agree that the semantics need to be spelled out though. :-)<br>
<br>
Thanks,<br>
Richard<br>
_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org" moz-do-not-send="true">cfe-dev@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" moz-do-not-send="true">https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><o:p></o:p></span></p>
</div>
</div>
</div>
</blockquote>
</div>
</blockquote>
</blockquote>
<br>
</body>
</html>