| 1 |
/* Definitions of target machine for GNU compiler, for CRIS. |
| 2 |
Copyright (C) 2002-2025 Free Software Foundation, Inc. |
| 3 |
|
| 4 |
This file is part of GCC. |
| 5 |
|
| 6 |
GCC is free software; you can redistribute it and/or modify |
| 7 |
it under the terms of the GNU General Public License as published by |
| 8 |
the Free Software Foundation; either version 3, or (at your option) |
| 9 |
any later version. |
| 10 |
|
| 11 |
GCC is distributed in the hope that it will be useful, |
| 12 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 |
GNU General Public License for more details. |
| 15 |
|
| 16 |
You should have received a copy of the GNU General Public License |
| 17 |
along with GCC; see the file COPYING3. If not see |
| 18 |
<http://www.gnu.org/licenses/>. */ |
| 19 |
|
| 20 |
/* Node: Condition Code */ |
| 21 |
|
| 22 |
/* The mode used for condition-codes depends on both the way the |
| 23 |
condition-codes are generated (the CC-setter, typically the compare |
| 24 |
instruction), and used (the CC-user, typically a branch). For CRIS, we |
| 25 |
have ordinary compares and incidental condition-code settings from |
| 26 |
preceding instructions, setting a subset of N, Z, V and C to usable |
| 27 |
values, from the perspective of comparing the result against zero |
| 28 |
(referred to below as "fpcraz"). The two subsets meaningful to gcc are |
| 29 |
all of N, Z, V, C versus just N, Z; some CC-users care only about N |
| 30 |
and/or Z and some that care about at least one of those flags together |
| 31 |
with V and/or C. |
| 32 |
|
| 33 |
The plain "CC_MODE (CC)" (which is always present in gcc), is used to |
| 34 |
reflect the "unoptimized" state, where the CC-setter is a compare |
| 35 |
against zero and the CC-user is any branch or s<condition> instruction, |
| 36 |
before reload. After reload, a need for C or V is reflected as |
| 37 |
CC_NZVCmode in both setters and users, and others remain CCmode, until |
| 38 |
or if optimization of CC-setter and CC-users, when CCmode setters can |
| 39 |
be changed or replaced by either CC_NZmode or CC_NZVCmode. To wit, all |
| 40 |
users that require CC_NZVCmode must match only that mode at any time. |
| 41 |
All other users must match all of CCmode, CC_NZmode, and CC_NZVCmode. |
| 42 |
All setters that set only CC_NZmode must match setting only that mode. |
| 43 |
All other setters must match setting all of CCmode, CC_NZmode, and |
| 44 |
CC_NZVCmode. |
| 45 |
|
| 46 |
There's also other modes (i.e. CC_ZnNmode) with a separate set of |
| 47 |
setters and users not matched by the others. */ |
| 48 |
|
| 49 |
/* Z and N flags only. For a condition-code setter: only the Z and N |
| 50 |
flags are set to usable values, fpcraz. For a condition-code user: the |
| 51 |
operation using the condition codes only care about the Z and N flags. */ |
| 52 |
CC_MODE (CC_NZ); |
| 53 |
|
| 54 |
/* Z and N *and* V and C flags. For a condition-code setter: all flags |
| 55 |
are set to usable values, fpcraz. For a condition-code user: at least |
| 56 |
one of V and C are used and possibly N and Z too. */ |
| 57 |
CC_MODE (CC_NZVC); |
| 58 |
|
| 59 |
/* The result of a btst / btstq instruction for extracting a single bit |
| 60 |
goes negated into the N flag, or in olde cc0-parlance, CC_Z_IN_NOT_N. */ |
| 61 |
CC_MODE (CC_ZnN); |