Skip to content

Commit e486bc5

Browse files
committed
[M68k] Fix legality declaration for MUL/DIV/REM with i8 operands
This changes the action on MUL/DIV/REM with i8 operands from "Promote" to "Legal". The implementation of these instructions correctly handles both i8 and i16 operands in ISel, so there is no need to promote i8 to i16; doing so causes redundant machine instructions to be emitted.
1 parent 423f9ab commit e486bc5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

llvm/lib/Target/M68k/M68kISelLowering.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ M68kTargetLowering::M68kTargetLowering(const M68kTargetMachine &TM,
7575
setTruncStoreAction(MVT::i32, MVT::i8, Expand);
7676
setTruncStoreAction(MVT::i16, MVT::i8, Expand);
7777

78-
setOperationAction({ISD::MUL, ISD::SDIV, ISD::UDIV}, MVT::i8, Promote);
78+
setOperationAction({ISD::MUL, ISD::SDIV, ISD::UDIV}, MVT::i8, Legal);
7979
setOperationAction({ISD::MUL, ISD::SDIV, ISD::UDIV}, MVT::i16, Legal);
8080
if (Subtarget.atLeastM68020())
8181
setOperationAction({ISD::MUL, ISD::SDIV, ISD::UDIV}, MVT::i32, Legal);
@@ -86,7 +86,7 @@ M68kTargetLowering::M68kTargetLowering(const M68kTargetMachine &TM,
8686
for (auto OP :
8787
{ISD::SREM, ISD::UREM, ISD::UDIVREM, ISD::SDIVREM,
8888
ISD::MULHS, ISD::MULHU, ISD::UMUL_LOHI, ISD::SMUL_LOHI}) {
89-
setOperationAction(OP, MVT::i8, Promote);
89+
setOperationAction(OP, MVT::i8, Legal);
9090
setOperationAction(OP, MVT::i16, Legal);
9191
setOperationAction(OP, MVT::i32, LibCall);
9292
}

0 commit comments

Comments
 (0)