Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Лаб2012 / 253665.pdf
Скачиваний:
46
Добавлен:
02.02.2015
Размер:
3.31 Mб
Скачать

GUIDELINES FOR WRITING SIMD FLOATING-POINT EXCEPTION HANDLERS

Table E-11. CVTPS2PD, CVTSS2SD

Source Operands

Masked Result

Unmasked Result

 

 

 

QNaN

QNaN11

QNaN11 (not an exception)

SNaN

QNaN12

None

NOTES:

1.The double precision output QNaN1 is created from the single precision input QNaN as follows: the sign bit is preserved, the 8-bit exponent FFH is replaced by the 11-bit exponent 7FFH, and the 24-bit significand is extended to a 53-bit significand by appending 29 bits equal to 0.

2.The double precision output QNaN1 is created from the single precision input SNaN as follows: the sign bit is preserved, the 8-bit exponent FFH is replaced by the 11-bit exponent 7FFH, and the 24-bit significand is extended to a 53-bit significand by pending 29 bits equal to 0. The second most significant bit of the significand is changed from 0 to 1 to convert the signaling NaN into a quiet NaN.

Table E-12. CVTPD2PS, CVTSD2SS

Source Operands

Masked Result

Unmasked Result

 

 

 

QNaN

QNaN11

QNaN11 (not an exception)

SNaN

QNaN12

None

NOTES:

1.The single precision output QNaN1 is created from the double precision input QNaN as follows: the sign bit is preserved, the 11-bit exponent 7FFH is replaced by the 8-bit exponent FFH, and the 53-bit significand is truncated to a 24-bit significand by removing its 29 least significant bits.

2.The single precision output QNaN1 is created from the double precision input SNaN as follows: the sign bit is preserved, the 11-bit exponent 7FFH is replaced by the 8-bit exponent FFH, and the 53-bit significand is truncated to a 24-bit significand by removing its 29 least significant bits. The second most significant bit of the significand is changed from 0 to 1 to convert the signaling NaN into a quiet NaN.

E.4.2.3 Condition Codes, Exception Flags, and Response for Masked and Unmasked Numeric Exceptions

In the following, the masked response is what the processor provides when a masked exception is raised by an SSE/SSE2/SSE3 numeric instruction. The same response is provided by the floating-point emulator for SSE/SSE2/SSE3 numeric instructions, when certain components of the quadruple input operands generate exceptions that are masked (the emulator also generates the correct answer, as specified by IEEE Standard 754 wherever applicable, in the case when no floating-point exception occurs). The unmasked response is what the emulator provides to the user handler for those components of the packed operands of SSE/SSE2/SSE3 instructions that raise unmasked exceptions. Note that for pre-computation exceptions (floating-point

E-12 Vol. 1

GUIDELINES FOR WRITING SIMD FLOATING-POINT EXCEPTION HANDLERS

faults), no result is provided to the user handler. For post-computation exceptions (floating-point traps), a result is provided to the user handler, as specified below.

In the following tables, the result is denoted by 'res', with the understanding that for the actual instruction, the destination coincides with the first source operand (except for COMISS, UCOMISS, COMISD, and UCOMISD, whose destination is the EFLAGS register).

Table E-13. #I - Invalid Operations

 

 

 

Unmasked

 

 

 

Response and

Instruction

Condition

Masked Response

Exception Code

 

 

 

 

ADDPS

src1 or src21 = SNaN

Refer to Table E-1 for

src1, src2

ADDPD

 

NaN operands, #IA = 1

unchanged; #IA =

ADDSS

 

 

1

ADDSD

 

 

 

HADDPS

 

 

 

HADDPD

 

 

 

 

 

 

 

ADDSUBPS (the

src1 = +Inf, src2 = -Inf or

res1 = QNaN Indefinite,

 

addition

src1 = -Inf, src2 = +Inf

#IA = 1

 

component)

 

 

 

ADDSUBPD (the

 

 

 

addition

 

 

 

component)

 

 

 

 

 

 

 

SUBPS

src1 or src2 = SNaN

Refer to Table E-1 for NaN

src1, src2

SUBPD

 

operands, #IA = 1

unchanged; #IA =

SUBSS

 

 

1

SUBSD

 

 

 

HSUBPS

 

 

 

HSUBPD

 

 

 

ADDSUBPS (the

 

 

 

src1 = +Inf, src2 = +Inf or

res = QNaN Indefinite,

 

subtraction

src1 = -Inf, src2 = -Inf

#IA = 1

 

component)

 

 

 

ADDSUBPD (the

 

 

 

subtraction

 

 

 

component)

 

 

 

 

 

 

 

MULPS

src1 or src2 = SNaN

Refer to Table E-1 for

src1, src2

MULPD

 

NaN operands, #IA = 1

unchanged;

 

 

 

#IA = 1

MULSS

src1 = ±Inf, src2 = ±0 or

res = QNaN Indefinite,

 

MULSD

src1 = ±0, src2 = ±Inf

#IA = 1

 

 

 

 

 

DIVPS

src1 or src2 = SNaN

Refer to Table E-1 for

src1, src2

DIVPD

 

NaN operands, #IA = 1

unchanged;

 

 

 

#IA = 1

DIVSS

src1 = ±Inf, src2 = ±Inf or

res = QNaN Indefinite,

 

DIVSD

src1 = ±0, src2 = ±0

#IA = 1

 

 

 

 

 

Vol. 1 E-13

GUIDELINES FOR WRITING SIMD FLOATING-POINT EXCEPTION HANDLERS

Table E-13. #I - Invalid Operations (Contd.)

 

 

 

Unmasked

 

 

 

Response and

Instruction

Condition

Masked Response

Exception Code

 

 

 

 

SQRTPS

src = SNaN

Refer to Table E-10 for

src unchanged,

SQRTPD

 

NaN operands, #IA = 1

#IA = 1

SQRTSS

 

 

 

src < 0

res = QNaN Indefinite,

 

SQRTSD

 

(note that -0 < 0 is false)

#IA = 1

 

 

 

 

 

 

 

MAXPS

src1 = NaN or src2 = NaN

res = src2, #IA = 1

src1, src2

MAXSS

 

 

unchanged; #IA =

MAXPD

 

 

1

MAXSD

 

 

 

 

 

 

 

MINPS

src1 = NaN or src2 = NaN

res = src2, #IA = 1

src1, src2

MINSS

 

 

unchanged; #IA =

MINPD

 

 

1

MINSD

 

 

 

 

 

 

 

CMPPS.LT

src1 = NaN or src2 = NaN

Refer to Table E-4 and

src1, src2

CMPPS.LE

 

Table E-5 for NaN

unchanged; #IA =

CMPPS.NLT

 

operands; #IA = 1

1

CMPPS.NLE

 

 

 

CMPSS.LT

 

 

 

CMPSS.LE

 

 

 

CMPSS.NLT

 

 

 

CMPSS.NLE

 

 

 

CMPPD.LT

 

 

 

CMPPD.LE

 

 

 

CMPPD.NLT

 

 

 

CMPPD.NLE

 

 

 

CMPSD.LT

 

 

 

CMPSD.LE

 

 

 

CMPSD.NLT

 

 

 

CMPSD.NLE

 

 

 

 

 

 

 

COMISS

src1 = NaN or src2 = NaN

Refer to Table E-6 for NaN

src1, src2, EFLAGS

COMISD

 

operands

unchanged; #IA =

 

 

 

1

 

 

 

 

UCOMISS

src1 = SNaN or src2 = SNaN

Refer to Table E-7 for NaN

src1, src2, EFLAGS

UCOMISD

 

operands

unchanged; #IA =

 

 

 

1

 

 

 

 

E-14 Vol. 1

GUIDELINES FOR WRITING SIMD FLOATING-POINT EXCEPTION HANDLERS

Table E-13. #I - Invalid Operations (Contd.)

 

 

 

Unmasked

 

 

 

Response and

Instruction

Condition

Masked Response

Exception Code

 

 

 

 

CVTPS2PI

src = NaN, ±Inf, or

res = Integer Indefinite,

src unchanged,

CVTSS2SI

|(src)rnd | > 7FFFFFFFH and

#IA = 1

#IA = 1

CVTPD2PI

(src)rnd 80000000H

 

 

CVTSD2SI

See Note2 for information

 

 

CVTPS2DQ

 

 

CVTPD2DQ

on rnd.

 

 

 

 

 

 

CVTTPS2PI

src = NaN, ±Inf, or

res = Integer Indefinite,

src unchanged,

CVTTSS2SI

|(src)rz | > 7FFFFFFFH and

#IA = 1

#IA = 1

CVTTPD2PI

(src)rz 80000000H

 

 

CVTTSD2SI

See Note2 for information

 

 

CVTTPS2DQ

 

 

CVTTPD2DQ

on rz.

 

 

 

 

 

 

CVTPS2PD

src = NAN

Refer to Table E-11 for

src unchanged,

CVTSS2SD

 

NaN operands

#IA = 1

 

 

 

 

CVTPD2PS

src = NAN

Refer to Table E-12 for

src unchanged,

CVTSD2SS

 

NaN operands

#IA = 1

 

 

 

 

NOTES:

1.For Tables E-13 to E-18:

-src denotes the single source operand of a unary operation.

-src1, src2 denote the first and second source operand of a binary operation.

-res denotes the numerical result of an operation.

2.rnd signifies the user rounding mode from MXCSR, and rz signifies the rounding mode toward zero. (truncate), when rounding a floating-point value to an integer. For more information, refer to Table 4-8.

3.For NAN encodings, see Table 4-3.

Table E-14. #Z - Divide-by-Zero

 

 

 

Unmasked

 

 

 

Response and

Instruction

Condition

Masked Response

Exception Code

 

 

 

 

DIVPS

src1 = finite non-zero (normal,

res = ±Inf,

src1, src2

DIVSS

or denormal)

#ZE = 1

unchanged;

DIVPD

src2 = ±0

 

#ZE = 1

DIVPS

 

 

 

 

 

 

 

Vol. 1 E-15

GUIDELINES FOR WRITING SIMD FLOATING-POINT EXCEPTION HANDLERS

Table E-15. #D - Denormal Operand

 

 

 

Unmasked Response

Instruction

Condition

Masked Response

and Exception Code

 

 

 

 

ADDPS

src1 = denormal1 or

res = Result rounded to

src1, src2 unchanged;

ADDPD

src2 = denormal (and

the destination precision

#DE = 1

ADDSUBPS

the DAZ bit in MXCSR

and using the bounded

 

ADDSUBPD

is 0)

exponent, but only if no

Note that SQRT,

HADDPS

 

unmasked post-

CVTPS2PD, CVTSS2SD,

HADDPD

 

computation exception

CVTPD2PS, CVTSD2SS

SUBPS

 

occurs.

have only 1 src.

SUBPD

 

 

 

HSUBPS

 

 

 

HSUBPD

 

 

 

MULPS

 

 

 

MULPD

 

 

 

DIVPS

 

 

 

DIVPD

 

 

 

SQRTPS

 

 

 

SQRTPD

 

 

 

MAXPS

 

 

 

MAXPD

 

 

 

MINPS

 

 

 

MINPD

 

 

 

CMPPS

 

 

 

CMPPD

 

 

 

ADDSS

 

 

 

ADDSD

 

 

 

SUBSS

 

 

 

SUBSD

 

 

 

MULSS

 

 

 

MULSD

 

 

 

DIVSS

 

 

 

DIVSD

 

 

 

SQRTSS

 

 

 

SQRTSD

 

 

 

MAXSS

 

 

 

MAXSD

 

 

 

MINSS

 

 

 

MINSD

 

 

 

CMPSS

 

 

 

CMPSD

 

 

 

COMISS

 

 

 

COMISD

 

 

 

UCOMISS

 

 

 

UCOMISD

 

 

 

CVTPS2PD

 

 

 

 

 

 

 

E-16 Vol. 1

GUIDELINES FOR WRITING SIMD FLOATING-POINT EXCEPTION HANDLERS

Table E-15. #D - Denormal Operand

 

 

 

Unmasked Response

Instruction

Condition

Masked Response

and Exception Code

 

 

 

 

CVTSS2SD

 

 

 

CVTPD2PS

 

 

 

CVTSD2SS

 

 

 

 

 

 

 

NOTE:

1. For denormal encodings, see Section 4.8.3.2, “Normalized and Denormalized Finite Numbers.”

Table E-16. #O - Numeric Overflow

 

 

 

 

 

Unmasked Response

Instruction

Condition

Masked Response

and Exception Code

 

 

 

 

 

 

ADDPS

Rounded result

Roundi

Sign

Result & Status

res = (result calculated

ADDSUBPS

> largest single

ng

Flags

with unbounded

 

HADDPS

precision finite

 

 

 

exponent and rounded to

To

 

#OE = 1, #PE = 1

SUBPS

normal value

 

the destination precision)

nearest

+

res = +

HSUBPS

 

/ 2192

 

 

-

res =

MULPS

 

 

#OE = 1

 

 

 

 

 

Toward

 

#OE = 1, #PE = 1

DIVPS

 

 

#PE = 1 if the result is

ADDSS

 

+

res = 1.11…1 * 2127

inexact

SUBSS

 

 

-

res =

 

MULSS

 

 

 

 

 

 

Toward

 

#OE = 1, #PE = 1

 

DIVSS

 

 

 

 

+

+

res = +

 

CVTPD2PS

 

 

 

 

-

res = -1.11…1 * 2127

 

CVTSD2SS

 

 

 

 

 

 

Toward

 

#OE = 1, #PE = 1

 

 

 

 

 

 

 

0

+

res = 1.11…1 * 2127

 

 

 

 

-

res = -1.11…1 * 2127

 

Vol. 1 E-17

GUIDELINES FOR WRITING SIMD FLOATING-POINT EXCEPTION HANDLERS

Table E-16. #O - Numeric Overflow (Contd.)

 

 

 

 

 

Unmasked Response

Instruction

Condition

Masked Response

and Exception Code

 

 

 

 

 

 

ADDPD

Rounded result

Roundi

Sign

Result & Status

res = (result calculated with

ADDSUBPD

> largest double

ng

Flags

unbounded exponent and

 

HADDPD

precision finite

 

 

 

rounded to the destination

To

 

#OE = 1, #PE = 1

precision) / 21536

SUBPD

normal value

 

nearest

+

res = +

• #OE = 1

HSUBPD

 

 

 

-

res =

• #PE = 1 if the result is

MULPD

 

 

 

 

 

 

inexact

 

Toward

 

#OE = 1, #PE = 1

DIVPD

 

 

 

ADDSD

 

+

res = 1.11…1 *

 

SUBSD

 

 

-

21023

 

MULSD

 

 

 

res =

 

DIVSD

 

 

 

 

 

 

Toward

 

#OE = 1, #PE = 1

 

 

 

 

 

 

 

+

+

res = +

 

 

 

 

-

res = -1.11…1 *

 

 

 

 

 

21023

 

 

 

Toward

 

#OE = 1, #PE = 1

 

 

 

0

+

res = 1.11…1 *

 

 

 

 

-

21023

 

 

 

 

 

res = -1.11…1 *

 

 

 

 

 

21023

 

E-18 Vol. 1

GUIDELINES FOR WRITING SIMD FLOATING-POINT EXCEPTION HANDLERS

Table E-17. #U - Numeric Underflow

 

 

 

Unmasked Response

Instruction

Condition

Masked Response

and Exception Code

 

 

 

 

ADDPS

Result calculated with

res = ±0, denormal, or

res = (result calculated with

ADDSUBPS

unbounded exponent and

normal

unbounded exponent and

HADDPS

rounded to the

 

rounded to the destination

 

precision) * 2192

SUBPS

destination precision <

#UE = 1 and #PE = 1,

#UE = 1

HSUBPS

smallest single precision

but only if the result is

• #PE = 1 if the result is

MULPS

finite normal value.

inexact

 

inexact

DIVPS

 

 

 

 

ADDSS

 

 

 

 

SUBSS

 

 

 

 

MULSS

 

 

 

 

DIVSS

 

 

 

 

CVTPD2PS

 

 

 

 

CVTSD2SS

 

 

 

 

 

 

 

 

ADDPD

Result calculated with

res = ±0, denormal or

res = (result calculated with

ADDSUBPD

unbounded exponent and

normal

unbounded exponent and

HADDPD

rounded to the

 

rounded to the destination

 

precision) * 21536

SUBPD

destination precision <

#UE = 1 and #PE = 1,

#UE = 1

HSUBPD

smallest double precision

but only if the result is

• #PE = 1 if the result is

MULPD

finite normal value.

inexact

 

inexact

DIVPD

 

 

 

 

ADDSD

 

 

 

 

SUBSD

 

 

 

 

MULSD

 

 

 

 

DIVSD

 

 

 

 

 

 

 

 

 

Vol. 1 E-19

GUIDELINES FOR WRITING SIMD FLOATING-POINT EXCEPTION HANDLERS

Table E-18. #P - Inexact Result (Precision)

 

 

 

Unmasked Response and Exception

Instruction

Condition

Masked Response

Code

 

 

 

 

ADDPS

The result is not

res = Result rounded

Only if no underflow/overflow condition

ADDPD

exactly

to the destination

occurred, or if the corresponding exceptions

ADDSUBPS

representable in

precision and using the

are masked:

bounded exponent, but

• Set #OE if masked overflow and set

ADDSUBPD

the destination

only if no unmasked

result as described above for masked

HADDPS

format.

underflow or overflow

overflow.

HADDPD

 

conditions occur (this

• Set #UE if masked underflow and set

SUBPS

 

exception can occur in

result as described above for masked

 

the presence of a

underflow.

SUBPD

 

 

masked underflow or

If neither underflow nor overflow, res

HSUBPS

 

 

overflow); #PE = 1.

equals the result rounded to the destination

HSUBPD

 

 

precision and using the bounded exponent

MULPS

 

 

set #PE = 1.

MULPD

 

 

 

DIVPS

 

 

 

DIVPD

 

 

 

SQRTPS

 

 

 

SQRTPD

 

 

 

CVTDQ2PS

 

 

 

CVTPI2PS

 

 

 

CVTPS2PI

 

 

 

CVTPS2DQ

 

 

 

CVTPD2PI

 

 

 

CVTPD2DQ

 

 

 

CVTPD2PS

 

 

 

CVTTPS2PI

 

 

 

CVTTPD2PI

 

 

 

CVTTPD2DQ

 

 

 

CVTTPS2DQ

 

 

 

ADDSS

 

 

 

ADDSD

 

 

 

SUBSS

 

 

 

SUBSD

 

 

 

MULSS

 

 

 

MULSD

 

 

 

DIVSS

 

 

 

DIVSD

 

 

 

SQRTSS

 

 

 

SQRTSD

 

 

 

CVTSI2SS

 

 

 

CVTSS2SI

 

 

 

CVTSD2SI

 

 

 

CVTSD2SS

 

 

 

CVTTSS2SI

 

 

 

CVTTSD2SI

 

 

 

 

 

 

 

E-20 Vol. 1

Соседние файлы в папке Лаб2012