This is the mail archive of the gcc-patches@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]

Re: [PATCH] Improve bswap on nop non-base_addr reshuffles (PR tree-optimization/81396)




On 14/07/17 09:56, Jakub Jelinek wrote:
On Fri, Jul 14, 2017 at 09:45:39AM +0100, Thomas Preudhomme wrote:
+  else if (!bswap)
+    {

Would it make sense to add an assert right here checking that this is a
cmpnop operation?

The earlier bswap_replace code to handle n->base_addr && !bswap doesn't
have anything like that either.

And the assert would be certainly non-trivial, like:
#if ENABLE_ASSERT_CHECKING
   uint64_t cmpnop = CMPNOP;
   /* Note, n->range has been multiplied by BITS_PER_UNIT in between, so it
      needs to be divided by it again.  */
   if (n->range / BITS_PER_UNIT < (int) sizeof (int64_t))
     {
       mask = ((uint64_t) 1 << (n->range / BITS_PER_UNIT * BITS_PER_MARKER)) - 1;
       cmpnop &= mask;
     }
   gcc_assert (n->n == cmpnop);
#endif

I think trusting find_bswap_or_nop did the job right is enough.

Ooops I meant check that if !base_addr then !bswap but that's already guaranteed by the structure of the if. All good then.

Best regards,

Thomas


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