[llvmlinux] AARCH64 unit tests for clang

Mark Charlebois charlebm at gmail.com
Tue Oct 29 03:35:49 UTC 2013


I have added unit tests for inline assembly that passes for GCC but does
not pass for clang.

The new test cases are in llvmlinux/test/unit/aarch64

The issues are:

1. msr and mrs can pass a 32bit variable for gcc but it must be 64bit for
clang

/tmp/t1-84708f.s: Assembler messages:
/tmp/t1-84708f.s:89: Error: operand mismatch -- `mrs w0,mdscr_el1'
clang-3.4: error: assembler command failed with exit code 1 (use -v to see
invocation)

2. prfm pldl1keep and prfm pstl1keep fail for clang

t2.c:5:15: error: invalid operand in inline asm: 'prfm pldl1keep, ${0:a}
'
        asm volatile("prfm pldl1keep, %a0\n" : : "p" (ptr));
                     ^
t2.c:10:15: error: invalid operand in inline asm: 'prfm pstl1keep, ${0:a}
'
        asm volatile("prfm pstl1keep, %a0\n" : : "p" (ptr));


3. The bfi instruction in the following code fails with the error indicated:

        u64 foo, tmp;
        asm volatile(
        "       mrs     %0, mair_el1\n"
        "       bfi     %0, %1, #%2, #8\n"
        "       msr     mair_el1, %0\n"
        "       isb\n"
        : "=&r" (tmp)
        : "r" (foo), "i" (MT_NORMAL * 8));

/tmp/t3-298eff.s: Assembler messages:
/tmp/t3-298eff.s:38: Error: constant expression required at operand 3 --
`bfi x1,x0,##32,#8'
clang-3.4: error: assembler command failed with exit code 1 (use -v to see
invocation)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linuxfoundation.org/pipermail/llvmlinux/attachments/20131028/ef96a26d/attachment.html>


More information about the LLVMLinux mailing list