Commit b13ec7a
committed
🐛 svg: Prevent code with fused instructions (#464)
Add a floating point conversion when multiplying when scaling coordinates
so that the multiplication does not get fused with an adjacent addition or
subtraction. This causes two instructions to be generated, a MUL and a
ADD/SUB, instead of a single FMADD or FMSUB. A fused instruction has
different rounding so ends up giving slightly different results to two
instructions. This was causing different values in the SVGs generated
between AMD64 and ARM64.
Revert "labs: Rework random rectangle generation" as we no longer need
to work around this by rounding in Evy code.
Remove the parens in `randrect.evy` as they are not needed any more due
to a recent change.
I've tested this on AMD64 and ARM64 and the same SVGs are now generated.
This merges the following commits:
* svg: Prevent code with fused instructions
* Revert "labs: Rework random rectangle generation"
* labs: Remove unnecessary parens in randrect
frontend/lab/samples/ifs/img/randrect.evy | 16 +-
frontend/lab/samples/ifs/img/randrect.svg | 420 ++++++++++++++++++----
pkg/cli/svg/runtime.go | 9 +-
3 files changed, 372 insertions(+), 73 deletions(-)
Link: https://go.dev/ref/spec#Floating_point_operators
Pull-request: #464File tree
3 files changed
+372
-73
lines changed- frontend/lab/samples/ifs/img
- pkg/cli/svg
3 files changed
+372
-73
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
5 | | - | |
6 | | - | |
7 | | - | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
0 commit comments