; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5
; RUN: llc < %s -mtriple=x86_64-- | FileCheck %s
define i8 @PR108728(i1 %a0) {
; CHECK-LABEL: PR108728:
; CHECK: # %bb.0:
; CHECK-NEXT: xorl %eax, %eax
; CHECK-NEXT: retq
%sel = select i1 %a0, i8 0, i8 1
%not = xor i8 %sel, -1
%udiv = udiv i8 1, %not
%cnt = tail call i8 @llvm.ctpop.i8(i8 %udiv)
ret i8 %cnt
}