Index: lib/Target/X86/X86ISelLowering.cpp =================================================================== --- lib/Target/X86/X86ISelLowering.cpp +++ lib/Target/X86/X86ISelLowering.cpp @@ -17892,6 +17892,11 @@ } if (AddTest) { + // Look past the AssertZext to see whether it is a truncate operation. + if (Cond.getOpcode() == ISD::AssertZext && + Cond.getOperand(0).getOpcode() == ISD::TRUNCATE) + Cond = Cond.getOperand(0); + // Look past the truncate if the high bits are known zero. if (isTruncWithZeroHighBitsInput(Cond, DAG)) Cond = Cond.getOperand(0); Index: test/CodeGen/X86/fp128-select.ll =================================================================== --- test/CodeGen/X86/fp128-select.ll +++ test/CodeGen/X86/fp128-select.ll @@ -11,7 +11,7 @@ define void @test_select(fp128* %p, fp128* %q, i1 zeroext %c) { ; MMX-LABEL: test_select: ; MMX: # BB#0: -; MMX-NEXT: testb %dl, %dl +; MMX-NEXT: testl %edx, %edx ; MMX-NEXT: jne .LBB0_1 ; MMX-NEXT: # BB#2: ; MMX-NEXT: movaps {{.*}}(%rip), %xmm0 @@ -25,7 +25,7 @@ ; CHECK-LABEL: test_select: ; CHECK: # BB#0: ; CHECK-NEXT: xorl %eax, %eax -; CHECK-NEXT: testb %dl, %dl +; CHECK-NEXT: testl %edx, %edx ; CHECK-NEXT: cmovneq (%rdi), %rax ; CHECK-NEXT: movabsq $9223231299366420480, %rcx # imm = 0x7FFF800000000000 ; CHECK-NEXT: cmovneq 8(%rdi), %rcx Index: test/CodeGen/X86/select_const.ll =================================================================== --- test/CodeGen/X86/select_const.ll +++ test/CodeGen/X86/select_const.ll @@ -413,7 +413,7 @@ define i32 @select_C1_C2_zeroext(i1 zeroext %cond) { ; CHECK-LABEL: select_C1_C2_zeroext: ; CHECK: # BB#0: -; CHECK-NEXT: testb %dil, %dil +; CHECK-NEXT: testl %edi, %edi ; CHECK-NEXT: movl $421, %ecx # imm = 0x1A5 ; CHECK-NEXT: movl $42, %eax ; CHECK-NEXT: cmovnel %ecx, %eax