File tree Expand file tree Collapse file tree 2 files changed +24
-2
lines changed Expand file tree Collapse file tree 2 files changed +24
-2
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ kind: instruction
55name : fsub.s
66long_name : No synopsis available.
77description : |
8- No description available.
8+ Do the single-precision floating-point subtraction of fs2 from fs1 and store the result in fd. rm is the dynamic Rounding Mode.
99definedBy : F
1010assembly : fd, fs1, fs2, rm
1111encoding :
@@ -26,7 +26,8 @@ access:
2626 vu : always
2727data_independent_timing : true
2828operation() : |
29-
29+ RoundingMode mode = rm_to_mode(X[rm], $encoding);
30+ X[fd] = f32_sub(X[fs1], X[fs2], mode);
3031sail() : |
3132 {
3233 let rs1_val_32b = F_or_X_S(rs1);
Original file line number Diff line number Diff line change @@ -861,3 +861,24 @@ function f32_add {
861861 }
862862 }
863863}
864+
865+ function f32_sub {
866+ returns U32
867+ arguments
868+ U32 a,
869+ U32 b,
870+ RoundingMode mode
871+ description {
872+ Returns difference of 2 floating point numbers
873+ }
874+ body {
875+ U32 a_xor_b = a ^ b;
876+ if (signF32UI(a_xor_b) == 1) {
877+ # add if signs are different
878+ return softfloat_addMagsF32(a,b,mode);
879+ } else {
880+ # subtract if signs are the same
881+ return softfloat_subMagsF32(a,b,mode);
882+ }
883+ }
884+ }
You can’t perform that action at this time.
0 commit comments