Clang equivalent of GCC's __builtin_darn()

こ雲淡風輕ζ 提交于 2019-12-24 11:46:58

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!