(no commit message)
[libreriscv.git] / openpower / sv / cr_ops.mdwn
1 # Data-dependent fail-first on CR operations
2
3 Data-dependent SVP64 Vectorised Operations involving the creation or
4 modification of a CR require an extra two bits, which are not available
5 in the compact space of the `MODE` Field. With the concept of element
6 width overrides being meaningless for CR Fields it is possible to use the
7 `ELWIDTH` field for extra fields.
8
9 Condition Register based operations such as `mfcr` and `crand` can thus
10 be made more flexible. However the rules that apply in this section
11 also apply to future CR-based instructions. Note that these rules and
12 the alternative mapping **only** applies to instructions that **only**
13 reference a CR Field or CR bit as the sole exclusive result. This section
14 **does not** apply to instructions which primarily produce arithmetic
15 results that also produce a CR Field (such as when Rc=1).
16
17 SVP64 RM `MODE` (includes `ELWIDTH` bits) for CR-based operations:
18
19 | 4 | 5 | 19-20 | 21 | 22 23 | description |
20 | - | - | ----- | --- |---------|----------------- |
21 |dz |VLi| 01 | inv | CR-bit | normal mode |
22 |sz |VLi| 01 | inv | dz Rc1 | VLSET mode |
23
24 Fields:
25
26 There are two primary different types of CR operations:
27
28 * Those which have a 3-bit operand field (referring to a CR Field)
29 * Those which have a 5-bit operand (referring to a bit within the
30 whole 32-bit CR)
31
32 Examining these two as has already been done it is observed that the
33 difference may be considered to be that the 5-bit variant provides
34 additional information about which CR Field bit (EQ, GE, LT, SO) is to
35 be operated on by the instruction.
36
37 Thus, logically, we may set the following rule:
38
39 * When a 5-bit CR Result field is used in an instruction, the
40 `inv, VLi and RC1` variant of Data-Dependent Fail-First
41 must be used. i.e. the bit of the CR field to be tested is
42 the one that has just been modified by the operation.
43 * When a 3-bit CR Result field is used the `inv CRbit` variant
44 must be used in order to select which CR Field bit shall
45 be tested (EQ, LE, GE, SO).
46
47 Examples of the former type:
48
49 * crand, cror, crnor. These all are 5-bit (BA, BB, BT). The bit
50 to be tested against `inv` is the one selected by `BT`
51 * mcrf. This has only 3-bit (BF, BFA). In order to select the
52 bit to be tested, the alternative FFirst encoding must be used.
53
54 This limits sv.mcrf in that it may not use the `VLi` (VL inclusive)
55 Mode. This is unfortunste but unavoidable due to encoding pressure
56 on SVP64.
57