Store and Set Computational Attributes (SSCA)


Op Code (Hex) Operand 1 Operand 2 Operand 3
107B Receiver Source Controls
Operand 1: Character(5) variable scalar.

Operand 2: Character(5) scalar or null.

Operand 3: Character(5) scalar or null.

Description

This instruction stores and optionally sets the attributes for controlling computational operations for the thread this instruction is executed in.

The receiver is assigned the values that each of the computational attributes had at the start of execution of the instruction. It has the same format and bit assignment as the source.

The source specifies new values for the computational attributes for the thread. The particular computational attributes that are selected for modification are determined by the controls operand. The source operand has the following format:

Offset
Dec Hex
Field Name
Data Type and Length
0 0
Floating-point exception masks
Char(2)



0 = Disabled (exception is masked)
1 = Enabled (exception is unmasked)


0 0
Reserved (binary 0)
Bits 0-9
0 0
Floating-point overflow
Bit 10
0 0
Floating-point underflow
Bit 11
0 0
Floating-point zero divide
Bit 12
0 0
Floating-point inexact result
Bit 13
0 0
Floating-point invalid operand
Bit 14
0 0
Reserved (binary 0)
Bit 15
2 2
Floating-point exception occurrence flags
Char(2)



0 = Exception has not occurred
1 = Exception has occurred


2 2
Reserved (binary 0)
Bits 0-9
2 2
Floating-point overflow
Bit 10
2 2
Floating-point underflow
Bit 11
2 2
Floating-point zero divide
Bit 12
2 2
Floating-point inexact result
Bit 13
2 2
Floating-point invalid operand
Bit 14
2 2
Reserved (binary 0)
Bit 15
4 4
Modes
Char(1)
4 4
Reserved
Bit 0
4 4 Binary floating-point rounding mode Bits 1-2



00= Round toward positive infinity
01= Round toward negative infinity
10= Round toward zero
11= Round to nearest, ties to even (default)


4 4 Reserved Bits 3-4






4 4 Decimal floating-point rounding mode Bits 5-7
000= Round to nearest, ties to even (default)
001= Round toward zero
010= Round toward positive infinity
011= Round toward negative infinity
100= Round to nearest, ties away from zero
101= Round to nearest, ties toward zero
110= Round away from zero
111= Round to prepare for shorter precision


5 5
--- End ---

If any of the reserved fields are not binary 0, a scalar value invalid  (hex 3203) exception is signaled.

The controls operand is used to select those attributes that are to be set from the bit values of the source operand. The format of the controls is the same as that for the source. A value of one for a bit in controls indicates that the corresponding computational attribute for the thread is to be set from the value of that bit of the source. A value of zero for a bit in controls indicates that the corresponding computational attribute for the thread is not to be changed, and will retain the value it had prior to this instruction. For an attribute controlled by a multiple-bit field, such as the rounding modes, all of the bits in the field must be ones or all must be zeros. A mixture of ones and zeros in such a field results in a scalar value invalid  (hex 3203) exception.

If the source and controls operands are both null, the instruction will just return the current computational attributes. If the source is specified, the computational attributes of the thread are modified under control of the controls operand. If the source operand is specified and the controls operand is null, the instruction will change all of the computational attributes to the values specified in the source.

With the floating-point exception masks field, it is possible to unmask/mask the exception processing and handling for each of the five floating-point exceptions that are maskable. If an exception that is unmasked occurs, then the corresponding floating point exception occurrence bit is set, and the exception is signaled. If an exception that is masked occurs, the exception is not signaled, but the floating point exception occurrence flag is still set to indicate the occurrence of the exception.

The floating-point exception occurrence flag for each exception may be set or cleared by this instruction from the source operand under control of the controls operand.

Unless specified otherwise by a particular instruction, or precluded due to implicit conversions, all floating-point operations are performed as if correct to infinite precision, and then rounded to fit in a destinations format while potentially signaling an exception that the result is inexact. To allow control of the floating-point rounding operations performed within a thread, four binary floating-point rounding modes and eight decimal floating-point rounding modes are supported. Assume y is the infinitely precise number that is to be rounded, bracketed most closely by x and z, where x is the largest representable value less than y and z is the smallest representable value greater than y. Note that x or z may be infinity. The following diagram shows this relationship of x, y, and z on a scale of numerically progressing values where the vertical bars denote values representable in a floating-point format.


Relationship of x, y, and z

Given the above, if y is not exactly representable in the receiving field format, the rounding modes change y as follows:

Round to nearest with ties to even is the default rounding mode in effect upon the initiation of a thread, for both binary and decimal floating-point computation. For this rounding mode, y is rounded to the closer of x or z. If they are equally close, the even one (the one whose least significant bit is a zero) is chosen. For the purposes of this mode of rounding, infinity is treated as if it was even. Except for the case of y being rounded to a value of infinity, the rounded result will differ from the infinitely precise result by at most half of the least significant digit position of the chosen value. This rounding mode differs slightly from the decimal round algorithm performed for the optional round form of an instruction. This rounding mode would round a value of 0.5 to 0, where the decimal round algorithm would round that value to 1.

Round toward positive infinity indicates directed rounding upward is to occur. For this mode, y is rounded to z.

Round toward negative infinity indicates directed rounding downward is to occur. For this mode, y is rounded to x.

Round toward zero indicates truncation is to occur. For this mode, y is rounded to the smaller (in magnitude) of x or z.

Round to nearest, ties away from zero indicates that y be rounded to the closer of x or z. If they are equally close, y is rounded to the larger (in magnitude) of x or z.

Round to nearest, ties toward zero indicates that y be rounded to the closer of x or z. If they are equally close, y is rounded to the smaller (in magnitude) of x or z.

Round away from zero indicates that y is rounded to the larger (in magnitude) of x or z.

Round to prepare for shorter precision indicates that y is rounded to the smaller (in magnitude) of x or z. If the units digit of the selected value is either 0 or 5, then the digit is incremented by one and the incremented result is delivered. In all other cases, the selected value is delivered. When a value has redundant forms, the units digit is determined by using the form that has the smallest exponent.

Arithmetic operations upon infinity are exact. Negative infinity is less than every finite value, which is less than positive infinity.

The computational attributes are set with a default value upon thread initiation. The default attributes are as follows:

These attributes can be modified by a program executing this instruction. The new attributes are then in effect for the program executing this instruction and for programs invoked subsequent to it unless changed through another execution of this instruction. External exception handlers and invocation exit routines are invoked with the same attributes as were last in effect for the program invocation they are related to. Event handlers do not really relate to another invocation in the thread. As such, they are invoked with the attributes that were in effect at the point the thread was interrupted to handle the event.

Upon return to the invocation of a program from subsequent program invocations, the computational attributes, other than floating point exception occurrence attributes, are restored to those that were in effect when the program gave up control. The floating point exception occurrence attributes are left intact reflecting the occurrence of any floating-point exceptions during the execution of subsequent invocations.

Internal exception handlers execute under the invocation of the program containing them. As such, the above discussion of how computational attributes are restored upon returning from an external exception handler does not apply. The execution of an internal exception handler occurs in a manner similar to the execution of an internal subroutine invoked through the Call Internal (CALLI) instruction. If the internal exception handler modifies the attributes, the modification remains in effect for that invocation when the exception handler completes the exception.

Authorization Required

Lock Enforcement

Exceptions

06 Addressing

08 Argument/Parameter

10 Damage Encountered

1C Machine-Dependent

20 Machine Support

22 Object Access

24 Pointer Specification

2E Resource Control Limit

32 Scalar Specification

36 Space Management

44 Protection Violation