This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/83175] compiler optimizing the code corresponding to double precision operations
- From: "pinskia at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 27 Nov 2017 06:34:34 +0000
- Subject: [Bug middle-end/83175] compiler optimizing the code corresponding to double precision operations
- Auto-submitted: auto-generated
- References: <bug-83175-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83175
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |wrong-code
Target| |Powerpc*-*-*
Status|UNCONFIRMED |RESOLVED
Component|c |middle-end
Resolution|--- |INVALID
--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
I did not notice this before but you either need to use volatile or a memory
barrier between the writes of unlockAddr1_f64[0].
Something like:
volatile double *unlockAddr1_f64 = (volatile double*)
thisVars(vol)->unlockAddr1;
volatile double *unlockAddr2_f64 = (volatile double*)
thisVars(vol)->unlockAddr2;
cmd.word32[0] = ((command<<16) | command);
cmd.word32[1] = cmd.word32[0];
unlockAddr1_f64[0] = unlock1_cmd.fword64;
unlockAddr2_f64[0] = unlock2_cmd.fword64;
unlockAddr1_f64[0] = cmd.fword64;
Or something like:
unlockAddr1_f64 = (double*) thisVars(vol)->unlockAddr1;
unlockAddr2_f64 = (double*) thisVars(vol)->unlockAddr2;
cmd.word32[0] = ((command<<16) | command);
cmd.word32[1] = cmd.word32[0];
unlockAddr1_f64[0] = unlock1_cmd.fword64;
asm("":::"memory");
unlockAddr2_f64[0] = unlock2_cmd.fword64;
asm("":::"memory");
unlockAddr1_f64[0] = cmd.fword64;