1

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()?

jww
  • 97,681
  • 90
  • 411
  • 885

2 Answers2

1

This was merged into LLVM 12.0.0-rc1, so it's likely to be available in llvm/clang 12.

Qiu Chaofan
  • 105
  • 2
  • 8
0

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

danblack
  • 12,130
  • 2
  • 22
  • 41