1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py 2; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu | FileCheck %s 3 4; The and with -9 has multiple users which prevents 5; SimplifyDemandedBits from touching it. The truncate only 6; demands the lower 8 bits. X86ISelDAGToDAG.cpp wants form 7; a test instruction from the icmp+trunc+and, but needs to 8; mask the -9 to 8 bits since SimplifyDemandedBits didn't. 9 10define i32 @foo(i16 signext %0, i32 %1, ptr nocapture %2) { 11; CHECK-LABEL: foo: 12; CHECK: # %bb.0: 13; CHECK-NEXT: incl %edi 14; CHECK-NEXT: andl $65527, %edi # imm = 0xFFF7 15; CHECK-NEXT: movl %edi, (%rdx) 16; CHECK-NEXT: xorl %eax, %eax 17; CHECK-NEXT: testb %dil, %dil 18; CHECK-NEXT: cmovel %esi, %eax 19; CHECK-NEXT: retq 20 %4 = add i16 %0, 1 21 %5 = and i16 %4, -9 22 %6 = zext i16 %5 to i32 23 store i32 %6, ptr %2, align 4 24 %7 = trunc i16 %5 to i8 25 %8 = icmp eq i8 %7, 0 26 %9 = select i1 %8, i32 %1, i32 0 27 ret i32 %9 28} 29