<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">On 6/15/2017 1:37 PM, 陳韋任 wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CAFSLk9es4uiW9jCzv_nMxQp+c_uaihYcEc3wZb85bES3xrjXzA@mail.gmail.com">
<div dir="ltr">
<div class="gmail_extra">
<div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0px 0px 0px
0.8ex;border-left:1px solid
rgb(204,204,204);padding-left:1ex">
<div bgcolor="#FFFFFF"><span class="gmail-">
<blockquote type="cite">
<div dir="ltr">
<div
style="font-family:arial,helvetica,sans-serif">Our
target doesn't support load i64, so we have
following code in XXXISelLowering.cpp</div>
<div
style="font-family:arial,helvetica,sans-serif"><br>
</div>
<div
style="font-family:arial,helvetica,sans-serif">
setOperationAction(ISD::<wbr>LOAD, MVT::i64,
Custom);</div>
<div
style="font-family:arial,helvetica,sans-serif"> </div>
<div
style="font-family:arial,helvetica,sans-serif">Transform
load i64 to load v2i32 during type legalization.</div>
</div>
</blockquote>
<br>
</span> If misaligned load v2i32 isn't legal, don't
generate it. If it is legal, you might need to mess
with your implementation of
allowsMisalignedMemoryAccesses<wbr>.<span class="gmail-"><br>
<br>
</span></div>
</blockquote>
<div><br>
</div>
<div class="gmail_default"
style="font-family:arial,helvetica,sans-serif">Will check
that. Just a little more explanation about the misaligned
part. We declare i64 is 8 align in the DataLayout, and in
"%0 = load i64, *i64 ptr, align 4" the alignment is 4. In
the op legalization stage, it will go through</div>
<div class="gmail_default"
style="font-family:arial,helvetica,sans-serif"><br>
</div>
<div class="gmail_default"><font face="arial, helvetica,
sans-serif"> SelectionDAGLegalize::LegalizeLoadOps
-> </font><span
style="font-family:arial,helvetica,sans-serif">TargetLowering::expandUnalignedLoad</span></div>
<div class="gmail_default"><span
style="font-family:arial,helvetica,sans-serif"><br>
</span></div>
<div class="gmail_default">We don't expect load i64 would be
4 align, so how do I know I will generate misaligned load
v2i32 beforehand? Another question is usually what we do
to handle load i64 if that is not natively supported? Is
it correct transforming load i64 to load v2i32? An
existing backend example would be great.</div>
</div>
</div>
</div>
</blockquote>
<br>
You can get the alignment by casting the SDNode to LoadSDNode, then
calling getAlignment().<br>
<br>
I think all in-tree backends which don't have 64-bit integer
registers use the default expansion for an i64 load, which splits
the load into two i32 loads.<br>
<br>
-Eli<br>
<pre class="moz-signature" cols="72">--
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project</pre>
</body>
</html>