Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13381,9 +13381,9 @@ SDValue DAGCombiner::visitSIGN_EXTEND(SDNode *N) {
if (N0.getOpcode() == ISD::SIGN_EXTEND_INREG) {
SDValue N00 = N0.getOperand(0);
EVT ExtVT = cast<VTSDNode>(N0->getOperand(1))->getVT();
if (N00.getOpcode() == ISD::TRUNCATE &&
if ((N00.getOpcode() == ISD::TRUNCATE || TLI.isTruncateFree(N00, ExtVT)) &&
(!LegalTypes || TLI.isTypeLegal(ExtVT))) {
SDValue T = DAG.getNode(ISD::TRUNCATE, DL, ExtVT, N00.getOperand(0));
SDValue T = DAG.getNode(ISD::TRUNCATE, DL, ExtVT, N00);
return DAG.getNode(ISD::SIGN_EXTEND, DL, VT, T);
}
}
Expand Down
8 changes: 4 additions & 4 deletions llvm/test/CodeGen/X86/abds.ll
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,9 @@ define i16 @abd_ext_i16_i32(i16 %a, i32 %b) nounwind {
;
; X64-LABEL: abd_ext_i16_i32:
; X64: # %bb.0:
; X64-NEXT: # kill: def $edi killed $edi def $rdi
; X64-NEXT: movswq %di, %rcx
; X64-NEXT: movslq %esi, %rax
; X64-NEXT: movswl %di, %ecx
; X64-NEXT: movslq %ecx, %rcx
; X64-NEXT: subq %rax, %rcx
; X64-NEXT: movq %rcx, %rax
; X64-NEXT: negq %rax
Expand Down Expand Up @@ -232,9 +232,9 @@ define i32 @abd_ext_i32_i16(i32 %a, i16 %b) nounwind {
;
; X64-LABEL: abd_ext_i32_i16:
; X64: # %bb.0:
; X64-NEXT: # kill: def $esi killed $esi def $rsi
; X64-NEXT: movswq %si, %rax
; X64-NEXT: movslq %edi, %rcx
; X64-NEXT: movswl %si, %eax
; X64-NEXT: cltq
; X64-NEXT: subq %rax, %rcx
; X64-NEXT: movq %rcx, %rax
; X64-NEXT: negq %rax
Expand Down
3 changes: 1 addition & 2 deletions llvm/test/CodeGen/X86/pr14088.ll
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ define i32 @f(i1 %foo, ptr %tm_year2, ptr %bar, i16 %zed, i32 %zed2) {
; CHECK-NEXT: imull $100, %ecx, %ecx
; CHECK-NEXT: subl %ecx, %eax
; CHECK-NEXT: movw %ax, (%rsi)
; CHECK-NEXT: cwtl
; CHECK-NEXT: cltq
; CHECK-NEXT: movswq %ax, %rax
; CHECK-NEXT: imulq $1717986919, %rax, %rax # imm = 0x66666667
; CHECK-NEXT: movq %rax, %rcx
; CHECK-NEXT: shrq $63, %rcx
Expand Down