-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
32 bit multiplication produces byte-swapped result #130
Comments
I've come up with a patch that fixes it but I was surprised such a serious issue exists in the AVR back end. I just ran the unit tests and found they are regressing. call.ll is breaking and I'm pretty sure this issue is what's causing it. Can anyone remember when they were last run? Maybe we can triage which commit introduced the regression? |
This is fixed by avr-rust/llvm#10 |
LABEL AS: has local patch |
I've added a 32-bit multiplication test to the compiler integration test suite dylanmckay/avr-compiler-integration-tests@d14e459 and it passes on LLVM trunk. |
Cool, I was just about to login and try to figure out where we are with all these patches and threads. :) I'm on holiday this week so hoping to have a bit of time. Last I knew we had patches for 129 and 130 but there was some interaction where some tests weren't passing. Can we get together on email or chat and sort out what's working and what's not if you have time? It feels like we probably have everything fixed in one branch or another, just maybe needs a bit of organising and some of the tests tweaked? Carl |
p.s. I should really change my avatar one day. Since becoming a dad, I never have time to bleach my hair any more, it's short and gingerish. 🤣 |
So it looks like #130 is just the same as talking about a regression from #92, which is fixed by the patch https://github.com/dylanmckay/llvm/commits/upstream-fix-avr-rust-92, which has either gone to upstream already or is going. That probably means that we can close this issue, once the patch is upstreamed? Also you've added extra tests to the compiler integration test suite to help prevent future regressions in this area, so I think that's everything? |
Cool
Sent from my BlackBerry® wireless device
…-----Original Message-----
From: Dylan McKay <[email protected]>
Date: Sat, 08 Jun 2019 06:42:44
To: avr-rust/rust<[email protected]>
Reply-To: avr-rust/rust <[email protected]>
Cc: Carl Peto<[email protected]>; Author<[email protected]>
Subject: Re: [avr-rust/rust] 32 bit multiplication produces byte-swapped
result (#130)
I've added a 32-bit multiplication test to the compiler integration test suite dylanmckay/avr-compiler-integration-tests@d14e459 and it passes on LLVM trunk.
--
You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub:
#130 (comment)
|
This is very similar to #129 and may well be the same bug/root cause or not.
I'll get a reduced test case later.
This swift code...
Produces this LLVM IR...
When run through llc it produces this assembly:
Looking at the call to
__mulsi3
, the result comes back in r22-r25, but it looks like the register pairs are swapped.When I test the code I get these results:
The calculation should be 167 * 19 = 3173
bit pattern
0000 0000 0000 0000 0000 1100 0110 0101
But instead we get 207945728
bit pattern
0000 1100 0110 0101 0000 0000 0000 0000
You can see that the words have been swapped.
The text was updated successfully, but these errors were encountered: