EasyManua.ls Logo

Renesas SuperH SH-4A - Floating-Point Instruction; FTRC (Floating-Point Truncate and Convert to Integer Floating-Point Instruction

Renesas SuperH SH-4A
472 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
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;
}
}

Table of Contents

Related product manuals