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
14 changes: 9 additions & 5 deletions llvm/lib/Target/LoongArch/LoongArchOptWInstrs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,11 +139,6 @@ static bool hasAllNBitUsers(const MachineInstr &OrigMI,
case LoongArch::MULH_WU:
case LoongArch::MULW_D_W:
case LoongArch::MULW_D_WU:
// TODO: {DIV,MOD}.{W,WU} consumes the upper 32 bits before LA664+.
// case LoongArch::DIV_W:
// case LoongArch::DIV_WU:
// case LoongArch::MOD_W:
// case LoongArch::MOD_WU:
case LoongArch::SLL_W:
case LoongArch::SLLI_W:
case LoongArch::SRL_W:
Expand All @@ -170,6 +165,15 @@ static bool hasAllNBitUsers(const MachineInstr &OrigMI,
if (Bits >= 32)
break;
return false;
// {DIV,MOD}.W{U} consumes the upper 32 bits if the div32
// feature is not enabled.
case LoongArch::DIV_W:
case LoongArch::DIV_WU:
case LoongArch::MOD_W:
case LoongArch::MOD_WU:
if (Bits >= 32 && ST.hasDiv32())
break;
return false;
case LoongArch::MOVGR2CF:
if (Bits >= 1)
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,9 @@ define signext i32 @sextw_rmv(i32 signext %a, i32 signext %b, i32 signext %c) {
;
; LA64-DIV32-LABEL: sextw_rmv:
; LA64-DIV32: # %bb.0: # %entry
; LA64-DIV32-NEXT: mul.d $a0, $a1, $a0
; LA64-DIV32-NEXT: addi.w $a1, $a0, 0
; LA64-DIV32-NEXT: div.w $a0, $a2, $a0
; LA64-DIV32-NEXT: sltu $a0, $a0, $a1
; LA64-DIV32-NEXT: mul.w $a0, $a1, $a0
; LA64-DIV32-NEXT: div.w $a1, $a2, $a0
; LA64-DIV32-NEXT: sltu $a0, $a1, $a0
; LA64-DIV32-NEXT: ret
entry:
%mul = mul nsw i32 %b, %a
Expand Down
Loading