Closed dylanmckay closed 8 years ago
@rjordans did you want to review this?
Sure no problem, I was mainly trying to follow how this would be implemented and figured that I could just as well give some suggestions whenever I spot things. I hope you didn't mind.
Anyway, I guess you missed my last comment but from looking at the LLVM language reference it seems that the atomicrmw operations require a write-back of the new value as well. It seems like you miss that in the currently generated code. Other than that it looks really nice now.
Suggestions and feedback are always appreciated :) I haven't worked with atomics much either so anything is useful.
Don't forget to store the result back to %foo though (see http://llvm.org/docs/LangRef.html#atomicrmw-instruction)
I didn't notice that before, nice catch!
The atomic RMW instructions now store the value back to the original pointer.
Have also rebased the branch so it's a bit cleaner.
This PR adds atomics support to AVR.
Still need to implement
atomic_load_add
atomic_cmp_swap
atomic_swap
atomic_load_sub
atomic_load_and
atomic_load_or
atomic_load_xor
atomic_load_nand
atomic_load_min
atomic_load_max
atomic_load_umin
atomic_load_umax
atomic_fence
Ideally we should use the AVR RMW instructions (
XCH
, etc) when we can. Not a priority though because they aren't well supported.Fixes #197.