<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<blockquote style="border-left: 3px solid rgb(200, 200, 200); border-top-color: rgb(200, 200, 200); border-right-color: rgb(200, 200, 200); border-bottom-color: rgb(200, 200, 200); padding-left: 1ex; margin-left: 0.8ex; color: rgb(102, 102, 102);">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div>
<div id="Signature">
<div class="BodyFragment"></div>
</div>
</div>
<div>
<div id="appendonsend"></div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> cfe-dev <cfe-dev-bounces@lists.llvm.org> on behalf of Keane, Erich via cfe-dev <cfe-dev@lists.llvm.org><br>
<b>Sent:</b> Friday, May 15, 2020 9:43 AM<br>
<b>To:</b> Richard Sandiford <richard.sandiford@arm.com>; Keane, Erich via cfe-dev <cfe-dev@lists.llvm.org><br>
<b>Cc:</b> Erich Focht <Erich.Focht@EMEA.NEC.COM>; MARUKAWA KAZUSHI <marukawa@nec.com>; ISHIZAKA KAZUHISA <ishizaka@nec.com><br>
<b>Subject:</b> Re: [cfe-dev] [RFC] Opt-in vector of bool type</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt">
<div class="PlainText">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.<br>
</div>
<div class="PlainText"><br>
</div>
</span></font></div>
</div>
</blockquote>
<div class="PlainText"><br>
</div>
<div class="PlainText">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?</div>
<div class="PlainText"><br>
</div>
<div class="PlainText"> -Hal</div>
<div class="PlainText"><br>
</div>
<blockquote style="border-left: 3px solid rgb(200, 200, 200); border-top-color: rgb(200, 200, 200); border-right-color: rgb(200, 200, 200); border-bottom-color: rgb(200, 200, 200); padding-left: 1ex; margin-left: 0.8ex; color: rgb(102, 102, 102);">
<div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt">
<div class="PlainText"><br>
<br>
-----Original Message-----<br>
From: Richard Sandiford <richard.sandiford@arm.com> <br>
Sent: Friday, May 15, 2020 7:41 AM<br>
To: Keane, Erich via cfe-dev <cfe-dev@lists.llvm.org><br>
Cc: Simon Moll <Simon.Moll@EMEA.NEC.COM>; Craig Topper <craig.topper@gmail.com>; Keane, Erich <erich.keane@intel.com>; MARUKAWA KAZUSHI <marukawa@nec.com>; ISHIZAKA KAZUHISA <ishizaka@nec.com>; Erich Focht <Erich.Focht@EMEA.NEC.COM><br>
Subject: Re: [cfe-dev] [RFC] Opt-in vector of bool type<br>
<br>
"Keane, Erich via cfe-dev" <cfe-dev@lists.llvm.org> 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>
cfe-dev@lists.llvm.org<br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev">https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br>
</div>
</span></font></div>
</div>
</blockquote>
<div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt">
<div class="PlainText"></div>
</span></font></div>
</div>
</body>
</html>