Document revision date: 30 March 2001
[Compaq] [Go to the documentation home page] [How to order documentation] [Help on this site] [How to contact us]
[OpenVMS documentation]

VAX MACRO and Instruction Set Reference Manual


Previous Contents Index


REMQUE

Remove Entry from Queue

Format

opcode entry.ab,addr.wl

Condition Codes

N|| <--- (entry) LSS (entry+4);  
Z|| <--- (entry) EQL (entry+4); ! Queue empty  
V|| <--- (entry) EQL (entry+4); ! No entry to remove  
C|| <--- (entry) LSSU (entry+4);  

Exceptions

None.

Opcodes

0F REMQUE Remove Entry from Queue

Description

The queue entry specified by the entry operand is removed from the queue. The address operand is replaced by the address of the entry removed. If there was no entry in the queue to be removed, the condition code V-bit is set; otherwise it is cleared. If the queue is empty at the end of this instruction, the condition code Z-bit is set; otherwise it is cleared. The removal is a noninterruptible operation. Before performing any part of the operation, the processor validates that the entire operation can be completed. This ensures that if a memory management exception occurs (see Appendix E), the queue is left in a consistent state.

Notes

  1. The following three types of removal can be performed by suitable choice of entry operand:
  2. Because the removal is noninterruptible, processes running in kernel mode can share queues with interrupt service routines.
  3. The INSQUE and REMQUE instructions are implemented so that cooperating software processes in a single processor may access a shared list without additional synchronization, if the insertions and removals are only at the head or tail of the queue.
  4. To release a software interlock realized with a queue, you can use the following:


           REMQUE  ...             ; Queue empty? 
           BEQL    1$              ; Yes 
           CALL    ACTIVATE(...)   ; Activate other waiters 
     
    1$: 
    

  5. To remove entries until the queue is empty, you can use the following:


    1$:    REMQUE  ...             ; Anything removed? 
           BVS     EMPTY           ; No 
             . 
             . 
             . 
           BR      1$ 
    

  6. During access validation, any access that cannot be completed results in a memory management exception, even though the queue removal is not started.

9.2.8 Floating-Point Instructions

Floating-point instructions operate on the following four data types:

To be consistent with the floating-point instruction set, which faults on reserved operands (see Chapter 8), software-implemented floating-point functions (for example, the absolute function) should verify that no input operands are reserved. An easy way to do this is a floating move or test of the input operands.

To make high-speed, floating-point operations easier, restrictions are placed on the addressing mode combinations usable within a single floating-point instruction. These combinations involve the logically inconsistent simultaneous use of a value as both a floating-point operand and an address.

If, within the same instruction, you use the contents of register Rn as both a part of a floating-point input operand (an .rf, .rd, .rg, .rh, .mf, .md, .mg, or .mh operand) and as an address in an addressing mode that modifies Rn (autoincrement, autodecrement, or autoincrement deferred), the value of the floating-point operand is UNPREDICTABLE.

9.2.8.1 Introduction

Mathematically, a floating-point number may be defined as having the following form:

(+ or -) (2**K)*f

where K is an integer and f is a nonnegative fraction. For a nonvanishing number, K and f are uniquely determined by imposing the following condition:


1/2 LEQ f LSS 1. 

The fractional factor, f, of the number is then said to be binary normalized. For the number 0, f must be assigned the value zero, and the value of K is indeterminate.

VAX derives these floating-point data formats from this mathematical representation for floating-point numbers. Four types of floating-point data are provided: the two standard PDP-11 formats (F_floating and D_floating), and two extended-range formats (G_floating and H_floating). Single-precision, or floating, data is 32 bits long. Double-precision, or D_floating, data is 64 bits long. Extended-range double-precision, or G_floating, data is 64 bits long. Extended-range quadruple-precision, or H_floating, data is 128 bits long. Use sign magnitude notation as follows:

  1. Nonzero floating-point numbers:
    The most significant bit of the floating-point data is the sign bit: 0 for positive and 1 for negative.
    The fractional factor f is assumed normalized, so that its most significant bit must be 1. This 1 is the "hidden" bit: it is not stored in the data word, but the hardware restores it before carrying out arithmetic operations. The F_floating and D_floating data types use 23 and 55 bits, respectively, for f, which, with the hidden bit, imply effective significance of 24 bits and 56 bits for arithmetic operations. The extended-range (G_floating and H_floating) data types use 52 and 112 bits, respectively, for f, which, with the hidden bit, imply effective significance of 53 and 113 bits for arithmetic operations.
    In the F_floating and D_floating data types, 8 bits are reserved for the storage of the exponent K in excess 128 notation. Thus, exponents from -128 to +127 could be represented, in biased form, by 0 to 255. For reasons given later, a biased exponent of zero (the true exponent of -128) is reserved for floating-point zero. Thus, for F_floating and D_floating data types, exponents are restricted to the range -127 to +127 inclusive or, in excess 128 notation, 1 to 255.
    In the G_floating data type, 11 bits are reserved for the storage of the exponent in excess 1024 notation. In the H_floating data type, 15 bits are reserved for the storage of the exponent in excess 16,384 notation. A biased exponent of zero is reserved for floating-point zero. Thus, exponents are restricted to -1023 to +1023 inclusive (in excess notation, 1 to 2047), and -16,383 to +16,383 inclusive (in excess notation, 1 to 32,767) for G_floating and H_floating data types, respectively.
  2. Floating-point 0:
    Because of the hidden bit, the fractional factor is not available to distinguish between zero and nonzero numbers whose fractional factor is exactly 1/2. Therefore, the VAX reserves a sign-exponent field of zero for this purpose. Any positive floating-point number with a biased exponent of zero is treated as if it were an exact zero by the floating-point instruction set. In particular, a floating-point operand whose bits are all zeros is treated as zero, and this is the format generated by all floating-point instructions for which the result is zero.
  3. The reserved operands:
    A reserved operand is defined to be any bit pattern with a sign bit of 1 and a biased exponent of zero. On the VAX, all floating-point instructions generate a fault if a reserved operand is encountered. A reserved operand is never generated as a result of a floating-point instruction. Scalar floating-point instructions never generate a reserved operand. However, vector floating-point instructions can generate reserved operands.

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

floating overflow
floating underflow
reserved operand

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

None.

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.


Previous Next Contents Index

  [Go to the documentation home page] [How to order documentation] [Help on this site] [How to contact us]  
  privacy and legal statement  
4515PRO_023.HTML