I'm working on a project with lots of C wrappers around M68000 asm calls. A few of these calls return a success/fail status on the condition code register, so it would be ideal to 'goto' a C label depending on the status of CC. However, no matter what permutations I try, I am constantly getting syntax errors from the compiler.
(This is gcc 10.2.0 --with-cpu=m68000)
Example code:
asm(R"(
moveq #0, d1
jsr %p0
bcc %l0
2:
)":
:
"i"(_BURAM),
"d"(d0_fcode),
"a"(a0_info),
"a"(a1_data)
:
"cc"
: failed);
return true;
failed:
return false;
The error this generates is:
/home/ryou/Projects/megadev/lib/sub/bram.h: In function 'bram_brmwrite':
/home/ryou/Projects/megadev/lib/sub/bram.h:156:7: error: expected ')' before ':' token
156 | "cc"
| ^
| )
157 | : failed);
| ~
/home/ryou/Projects/megadev/lib/sub/bram.h:144:5: note: to match this '('
144 | asm(R"(
| ^
I have attempted doing it with the simplest of examples, for testing:
asm("bra %l0" :::: failed);
And I still get:
/home/ryou/Projects/megadev/lib/sub/bram.h:144:18: error: expected ')' before '::' token
144 | asm("bra %l0" :::: failed);
The only other somewhat relevant information I have found here is: Extended asm with goto, including an example from the gcc docs, fails to compile
However, as you can see in both examples, I am not using any outputs. I assume that the m68k-elf target does not support this in particular, but I really don't see why it wouldn't and I haven't found any documentation saying as much.
There are ways around this (namely by checking the state of CC within the asm snippet itself and pushing the status to an output register), but if at all possible I'd like to use goto labels. Any help with solving this would be much appreciated.