Rev. 1.50, 10/04, page 420 of 448
10.3.25 FTRC (Floating-point Truncate and Convert to integer): Floating-Point
Instruction
PR
Format
Operation
Instruction Code
Cycle
T Bit
0
FTRC FRm,FPUL
(long)FRm
→
FPUL
1111mmmm00111101
1 —
1
FTRC DRm,FPUL
(long)DRm
→
FPUL
1111mmm000111101
1 —
Description:
When FPSCR.PR = 0: Converts the single-precision floating-point number in FRm
to a 32-bit integer, and stores the result in FPUL.
When FPSCR.PR = 1: Converts the double-precision floating-point number in FRm to a 32-bit
integer, and stores the result in FPUL.
The rounding mode is always truncation.
Notes:
None
Operation:
#define N_INT_SINGLE_RANGE 0xcf000000 & 0x7fffffff /* -1.000000 * 2^31 */
#define P_INT_SINGLE_RANGE 0x4effffff /* 1.fffffe * 2^30 */
#define N_INT_DOUBLE_RANGE 0xc1e0000000200000 & 0x7fffffffffffffff
#define P_INT_DOUBLE_RANGE 0x41e0000000000000
void FTRC(int m, int *FPUL)
{
pc += 2;
clear_cause();
if(FPSCR.PR==0){
case(ftrc_single_ type_of(m)){
NORM: *FPUL = FR[m]; break;
PINF: ftrc_invalid(0,*FPUL);
break;
NINF: ftrc_invalid(1,*FPUL);
break;
}
}
Summary of Contents for SuperH SH-4A
Page 2: ...Rev 1 50 10 04 page ii of xx ...
Page 8: ...Rev 1 50 10 04 page viii of xx ...
Page 116: ...Rev 1 50 10 04 page 96 of 448 ...
Page 178: ...Rev 1 50 10 04 page 158 of 448 ...
Page 206: ...Rev 1 50 10 04 page 186 of 448 ...
Page 231: ...Rev 1 50 10 04 page 211 of 448 Possible Exceptions Slot illegal instruction exception ...
Page 235: ...Rev 1 50 10 04 page 215 of 448 Possible Exceptions Slot illegal instruction exception ...
Page 238: ...Rev 1 50 10 04 page 218 of 448 Possible Exceptions Slot illegal instruction exception ...
Page 408: ...Rev 1 50 10 04 page 388 of 448 Possible Exceptions Inexact Not generated when FPSCR PR 1 ...
Page 446: ...Rev 1 50 10 04 page 426 of 448 ...
Page 468: ...Rev 1 50 10 04 page 448 of 448 ...
Page 471: ......
Page 472: ...SH 4A Software Manual ...