-
Notifications
You must be signed in to change notification settings - Fork 10
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
WIP: Support Short (8/16 bit) atomic RMW operations on RISCV #297
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Máté Tokodi [email protected]
8253ce1
to
4dd002b
Compare
if (!(operationSize & SLJIT_32) && operationSize != SLJIT_MOV32) { | ||
compareTopFalse = sljit_emit_cmp(compiler, SLJIT_NOT_EQUAL, SLJIT_IMM, 0, srcExpectedPair.arg2, srcExpectedPair.arg2w); | ||
} | ||
if (noShortAtomic && size <= 2) { | ||
sljit_emit_op2(compiler, SLJIT_AND, maskReg, 0, baseReg, 0, SLJIT_IMM, 0x3); | ||
sljit_emit_op2(compiler, SLJIT_SHL, maskReg, 0, maskReg, 0, SLJIT_IMM, 3); // multiply by 8 |
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.
32 bit atomic should be present, so mutiply by 4 should be enough
sljit_s32 operationSize = SLJIT_MOV; | ||
sljit_s32 size = 0; | ||
sljit_s32 offset = 0; | ||
sljit_s32 operation; | ||
uint32_t options = MemAddress::CheckNaturalAlignment | MemAddress::AbsoluteAddress; | ||
sljit_sw stackTmpStart = CompileContext::get(compiler)->stackTmpStart; | ||
|
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.
No need this newline.
case ByteCode::I32AtomicRmwAndOpcode: | ||
case ByteCode::I32AtomicRmwOrOpcode: | ||
case ByteCode::I32AtomicRmwXorOpcode: | ||
case ByteCode::I32AtomicRmwXchgOpcode: { | ||
info = Instruction::kIs32Bit; | ||
requiredInit = OTAtomicRmwI32; |
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.
There should be an OTAtomicRmwShort
which adds an extra tmp register when short atomic is not present. Could use the compiler option bits to check this.
Add support for short atomic RMW operations for RISCV
This patch is not yet functional on 32 bit, but considering the increase in the number of instructions required, it may the worthwhile to consider using callback functions in those cases instead.