<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=us-ascii">
<meta name="Generator" content="Microsoft Word 14 (filtered medium)">
<style><!--
/* Font Definitions */
@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:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-serif";
mso-fareast-language:EN-US;}
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;}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Calibri","sans-serif";
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri","sans-serif";
mso-fareast-language:EN-US;}
@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">Hi,<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">From http://llvm.org/docs/LangRef.html#bitcast-to-instruction:<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal" style="margin-left:36.0pt">The ‘bitcast‘ instruction converts value to type ty2. 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. Pointer (or vector of pointers) types may only be converted to other pointer (or vector of pointers) types with this instruction if the pointer sizes are equal. To convert pointers to other types, use the inttoptr or ptrtoint instructions first.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">If I understand the definition correctly, then:<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New"">%1 = bitcast <8 x i16> %0 to <4 x i32><o:p></o:p></span></p>
<p class="MsoNormal">Should be equivalent to:<o:p></o:p></p>
<p class="MsoNormal"> <span style="font-family:"Courier New"">store <8 x i16> %0, <8 x i16>* %ptr<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New"">%1 = load <4 x i32>* %ptr<o:p></o:p></span></p>
<p class="MsoNormal">Which the definition above asserts is a no-op cast. However, the store/load sequence is not a no-op cast for vector types when the target does not treat the whole vector as either little or big-endian. MIPS MSA stores vector elements in
big or little endian order according to a configuration bit, but irrespective of this bit the lanes are stored in ascending order. For example, <4 x i32> <i32 1, i32 2, i32 3, i32 4> would be stored as this in big-endian mode:<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New"">%ptr : 00 00 00 01<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New"">%ptr+4 : 00 00 00 02<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New"">%ptr+8 : 00 00 00 03<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New"">%ptr+12: 00 00 00 04<o:p></o:p></span></p>
<p class="MsoNormal">And this in little-endian mode:<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New"">%ptr : 01 00 00 00<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New"">%ptr+4 : 02 00 00 00<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New"">%ptr+8 : 03 00 00 00<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New"">%ptr+12: 04 00 00 00<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">How should I resolve this conflicting definition?<o:p></o:p></p>
<p class="MsoNormal" style="text-align:justify"><o:p> </o:p></p>
<p class="MsoNormal" style="text-align:justify"><b><span style="font-size:12.0pt;font-family:"Arial","sans-serif";color:#3333FF">Daniel Sanders<o:p></o:p></span></b></p>
<p class="MsoNormal" style="text-align:justify"><span style="font-size:10.0pt;font-family:"Arial","sans-serif";color:#3333FF">Leading Software Design Engineer, MIPS Processor IP<o:p></o:p></span></p>
<p class="MsoNormal" style="text-align:justify"><span style="font-size:10.0pt;font-family:"Arial","sans-serif";color:#3333FF">Imagination Technologies Limited<o:p></o:p></span></p>
<p class="MsoNormal" style="text-align:justify"><span style="font-size:10.0pt;font-family:"Arial","sans-serif";color:#3333FF">t: +44 (0)1923 260511<o:p></o:p></span></p>
<p class="MsoNormal" style="text-align:justify"><a href="http://www.imgtec.com/"><span style="font-size:10.0pt;font-family:"Arial","sans-serif";color:blue">www.imgtec.com</span></a><span style="font-size:10.0pt;font-family:"Arial","sans-serif""><o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</body>
</html>