[llvm] [M68k] Implement `SWAP` instruction encoding, patterns, and tests (PR #215597)

Dan Salvato via llvm-commits llvm-commits at lists.llvm.org
Sat Aug 15 20:29:10 PDT 2026


================
@@ -77,17 +77,29 @@ M68kTargetLowering::M68kTargetLowering(const M68kTargetMachine &TM,
   setTruncStoreAction(MVT::i32, MVT::i8, Expand);
   setTruncStoreAction(MVT::i16, MVT::i8, Expand);
 
-  setOperationAction({ISD::MUL, ISD::SDIV, ISD::UDIV}, MVT::i8, Promote);
-  setOperationAction({ISD::MUL, ISD::SDIV, ISD::UDIV}, MVT::i16, Legal);
-  if (Subtarget.atLeastM68020())
-    setOperationAction({ISD::MUL, ISD::SDIV, ISD::UDIV}, MVT::i32, Legal);
-  else
-    setOperationAction({ISD::MUL, ISD::SDIV, ISD::UDIV}, MVT::i32, LibCall);
-  setOperationAction(ISD::MUL, MVT::i64, LibCall);
----------------
dansalvato wrote:

Good catch, thanks for noticing. I pushed a fix to add the line back. This diff should remain because codegen benefits from DIV/REM being marked as Legal (it was an error in the first place that they weren't), and the diffs in the test files also reflect this change.

https://github.com/llvm/llvm-project/pull/215597


More information about the llvm-commits mailing list