<?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>ARM clang compiler errors out as - error: unknown register name &amp;#39;cp15:0:c9:c12:0&amp;#39;</title><link>https://community.arm.com/developer/tools-software/tools/f/arm-compilers-forum/48020/arm-clang-compiler-errors-out-as---error-unknown-register-name-cp15-0-c9-c12-0</link><description> I am trying to migrate my source code compilation from armcc compiler v5.06 to armclang v6. And I see armclang errors out saying it can not recognize cp15 registers. It looks like there might be a change in armcc vs clang as how to declare the registers</description><dc:language>en-US</dc:language><generator>Telligent Community 10</generator><item><title>RE: ARM clang compiler errors out as - error: unknown register name 'cp15:0:c9:c12:0'</title><link>https://community.arm.com/thread/168725?ContentTypeID=1</link><pubDate>Fri, 20 Nov 2020 05:13:49 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:f9d7f9fc-1f58-4262-b2c9-580982ce07e2</guid><dc:creator>Anupam_on</dc:creator><description>&lt;p&gt;Thanks for the explanation and snippet. This is what I was looking for.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ARM clang compiler errors out as - error: unknown register name 'cp15:0:c9:c12:0'</title><link>https://community.arm.com/thread/168655?ContentTypeID=1</link><pubDate>Mon, 16 Nov 2020 02:53:53 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:f53ab81a-1903-4577-90a1-bf95814a4363</guid><dc:creator>Alex Johnson</dc:creator><description>&lt;p&gt;I have been facing similar issues. I hope you got a solution to your problem.&amp;nbsp;&lt;span&gt;&lt;a class="in-cell-link" href="https://nicciskincare.com/products/mr-white-night-serum" rel="noopener noreferrer" target="_blank"&gt;&lt;/a&gt;&lt;a class="in-cell-link" href="https://nicciskincare.com/products/mr-white-night-serum" rel="noopener noreferrer" target="_blank"&gt;https://nicciskincare.com/products/mr-white-night-serum&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ARM clang compiler errors out as - error: unknown register name 'cp15:0:c9:c12:0'</title><link>https://community.arm.com/thread/168595?ContentTypeID=1</link><pubDate>Wed, 11 Nov 2020 13:04:11 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:44f9d9a9-071c-4cbd-8930-53df271f99a5</guid><dc:creator>a.surati</dc:creator><description>&lt;p&gt;For clang:&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://godbolt.org/z/YWsTe4"&gt;https://godbolt.org/z/YWsTe4&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ARM clang compiler errors out as - error: unknown register name 'cp15:0:c9:c12:0'</title><link>https://community.arm.com/thread/168589?ContentTypeID=1</link><pubDate>Wed, 11 Nov 2020 06:47:40 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:97e4e84b-fa0e-4c75-87f5-c97c56d795b1</guid><dc:creator>Anupam_on</dc:creator><description>&lt;p&gt;Hi Ronan,&lt;/p&gt;
&lt;p&gt;I am using Cortex A5 and I do not use dev studio. However, I could not find such examples in ARM docs.&lt;/p&gt;
&lt;p&gt;I saw some example in linux repo :&amp;nbsp;&lt;a href="https://github.com/torvalds/linux/blob/8808cf8cbc4da1ceef9307fba7e499563908c211/arch/arm/kernel/perf_event_v7.c"&gt;https://github.com/torvalds/linux/blob/8808cf8cbc4da1ceef9307fba7e499563908c211/arch/arm/kernel/perf_event_v7.c&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;The way it is being accessed is&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;span class="pl-k"&gt;asm&lt;/span&gt; &lt;span class="pl-smi"&gt;volatile&lt;/span&gt;(&lt;span class="pl-s"&gt;&lt;span class="pl-pds"&gt;&amp;quot;&lt;/span&gt;mrc p15, 0, %0, c9, c13, 0&lt;span class="pl-pds"&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; : &lt;span class="pl-s"&gt;&lt;span class="pl-pds"&gt;&amp;quot;&lt;/span&gt;=r&lt;span class="pl-pds"&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; (value));&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;I had tried this way but no luck -&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;reg_cp15_pmcr __asm(&amp;quot;mcr cp15, 0, c9, c12, 0&amp;quot;);&amp;nbsp; // experiment 1&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;reg_cp15_pmcr __asm(&amp;quot;mcr cp15:0:c9:c12:0&amp;quot;);&amp;nbsp; &amp;nbsp; &amp;nbsp; // experiment 2&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;All I see here in programmer&amp;#39;s guide -&amp;nbsp;&lt;a href="https://www.macs.hw.ac.uk/~hwloidl/Courses/F28HS/Docu/DEN0013D_cortex_a_series_PG.pdf"&gt;https://www.macs.hw.ac.uk/~hwloidl/Courses/F28HS/Docu/DEN0013D_cortex_a_series_PG.pdf&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;There is no example for calling from c for clang.&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I see cp15 is accessed as p15 in the doc.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ARM clang compiler errors out as - error: unknown register name 'cp15:0:c9:c12:0'</title><link>https://community.arm.com/thread/168585?ContentTypeID=1</link><pubDate>Wed, 11 Nov 2020 01:55:50 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:2a537879-aad5-43c7-8ce6-ce32670faa86</guid><dc:creator>Ronan Synnott</dc:creator><description>&lt;p&gt;Hi Anupam,&lt;/p&gt;
&lt;p&gt;I worry that this code may not be easily portable in the current form.&lt;/p&gt;
&lt;p&gt;The register definition as you do above is only for r6-r11:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://developer.arm.com/documentation/101754/0615/armclang-Reference/Compiler-specific-Keywords-and-Operators/Global-named-register-variables"&gt;https://developer.arm.com/documentation/101754/0615/armclang-Reference/Compiler-specific-Keywords-and-Operators/Global-named-register-variables&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I assume you have Arm Development Studio? I recommend you look at the PMU_AArch64 example, which includes a range of functions (in pmu.c) to implement the above and similar operations (via macros of explicit instructions&amp;nbsp;from pmu_macros.h).&lt;/p&gt;
&lt;p&gt;(If you don&amp;#39;t have Development Studio, a 30-day evaluation is available)&lt;br /&gt;&lt;a href="https://developer.arm.com/tools-and-software/embedded/arm-development-studio"&gt;developer.arm.com/.../arm-development-studio&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>