jww
jww

Reputation: 102296

Clang equivalent of GCC's __builtin_darn()

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

Upvotes: 1

Views: 224

Answers (2)

Qiu Chaofan
Qiu Chaofan

Reputation: 135

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

Upvotes: 1

danblack
danblack

Reputation: 14691

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

Upvotes: 0

Related Questions