-
-
Notifications
You must be signed in to change notification settings - Fork 392
[LA64_DYNAREC] Add 8bits lock op macros. #3127
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
Conversation
phorcys
commented
Nov 5, 2025
- Add LOCK_8_ALIGNED_4BYTE, LOCK_8_IN_4BYTE macro.
- F0 00 LOCK ADD Eb, Gb
src/dynarec/la64/dynarec_la64_f0.c
Outdated
| if (cpuext.lam_bh) { | ||
| AMADD_DB_B(x1, gd, wback); | ||
| } else { | ||
| if (!ALIGNED_ATOMICxw) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't make sense. Byte atomic can never be unaligned.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#define ALIGNED_ATOMICxw ((fixedaddress && !(fixedaddress & (((1 << (2 + rex.w)) - 1)))) || BOX64ENV(dynarec_aligned_atomics))
Byte lock opcodes has no "nature alignment"
But LoongArch has only ll.w/sc.w ( amcas_db.b is exceptional)
So I create two macro:
LOCK_8_ALIGNED_4BYTE for 4-byte aligned 8-bits
LOCK_8_IN_4BYTE for 4-byte offset 1/2/3
ALIGNED_ATOMICxw here is to test addr is 4byte aligned or BOX64_DYNAREC_ALIGNED_ATOMICS is turned on.
It's will not emit LOCK_8_IN_4BYTE macro or addr ANDI test.
Else if addr is not 4-byte aligned and BOX64_DYNAREC_ALIGNED_ATOMICS is not turned on ,emit LOCK_8_IN_4BYTE related.
Indeed it looks quite strange, but it should work properly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My bad, BOX64_DYNAREC_ALIGNED_ATOMICS should not be tested.
|
By the way, how were these opcodes tested? |
* Add LOCK_8_ALIGNED_4BYTE, LOCK_8_IN_4BYTE macro. * F0 00 LOCK ADD Eb, Gb
de2c29b to
92f9d8d
Compare