 |
VAX MACRO and Instruction Set Reference Manual
CMP
Compare
Format
opcode src1.rx, src2.rx
Condition Codes
N|| <--- src1 LSS src2;
|
|
Z|| <--- src1 EQL src2;
|
|
V|| <--- 0;
|
|
C|| <--- 0;
|
|
Exceptions
reserved operand
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
integer overflow
floating overflow
floating underflow
reserved operand
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
- 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.
- 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.
- 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.
- 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.
DIV
Divide
Format
2operand: opcode divr.rx, quo.mx
3operand: opcode divr.rx, divd.rx, quo.wx
Condition Codes
N|| <--- quo LSS 0;
|
|
Z|| <--- quo EQL 0;
|
|
V|| <--- 0;
|
|
C|| <--- 0;
|
|
Exceptions
floating overflow
floating underflow
divide by zero
reserved operand
Opcodes
46
|
DIVF2
|
Divide F_floating 2 Operand
|
47
|
DIVF3
|
Divide F_floating 3 Operand
|
66
|
DIVD2
|
Divide D_floating 2 Operand
|
67
|
DIVD3
|
Divide D_floating 3 Operand
|
46FD
|
DIVG2
|
Divide G_floating 2 Operand
|
47FD
|
DIVG3
|
Divide G_floating 3 Operand
|
66FD
|
DIVH2
|
Divide H_floating 2 Operand
|
67FD
|
DIVH3
|
Divide H_floating 3 Operand
|
Description
In 2 operand format, the quotient operand is divided by the divisor
operand and the quotient operand is replaced by the rounded result. In
3 operand format, the dividend operand is divided by the divisor
operand, and the quotient operand is replaced by the rounded result.
Notes
- On a reserved operand fault, the quotient operand is unaffected,
and the condition codes are UNPREDICTABLE.
- On floating underflow, if FU is set, a fault occurs. On a floating
underflow fault, the quotient operand is unaffected. If FU is clear,
the quotient operand is replaced by zero, and no exception occurs.
- On floating overflow, the instruction faults, the quotient operand
is unaffected, and the condition codes are UNPREDICTABLE.
- On divide by zero, the quotient operand and condition codes are
affected, as in note 3.
EMOD
Extended Multiply and Integerize
Format
EMODF and EMODD:
opcode mulr.rx, mulrx.rb, muld.rx, int.wl, fract.wx
EMODG and EMODH:
opcode mulr.rx, mulrx.rw, muld.rx, int.wl, fract.wx
Condition Codes
N|| <--- fract LSS 0;
|
|
Z|| <--- fract EQL 0;
|
|
V|| <--- {integer overflow};
|
|
C|| <--- 0;
|
|
Exceptions
integer overflow
floating underflow
reserved operand
Opcodes
54
|
EMODF
|
Extended Multiply and Integerize F_floating
|
74
|
EMODD
|
Extended Multiply and Integerize D_floating
|
54FD
|
EMODG
|
Extended Multiply and Integerize G_floating
|
74FD
|
EMODH
|
Extended Multiply and Integerize H_floating
|
Description
The multiplier extension operand is concatenated with the multiplier
operand to gain 8 (EMODD and EMODF), 11 (EMODG), or 15 (EMODH)
additional low-order fraction bits. The low-order 5 or 1 bits of the
16-bit multiplier extension operand are ignored by the EMODG and EMODH
instructions, respectively. The multiplicand operand is multiplied by
the extended multiplier operand. The multiplication result is
equivalent to the exact product truncated (before normalization) to a
fraction field of 32 bits in F_floating, 64 bits in D_floating and
G_floating, and 128 bits in H_floating. The result is regarded as the
sum of an integer and fraction of the same sign. The integer operand is
replaced by the integer part of the result, and the fraction operand is
replaced by the rounded fractional part of the result.
Notes
- On a reserved operand fault, the integer operand, and the fraction
operand are unaffected. The condition codes are UNPREDICTABLE.
- On floating underflow, if FU is set, a fault occurs. On a floating
underflow fault, the integer and fraction parts are unaffected. If FU
is clear, the integer and fraction parts are replaced by zero, and no
exception occurs.
- On integer overflow, the integer operand is replaced by the
low-order bits of the true result.
- Floating overflow is indicated by integer overflow; however,
integer overflow is possible in the absence of floating overflow.
- The signs of the integer and fraction are the same unless integer
overflow results.
- Because the fraction part is rounded after separation of the
integer part, it is possible that the value of the fraction operand is
1.
MNEG
Move Negated
Format
opcode src.rx, dst.wx
Condition Codes
N|| <--- dst LSS 0;
|
|
Z|| <--- dst EQL 0;
|
|
V|| <--- 0;
|
|
C|| <--- 0;
|
|
Exceptions
reserved operand
Opcodes
52
|
MNEGF
|
Move Negated F_floating
|
72
|
MNEGD
|
Move Negated D_floating
|
52FD
|
MNEGG
|
Move Negated G_floating
|
72FD
|
MNEGH
|
Move Negated H_floating
|
Description
The destination operand is replaced by the negative of the source
operand.
MOV
Move
Format
opcode src.rx, dst.wx
Condition Codes
N|| <--- dst LSS 0;
|
|
Z|| <--- dst EQL 0;
|
|
V|| <--- 0;
|
|
C|| <--- C;
|
|
Exceptions
reserved operand
Opcodes
50
|
MOVF
|
Move F_floating
|
70
|
MOVD
|
Move D_floating
|
50FD
|
MOVG
|
Move G_floating
|
70FD
|
MOVH
|
Move H_floating
|
Description
The destination operand is replaced by the source operand.
Note
On a reserved operand fault, the destination operand is unaffected, and
the condition codes are UNPREDICTABLE.
MUL
Multiply
Format
2operand: opcode mulr.rx, prod.mx
3operand: opcode mulr.rx, muld.rx, prod.wx
Condition Codes
N|| <--- prod LSS 0;
|
|
Z|| <--- prod EQL 0;
|
|
V|| <--- 0;
|
|
C|| <--- 0;
|
|
Exceptions
floating overflow
floating underflow
reserved operand
Opcodes
44
|
MULF2
|
Multiply F_floating 2 Operand
|
45
|
MULF3
|
Multiply F_floating 3 Operand
|
64
|
MULD2
|
Multiply D_floating 2 Operand
|
65
|
MULD3
|
Multiply D_floating 3 Operand
|
44FD
|
MULG2
|
Multiply G_floating 2 Operand
|
45FD
|
MULG3
|
Multiply G_floating 3 Operand
|
64FD
|
MULH2
|
Multiply H_floating 2 Operand
|
65FD
|
MULH3
|
Multiply H_floating 3 Operand
|
Description
In 2 operand format, the product operand is multiplied by the
multiplier operand, and the product operand is replaced by the rounded
result. In 3 operand format, the multiplicand operand is multiplied by
the multiplier operand, and the product operand is replaced by the
rounded result.
Notes
- On a reserved operand fault, the product operand is unaffected, and
the condition codes are UNPREDICTABLE.
- On floating underflow, if FU is set, a fault occurs. On a floating
underflow fault, the product operand is unaffected. If FU is clear, the
product operand is replaced by zero, and no exception occurs.
- On floating overflow, the instruction faults, the product operand
is unaffected, and the condition codes are UNPREDICTABLE.
POLY
Polynomial Evaluation
Format
opcode arg.rx, degree.rw, tbladdr.ab
Condition Codes
N|| <--- R0 LSS 0;
|
|
Z|| <--- R0 EQL 0;
|
|
V|| <--- 0;
|
|
C|| <--- 0;
|
|
Exceptions
floating overflow
floating underflow
reserved operand
Opcodes
55
|
POLYF
|
Polynomial Evaluation F_floating
|
75
|
POLYD
|
Polynomial Evaluation D_floating
|
55FD
|
POLYG
|
Polynomial Evaluation G_floating
|
75FD
|
POLYH
|
Polynomial Evaluation H_floating
|
Description
The table address operand points to a table of polynomial coefficients.
The coefficient of the highest-order term of the polynomial is pointed
to by the table address operand. The table is specified with
lower-order coefficients stored at increasing addresses. The data type
of the coefficients is the same as the data type of the argument
operand. The evaluation is carried out by Horner's method, and the
contents of R0 (R1'R0 for POLYD and POLYG, R3'R2'R1'R0 for POLYH) are
replaced by the result. The result computed is:
if d = degree
and x = arg
result = C[0]+x**0 + x*(C[1] + x*(C[2] + ... x*C[d]))
|
The unsigned word degree operand specifies the highest-numbered
coefficient to participate in the evaluation. POLYH requires four
longwords on the stack to store arg in case the
instruction is interrupted.
Notes
- After execution:
POLYF:
R0 = result
R1 = 0
R2 = 0
R3 = table address + degree*4 + 4
POLYD and POLYG:
R0 = high-order part of result
R1 = low-order part of result
R2 = 0
R3 = table address + degree*8 + 8
R4 = 0
R5 = 0
POLYH:
R0 = highest-order part of result
R1 = second-highest-order part of result
R2 = second-lowest-order part of result
R3 = lowest-order part of result
R4 = 0
R5 = table address + degree*16 + 16
- On a floating fault:
- If PSL<FPD> = 0, the instruction faults, and all relevant
side effects are restored to their original state.
- If PSL<FPD> = 1, the instruction is suspended, and the state
is saved in the general registers as follows:
POLYF:
R0 = tmp3 ! Partial result after iteration
! prior to the one causing the
! overflow/underflow
R1 = arg
R2<7:0> = tmp1 ! Number of iterations remaining
R2<31:8> = implementation specific
R3 = tmp2 ! Points to table entry causing
! exception
POLYD and POLYG:
R1'R0 = tmp3 ! Partial result after iteration
! prior to the one causing the
! overflow/underflow
R2<7:0> = tmp1 ! Number of iterations remaining
R2<31:8> = implementation specific
R3 = tmp2 ! Points to table entry causing
! exception
R5'R4 = arg
POLYH:
R3'R2'R1'R0 = tmp3 ! Partial result after iteration
! prior to the one causing the
! overflow/underflow
R4<7:0> = tmp1 ! Number of iterations remaining
R4<31:8> = implementation specific
R5 = tmp2 ! Points to table entry causing
! exception
|
arg is saved on the stack in use during the
faulting instruction. Implementation-specific information is saved
to allow the instruction to continue after possible scaling of the
coefficients and partial result by the fault handler.
- If the unsigned word degree operand is zero and the argument is not
a reserved operand, the result is C[0].
- If the unsigned word degree operand is greater than 31, a reserved
operand fault occurs.
- On a reserved operand fault:
- If PSL<FPD> = 0, the reserved operand is either the degree
operand (greater than 31), or the argument operand, or some coefficient.
- If PSL<FPD> = 1, the reserved operand is a coefficient, and
R3 (except for POLYH) or R5 (for POLYH) is pointing at the value that
caused the exception.
- The state of the saved condition codes and the other registers is
UNPREDICTABLE. If the reserved operand is changed and the contents of
the condition codes and all registers are preserved, the fault can be
continued.
- On floating underflow after the rounding operation at any iteration
of the computation loop, a fault occurs if FU is set. If FU is clear,
the temporary result (tmp3) is replaced by zero and
the operation continues. In this case, the final result may be nonzero
if underflow occurred before the last iteration.
- On floating overflow after the rounding operation at any iteration
of the computation loop, the instruction terminates with a fault.
- If the argument is zero and one of the coefficients in the table is
the reserved operand, whether a reserved operand fault occurs is
UNPREDICTABLE.
- For POLYH, some implementations may not save arg
on the stack until after an interrupt or fault occurs. However,
arg will always be on the stack if an interrupt or
floating fault occurs after FPD is set. If the four longwords on the
stack overlap any of the source operands, the results are UNPREDICTABLE.
Example
|
; To compute P(x) = C0 + C1*x + C2*x**2
; where C0 = 1.0, C1 = .5, and C2 = .25
POLYF X,#2,PTABLE
.
.
.
PTABLE: .FLOAT 0.25 ; C2
.FLOAT 0.5 ; C1
.FLOAT 1.0 ; C0
|
|