Index: lib/Target/X86/X86ISelDAGToDAG.cpp =================================================================== --- lib/Target/X86/X86ISelDAGToDAG.cpp +++ lib/Target/X86/X86ISelDAGToDAG.cpp @@ -3024,27 +3024,6 @@ return; } - // For example, "testl %eax, $32776" to "testw %ax, $32776". - if (isUInt<16>(Mask) && N0.getValueType() != MVT::i16 && - (!(Mask & 0x8000) || hasNoSignedComparisonUses(Node))) { - SDValue Imm = CurDAG->getTargetConstant(Mask, dl, MVT::i16); - SDValue Reg = N0.getOperand(0); - - // Extract the 16-bit subregister. - SDValue Subreg = CurDAG->getTargetExtractSubreg(X86::sub_16bit, dl, - MVT::i16, Reg); - - // Emit a testw. - SDNode *NewNode = CurDAG->getMachineNode(X86::TEST16ri, dl, MVT::i32, - Subreg, Imm); - // Replace SUB|CMP with TEST, since SUB has two outputs while TEST has - // one, do not call ReplaceAllUsesWith. - ReplaceUses(SDValue(Node, (Opcode == X86ISD::SUB ? 1 : 0)), - SDValue(NewNode, 0)); - CurDAG->RemoveDeadNode(Node); - return; - } - // For example, "testq %rax, $268468232" to "testl %eax, $268468232". if (isUInt<32>(Mask) && N0.getValueType() == MVT::i64 && (!(Mask & 0x80000000) || hasNoSignedComparisonUses(Node))) { Index: test/CodeGen/X86/tbm_patterns.ll =================================================================== --- test/CodeGen/X86/tbm_patterns.ll +++ test/CodeGen/X86/tbm_patterns.ll @@ -53,7 +53,7 @@ ; CHECK-LABEL: test_x86_tbm_bextri_u32_z2: ; CHECK: # BB#0: ; CHECK-NEXT: shrl $4, %edi -; CHECK-NEXT: testw $4095, %di # imm = 0xFFF +; CHECK-NEXT: testl $4095, %edi # imm = 0xFFF ; CHECK-NEXT: cmovnel %edx, %esi ; CHECK-NEXT: movl %esi, %eax ; CHECK-NEXT: retq @@ -114,7 +114,7 @@ ; CHECK-LABEL: test_x86_tbm_bextri_u64_z2: ; CHECK: # BB#0: ; CHECK-NEXT: shrl $4, %edi -; CHECK-NEXT: testw $4095, %di # imm = 0xFFF +; CHECK-NEXT: testl $4095, %edi # imm = 0xFFF ; CHECK-NEXT: cmovneq %rdx, %rsi ; CHECK-NEXT: movq %rsi, %rax ; CHECK-NEXT: retq Index: test/CodeGen/X86/test-shrink-bug.ll =================================================================== --- test/CodeGen/X86/test-shrink-bug.ll +++ test/CodeGen/X86/test-shrink-bug.ll @@ -3,7 +3,7 @@ ; Codegen shouldn't reduce the comparison down to testb $-1, %al ; because that changes the result of the signed test. ; PR5132 -; CHECK: testw $255, %ax +; CHECK: testl $255, %eax target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128" target triple = "i386-apple-darwin10.0" Index: test/CodeGen/X86/test-shrink.ll =================================================================== --- test/CodeGen/X86/test-shrink.ll +++ test/CodeGen/X86/test-shrink.ll @@ -105,10 +105,10 @@ ret void } ; CHECK-64-LABEL: g64x16: -; CHECK-64: testw $-32640, %[[A0W:di|cx]] +; CHECK-64: testl $32896, %[[A0D:edi|ecx]] ; CHECK-64: ret ; CHECK-32-LABEL: g64x16: -; CHECK-32: testw $-32640, %ax +; CHECK-32: testl $32896, %eax ; CHECK-32: ret define void @g64x16(i64 inreg %x) nounwind { %t = and i64 %x, 32896 @@ -122,10 +122,10 @@ ret void } ; CHECK-64-LABEL: g32x16: -; CHECK-64: testw $-32640, %[[A0W]] +; CHECK-64: testl $32896, %[[A0D]] ; CHECK-64: ret ; CHECK-32-LABEL: g32x16: -; CHECK-32: testw $-32640, %ax +; CHECK-32: testl $32896, %eax ; CHECK-32: ret define void @g32x16(i32 inreg %x) nounwind { %t = and i32 %x, 32896 @@ -139,7 +139,7 @@ ret void } ; CHECK-64-LABEL: g64x32: -; CHECK-64: testl $268468352, %e[[A0W]] +; CHECK-64: testl $268468352, %[[A0D]] ; CHECK-64: ret ; CHECK-32-LABEL: g64x32: ; CHECK-32: testl $268468352, %eax