This is the mail archive of the
mailing list for the GCC project.
Re: volatile access optimization (C++ / x86_64)
- From: DJ Delorie <dj at redhat dot com>
- To: Matt Godbolt <matt at godbolt dot org>
- Cc: gcc at gcc dot gnu dot org
- Date: Mon, 5 Jan 2015 13:47:02 -0500
- Subject: Re: volatile access optimization (C++ / x86_64)
- Authentication-results: sourceware.org; auth=none
- References: <CAFWXXN3quEdSnaoWuPcQn2k-F99Yaw+6=NqgFgcu9ABpv5ZD3Q at mail dot gmail dot com> <xnvbkldsgz dot fsf at greed dot delorie dot com> <CAFWXXN2phpRE3vmrN1-3zDwheEzH3mygxVP93k8cQNeFnX8DVg at mail dot gmail dot com>
> One question: do you have an example of a non-volatile-safe machine so
> I can get a feel for the problems one might encounter? At best I can
> imagine a machine that optimizes "add 0, [mem]" to avoid the
> read/write, but I'm not aware of such an ISA.
For example, the MSP430 backend uses a macro for movsi, addsipsi3,
subpsi3, and a few others, which aren't volatile-safe. Look for
"general_operand" vs "msp_general_operand".