<s>
A	O
status	B-General_Concept
register	I-General_Concept
,	O
flag	B-General_Concept
register	I-General_Concept
,	O
or	O
condition	B-General_Concept
code	I-General_Concept
register	I-General_Concept
(	O
CCR	O
)	O
is	O
a	O
collection	O
of	O
status	O
flag	O
bits	O
for	O
a	O
processor	B-General_Concept
.	O
</s>
<s>
Examples	O
of	O
such	O
registers	O
include	O
FLAGS	B-General_Concept
register	I-General_Concept
in	O
the	O
x86	B-Operating_System
architecture	I-Operating_System
,	O
flags	B-General_Concept
in	O
the	O
program	B-Device
status	I-Device
word	I-Device
(	O
PSW	O
)	O
register	O
in	O
the	O
IBM	B-Device
System/360	I-Device
architecture	I-Device
through	O
z/Architecture	B-Device
,	O
and	O
the	O
application	O
program	O
status	B-General_Concept
register	I-General_Concept
(	O
APSR	O
)	O
in	O
the	O
ARM	O
Cortex-A	O
architecture	O
.	O
</s>
<s>
The	O
status	B-General_Concept
register	I-General_Concept
is	O
a	O
hardware	B-General_Concept
register	I-General_Concept
that	O
contains	O
information	O
about	O
the	O
state	O
of	O
the	O
processor	B-General_Concept
.	O
</s>
<s>
Individual	O
bits	O
are	O
implicitly	O
or	O
explicitly	O
read	O
and/or	O
written	O
by	O
the	O
machine	B-Language
code	I-Language
instructions	O
executing	O
on	O
the	O
processor	B-General_Concept
.	O
</s>
<s>
The	O
status	B-General_Concept
register	I-General_Concept
lets	O
an	O
instruction	O
take	O
action	O
contingent	O
on	O
the	O
outcome	O
of	O
a	O
previous	O
instruction	O
.	O
</s>
<s>
Typically	O
,	O
flags	B-General_Concept
in	O
the	O
status	B-General_Concept
register	I-General_Concept
are	O
modified	O
as	O
effects	O
of	O
arithmetic	O
and	O
bit	O
manipulation	O
operations	O
.	O
</s>
<s>
Other	O
classes	O
of	O
instructions	O
may	O
also	O
modify	O
the	O
flags	B-General_Concept
to	O
indicate	O
status	O
.	O
</s>
<s>
The	O
flags	B-General_Concept
are	O
read	O
by	O
a	O
subsequent	O
conditional	O
instruction	O
so	O
that	O
the	O
specified	O
action	O
(	O
depending	O
on	O
the	O
processor	B-General_Concept
,	O
a	O
jump	O
,	O
call	O
,	O
return	O
,	O
or	O
so	O
on	O
)	O
occurs	O
only	O
if	O
the	O
flags	B-General_Concept
indicate	O
a	O
specified	O
result	O
of	O
the	O
earlier	O
instruction	O
.	O
</s>
<s>
Some	O
CPU	O
architectures	O
,	O
such	O
as	O
the	O
MIPS	B-Device
and	O
Alpha	B-Device
,	O
do	O
not	O
use	O
a	O
dedicated	O
flag	B-General_Concept
register	I-General_Concept
.	O
</s>
<s>
Others	O
do	O
not	O
implicitly	O
set	O
and/or	O
read	O
flags	B-General_Concept
.	O
</s>
<s>
A	O
status	B-General_Concept
register	I-General_Concept
may	O
often	O
have	O
other	O
fields	O
as	O
well	O
,	O
such	O
as	O
more	O
specialized	O
flags	B-General_Concept
,	O
interrupt	B-Application
enable	O
bits	O
,	O
and	O
similar	O
types	O
of	O
information	O
.	O
</s>
<s>
During	O
an	O
interrupt	B-Application
,	O
the	O
status	O
of	O
the	O
thread	O
currently	O
executing	O
can	O
be	O
preserved	O
(	O
and	O
later	O
recalled	O
)	O
by	O
storing	O
the	O
current	O
value	O
of	O
the	O
status	B-General_Concept
register	I-General_Concept
along	O
with	O
the	O
program	B-General_Concept
counter	I-General_Concept
and	O
other	O
active	O
registers	O
into	O
the	O
machine	B-General_Concept
stack	I-General_Concept
or	O
some	O
other	O
reserved	O
area	O
of	O
memory	O
.	O
</s>
<s>
This	O
is	O
a	O
list	O
of	O
the	O
most	O
common	O
CPU	O
status	B-General_Concept
register	I-General_Concept
flags	B-General_Concept
,	O
implemented	O
in	O
almost	O
all	O
modern	O
processors	O
.	O
</s>
<s>
FlagNameDescriptionZ	O
Zero	B-Algorithm
flag	I-Algorithm
Indicates	O
that	O
the	O
result	O
of	O
an	O
arithmetic	O
or	O
logical	O
operation	O
(	O
or	O
,	O
sometimes	O
,	O
a	O
load	O
)	O
was	O
zero.C	O
Carry	B-Algorithm
flag	I-Algorithm
Enables	O
numbers	O
larger	O
than	O
a	O
single	O
word	O
to	O
be	O
added/subtracted	O
by	O
carrying	O
a	O
binary	O
digit	O
from	O
a	O
less	O
significant	O
word	O
to	O
the	O
least	O
significant	O
bit	O
of	O
a	O
more	O
significant	O
word	O
as	O
needed	O
.	O
</s>
<s>
It	O
is	O
also	O
used	O
to	O
extend	O
bit	O
shifts	O
and	O
rotates	O
in	O
a	O
similar	O
manner	O
on	O
many	O
processors	O
(	O
sometimes	O
done	O
via	O
a	O
dedicated	O
X	O
flag	O
)	O
.S	O
/	O
N	O
Sign	B-Algorithm
flag	I-Algorithm
Negative	B-Algorithm
flag	I-Algorithm
Indicates	O
that	O
the	O
result	O
of	O
a	O
mathematical	O
operation	O
is	O
negative	O
.	O
</s>
<s>
In	O
some	O
processors	O
,	O
the	O
N	O
and	O
S	O
flags	B-General_Concept
are	O
distinct	O
with	O
different	O
meanings	O
and	O
usage	O
:	O
One	O
indicates	O
whether	O
the	O
last	O
result	O
was	O
negative	O
whereas	O
the	O
other	O
indicates	O
whether	O
a	O
subtraction	O
or	O
addition	O
has	O
taken	O
place.V	O
/	O
O	O
/	O
W	O
Overflow	B-Algorithm
flag	I-Algorithm
Indicates	O
that	O
the	O
signed	O
result	O
of	O
an	O
operation	O
is	O
too	O
large	O
to	O
fit	O
in	O
the	O
register	O
width	O
using	O
two	B-General_Concept
's	I-General_Concept
complement	I-General_Concept
representation	O
.	O
</s>
<s>
On	O
some	O
processors	O
,	O
the	O
status	B-General_Concept
register	I-General_Concept
also	O
contains	O
flags	B-General_Concept
such	O
as	O
these	O
:	O
</s>
<s>
FlagNameDescriptionH	O
/	O
A	O
/	O
DC	O
Half-carry	B-Device
flag	I-Device
Auxiliary	O
flag	O
Digit	O
Carry	O
Decimal	B-Device
adjust	I-Device
flag	O
Indicates	O
that	O
a	O
bit	O
carry	O
was	O
produced	O
between	O
the	O
nibbles	O
(	O
typically	O
between	O
the	O
4-bit	O
halves	O
of	O
a	O
byte	O
operand	O
)	O
as	O
a	O
result	O
of	O
the	O
last	O
arithmetic	O
operation	O
.	O
</s>
<s>
Such	O
a	O
flag	O
is	O
generally	O
useful	O
for	O
implementing	O
BCD	O
arithmetic	O
operations	O
on	O
binary	O
hardware.P	O
Parity	B-General_Concept
flag	I-General_Concept
Indicates	O
whether	O
the	O
number	O
of	O
set	O
bits	O
of	O
the	O
last	O
result	O
is	O
odd	O
or	O
even.I	O
Interrupt	B-Device
flag	I-Device
On	O
some	O
processors	O
,	O
this	O
bit	O
indicates	O
whether	O
interrupts	B-Application
are	O
enabled	O
or	O
masked	O
.	O
</s>
<s>
If	O
the	O
processor	B-General_Concept
has	O
multiple	O
interrupt	B-Application
priority	O
levels	O
,	O
such	O
as	O
the	O
PDP-11	O
,	O
several	O
bits	O
may	O
be	O
used	O
to	O
indicate	O
the	O
priority	O
of	O
the	O
current	O
thread	O
,	O
allowing	O
it	O
to	O
be	O
interrupted	O
only	O
by	O
hardware	O
set	O
to	O
a	O
higher	O
priority	O
.	O
</s>
<s>
On	O
other	O
architectures	O
,	O
a	O
bit	O
may	O
indicate	O
that	O
an	O
interrupt	B-Application
is	O
currently	O
active	O
,	O
and	O
that	O
the	O
current	O
thread	O
is	O
part	O
of	O
an	O
interrupt	B-Application
handler.S	O
Supervisor	O
flag	O
On	O
processors	O
that	O
provide	O
two	O
or	O
more	O
protection	B-Operating_System
rings	I-Operating_System
,	O
one	O
or	O
more	O
bits	O
in	O
the	O
status	B-General_Concept
register	I-General_Concept
indicate	O
the	O
ring	O
of	O
the	O
current	O
thread	O
(	O
how	O
trusted	O
it	O
is	O
,	O
or	O
whether	O
it	O
must	O
use	O
the	O
operating	O
system	O
for	O
requests	O
that	O
could	O
hinder	O
other	O
threads	O
)	O
.	O
</s>
<s>
On	O
a	O
processor	B-General_Concept
with	O
only	O
two	O
rings	O
,	O
a	O
single	O
bit	O
may	O
distinguish	O
Supervisor	O
from	O
User	O
mode	O
.	O
</s>
<s>
Status	O
flags	B-General_Concept
enable	O
an	O
instruction	O
to	O
act	O
based	O
on	O
the	O
result	O
of	O
a	O
previous	O
instruction	O
.	O
</s>
<s>
In	O
pipelined	B-General_Concept
processors	I-General_Concept
,	O
such	O
as	O
superscalar	B-General_Concept
and	O
speculative	B-General_Concept
processors	O
,	O
this	O
can	O
create	O
hazards	B-General_Concept
that	O
slow	O
processing	O
or	O
require	O
extra	O
hardware	O
to	O
work	O
around	O
them	O
.	O
</s>
<s>
Some	O
very	B-General_Concept
long	I-General_Concept
instruction	I-General_Concept
word	I-General_Concept
processors	O
dispense	O
with	O
the	O
status	O
flags	B-General_Concept
.	O
</s>
<s>
Another	O
alternative	O
to	O
the	O
status	B-General_Concept
register	I-General_Concept
is	O
for	O
processor	B-General_Concept
instructions	O
to	O
deposit	O
status	O
information	O
in	O
a	O
general-purpose	O
register	O
when	O
the	O
program	O
requests	O
it	O
.	O
</s>
<s>
MIPS	B-Device
,	O
AMD	B-General_Concept
29000	I-General_Concept
,	O
DEC	B-Device
Alpha	I-Device
,	O
and	O
RISC-V	B-Device
are	O
examples	O
of	O
architectures	O
that	O
provide	O
comparison	O
instructions	O
that	O
store	O
the	O
comparison	O
result	O
in	O
a	O
general-purpose	O
register	O
,	O
as	O
a	O
single	O
bit	O
or	O
a	O
numeric	O
value	O
of	O
0	O
or	O
1	O
.	O
</s>
<s>
For	O
example	O
,	O
MIPS	B-Device
has	O
no	O
"	O
carry	B-Algorithm
bit	I-Algorithm
"	O
but	O
a	O
program	O
performing	O
multiple-word	O
addition	O
can	O
test	O
whether	O
a	O
single-word	O
addition	O
of	O
registers	O
overflowed	O
by	O
testing	O
whether	O
the	O
sum	O
is	O
lower	O
than	O
an	O
operand	O
:	O
</s>
<s>
(	O
Here	O
,	O
the	O
general-purpose	O
register	O
tmp	O
is	O
not	O
used	O
as	O
a	O
status	B-General_Concept
register	I-General_Concept
to	O
govern	O
a	O
conditional	O
jump	O
;	O
rather	O
,	O
the	O
possible	O
value	O
of	O
1	O
,	O
indicating	O
carry	O
from	O
the	O
low-order	O
addition	O
,	O
is	O
added	O
to	O
the	O
high-order	O
word	O
.	O
)	O
</s>
