Encoding:

MSA

011110

1010

df

wt

ws

wd

3RF

011011

6

4

1

5

5

5

6

Format:

FTQ.df 

Vector Floating-Point Convert to Fixed-Point

FTQ.H wd,ws,wt

MSA

Vector Floating-Point Convert to Fixed-Point

FTQ.W wd,ws,wt

MSA

Vector Floating-Point Convert to Fixed-Point

Purpose:

Vector Floating-Point Convert to Fixed-Point

Vector fix-point format conversion from floating-point.

Description:

left_half(wd)[i] = to_q(ws[i]); right_half(wd)[i] = to_q(wt[i])

The floating-point elements in vectors ws and wt are down-converted to a fixed-point representation, i.e. from 64-bit floating-point to 32-bit Q31 fixed-point representation, or from 32-bit floating-point to 16-bit Q15 fixed-point representation.

The floating-point data inside the fixed-point range is first scaled up (multiplied by 215 or 231) and then rounded and converted to a 16-bit or 32 -bit integer based on the ro unding mode bits RM in MSA Control and St atus

Register MSACSR. The resulting value is the Q15 or Q31 representation.

The scaling and floating-point to integer conversion operations are defined by the IEEE Standard for Floating-Point

Arithmetic 754TM-2008. The integer conversion operation is exact, i.e. the Inexact exception is signaled if the result does not have the same numerical value as the input operand. In this case, the default result is the rounded result.

NaN values signal the Invalid Operation exception. Numeric operands converting to fixed-point values outside the range of the destination format signal the Overflow and the Inexact exceptions. For positive numeric operands outside

the range, the default result is the largest fixed-point value. The default result for negative numeric operands outside the range is the smallest fixed-point value. The default result for NaN operands is zero.

The operands are values in floating-point data format df. The results are fixed-point values in data format half the size of df.

Restrictions:

Data-dependent exceptions are possible.

Operation:

FTQ.H
   for i in 0 .. WRLEN/32-1
      q = ToFixPointFP((WR[ws]32i+31..32i, 32)
      r = ToFixPointFP((WR[wt]32i+31..32i, 32)
      WR[wd]16i+15+WRLEN/2..16i+WRLEN/2 = q
      WR[wd]16i+15..16i = r
   endfor
FTQ.W
   for i in 0 .. WRLEN/64-1
      q = ToFixPointFP((WR[ws]64i+63..64i, 64)
      r = ToFixPointFP((WR[wt]64i+63..64i, 64)
      WR[wd]32i+31+WRLEN/2..32i+WRLEN/2 = q
      WR[wd]32i+31..32i = r
   endfor

Exceptions:

Reserved Instruction Exception, MSA Disabled Exception, MSA Floating Point Exception.