Simplify atomic load/store IRGen.

Also fixes a couple minor bugs along the way; see testcases.