Files
clang-p2996/llvm/test/CodeGen/X86/pr94824.ll
Yingwei Zheng d9507a3e10 [DAGCombine] Fix miscompilation caused by PR94008 (#94850)
The pr description in #94008 mismatches with the code.
> + When VT is smaller than ShiftVT, it is safe to use trunc.
> + When VT is larger than ShiftVT, it is safe to use zext iff
`is_zero_poison` is true (i.e., `opcode == ISD::CTTZ_ZERO_UNDEF`). See
also the counterexample `src_shl_cttz2 -> tgt_shl_cttz2` in the alive2
    proofs.

Closes #94824.
2024-06-08 21:40:57 +08:00

20 lines
654 B
LLVM

; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5
; RUN: llc < %s -mtriple=x86_64-linux-gnu | FileCheck %s
define i16 @pr94824(i8 %x1) {
; CHECK-LABEL: pr94824:
; CHECK: # %bb.0: # %entry
; CHECK-NEXT: orl $256, %edi # imm = 0x100
; CHECK-NEXT: rep bsfl %edi, %ecx
; CHECK-NEXT: movl $1, %eax
; CHECK-NEXT: # kill: def $cl killed $cl killed $ecx
; CHECK-NEXT: shll %cl, %eax
; CHECK-NEXT: # kill: def $ax killed $ax killed $eax
; CHECK-NEXT: retq
entry:
%cttz = call i8 @llvm.cttz.i8(i8 %x1, i1 false)
%ext = zext i8 %cttz to i16
%shl = shl i16 1, %ext
ret i16 %shl
}