[clang] [OpenCL] Support for inline asm (PR #165214)

via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 3 05:03:54 PST 2025


https://github.com/whisperity commented:

Enabling the keyword in Sema is one thing, but could you add some tests to the backend libraries for the backends to test that the use of this statement compiles to something that actually works properly?

Why I'm asking is that I tried the test file with the code that you posted in the issue #165155 and it ended up triggering backend assertions:

https://godbolt.org/z/jbscvM4xz

```opencl
kernel void do_add_sub(global short4 *add_out, global short4 *sub_out,
                       global short4 *x, global short4 *y)
{
    size_t g = get_global_id(0);
loop:
    add_out[g] = x[g] + y[g];
    sub_out[g] = x[g] - y[g];
    asm goto(""::::loop);
}
```

```
<source>:8:5: warning: extension used
    8 |     asm goto(""::::loop);
      |     ^
Branch condition is not 'i1' type!
  br label %__clang_ocl_kern_imp_do_add_sub.exit, label %__clang_ocl_kern_imp_do_add_sub.exit, label %loop.i, !dbg !50
label %__clang_ocl_kern_imp_do_add_sub.exit
LLVM ERROR: Broken module found, compilation aborted!
Program terminated with signal: SIGSEGV
Compiler returned: 139
```

https://github.com/llvm/llvm-project/pull/165214


More information about the cfe-commits mailing list