This is based on current memcmp implementation. Differential Revision: https://reviews.llvm.org/D114432