File tree Expand file tree Collapse file tree 3 files changed +29
-5
lines changed Expand file tree Collapse file tree 3 files changed +29
-5
lines changed Original file line number Diff line number Diff line change 33$schema : " inst_schema.json#"
44kind : instruction
55name : fadd.s
6- long_name : No synopsis available.
6+ long_name : Single-precision floating-point addition
77description : |
8- No description available.
8+ Do the single-precision floating-point addition of fs1 and fs2 and store the result in fd.
9+ rm is the dynamic Rounding Mode.
910definedBy : F
1011assembly : fd, fs1, fs2, rm
1112encoding :
Original file line number Diff line number Diff line change 33$schema : " inst_schema.json#"
44kind : instruction
55name : fsub.s
6- long_name : No synopsis available.
6+ long_name : Single-precision floating-point subtraction
77description : |
8- No description available.
8+ Do the single-precision floating-point subtraction of fs2 from fs1 and store the result in fd.
9+ rm is the dynamic Rounding Mode.
910definedBy : F
1011assembly : fd, fs1, fs2, rm
1112encoding :
@@ -26,7 +27,8 @@ access:
2627 vu : always
2728data_independent_timing : true
2829operation() : |
29-
30+ RoundingMode mode = rm_to_mode(X[rm], $encoding);
31+ X[fd] = f32_sub(X[fs1], X[fs2], mode);
3032sail() : |
3133 {
3234 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