SCVTF¶
说明¶
有符号整数向浮点数转换(Signed integer Convert to Floating-point)
将输入寄存器中有符号整数转换为指定精度的浮点数,舍入模式由系统寄存器CSTATE确定,结果写入到目的寄存器中。
汇编语法¶
汇编符号¶
- SrcL:输入寄存器,可以索引全局寄存器R0-R23和前序1-4条输出至T队列或U队列的指令结果。
- srcT:表达源数据类型,范围包括SD,SW,SH,SB。
- dstT:表达目标数据类型,范围包括FB,FH,FS,FD等。
- ->:用于指示目的寄存器。
- {t,u,Rd}:表示三种可选的目的寄存器,编码于RegDst域。其中:
- t,u:分别表示块内的T和U寄存器队列。
- Rd:可以索引全局寄存器R1-R23。
编码格式¶
SrcType字段编码如下表:
| SrcType | 数据格式 | 说明 |
|---|---|---|
| 0 | SD | 操作数为64bit有符号整型数据 |
| 1 | SW | 操作数为32bit有符号整型数据 |
| 2 | SH | 操作数为16bit有符号整型数据 |
| 3 | SB | 操作数为8bit有符号整型数据 |
DstType字段编码如下表:
| DstType | 数据格式 | 说明 |
|---|---|---|
| 0 | FD | 64bit双精度浮点数 |
| 1 | FS | 32bit单精度浮点数 |
| 2 | FH | 16bit半精度浮点数 |
| 3 | FB | 8bit低精度浮点数 |
| >3 | reserve | 保留 |
执行方式¶
integer d = UInt(RegDst);
integer m = UInt(SrcL);
DataType srcType, dstType;
RoundingMode rmode;
if SSR[CSTATE].RV == 1 then rmode = SSR[CSTATE].FRM;
else rmode = FPRounding_TIEEVEN
case SrcType of:
when 0 then srcType = INT64;
when 1 then srcType = INT32;
when 2 then srcType = INT16;
when 3 then srcType = INT8;
case DstType of:
when 0 then dstType = FP64;
when 1 then dstType = FP32;
when 2 then dstType = FP16;
when 3 then dstType = FP8;
otherwise undefined; # 其他编码未定义
bits(64) operand = R[m, 64];
bits(64) result = FPConvert(operand, srcType, dstType, rmode);
R[d, 64] = result;
备注¶
本指令属于标准指令扩展,只能用于浮点块指令块体中。