<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.arm.com/utility/feedstylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Is there a way to prevent the C compiler from generating ldrd instructions (which assume 64-bit alignment)</title><link>https://community.arm.com/developer/tools-software/oss-platforms/f/gnu-toolchain-forum/48312/is-there-a-way-to-prevent-the-c-compiler-from-generating-ldrd-instructions-which-assume-64-bit-alignment</link><description> I&amp;#39;m using the GCC compiler to load packed 16-bit data (i.e. two 16-bit words in a 32-bit value). My pointer is to a 32-bit type because I want to load two 16-bit values in a single cycle but the pointer is not necessarily aligned to a 4 byte boundary</description><dc:language>en-US</dc:language><generator>Telligent Community 10</generator><item><title>RE: Is there a way to prevent the C compiler from generating ldrd instructions (which assume 64-bit alignment)</title><link>https://community.arm.com/thread/169420?ContentTypeID=1</link><pubDate>Mon, 04 Jan 2021 12:34:48 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:6a702f7e-e5a9-4c6b-af7d-55fb8c614889</guid><dc:creator>Cliff Parris</dc:creator><description>&lt;p&gt;Hi Robert, Yes a modified version of the above works, thanks. I note that for GCC it appears that the packed attribute is only accepted when dealing with structures. I thought normally this refers to padding between the elements rather than packed in the SIMD sense.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Is there a way to prevent the C compiler from generating ldrd instructions (which assume 64-bit alignment)</title><link>https://community.arm.com/thread/169310?ContentTypeID=1</link><pubDate>Tue, 22 Dec 2020 20:26:55 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:356447c7-f9ad-441c-8fe4-ccc41eac1efe</guid><dc:creator>Robert McNamara</dc:creator><description>&lt;p&gt;I use that in GCC.&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;struct __attribute__((packed))  unaligned_struct

{
    uint64_t Value;
}

uint8_t byte_buffer[100]

uint64_t data;;

data = *((unligned_struct *) &amp;amp;byte_buffer[55]);&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Is there a way to prevent the C compiler from generating ldrd instructions (which assume 64-bit alignment)</title><link>https://community.arm.com/thread/169303?ContentTypeID=1</link><pubDate>Tue, 22 Dec 2020 14:31:33 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:5886b91b-644d-4a8f-8256-2ea4ed677faf</guid><dc:creator>Cliff Parris</dc:creator><description>&lt;p&gt;Thanks for the response Robert. I don&amp;#39;t think that works for GCC, or at least not the GCC version that&amp;#39;s part of STMCubeIDE currently, The compiler appears not to recognize &amp;#39;packed&amp;#39;. I can see from CMSIS that other compilers, like ARM CC, support this. Should this work for GCC? I found an inelegant way around this using inline ASM LDR instructions to do my loading.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Is there a way to prevent the C compiler from generating ldrd instructions (which assume 64-bit alignment)</title><link>https://community.arm.com/thread/169302?ContentTypeID=1</link><pubDate>Tue, 22 Dec 2020 13:25:19 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:01fabede-6cdb-4fe9-b67c-15cdb719b34d</guid><dc:creator>Robert McNamara</dc:creator><description>&lt;p&gt;&lt;span&gt;__attrubute__ ((packed)) is the way you control alignment assumptions.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Make sure that &amp;quot;My pointer&amp;quot; is a pointer to a packed 32-bit type.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>