问题
I'm trying to discover Clang's equivalent to GCC's __builtin_darn() on Power9. Grepping Clang 7.0 sources it looks like LLVM supports it:
llvm_source$ cat llvm/test/MC/PowerPC/ppc64-encoding.s | grep darn -B 1 -A 1
# CHECK-BE: darn 2, 3 # encoding: [0x7c,0x43,0x05,0xe6]
# CHECK-LE: darn 2, 3 # encoding: [0xe6,0x05,0x43,0x7c]
darn 2, 3
However, I can't seen to find the builtin:
llvm_source$ grep -IR darn | grep builtin
llvm_source$
What is Clang equivalent of GCC's __builtin_darn()
?
回答1:
You could write in in extended ASM (which you've already done probably):
void t2()
{
static unsigned int x;
asm __volatile__("darn %0,1": "=r" (x));
}
your bug ref: https://bugs.llvm.org/show_bug.cgi?id=39800
来源:https://stackoverflow.com/questions/53476239/clang-equivalent-of-gccs-builtin-darn