Bug ID: 81739
           Summary: Replace calls to memcmp with more efficient code if
           Product: gcc
           Version: 4.8.5
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot
  Target Milestone: ---

In our app we had function which was comparing two uint64 values using memcmp.
As it turned out, it was taking a lot of time. After some googling we found
this link:
After fixing our code using this approach it started working much faster.
Please implement such optimization in gcc itself. I found that it already
optimizes some calls to memcpy, it could do the same with memcmp too.


#include <string.h>
#include <stdint.h>

int cmp1(uint64_t a, uint64_t b)
    return memcmp(&a, &b, sizeof(uint64_t));

int cmp2(uint64_t a, uint64_t b)
    return a < b ? -1 : (a > b);

Reply via email to