在 2021/1/19 上午3:32, Zebediah Figura (she/her) 写道: > I guess I ask because it's not clear to me whether it should be > necessary either. It doesn't seem to be present for x86, but there might > be code out there that does something like > > "while (!var) YieldProcessor();" > > and expects it to work. I'm assuming the "dmb ishst" would prevent CPU > reordering enough for that to work, but it's not clear to me that the > compiler wouldn't optimize out the loop somehow...
This requires that the read operation on `var` should have acquire semantics, which consequently plays the role as the acquire barrier. `YieldProcessor()` doesn't have to be a barrier itself. On the other hand, the effect of memory clobber seems a bit unclear to me. Because inline assembly can call external functions, all memory that is reachable (save for local variables that are known not to escape) will be clobbered. There don't seem to be any differences between having it and not having it [1]. I believe it is not necessary in `YieldProcessor()`. [1] https://gcc.godbolt.org/z/8W1K8q -- Best regards, LH_Mouse
signature.asc
Description: OpenPGP digital signature
_______________________________________________ Mingw-w64-public mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
