This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug middle-end/83175] compiler optimizing the code corresponding to double precision operations


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;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]