<HTML><HEAD><TITLE>Samsung Enterprise Portal mySingle</TITLE>
<META content="text/html; charset=windows-1252" http-equiv=Content-Type>
<STYLE id=mysingle_style type=text/css>P {
MARGIN-TOP: 5px; FONT-FAMILY: Arial, arial; MARGIN-BOTTOM: 5px; FONT-SIZE: 9pt
}
TD {
MARGIN-TOP: 5px; FONT-FAMILY: Arial, arial; MARGIN-BOTTOM: 5px; FONT-SIZE: 9pt
}
LI {
MARGIN-TOP: 5px; FONT-FAMILY: Arial, arial; MARGIN-BOTTOM: 5px; FONT-SIZE: 9pt
}
BODY {
LINE-HEIGHT: 1.4; MARGIN: 10px; FONT-FAMILY: Arial, arial; FONT-SIZE: 9pt
}
</STYLE>
<META name=GENERATOR content=ActiveSquare></HEAD>
<BODY>
<P>Hi Renato,</P>
<P> </P>
<P>Thanks for reply, please find the my comments and qurey inline.</P>
<P> </P>
<P>Regards</P>
<P>Rajesh</P>
<P> </P>
<P>------- <B>Original Message</B> -------</P>
<P><B>Sender</B> : Renato Golin<renato.golin@linaro.org></P>
<P><B>Date</B> : Jun 18, 2013 21:12 (GMT+09:00)</P>
<P><B>Title</B> : Re: [LLVMdev] ARM struct byval size > 64 triggers failure</P>
<P> </P>
<DIV dir=ltr>Hi Rajesh,
<DIV><BR></DIV>
<DIV>Stepan and Manman were changing that part of the code recently, so they can have better answer than I do.</DIV>
<DIV class=gmail_extra><BR><BR>
<DIV class=gmail_quote>On 18 June 2013 12:26, Rajesh Viswabramana <SPAN dir=ltr><<A href="mailto:rajesh.vis@samsung.com" target=_blank>rajesh.vis@samsung.com</A>></SPAN> wrote:<BR>
<BLOCKQUOTE style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex" class=gmail_quote>
<DIV>
<P><STRONG>Output on arm :</STRONG><BR></P>
<P># ./check114.exe <BR>values 0x10861, 0x4071706f<BR>which is wrong.</P></DIV></BLOCKQUOTE>
<DIV><BR></DIV>
<DIV>This works on my Chromebook, is this soft-float? Can you show us your compilation options and to which target you're compiling to, please?</DIV>
<DIV> </DIV>
<DIV>Yes, its soft-float, below is verbose of my command, </DIV>
<DIV> </DIV>
<DIV>"$HOME/svn_3_3/install/bin/clang" -cc1 -triple armv4t--linux-gnueabi -S -disable-free -main-file-name check114.c -mrelocation-model static -mdisable-fp-elim -fmath-errno -mconstructor-aliases -target-abi aapcs-linux -target-cpu arm7tdmi -mfloat-abi soft -target-feature +soft-float-abi -target-linker-version 2.21.53.20110810 -v -g -coverage-file /tmp/check114-gebP2Y.s -resource-dir $HOME/svn_3_3/install/bin/../lib/clang/3.3 -D SKIP_DECIMAL_FLOAT -I $HOME/ROOTSTRAP_PATH/rootstraps/target-arm/usr/include -isysroot $HOME/ROOTSTRAP_PATH/rootstraps/target-arm -internal-isystem $HOME/ROOTSTRAP_PATH/rootstraps/target-arm/usr/local/include -internal-isystem $HOME/svn_3_3/install/bin/../lib/clang/3.3/include -internal-externc-isystem $HOME/ROOTSTRAP_PATH/rootstraps/target-arm/include -internal-externc-isystem $HOME/ROOTSTRAP_PATH/rootstraps/target-arm/usr/include -Wno-abi -Wno-unused-value -Wno-return-type -Wno-constant-logical-operand -w -fno-dwarf-directory-asm -fdebug-compilation-dir $HOME/tests -ferror-limit 19 -fmessage-length 0 -mstackrealign -fno-signed-char -fobjc-runtime=gcc -fobjc-default-synthesize-properties -fdiagnostics-show-option -fcolor-diagnostics -backend-option -vectorize-loops -o /tmp/check114-gebP2Y.s -x c check114.c</DIV>
<DIV> </DIV>
<BLOCKQUOTE style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex" class=gmail_quote>
<DIV>
<P>When the offset(#76) for the instruction, "ldr r1, [r11, #76] ; 0x4c" is calculated, 4 bytes alignment is considered.<BR>In prologue stackpointer calculation 8 byte alignment is considered. </P>
<P>Due to this mimatch of alignment, If try to access any parameter after byval which results wrong value. </P>
<P>Issue(or offset of 4 bytes) wont occur if even number of register used for byval spilling.<BR>ex: <BR>struct S114 check114 (int a, struct S114 arg0, struct S114* arg1) { // accessing arg1 is fine in this case<BR>.....<BR>}</P></DIV></BLOCKQUOTE>
<DIV>This looks like a bug. ;)</DIV>
<DIV><BR></DIV>
<DIV> </DIV>
<BLOCKQUOTE style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex" class=gmail_quote>
<DIV>
<P>1) Is this 8 byte alignment mandatory ? Is this due to " ARM AAPCS 5.2.1.2 Stack constraints at a public interface" ? Can this be removed?<BR></P></DIV></BLOCKQUOTE>
<DIV>I'm not sure what you want removed here. AAPCS should be followed to guarantee compatibility. It looks to me as though the code is considering different constraints in different places, and all we need to do is to match the logic on both places.</DIV>
<DIV> </DIV>
<DIV>One query here, "public interface" in AAPCS doc meant for global functions ?<BR></DIV>
<DIV><BR></DIV>
<BLOCKQUOTE style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex" class=gmail_quote>
<DIV>
<P></P>
<P>2) We will leave alignment as it is but in prologue we will adjust SP once again, this is little meaningless.</P>
<P>3) While accessing arg1 we will consider alignment and add extra offset -> looks better.</P></DIV></BLOCKQUOTE>
<DIV>I think both are bad fixes, as they don't fix the correct problem. Once the bug is fixed on trunk, can you use trunk LLVM? Or do you have to use a point-version?</DIV>
<DIV> </DIV>
<DIV>Anything is fine, Could you share bug id if you have.</DIV>
<DIV><BR> </DIV>
<DIV>Anyway, changing your code to work around compiler issues is always a bad idea...</DIV>
<DIV><BR></DIV>
<DIV><BR></DIV>
<BLOCKQUOTE style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex" class=gmail_quote>
<DIV>
<P> Offset to access arg1 is calculated by selection DAG that will be target independent. But Alignment adjustment should be done by target lowering. Any suggestions on how to fix this ?</P></DIV></BLOCKQUOTE>
<DIV>I'm not too familiar with that part of the code, but Manman or Stepan can give you a hand here.</DIV>
<DIV><BR></DIV>
<DIV>cheers,</DIV>
<DIV>--renato</DIV></DIV></DIV></DIV>
<P> </P>
<TABLE id=confidentialsignimg>
<TBODY>
<TR>
<TD NAMO_LOCK>
<P><IMG border=0 src="cid:Z5JE7EUABGFC@namo.co.kr" width=520></P></TD></TR></TBODY></TABLE></BODY></HTML><img src='http://ext.samsung.net/mailcheck/SeenTimeChecker?do=24fd7bfac5a29b9f4f1bf81182f9666e23f6f92edba029124b8edb9941f8601fb846c8a3750bbecdd1479191c8e13bdda4db4f4540c3ce487d6f8b298eafad26cf878f9a26ce15a0' border=0 width=0 height=0 style='display:none'>