https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88545
--- Comment #10 from AK <hiraditya at msn dot com> --- With this patch find of int8_t gets converted to memchr. Using testcase from https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115040 as example. With the patch posted in https://gcc.gnu.org/pipermail/gcc-patches/2024-June/653731.html ``` bool find_epi8(const std::vector<int8_t>& v) { return std::find(v.begin(), v.end(), 42) != v.end(); } ``` $ gcc -O3 -ftree-vectorize -march=pantherlake test.cpp -S -o test.s ``` .globl _Z9find_epi8RKSt6vectorIaSaIaEE .type _Z9find_epi8RKSt6vectorIaSaIaEE, @function _Z9find_epi8RKSt6vectorIaSaIaEE: .LFB1535: .cfi_startproc pushq %rbx .cfi_def_cfa_offset 16 .cfi_offset 3, -16 movq 8(%rdi), %rbx movq (%rdi), %rdi testq %rdi, %rdi je .L2 movq %rbx, %rdx subq %rdi, %rdx xorl %eax, %eax testq %rdx, %rdx jle .L1 movl $42, %esi call memchr movq %rax, %rdx cmpq %rax, %rbx setne %al testq %rdx, %rdx setne %dl andl %edx, %eax .L1: popq %rbx .cfi_remember_state .cfi_def_cfa_offset 8 ret .p2align 4,,10 .p2align 3 .L2: .cfi_restore_state cmpq $3, %rbx jg .L4 cmpq $2, %rbx je .L10 cmpq $3, %rbx je .L6 xorl %eax, %eax cmpq $1, %rbx jne .L1 .L7: cmpb $42, (%rdi) sete %al cmpq %rdi, %rbx setne %dl andl %edx, %eax popq %rbx .cfi_def_cfa_offset 8 ret .L10: .cfi_restore_state xorl %edx, %edx movl $1, %edi .L5: cmpb $42, (%rdx) movl $1, %eax jne .L7 popq %rbx .cfi_remember_state .cfi_def_cfa_offset 8 ret .L6: .cfi_restore_state cmpb $42, 0 movl $1, %eax je .L1 movl $2, %edi movl $1, %edx jmp .L5 .cfi_endproc .section .text.unlikely .cfi_startproc .type _Z9find_epi8RKSt6vectorIaSaIaEE.cold, @function _Z9find_epi8RKSt6vectorIaSaIaEE.cold: .LFSB1535: .L4: .cfi_def_cfa_offset 16 .cfi_offset 3, -16 movzbl 0, %eax ud2 .cfi_endproc .LFE1535: .text .size _Z9find_epi8RKSt6vectorIaSaIaEE, .-_Z9find_epi8RKSt6vectorIaSaIaEE .section .text.unlikely .size _Z9find_epi8RKSt6vectorIaSaIaEE.cold, .-_Z9find_epi8RKSt6vectorIaSaIaEE.cold ```