Skip to content

Commit 00d924f

Browse files
committed
Committing after removing trailing whitespace
1 parent 1d9ada9 commit 00d924f

File tree

4 files changed

+23
-14
lines changed

4 files changed

+23
-14
lines changed

arch/inst/F/fadd.s.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ access:
2727
vu: always
2828
data_independent_timing: true
2929
operation(): |
30+
check_f_ok($encoding);
3031
RoundingMode mode = rm_to_mode(X[rm], $encoding);
3132
X[fd] = f32_add(X[fs1], X[fs2], mode);
3233

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

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -34,20 +34,8 @@ access:
3434
data_independent_timing: false
3535
operation(): |
3636
check_f_ok($encoding);
37-
38-
Bits<32> int_value = X[rs1];
39-
40-
Bits<1> sign = int_value[31];
41-
42-
RoundingMode rounding_mode = rm_to_mode(rm, $encoding);
43-
44-
if ((int_value & 32'h7fff_ffff) == 0) {
45-
X[fd] = (sign == 1) ? packToF32UI(1, 0x9E, 0) : 0;
46-
} else {
47-
Bits<32> absA = (sign == 1) ? -int_value : int_value;
48-
X[fd] = softfloat_normRoundPackToF32( sign, 0x9C, absA, rounding_mode );
49-
}
50-
37+
RoundingMode rounding_mode = rm_to_mode(X[rm], $encoding);
38+
X[fd] = i32_to_f32(X[rs1], rounding_mode);
5139
mark_f_state_dirty();
5240
5341
sail(): |

arch/inst/F/fsub.s.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ access:
2727
vu: always
2828
data_independent_timing: true
2929
operation(): |
30+
check_f_ok($encoding);
3031
RoundingMode mode = rm_to_mode(X[rm], $encoding);
3132
X[fd] = f32_sub(X[fs1], X[fs2], mode);
3233
sail(): |

arch/isa/fp.idl

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -882,3 +882,22 @@ function f32_sub {
882882
}
883883
}
884884
}
885+
886+
function i32_to_f32 {
887+
returns U32
888+
arguments
889+
U32 a,
890+
RoundingMode mode
891+
description {
892+
Converts 32-bit signed integer to 32-bit floating point
893+
}
894+
body {
895+
# sign of integer, it is 1 when negative
896+
Bits<1> sign = a[31];
897+
if ((a & 0x7FFFFFFF) == 0) {
898+
return (sign == 1) ? packToF32UI(1, 0x9E, 0) : packToF32UI(0, 0, 0);
899+
}
900+
U32 magnitude_of_A = returnMag(a);
901+
return softfloat_normRoundPackToF32(sign, 0x9C, magnitude_of_A, mode);
902+
}
903+
}

0 commit comments

Comments
 (0)