changes softfloat API usage, all effected Instrs pass test suite

This commit is contained in:
Eyck-Alexander Jentzsch 2024-07-30 13:31:00 +02:00
parent 5d69b79232
commit fd20e66f1f
1 changed files with 16 additions and 10 deletions

View File

@ -149,18 +149,24 @@ uint32_t fcvt_s(uint32_t v1, uint32_t op, uint8_t mode) {
} }
uint32_t fmadd_s(uint32_t v1, uint32_t v2, uint32_t v3, uint32_t op, uint8_t mode) { uint32_t fmadd_s(uint32_t v1, uint32_t v2, uint32_t v3, uint32_t op, uint8_t mode) {
// Used values for op are: uint32_t F32_SIGN = 1UL << 31;
// FMADD_S: 0b00 switch(op) {
// FMSUB_S: 0b01 case 0: // FMADD_S
// FNMADD_S: 0b10 break;
// FNMSUB_S: 0b11 case 1: // FMSUB_S
// op should be {softfloat_mulAdd_subProd(2), softfloat_mulAdd_subC(1)} v3 ^= F32_SIGN;
break;
case 2: // FNMADD_S
v1 ^= F32_SIGN;
v3 ^= F32_SIGN;
break;
case 3: // FNMSUB_S
v1 ^= F32_SIGN;
break;
}
softfloat_roundingMode = rmm_map[mode & 0x7]; softfloat_roundingMode = rmm_map[mode & 0x7];
softfloat_exceptionFlags = 0; softfloat_exceptionFlags = 0;
float32_t res = softfloat_mulAddF32(v1, v2, v3, op & 0x1); float32_t res = softfloat_mulAddF32(v1, v2, v3, 0);
// Do not invert quiet NaN
if((op & 0b10) && (res.v != quiet_nan32))
res.v ^= 1ULL << 31;
return res.v; return res.v;
} }