Inline ptx problem

Hello there.

I found problem in inline ptx.
This code will work incorrect:

asm(“bra $label;\n”);

“mov.s32 %reg, %0;\n” :: “r”(1234));

in ptx it will:

bra $label;
mov %r, 1234;
mov.s32 %reg, %r;

1234 will not be loaded to %reg, because program jump across parameters initialization. Is it bug or feature? Maybe more correctly load asm parameters before each instruction or, in the last resort send compilation warning?


In general it is a bad idea to do this as inline assembly code is supposed to be free of side effects, which the [font=“Courier New”]bra[/font] obviously isn’t. Check out the “Using Inline PTX Assembly in CUDA” document.

EDIT: remove bad code example.

Ok, I understood, but may be opencc should output warning in case bra from one asm block to another?