@@ -416,27 +416,6 @@ function softfloat_normSubnormalF16Sig {
416416 }
417417}
418418
419- function softfloat_normRoundPackToF32 {
420- returns Bits<32>
421- arguments
422- Bits<1> sign,
423- Bits<8> exp,
424- Bits<23> sig,
425- RoundingMode mode
426- description {
427- Normalize, round, and pack into a 32-bit floating point value
428- }
429- body {
430- Bits<8> shiftDist = count_leading_zeros<32>(sig) - 1;
431- exp = exp - shiftDist;
432- if ((7 <= shiftDist) && (exp < 0xFD)) {
433- return packToF32UI(sign, (sig != 0) ? exp : 0, sig << (shiftDist - 7));
434- } else {
435- return softfloat_roundPackToF32(sign, exp, sig << shiftDist, mode);
436- }
437- }
438- }
439-
440419function softfloat_roundPackToF32 {
441420 returns Bits<32> # single precision value
442421 arguments
@@ -485,3 +464,24 @@ function softfloat_roundPackToF32 {
485464 return packToF32UI(sign, exp, sig);
486465 }
487466}
467+
468+ function softfloat_normRoundPackToF32 {
469+ returns Bits<32>
470+ arguments
471+ Bits<1> sign,
472+ Bits<8> exp,
473+ Bits<23> sig,
474+ RoundingMode mode
475+ description {
476+ Normalize, round, and pack into a 32-bit floating point value
477+ }
478+ body {
479+ Bits<8> shiftDist = count_leading_zeros<32>(sig) - 1;
480+ exp = exp - shiftDist;
481+ if ((7 <= shiftDist) && (exp < 0xFD)) {
482+ return packToF32UI(sign, (sig != 0) ? exp : 0, sig << (shiftDist - 7));
483+ } else {
484+ return softfloat_roundPackToF32(sign, exp, sig << shiftDist, mode);
485+ }
486+ }
487+ }
0 commit comments