### 13.3.2. Operations using register banks

The register file organization supports four types of operations described in the following sections:

#### Scalar-only instructions

An instruction is a scalar-only operation if the operands are treated as scalars and the result is a scalar.

Clearing the LEN field in the FPSCR Register selects a vector length of one iteration. For example, if the LEN field contains b000, then the following operation writes the sum of the single-precision values in S21 and S22 to S12:

`FADDS S12, S21, S22`

Some instructions can operate only on scalar data regardless of the value in the LEN field. These instructions are:

Compare operations

`FCMPS/D`, `FCMPZS/D`, `FCMPES/D`, and `FCMPEZS/D`.

Integer conversions

`FTOUIS/D`, `FTOUIZS/D`, `FTOSIS/D`, `FTOSIZS/D`, `FUITOS/D`, and `FSITOS/D`.

Precision conversions

`FCVTDS` and `FCVTSD`.

Fixed-point instructions

`FSHTOS/D`, `FSCTOS/D`, `FUHTOS/D`, `FULTOS/D`, `FTOSHS/D`, `FTOSLS/D`, FTOUHS/D, and `FTOULS/D`.

#### Short vector-only instructions

Vector-only instructions require that the value in the LEN field is nonzero, and that the destination and Fm registers are not in bank 0.

Example 13.2 shows the iterations of the following short vector instruction:

```FMACS S16, S0, S8
```

In the example, the LEN field contains b011, selecting a vector length of four iterations, and the STRIDE field contains b00, selecting a vector stride of one.

Example 13.2. Short vector instruction

```FMACS S16, S0, S8    ; 1st iteration
```
```FMACS S17, S1, S9    ; 2nd iteration
```
```FMACS S18, S2, S10   ; 3rd iteration
```
```FMACS S19, S3, S11   ; 4th and last iteration
```

#### Short vector instructions with scalar source

The VFPv3 architecture enables a vector to be operated on by a scalar operand. The destination must be a vector, that is, not in bank 0, and the Fm operand must be in bank 0.

Example 13.3 shows the iterations of the following short vector instruction with a scalar source:

```FMULD D12, D8, D2
```

In the example, the LEN field contains b001, selecting a vector length of two iterations, and the STRIDE field contains b00, selecting a vector stride of one.

Example 13.3. Short vector instruction with scalar source

```FMULD D12, D8, D2    ; 1st iteration
```
```FMULD D13, D9, D2    ; 2nd and last iteration
```

This scales the two source registers, D8 and D9, by the value in D2 and writes the new values to D12 and D13.

#### Scalar instructions in short vector mode

You can mix scalar and short vector operations by carefully selecting the source and destination registers. If the destination is in bank 0 or bank 4, the operation is scalar-only regardless of the value in the LEN field. You do not have to change the LEN field from a nonzero value to b000 to perform scalar operations.

Example 13.4 shows the sequence of operations for the following instructions:

```FABSD D4, D8
```
```FADDS S0, S0, S31
```
```FMULS S24, S26, S1
```

In the example, the LEN field contains b001, selecting a vector length of two iterations, and the STRIDE field contains b00, selecting a vector stride of one.

Example 13.4. Scalar operation in short vector mode

```FABSD D4, D8        ; vector DP ABS operation on regs (D8, D9) to (D4, D5)
```
```FABSD D5, D9
```
```FADDS S0, S0, S31   ; scalar increment of S0 by S31
```
```FMULS S24, S26, S1  ; vector (S26, S27) scaled by S1 and written to (S24, S25)
```
```FMULS S25, S27, S1
```

The tables that follow show the four types of operations possible in the VFPv3 architecture. In the tables, Any refers to the availability of all registers in the precision for the specified operand. S refers to a scalar operand with only a single register. V refers to a vector operand with multiple registers. Table 13.1 describes single-precision three-operand register usage.

Table 13.1. Single-precision three-operand register usage

LEN field

Fd

Fn

Fm

Operation type

b000

Any

Any

Any

S = S op S OR S = S S S

Nonzero

0-7

Any

Any

S = S op S OR S = S S S

Nonzero

8-31

Any

0-7

V = V op S OR V = V V S

Nonzero

8-31

Any

8-31

V = V op V OR V = V V V

Table 13.2 describes single-precision two-operand register usage.

Table 13.2. Single-precision two-operand register usage

LEN field

Fd

Fm

Operation type

b000

Any

Any

S = op S

Nonzero

0-7

Any

S = op S

Nonzero

8-31

0-7

V = op S

Nonzero

8-31

8-31

V = op V

Table 13.3 describes double-precision three-operand register usage.

Table 13.3. Double-precision three-operand register usage

LEN field

Fd

Fn

Fm

Operation type

b000

Any

Any

Any

S = S op S OR S = S S S

Nonzero

0-3, 16-19

Any

Any

S = S op S OR S = S S S

Nonzero

4-15

Any

0-3

V = V op S OR V = V V S

Nonzero

4-15

Any

4-15

V = V op V OR V = V V V

Table 13.4 describes double-precision two-operand register usage.

Table 13.4. Double-precision two-operand register usage

LEN field

Fd

Fm

Operation type

b000

Any

Any

S = op S

Nonzero

0-3, 16-19

Any

S = op S

Nonzero

4-15, 20-31

0-3

V = op S

Nonzero

4-15, 20-31

4-15

V = op V