x86: preserve flags when folding atomic operations