Skip to content

Commit 222505f

Browse files
committed
autochange by end-of-file-fixer
1 parent f725f1b commit 222505f

File tree

2 files changed

+35
-3
lines changed

2 files changed

+35
-3
lines changed

arch/inst/F/fcvt.s.wu.yaml

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,18 @@
33
$schema: "inst_schema.json#"
44
kind: instruction
55
name: fcvt.s.wu
6-
long_name: No synopsis available.
6+
long_name: Convert unsigned 32-bit integer to single-precision float
77
description: |
8-
No description available.
8+
Converts a 32-bit unsigned integer in integer register _rs1_ into a floating-point number in
9+
floating-point register _fd_.
10+
11+
All floating-point to integer and integer to floating-point conversion instructions round
12+
according to the _rm_ field.
13+
A floating-point register can be initialized to floating-point positive zero using
14+
`fcvt.s.w rd, x0`, which will never set any exception flags.
15+
16+
All floating-point conversion instructions set the Inexact exception flag if the rounded
17+
result differs from the operand value and the Invalid exception flag is not set.
918
definedBy: F
1019
assembly: fd, xs1, rm
1120
encoding:
@@ -24,7 +33,10 @@ access:
2433
vu: always
2534
data_independent_timing: true
2635
operation(): |
27-
36+
check_f_ok($encoding);
37+
RoundingMode rounding_mode = rm_to_mode(rm, $encoding);
38+
X[fd] = ui32_to_f32(X[rs1], rounding_mode);
39+
mark_f_state_dirty();
2840
sail(): |
2941
{
3042
assert(sizeof(xlen) >= 64);

arch/isa/fp.idl

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -901,3 +901,23 @@ function i32_to_f32 {
901901
return softfloat_normRoundPackToF32(sign, 0x9C, magnitude_of_A, mode);
902902
}
903903
}
904+
905+
function ui32_to_f32 {
906+
returns U32
907+
arguments
908+
U32 a,
909+
RoundingMode mode
910+
description {
911+
Converts 32-bit unsigned integer to 32-bit floating point
912+
}
913+
body {
914+
# sign of integer, it is 1 when negative
915+
if (a == 0) {
916+
return a;
917+
}
918+
if (a[31] == 1) {
919+
return softfloat_roundPackToF32(0, 0x9D, a>>1 | (a & 1), mode);
920+
} else {
921+
return softfloat_normRoundPackToF32(0, 0x9C, a, mode);
922+
}
923+
}

0 commit comments

Comments
 (0)