Skip to content

Commit

Permalink
Add fma and fms
Browse files Browse the repository at this point in the history
  • Loading branch information
ngzhian committed Jun 29, 2021
1 parent 4fced21 commit 037082b
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions proposals/relaxed-simd/Overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,25 @@ def relaxed_i32x4_trunc_f64x2_zero(a : f64x2, signed : bool) -> i32x4:
result[i] = UNDEFINED
```

### Relaxed fused multiply-add and fused multiply-subtract

- `relaxed f32x4.fma`
- `relaxed f32x4.fms`
- `relaxed f64x2.fma`
- `relaxed f64x2.fms`

All the instructions take 3 operands, `a`, `b`, `c`, perform `a + (b * c)` or `a - (b * c)`:

- `relaxed f32x4.fma(a, b, c) = a + (b * c)`
- `relaxed f32x4.fms(a, b, c) = a - (b * c)`
- `relaxed f64x2.fma(a, b, c) = a + (b * c)`
- `relaxed f64x2.fms(a, b, c) = a - (b * c)`

where:

- the intermediate `b * c` is be rounded first, and the final result rounded again (for a total of 2 roundings), or
- the the entire expression evaluated with higher precision and then only rounded once (if supported by hardware).

## Binary format

> This is a placeholder for binary format of instructions and new constructs.
Expand Down

0 comments on commit 037082b

Please sign in to comment.