<div dir="ltr">I have added unit tests for inline assembly that passes for GCC but does not pass for clang.<div><br></div><div style>The new test cases are in llvmlinux/test/unit/aarch64</div><div style><br></div><div style>
The issues are:</div><div style><br></div><div style>1. msr and mrs can pass a 32bit variable for gcc but it must be 64bit for clang</div><div style><br></div><div style><div>/tmp/t1-84708f.s: Assembler messages:</div><div>
/tmp/t1-84708f.s:89: Error: operand mismatch -- `mrs w0,mdscr_el1&#39;</div><div>clang-3.4: error: assembler command failed with exit code 1 (use -v to see invocation)</div></div><div style><br></div><div style>2. prfm pldl1keep and prfm pstl1keep fail for clang</div>
<div style><br></div><div style><div>t2.c:5:15: error: invalid operand in inline asm: &#39;prfm pldl1keep, ${0:a}</div><div>&#39;</div><div>        asm volatile(&quot;prfm pldl1keep, %a0\n&quot; : : &quot;p&quot; (ptr));</div>
<div>                     ^</div><div>t2.c:10:15: error: invalid operand in inline asm: &#39;prfm pstl1keep, ${0:a}</div><div>&#39;</div><div>        asm volatile(&quot;prfm pstl1keep, %a0\n&quot; : : &quot;p&quot; (ptr));</div>
<div><br></div></div><div style><br></div><div style>3. The bfi instruction in the following code fails with the error indicated:</div><div style><br></div><div style><div>        u64 foo, tmp;</div><div>        asm volatile(</div>
<div>        &quot;       mrs     %0, mair_el1\n&quot;</div><div>        &quot;       bfi     %0, %1, #%2, #8\n&quot;</div><div>        &quot;       msr     mair_el1, %0\n&quot;</div><div>        &quot;       isb\n&quot;</div>
<div>        : &quot;=&amp;r&quot; (tmp)</div><div>        : &quot;r&quot; (foo), &quot;i&quot; (MT_NORMAL * 8));</div><div><br></div><div><div>/tmp/t3-298eff.s: Assembler messages:</div><div>/tmp/t3-298eff.s:38: Error: constant expression required at operand 3 -- `bfi x1,x0,##32,#8&#39;</div>
<div>clang-3.4: error: assembler command failed with exit code 1 (use -v to see invocation)</div></div><div><br></div></div></div>