[llvm] r321066 - [mips] Handle the emission of microMIPSr6 sll instruction when used as a nop.

Simon Dardis via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 19 03:16:22 PST 2017


Author: sdardis
Date: Tue Dec 19 03:16:22 2017
New Revision: 321066

URL: http://llvm.org/viewvc/llvm-project?rev=321066&view=rev
Log:
[mips] Handle the emission of microMIPSr6 sll instruction when used as a nop.

This instruction is encoded as zero, so we have handle that case when checking
for unimplemented opcodes when producing the encoding for an instruction.

Added:
    llvm/trunk/test/CodeGen/Mips/sll-micromips-r6-encoding.mir
Modified:
    llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsMCCodeEmitter.cpp

Modified: llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsMCCodeEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsMCCodeEmitter.cpp?rev=321066&r1=321065&r2=321066&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsMCCodeEmitter.cpp (original)
+++ llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsMCCodeEmitter.cpp Tue Dec 19 03:16:22 2017
@@ -188,7 +188,7 @@ encodeInstruction(const MCInst &MI, raw_
   // so we have to special check for them.
   unsigned Opcode = TmpInst.getOpcode();
   if ((Opcode != Mips::NOP) && (Opcode != Mips::SLL) &&
-      (Opcode != Mips::SLL_MM) && !Binary)
+      (Opcode != Mips::SLL_MM) && (Opcode != Mips::SLL_MMR6) && !Binary)
     llvm_unreachable("unimplemented opcode in encodeInstruction()");
 
   int NewOpcode = -1;

Added: llvm/trunk/test/CodeGen/Mips/sll-micromips-r6-encoding.mir
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Mips/sll-micromips-r6-encoding.mir?rev=321066&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/Mips/sll-micromips-r6-encoding.mir (added)
+++ llvm/trunk/test/CodeGen/Mips/sll-micromips-r6-encoding.mir Tue Dec 19 03:16:22 2017
@@ -0,0 +1,46 @@
+# RUN: llc -march=mips -mcpu=mips32r6 -mattr=+micromips %s -start-after=xray-instrumentation -o - -show-mc-encoding | FileCheck %s
+
+# Test that the 'sll $zero, $zero, 0' is correctly recognized as a real
+# instruction rather than some unimplemented opcode for the purposes of
+# encoding an instruction.
+
+# CHECK-LABEL: a:
+# CHECK:  nop                           # encoding: [0x00,0x00,0x00,0x00]
+# CHECK:  jrc   $ra                     # encoding: [0x45,0xbf]
+---
+name:            a
+alignment:       2
+exposesReturnsTwice: false
+legalized:       false
+regBankSelected: false
+selected:        false
+tracksRegLiveness: false
+registers:
+liveins:
+  - { reg: '%a0', virtual-reg: '' }
+frameInfo:
+  isFrameAddressTaken: false
+  isReturnAddressTaken: false
+  hasStackMap:     false
+  hasPatchPoint:   false
+  stackSize:       0
+  offsetAdjustment: 0
+  maxAlignment:    1
+  adjustsStack:    false
+  hasCalls:        false
+  stackProtector:  ''
+  maxCallFrameSize: 0
+  hasOpaqueSPAdjustment: false
+  hasVAStart:      false
+  hasMustTailInVarArgFunc: false
+  savePoint:       ''
+  restorePoint:    ''
+fixedStack:
+stack:
+constants:
+body:             |
+  bb.0.entry:
+    renamable %zero = SLL_MMR6 killed renamable %zero, 0
+    JRC16_MM undef %ra, implicit %v0
+
+...




More information about the llvm-commits mailing list