[OpenVMS documentation]
[Site home] [Send comments] [Help with this site] [How to order documentation] [OpenVMS site] [Compaq site]
Updated: 11 December 1998

VAX MACRO and Instruction Set Reference Manual


Previous Contents Index

9.2.8.2 Overview of the Instruction Set

The VAX has the standard arithmetic operations ADD, SUB, MUL, and DIV implemented for all four floating-point data types. The results of these operations are always rounded, as described in Section 9.2.8.3. In addition, VAX has two composite operations, EMOD and POLY, also implemented for all four floating-point data types. EMOD generates a product of two operands and then separates the product into its integer and fractional terms. POLY evaluates a polynomial, given the degree, the argument, and a pointer to a table of coefficients. Details on the operation of EMOD and POLY are given in their respective descriptions. All of these instructions are subject to the rounding errors associated with floating-point operations, as well as to exponent overflow and underflow. Accuracy is discussed in Section 9.2.8.3. Exceptions are discussed in Appendix E.

The VAX architecture also has a complete set of instructions for conversion from integer arithmetic types (byte, word, longword) to all floating types (F_floating, D_floating, G_floating, H_floating), and vice versa. The VAX architecture also has a set of instructions for conversion between all of the floating types except between D_floating and G_floating. Many of these instructions are exact, in the sense defined in Section 9.2.8.3. However, a few may generate rounding error, floating overflow, or floating underflow, or induce integer overflow. Details are given in the description of the CVT instructions.

The following move-type instructions are always exact: MOV, NEG, CLR, CMP, and TST. The ACB (Add Compare and Branch) instruction is subject to rounding errors, overflow, and underflow.

All of the floating-point instructions on the VAX architecture fault if they encounter a reserved operand. Floating-point instructions also fault on the occurrence of floating overflow or divide by zero, and the condition codes are UNPREDICTABLE. The FU bit in the processor status word (PSW) is available to enable or disable an exception on underflow. If the FU bit is clear, no exception occurs on underflow and zero is returned as the result. If the FU bit is set, a fault occurs on underflow. Further details on the actions taken if any of these exceptions occurs are included in the descriptions of the instructions and discussed in Appendix E.

9.2.8.3 Accuracy

This section discusses general comments on the accuracy of the VAX floating-point instruction set. The descriptions of the individual instructions may include additional details on their accuracy.

An instruction is defined to be exact if its result, extended on the right by an infinite sequence of zeros, is identical to that of an infinite precision calculation involving the same operands. The prior accuracy of the operands is ignored. For all arithmetic operations except DIV, a zero operand implies that the instruction is exact. The instruction is exact for DIV if the 0 operand is the dividend. If the 0 operand is the divisor, division is undefined and the instruction faults.

For nonzero floating-point operands, the fractional factor is binary normalized with 24 or 56 bits for single-precision (F_floating) or double-precision (D_floating), respectively; and 53 or 113 bits for extended-range double-precision (G_floating), and extended-range quadruple-precision (H_floating), respectively. The ADD, SUB, MUL, and DIV instructions require an overflow bit (on the left) and two guard bits (on the right) to guarantee the return of a rounded result identical to the corresponding infinite precision operation rounded to the specified word length. With these two guard bits, a rounded result has an error bound of 1/2 LSB (least significant bit).

Note that an arithmetic result is exact if no nonzero bits are lost in chopping the infinite precision result to the data length to be stored. Chopping is defined to mean that the 24 (F_floating), 56 (D_floating), 53 (G_floating), or 113 (H_floating) high-order bits of the normalized fractional factor of a result are stored; the rest of the bits are discarded. The first bit lost in chopping is referred to as the "rounding" bit. The value of a rounded result is related to the chopped result as follows:

All VAX processors implement rounding to produce results identical to the results produced by the following algorithm: add a 1 to the rounding bit and propagate the carry, if it occurs. Note that a renormalization may be required after rounding takes place. If this occurs, the new rounding bit will be 0; therefore, it can occur only once. The following statements summarize the relations among chopped, rounded, and true (infinite precision) results:

9.2.8.4 Instruction Descriptions

The following instructions are described in this section:
  Description and Opcode Number of Instructions
1. Add 2 Operand
ADD{F,D,G,H}2 add.rx, sum.mx
4
2. Add 3 Operand
ADD{F,D,G,H}3 add1.rx, add2.rx, sum.wx
4
3. Clear
CLR{L=F,Q=D=G,O=H} dst.wx
3
4. Compare
CMP{F,D,G,H} src1.rx, src2.rx
4
5. Convert
CVT{F,D,G,H}{B,W,L,F,D,G,H} src.rx, dst.wy
CVT{B,W,L}{F,D,G,H} src.rx, dst.wy
All pairs except FF,DD,GG,HH,DG, and GD
34
6. Convert Rounded
CVTR{F,D,G,H}L src.rx, dst.wl
4
7. Divide 2 Operand
DIV{F,D,G,H}2 divr.rx, quo.mx
4
8. Divide 3 Operand
DIV{F,D,G,H}3 divr.rx, divd.rx, quo.wx
4
9. Extended Modulus
EMOD{F,D} mulr.rx, mulrx.rb, muld.rx,
int.wl, fract.wx
EMOD{G,H} mulr.rx, mulrx.rw, muld.rx,
int.wl, fract.wx
4
10. Move Negated
MNEG{F,D,G,H} src.rx, dst.wx
4
11. Move
MOV{F,D,G,H} src.rx, dst.wx
4
12. Multiply 2 Operand
MUL{F,D,G,H}2 mulr.rx, prod.mx
4
13. Multiply 3 Operand
MUL{F,D,G,H}3 mulr.rx, muld.rx, prod.wx
4
14. Polynomial Evaluation F_floating
POLYF arg.rf, degree.rw, tbladdr.ab,
{R0-3.wl}
1
15. Polynomial Evaluation D_floating
POLYD arg.rd, degree.rw, tbladdr.ab,
{R0-5.wl}
1
16. Polynomial Evaluation G_floating
POLYG arg.rg, degree.rw, tbladdr.ab,
{R0-5.wl}
1
17. Polynomial Evaluation H_floating
POLYH arg.rh, degree.rw, tbladdr.ab,
{R0-5.wl,-16(SP):-1(SP).wb}
1
18. Subtract 2 Operand
SUB{F,D,G,H}2 sub.rx, dif.mx
4
19. Subtract 3 Operand
SUB{F,D,G,H}3 sub.rx, min.rx, dif.wx
4
20. Test
TST{F,D,G,H} src.rx
4

The following floating-point instructions are described in Section 9.2.4.
  Description and Opcode Number of Instructions
1. Add Compare and Branch
ACB{F,D,G,H} limit.rx, add.rx, index.mx,
displ.bw
4
  Compare is LE on positive add, GE on
negative add.
 


ADD

Add

Format

2operand: opcode add.rx, sum.mx

3operand: opcode add1.rx, add2.rx, sum.wx

Condition Codes

N|| <--- sum LSS 0;  
Z|| <--- sum EQL 0;  
V|| <--- 0;  
C|| <--- 0;  

Exceptions

Opcodes

40 ADDF2 Add F_floating 2 Operand
41 ADDF3 Add F_floating 3 Operand
60 ADDD2 Add D_floating 2 Operand
61 ADDD3 Add D_floating 3 Operand
40FD ADDG2 Add G_floating 2 Operand
41FD ADDG3 Add G_floating 3 Operand
60FD ADDH2 Add H_floating 2 Operand
61FD ADDH3 Add H_floating 3 Operand

Description

In 2 operand format, the addend operand is added to the sum operand, and the sum operand is replaced by the rounded result. In 3 operand format, the addend 1 operand is added to the addend 2 operand, and the sum operand is replaced by the rounded result.

Notes

  1. On a reserved operand fault, the sum operand is unaffected, and the condition codes are UNPREDICTABLE.
  2. On floating underflow, if FU is set, a fault occurs. Zero is stored as the result of floating underflow only if FU is clear. On a floating underflow fault, the sum operand is unaffected. If FU is clear, the sum operand is replaced by zero, and no exception occurs.
  3. On floating overflow, the instruction faults, the sum operand is unaffected, and the condition codes are UNPREDICTABLE.

CLR

Clear

Format

opcode dst.wx

Condition Codes

N|| <--- 0;  
Z|| <--- 1;  
V|| <--- 0;  
C|| <--- C;  

Exceptions

Opcodes

D4 CLRF Clear F_floating
7C CLRD Clear D_floating,
  CLRG Clear G_floating
7CFD CLRH Clear H_floating

Description

The destination operand is replaced by zero.

Note

CLRx dst is equivalent to MOVx S^#0, dst, but is 1 byte shorter.


CMP

Compare

Format

opcode src1.rx, src2.rx

Condition Codes

N|| <--- src1 LSS src2;  
Z|| <--- src1 EQL src2;  
V|| <--- 0;  
C|| <--- 0;  

Exceptions

Opcodes

51 CMPF Compare F_floating
71 CMPD Compare D_floating
51FD CMPG Compare G_floating
71FD CMPH Compare H_floating

Description

The source 1 operand is compared with the source 2 operand. The only action is to affect the condition codes.

CVT

Convert

Format

opcode src.rx, dst.wy

Condition Codes

N|| <--- dst LSS 0;  
Z|| <--- dst EQL 0;  
V|| <--- {integer overflow};  
C|| <--- 0;  

Exceptions

Opcodes

4C CVTBF Convert Byte to F_floating
6C CVTBD Convert Byte to D_floating
4CFD CVTBG Convert Byte to G_floating
6CFD CVTBH Convert Byte to H_floating
4D CVTWF Convert Word to F_floating
6D CVTWD Convert Word to D_floating
4DFD CVTWG Convert Word to G_floating
6DFD CVTWH Convert Word to H_floating
4E CVTLF Convert Long to F_floating
6E CVTLD Convert Long to D_floating
4EFD CVTLG Convert Long to G_floating
6EFD CVTLH Convert Long to H_floating
48 CVTFB Convert F_floating to Byte
68 CVTDB Convert D_floating to Byte
48FD CVTGB Convert G_floating to Byte
68FD CVTHB Convert H_floating to Byte
49 CVTFW Convert F_floating to Word
69 CVTDW Convert D_floating to Word
49FD CVTGW Convert G_floating to Word
69FD CVTHW Convert H_floating to Word
4A CVTFL Convert F_floating to Long
4B CVTRFL Convert Rounded F_floating to Long
6A CVTDL Convert D_floating to Long
6B CVTRDL Convert Rounded D_floating to Long
4AFD CVTGL Convert G_floating to Long
4BFD CVTRGL Convert Rounded G_floating to Long
6AFD CVTHL Convert H_floating to Long
6BFD CVTRHL Convert Rounded H_floating to Long
56 CVTFD Convert F_floating to D_floating
99FD CVTFG Convert F_floating to G_floating
98FD CVTFH Convert F_floating to H_floating
76 CVTDF Convert D_floating to F_floating
32FD CVTDH Convert D_floating to H_floating
33FD CVTGF Convert G_floating to F_floating
56FD CVTGH Convert G_floating to H_floating
F6FD CVTHF Convert H_floating to F_floating
F7FD CVTHD Convert H_floating to D_floating
76FD CVTHG Convert H_floating to G_floating

Description

The source operand is converted to the data type of the destination operand, and the destination operand is replaced by the result. The form of the conversion is as follows:
Form Instructions
Exact CVTBF, CVTBD, CVTBG, CVTBH, CVTWF, CVTWD, CVTWG, CVTWH, CVTLD, CVTLG, CVTLH, CVTFD, CVTFG, CVTFH, CVTDH, CVTGH
Truncated CVTFB, CVTDB, CVTGB, CVTHB, CVTFW, CVTDW, CVTGW, CVTHW, CVTFL, CVTDL, CVTGL, CVTHL
Rounded CVTLF, CVTRFL, CVTRDL, CVTRGL, CVTRHL, CVTDF, CVTGF, CVTHF, CVTHD, CVTHG

Notes

  1. Only CVTDF, CVTGF, CVTHF, CVTHD, and CVTHG can result in a floating overflow fault; the destination operand is unaffected, and the condition codes are UNPREDICTABLE.
  2. Only converts with a floating-point source operand can result in a reserved operand fault. On a reserved operand fault, the destination operand is unaffected, and the condition codes are UNPREDICTABLE.
  3. Only converts with an integer destination operand can result in integer overflow. On integer overflow, the destination operand is replaced by the low-order bits of the true result.
  4. Only CVTGF, CVTHF, CVTHD, and CVTHG can result in floating underflow. If FU is set, a fault occurs. On a floating underflow fault, the destination operand is unaffected. If FU is clear, the destination operand is replaced by zero, and no exception occurs.


Previous Next Contents Index

[Site home] [Send comments] [Help with this site] [How to order documentation] [OpenVMS site] [Compaq site]
[OpenVMS documentation]

Copyright © Compaq Computer Corporation 1998. All rights reserved.

Legal
4515PRO_023.HTML