<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'</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: 'prfm pldl1keep, ${0:a}</div><div>'</div><div> asm volatile("prfm pldl1keep, %a0\n" : : "p" (ptr));</div>
<div> ^</div><div>t2.c:10:15: error: invalid operand in inline asm: 'prfm pstl1keep, ${0:a}</div><div>'</div><div> asm volatile("prfm pstl1keep, %a0\n" : : "p" (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> " mrs %0, mair_el1\n"</div><div> " bfi %0, %1, #%2, #8\n"</div><div> " msr mair_el1, %0\n"</div><div> " isb\n"</div>
<div> : "=&r" (tmp)</div><div> : "r" (foo), "i" (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'</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>