<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 14 (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:Helvetica;
panose-1:2 11 6 4 2 2 2 2 2 4;}
@font-face
{font-family:Helvetica;
panose-1:2 11 6 4 2 2 2 2 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Tahoma;
panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman","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
{mso-style-priority:99;
margin:0cm;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman","serif";}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
{mso-style-priority:99;
mso-style-link:"Balloon Text Char";
margin:0cm;
margin-bottom:.0001pt;
font-size:8.0pt;
font-family:"Tahoma","sans-serif";}
span.EmailStyle18
{mso-style-type:personal;
font-family:"Calibri","sans-serif";
color:windowtext;}
span.EmailStyle19
{mso-style-type:personal-reply;
font-family:"Calibri","sans-serif";
color:windowtext;}
span.BalloonTextChar
{mso-style-name:"Balloon Text Char";
mso-style-priority:99;
mso-style-link:"Balloon Text";
font-family:"Tahoma","sans-serif";}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;}
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]-->
</head>
<body lang="EN-GB" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif"">Hi,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif""><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif"">I've posted a patch for the ISD::BITCAST change as http://reviews.llvm.org/D16464.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif""><o:p> </o:p></span></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0cm 0cm 0cm 4.0pt">
<div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span lang="EN-US" style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> Hal Finkel [mailto:hfinkel@anl.gov]
<br>
<b>Sent:</b> 15 January 2016 13:47<br>
<b>To:</b> Daniel Sanders<br>
<b>Cc:</b> llvm-dev@lists.llvm.org; James Molloy; Philip Reames<br>
<b>Subject:</b> Re: [llvm-dev] [GlobalISel] A Proposal for global instruction selection<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><span style="font-size:10.0pt;font-family:"Arial","sans-serif";color:black"><o:p> </o:p></span></p>
<div class="MsoNormal" align="center" style="text-align:center"><span style="font-size:10.0pt;font-family:"Arial","sans-serif";color:black">
<hr size="2" width="100%" align="center" id="zwchr">
</span></div>
<blockquote style="border:none;border-left:solid #1010FF 1.5pt;padding:0cm 0cm 0cm 4.0pt;margin-left:3.75pt;margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal" style="margin-bottom:12.0pt"><b><span style="font-family:"Helvetica","sans-serif";color:black">From:
</span></b><span style="font-family:"Helvetica","sans-serif";color:black">"Daniel Sanders" <Daniel.Sanders@imgtec.com><br>
<b>To: </b>"James Molloy" <james@jamesmolloy.co.uk>, "Hal Finkel" <hfinkel@anl.gov>, "Philip Reames" <listmail@philipreames.com><br>
<b>Cc: </b>llvm-dev@lists.llvm.org<br>
<b>Sent: </b>Friday, January 15, 2016 4:29:33 AM<br>
<b>Subject: </b>RE: [llvm-dev] [GlobalISel] A Proposal for global instruction selection<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:black">Hi,</span><span style="color:black"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:black"> </span><span style="color:black"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:black">I think we just need to draw attention to the fact that other IR's may vary.</span><span style="color:black"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:black"> </span><span style="color:black"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:black">I'm thinking we should add something like this to the ISD::BITCAST doxygen comment:</span><span style="color:black"><o:p></o:p></span></p>
<p class="MsoNormal" style="text-indent:36.0pt"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:black">This is subtly different from the bitcast instruction from LLVM-IR since this node may change the bits</span><span style="color:black"><o:p></o:p></span></p>
<p class="MsoNormal" style="text-indent:36.0pt"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:black">in the register. For example, this occurs on big-endian NEON and big-endian MSA where the layout</span><span style="color:black"><o:p></o:p></span></p>
<p class="MsoNormal" style="text-indent:36.0pt"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:black">of the bits in the register depends on the vector type and this node acts as a shuffle operation for</span><span style="color:black"><o:p></o:p></span></p>
<p class="MsoNormal" style="text-indent:36.0pt"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:black">some vector type combinations.</span><span style="color:black"><o:p></o:p></span></p>
</blockquote>
<p class="MsoNormal" style="margin-bottom:12.0pt"><span style="font-size:10.0pt;font-family:"Arial","sans-serif";color:black"><br>
I agree; improving the ISD::BITCAST documentation is a good idea.<o:p></o:p></span></p>
<p class="MsoNormal" style="text-indent:36.0pt"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:black"> </span><span style="color:black"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:black">And have LangRef say something like:</span><span style="color:black"><o:p></o:p></span></p>
<p class="MsoNormal" style="text-indent:36.0pt"><span style="color:black">The conversion is done as if the value had been stored to memory and read back as type ty2. This is equivalent to a no-op cast where no bits change with this conversion.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:black"> .. caution::</span><span style="color:black"><o:p></o:p></span></p>
<p class="MsoNormal" style="text-indent:36.0pt"><span style="color:black"> This equivalence does not necessarily apply to other IR's in LLVM. See ISD::BITCAST for an example.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:black">The '.. caution::' should render in the same way as the 'Rationale' box in
<a href="http://llvm.org/docs/LangRef.html#volatile-memory-accesses">http://llvm.org/docs/LangRef.html#volatile-memory-accesses</a>.</span><span style="color:black"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial","sans-serif";color:black"><br>
We should not do this. We try to keep the LangRef as implementation-independent as possible, and thus, we don't explicitly discuss things like ISD nodes there.<br>
<br>
-Hal<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:black"> </span><span style="color:black"><o:p></o:p></span></p>
<div style="border:none;border-left:solid windowtext 1.5pt;padding:0cm 0cm 0cm 4.0pt;border-color:-moz-use-text-color -moz-use-text-color -moz-use-text-color blue">
<div>
<div style="border:none;border-top:solid windowtext 1.0pt;padding:3.0pt 0cm 0cm 0cm;border-color:-moz-use-text-color -moz-use-text-color">
<p class="MsoNormal"><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:black">From:</span></b><span lang="EN-US" style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:black"> James Molloy [mailto:james@jamesmolloy.co.uk]
<br>
<b>Sent:</b> 15 January 2016 08:46<br>
<b>To:</b> Hal Finkel; Philip Reames<br>
<b>Cc:</b> llvm-dev@lists.llvm.org; Daniel Sanders<br>
<b>Subject:</b> Re: [llvm-dev] [GlobalISel] A Proposal for global instruction selection</span><span style="color:black"><o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><span style="color:black"> <o:p></o:p></span></p>
<div>
<p class="MsoNormal"><span style="color:black">Hi,<o:p></o:p></span></p>
<div>
<p class="MsoNormal"><span style="color:black"> <o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="color:black">> "It is always a no-op cast because no bits change with this conversion. The conversion is done as if the value had been stored to memory and read back as type ty2."<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="color:black"> <o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="color:black">I think a simple "as-if" in there should be sufficient;<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="color:black"> <o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="color:black">"It is always a no-op cast because it acts as if no bits change with this conversion. The conversion is done as if the value had been stored to memory and read back as type ty2."<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="color:black"> <o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="color:black">What do you think?<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="color:black"> <o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="color:black">James<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><span style="color:black"> <o:p></o:p></span></p>
<div>
<div>
<p class="MsoNormal"><span style="color:black">On Thu, 14 Jan 2016 at 22:35 Hal Finkel <<a href="mailto:hfinkel@anl.gov" target="_blank">hfinkel@anl.gov</a>> wrote:<o:p></o:p></span></p>
</div>
<blockquote style="border:none;border-left:solid windowtext 1.0pt;padding:0cm 0cm 0cm 6.0pt;margin-left:4.8pt;margin-top:5.0pt;margin-right:0cm;margin-bottom:5.0pt;border-color:-moz-use-text-color -moz-use-text-color -moz-use-text-color rgb(204, 204, 204)">
<div class="MsoNormal" align="center" style="text-align:center"><span style="font-family:"Helvetica","sans-serif";color:black">
<hr size="2" width="100%" align="center" id="zwchr">
</span></div>
<p class="MsoNormal"><span style="font-family:"Helvetica","sans-serif";color:black"><br>
> From: "Philip Reames" <<a href="mailto:listmail@philipreames.com" target="_blank">listmail@philipreames.com</a>><br>
> To: "James Molloy" <<a href="mailto:james@jamesmolloy.co.uk" target="_blank">james@jamesmolloy.co.uk</a>>, "Daniel Sanders" <<a href="mailto:Daniel.Sanders@imgtec.com" target="_blank">Daniel.Sanders@imgtec.com</a>>, "Hal Finkel"<br>
> <<a href="mailto:hfinkel@anl.gov" target="_blank">hfinkel@anl.gov</a>><br>
> Cc: <a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
> Sent: Thursday, January 14, 2016 3:48:37 PM<br>
> Subject: Re: [llvm-dev] [GlobalISel] A Proposal for global instruction selection<br>
><br>
> This explanation makes a lot more sense to me. I think it would make<br>
> sense to document this mental model, but I agree that this<br>
> interpretation does not seem to require changes to the IR semantics.<br>
<br>
The semantics, no. But we still may want to update the language reference. It says, "It is always a no-op cast because no bits change with this conversion. The conversion is done as if the value had been stored to memory and read back as type ty2." And, what
we've learned, is that this second sentence does not always imply the first (the bits might, in fact, change).<br>
<br>
-Hal<br>
<br>
><br>
> Just to check, this implies that DSE *is* legal right?<br>
><br>
> Philip<br>
><br>
><br>
> On 01/14/2016 05:48 AM, James Molloy wrote:<br>
><br>
><br>
><br>
> Hi,<br>
><br>
><br>
> I've given a bit of misinformation here and have caused some<br>
> confusion. After talking with Tim and Mehdi last night on IRC, I<br>
> need to correct what I said above to fall more in line with what<br>
> Daniel is saying. If any of the below contradicts what I've said<br>
> already, please accept my apologies. This version should be right.<br>
><br>
><br>
> The behaviour of the code generator for big-endian NEON and MIPS is<br>
> derived from the fact that we did not want to change IR semantics at<br>
> all. A fundamental property that we do not want to break is memory<br>
> round-tripping:<br>
><br>
><br>
> %1 = load <4 x i32>, %p32<br>
> %2 = bitcast <4 x i32> %1 to <2 x i64><br>
> store <2 x i64> %2, (bitcast %p32 to <2 x i64>*)<br>
><br>
><br>
> The value of memory before and after the store MUST NOT change<br>
> (contrary to what I said in an earlier post, I know).<br>
><br>
><br>
> So in fact everything you can do in IR is valid. There are no changes<br>
> to IR semantics in the slightest. However, when it comes to<br>
> generating code from the IR, there are new rules:<br>
> 1) Loads and stores are selected to be special loads and stores that<br>
> do some transform from a canonical form in memory to a type-specific<br>
> form in register.<br>
> 2) Because bitcasts are load/store pairs in semantic, they must<br>
> behave as if a store then load was done. Specifically (bitcast TyA<br>
> to TyB) must transform TyA -> canonical form -> TyB, as a store then<br>
> load would. Therefore bitcasts are not no-ops during code generation<br>
> (*but behave as if they are from an IR perspective!*).<br>
><br>
><br>
> The reason this works neatly in IR is due to the IR's type system. In<br>
> order to change type, a cast must be inserted or a memory round<br>
> trip. There is no other way. However in SDAG, things break down a<br>
> bit. SDAG is more weakly typed, and bitconverts are often simply<br>
> removed. We need that not to happen. Bitconverts are not no-ops.<br>
><br>
><br>
> Daniel's explanation of physical register mapping was excellent so<br>
> I'm not going to repeat that.<br>
><br>
><br>
> I apologise for the confusion and misinformation. This is quite a<br>
> complex topic and takes a bit of mind bending for me to understand,<br>
> and it was a long time ago.<br>
><br>
><br>
> James<br>
><br>
><br>
> On Thu, 14 Jan 2016 at 13:17 Daniel Sanders <<br>
> <a href="mailto:Daniel.Sanders@imgtec.com" target="_blank">Daniel.Sanders@imgtec.com</a> > wrote:<br>
><br>
><br>
><br>
><br>
><br>
><br>
> > Ok. Then we need to change the LangRef as suggested. Given this is<br>
> > a rather important semantic change, I think you need to send a top<br>
> > level RFC to the list.<br>
><br>
><br>
><br>
><br>
><br>
> FWIW, I don't think this is a semantic change to LLVM-IR itself. I<br>
> think it's more clearing up the misconception that LLVM-IR semantics<br>
> also apply to SelectionDAG's operations. That said, I do think it's<br>
> important to mention this in LangRef since it's very easy to make<br>
> this mistake and very few targets need to worry about the<br>
> distinction.<br>
><br>
><br>
><br>
> To explain why I don't think this is a semantic change to LLVM-IR,<br>
> let's consider this example from earlier:<br>
><br>
><br>
><br>
> %0 = load <4 x i32> %x<br>
> %1 = bitcast <4 x i32> %0 to <2 x i64><br>
><br>
><br>
><br>
><br>
> store <2 x i64> %1, <2 x i64>* %y<br>
><br>
><br>
><br>
><br>
><br>
> In LLVM-IR terms, if the value of %0 is:<br>
><br>
> %0 = 0x00112233_44556677_8899aabb_ccddeeff<br>
><br>
> then the value of %1 is:<br>
><br>
> %1 = 0x0011223344556677_8899aabbccddeeff<br>
><br>
> which agrees with the store/load and the 'no bits change' statements<br>
> in LangRef.<br>
><br>
><br>
><br>
> However, the mapping of these bits to physical register bits is not<br>
> consistent between types:<br>
><br>
> Physreg(%0) = 0xccddeeff_8899aabb_44556677_00112233<br>
><br>
> Physreg(%1) = 0x8899aabbccddeeff_0011223344556677<br>
><br>
><br>
><br>
> Essentially, I'm saying that BitCastInst and ISD::BITCAST have<br>
> slightly different semantics because of their different domains. The<br>
> former is working on an abstract representation of the values where<br>
> both statements in LangRef are true, but the latter is closer to the<br>
> target where the 'no bits change' statement ceases to be true in<br>
> some cases.<br>
><br>
><br>
><br>
> > A couple of points that will need clarified:<br>
> > - Does this only apply to vector types? It definitely doesn't apply<br>
> > between pointer types today. What about integer, floating point,<br>
> > and FCAs?<br>
><br>
><br>
><br>
><br>
><br>
> I've only seen it for vector types so far but in theory it could<br>
> happen for other types. I'd expect FCAs to encounter it since the<br>
> physical registers may contain padding that isn't present in the<br>
> LLVM-IR representation and the placement and amount of padding will<br>
> depend on the exact FCA.<br>
><br>
> I can think of cases where address space casts can encounter the same<br>
> problem but that's already been covered in LangRef ("It can be a<br>
> no-op cast or a complex value modification, depending on the target<br>
> and the address space pair.").<br>
><br>
><br>
><br>
> Does anyone use FCAs directly? Most targets seem to convert them to<br>
> same-sized integers or bitcast an FCA* to i8*.<br>
><br>
><br>
><br>
><br>
> > - Is combining two casts into one a legal operation? I think it is<br>
> > so far, but we need to explicitly state that.<br>
><br>
><br>
><br>
><br>
><br>
> Yes, A->B->C and A->C are equivalent.<br>
><br>
><br>
><br>
><br>
> > - Do we have a predicate for identifying no-op casts that can be<br>
> > freely removed/combined?<br>
><br>
><br>
><br>
><br>
><br>
> James mentioned one in CGP but I haven't been able to find it. I<br>
> don't think it's necessary to have one at the LLVM-IR level but we<br>
> do need one in the backends. I remember adding one to the backend<br>
> but I can't find that either so I think I'm remembering one of my<br>
> patches from before I split MSA's registers into type-specific<br>
> classes.<br>
><br>
><br>
><br>
><br>
> > - Is coercing a load to the type it's immediately bitcast to legal<br>
> > under this model?<br>
><br>
><br>
><br>
><br>
><br>
> Yes.<br>
><br>
><br>
><br>
><br>
><br>
><br>
> From: llvm-dev [mailto: <a href="mailto:llvm-dev-bounces@lists.llvm.org" target="_blank">
llvm-dev-bounces@lists.llvm.org</a> ] On Behalf<br>
> Of Philip Reames via llvm-dev<br>
> Sent: 13 January 2016 20:31<br>
> To: James Molloy; Hal Finkel<br>
> Cc: llvm-dev<br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
> Subject: Re: [llvm-dev] [GlobalISel] A Proposal for global<br>
> instruction selection<br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
> On 01/13/2016 12:20 PM, James Molloy wrote:<br>
><br>
><br>
><br>
><br>
> > (Right?)<br>
><br>
><br>
><br>
><br>
><br>
> Uh no, the register content explicitly does change :( We insert REV<br>
> instructions (byteswap) on each bitcast. Bitcasts can be merged and<br>
> elided etc, but conceptually there's a register content change on<br>
> every bitcast.<br>
><br>
> Ok. Then we need to change the LangRef as suggested. Given this is a<br>
> rather important semantic change, I think you need to send a top<br>
> level RFC to the list.<br>
><br>
> A couple of points that will need clarified:<br>
> - Does this only apply to vector types? It definitely doesn't apply<br>
> between pointer types today. What about integer, floating point, and<br>
> FCAs?<br>
> - Is combining two casts into one a legal operation? I think it is so<br>
> far, but we need to explicitly state that.<br>
> - Do we have a predicate for identifying no-op casts that can be<br>
> freely removed/combined?<br>
> - Is coercing a load to the type it's immediately bitcast to legal<br>
> under this model?<br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
> James<br>
><br>
><br>
><br>
><br>
><br>
> On Wed, 13 Jan 2016 at 18:09 Philip Reames <<br>
> <a href="mailto:listmail@philipreames.com" target="_blank">listmail@philipreames.com</a> > wrote:<br>
><br>
><br>
><br>
><br>
><br>
> On 01/13/2016 08:01 AM, Hal Finkel via llvm-dev wrote:<br>
> > ----- Original Message -----<br>
> >> From: "James Molloy" < <a href="mailto:james@jamesmolloy.co.uk" target="_blank">
james@jamesmolloy.co.uk</a> ><br>
> >> To: "Hal Finkel" < <a href="mailto:hfinkel@anl.gov" target="_blank">hfinkel@anl.gov</a> ><br>
> >> Cc: "llvm-dev" < <a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a> >, "Quentin Colombet" <<br>
> >> <a href="mailto:qcolombet@apple.com" target="_blank">qcolombet@apple.com</a> ><br>
> >> Sent: Wednesday, January 13, 2016 9:54:26 AM<br>
> >> Subject: Re: [llvm-dev] [GlobalISel] A Proposal for global<br>
> >> instruction selection<br>
> >><br>
> >><br>
> >>> I think that teaching the optimizer about big-Endian lane<br>
> >>> ordering<br>
> >>> would have been better.<br>
> >><br>
> >> It's certainly arguable. Even in hindsight I'm glad we didn't -<br>
> >> that's the approach GCC took and they've been fixing subtle bugs<br>
> >> in<br>
> >> their vectorizer ever since.<br>
> >><br>
> >><br>
> >>> Inserting the REV after every LDR<br>
> >><br>
> >> We only do this conceptually. In most cases REVs cancel out, and<br>
> >> we<br>
> >> have the LD1 instruction which is LDR+REV. With enough peepholes<br>
> >> there's really no need for code to run slower.<br>
> >><br>
> >><br>
> >>> Given what's been done, should we update the LangRef.<br>
> >><br>
> >> Potentially, yes. I hadn't realised quite how strongly worded it<br>
> >> was<br>
> >> with respect to this.<br>
> >><br>
> > Please do ;)<br>
> I'm not sure changing bitcast is the right place. Since the bitcast<br>
> is<br>
> representing the in-register value (which doesn't change), maybe we<br>
> should define it as part of the load/store instead? That's<br>
> essentially<br>
> what's going on; we're converting from a canonical register form to a<br>
> variety of memory forms. (Right?)<br>
> ><br>
> > -Hal<br>
> ><br>
> >> James<br>
> >><br>
> >><br>
> >> On Wed, 13 Jan 2016 at 14:39 Hal Finkel < <a href="mailto:hfinkel@anl.gov" target="_blank">
hfinkel@anl.gov</a> > wrote:<br>
> >><br>
> >><br>
> >><br>
> >><br>
> >> [resending so the message is smaller]<br>
> >><br>
> >><br>
> >><br>
> >><br>
> >><br>
> >><br>
> >> From: "James Molloy via llvm-dev" < <a href="mailto:llvm-dev@lists.llvm.org" target="_blank">
llvm-dev@lists.llvm.org</a> ><br>
> >> To: "Quentin Colombet" < <a href="mailto:qcolombet@apple.com" target="_blank">
qcolombet@apple.com</a> ><br>
> >> Cc: "llvm-dev" < <a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a> ><br>
> >> Sent: Wednesday, January 13, 2016 2:35:32 AM<br>
> >> Subject: Re: [llvm-dev] [GlobalISel] A Proposal for global<br>
> >> instruction selection<br>
> >><br>
> >> Hi Philip,<br>
> >><br>
> >><br>
> >><br>
> >><br>
> >><br>
> >> store <2 x i64> %1, <2 x i64>* %y<br>
> >><br>
> >> Yes. The memory pattern differs. This is the first diagram on the<br>
> >> right at: <a href="http://llvm.org/docs/BigEndianNEON.html#bitconverts" target="_blank">
http://llvm.org/docs/BigEndianNEON.html#bitconverts</a> )<br>
> >><br>
> >><br>
> >> I think that teaching the optimizer about big-Endian lane ordering<br>
> >> would have been better. Inserting the REV after every LDR sounds<br>
> >> very similar to what we do for VSX on little-Endian PowerPC<br>
> >> systems<br>
> >> (PowerPC may have a slight advantage here in that we don't need to<br>
> >> do insertelement / extractelement / shufflevector through memory<br>
> >> on<br>
> >> systems where little-Endian mode is relevant, see<br>
> >> <a href="http://llvm.org/devmtg/2014-10/Slides/Schmidt-SupportingVectorProgramming.pdf" target="_blank">
http://llvm.org/devmtg/2014-10/Slides/Schmidt-SupportingVectorProgramming.pdf</a><br>
> >> ).<br>
> >><br>
> >> Given what's been done, should we update the LangRef. It currently<br>
> >> reads, " The ‘ bitcast ‘ instruction converts value to type ty2 .<br>
> >> It<br>
> >> is always a no-op cast because no bits change with this<br>
> >> conversion.<br>
> >> The conversion is done as if the value had been stored to memory<br>
> >> and<br>
> >> read back as type ty2 ." But this is now, at the least,<br>
> >> misleading,<br>
> >> because this process of storing the value as one type and reading<br>
> >> it<br>
> >> back in as another does, in fact, change the bits. We need to make<br>
> >> clear that this might change the bits (perhaps specifically by<br>
> >> calling out this case of vector bitcasts on big-Endian systems?).<br>
> >><br>
> >><br>
> >><br>
> >> Also, regarding this, " Most operating systems however do not run<br>
> >> with alignment faults enabled, so this is often not an issue." Are<br>
> >> you saying that the processor does the correct thing in this case<br>
> >> (if alignment faults are not enabled, then it performs a proper<br>
> >> unaligned load), or that the operating-system trap handler<br>
> >> emulates<br>
> >> the unaligned load should one occur?<br>
> >><br>
> >> Thanks again,<br>
> >> Hal<br>
> >><br>
> >><br>
> >> _______________________________________________<br>
> >><br>
> >><br>
> >> LLVM Developers mailing list<br>
> >> <a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
> >> <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" target="_blank">
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
> >><br>
> >><br>
> >> --<br>
> >> Hal Finkel<br>
> >> Assistant Computational Scientist<br>
> >> Leadership Computing Facility<br>
> >> Argonne National Laboratory<br>
> >><br>
><br>
><br>
><br>
<br>
--<br>
Hal Finkel<br>
Assistant Computational Scientist<br>
Leadership Computing Facility<br>
Argonne National Laboratory<o:p></o:p></span></p>
</blockquote>
</div>
</div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial","sans-serif";color:black"><br>
<br>
<br>
-- <o:p></o:p></span></p>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial","sans-serif";color:black">Hal Finkel<br>
Assistant Computational Scientist<br>
Leadership Computing Facility<br>
Argonne National Laboratory<o:p></o:p></span></p>
</div>
</div>
</div>
</div>
</body>
</html>