diff options
author | Eyal Sawady <ecs@d2evs.net> | 2021-08-13 08:15:49 +0000 |
---|---|---|
committer | Quentin Carbonneaux <quentin@c9x.me> | 2021-08-23 10:35:58 +0200 |
commit | 3cbad4d9c465d3f298cbe19c46f7c16f6a9b9f0f (patch) | |
tree | c622f86f57c5aa35b580af1fa643740e91e8a42f | |
parent | 2dd269f522298836796ff78390d0eb0e244e41f4 (diff) | |
download | roux-3cbad4d9c465d3f298cbe19c46f7c16f6a9b9f0f.tar.gz |
amd64/emit.c: fix %x =k sub %x, %x
The negate trick is unnecessary and broken when the first arg is the result.
-rw-r--r-- | amd64/emit.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/amd64/emit.c b/amd64/emit.c index 29b6bbb..09b90d5 100644 --- a/amd64/emit.c +++ b/amd64/emit.c @@ -408,7 +408,7 @@ emitins(Ins i, Fn *fn, FILE *f) case Osub: /* we have to use the negation trick to handle * some 3-address subtractions */ - if (req(i.to, i.arg[1])) { + if (req(i.to, i.arg[1]) && !req(i.arg[0], i.to)) { if (KBASE(i.cls) == 0) emitf("neg%k %=", &i, fn, f); else |