diff --git a/llvm/lib/Target/M68k/AsmParser/M68kAsmParser.cpp b/llvm/lib/Target/M68k/AsmParser/M68kAsmParser.cpp --- a/llvm/lib/Target/M68k/AsmParser/M68kAsmParser.cpp +++ b/llvm/lib/Target/M68k/AsmParser/M68kAsmParser.cpp @@ -479,6 +479,12 @@ StringRef RegisterName) { auto RegisterNameLower = RegisterName.lower(); + // CCR register + if (RegisterNameLower == "ccr") { + RegNo = M68k::CCR; + return true; + } + // Parse simple general-purpose registers. if (RegisterNameLower.size() == 2) { static unsigned RegistersByIndex[] = { @@ -501,13 +507,6 @@ break; } - case 'c': - if (RegisterNameLower[1] == 'c' && RegisterNameLower[2] == 'r') { - RegNo = M68k::CCR; - return true; - } - break; - case 's': if (RegisterNameLower[1] == 'p') { RegNo = M68k::SP; diff --git a/llvm/test/CodeGen/M68k/Encoding/Data/Classes/MxMoveCCR.mir b/llvm/test/CodeGen/M68k/Encoding/Data/Classes/MxMoveCCR.mir deleted file mode 100644 --- a/llvm/test/CodeGen/M68k/Encoding/Data/Classes/MxMoveCCR.mir +++ /dev/null @@ -1,34 +0,0 @@ -# RUN: llc %s -mtriple=m68k -start-after=prologepilog -O0 -filetype=obj -o - \ -# RUN: | extract-section .text \ -# RUN: | FileCheck %s -check-prefixes=MOV16CD,MOV16DC - -#------------------------------------------------------------------------------ -# MxMoveToCCR and MxMoveFromCCR load/store condition flag register -#------------------------------------------------------------------------------ - ---- # To CCR -# ---------------------------------------+-----------+----------- -# F E D C B A 9 8 7 6 | 5 4 3 | 2 1 0 -# ---------------------------------------+-----------+----------- -# 0 1 0 0 0 1 0 0 1 1 | MODE | REG -# ---------------------------------------+-----------+----------- -# MOV16CD: 0 1 0 0 0 1 0 0 . 1 1 0 0 0 0 0 1 -name: MxMoveToCCR -body: | - bb.0: - $ccr = MOV16cd $wd1, implicit-def $ccr - -... ---- # From CCR -# ---------------------------------------+-----------+----------- -# F E D C B A 9 8 7 6 | 5 4 3 | 2 1 0 -# ---------------------------------------+-----------+----------- -# 0 1 0 0 0 0 1 0 1 1 | MODE | REG -# ---------------------------------------+-----------+----------- -# MOV16DC-SAME: 0 1 0 0 0 0 1 0 . 1 1 0 0 0 0 0 1 -name: MxMoveFromCCR -body: | - bb.0: - $wd1 = MOV16dc $ccr, implicit $ccr - -... diff --git a/llvm/test/MC/M68k/Data/Classes/MxMoveCCR.s b/llvm/test/MC/M68k/Data/Classes/MxMoveCCR.s new file mode 100644 --- /dev/null +++ b/llvm/test/MC/M68k/Data/Classes/MxMoveCCR.s @@ -0,0 +1,16 @@ +; RUN: llvm-mc -triple=m68k -show-encoding %s | FileCheck %s + .text + .globl MxMoveToCCR +; CHECK-LABEL: MxMoveToCCR: +MxMoveToCCR: + ; CHECK: move.w %d1, %ccr + ; CHECK-SAME: encoding: [0x44,0xc1] + move.w %d1, %ccr + + .globl MxMoveFromCCR +; CHECK-LABEL: MxMoveFromCCR: +MxMoveFromCCR: + ; CHECK: move.w %ccr, %d1 + ; CHECK-SAME: encoding: [0x42,0xc1] + move.w %ccr, %d1 +