This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
What registers are protected by "cc" in a clobberlist when using inline assembly?
- From: Jeffrey Walton <noloader at gmail dot com>
- To: "gcc-help at gcc dot gnu dot org" <gcc-help at gcc dot gnu dot org>
- Date: Tue, 4 Feb 2014 16:16:32 -0500
- Subject: What registers are protected by "cc" in a clobberlist when using inline assembly?
- Authentication-results: sourceware.org; auth=none
- Reply-to: noloader at gmail dot com
I'm having trouble locating information on the register(s) protected
by adding "cc" to a clobber list.
Can anyone confirm (1) FLAGS/EFLAGS on x86/c64, and (2) CPSR on ARM?
The reason I ask is I came across some code that sets the Carry Flag
(CF) on success, but "cc" was not specified in a clobber list:
char rc;
unsigned int val;
__asm__ volatile(
"rdrand %0 ; setc %1"
: "=r" (val), "=qm" (rc)
);
// 1 = success, 0 = underflow
if(rc) {
// use val
...
}
So I'm trying to understand why "cc" was not specified.
Thanks in advance. (And my apologies if this should have gone to a
Binutils list).