[llvm] r244064 - [Sparc] Fix disassembly of popc instruction.

James Y Knight jyknight at google.com
Wed Aug 5 10:00:30 PDT 2015


Author: jyknight
Date: Wed Aug  5 12:00:30 2015
New Revision: 244064

URL: http://llvm.org/viewvc/llvm-project?rev=244064&view=rev
Log:
[Sparc] Fix disassembly of popc instruction.

And add tests.

Patch by David Wiberg!

Added:
    llvm/trunk/test/MC/Disassembler/Sparc/sparc-v9.txt
Modified:
    llvm/trunk/lib/Target/Sparc/SparcInstrInfo.td
    llvm/trunk/test/MC/Sparc/sparcv9-instructions.s

Modified: llvm/trunk/lib/Target/Sparc/SparcInstrInfo.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/SparcInstrInfo.td?rev=244064&r1=244063&r2=244064&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Sparc/SparcInstrInfo.td (original)
+++ llvm/trunk/lib/Target/Sparc/SparcInstrInfo.td Wed Aug  5 12:00:30 2015
@@ -1221,8 +1221,8 @@ let Predicates = [HasV9] in {
 // the top 32-bits before using it.  To do this clearing, we use a SRLri X,0.
 let rs1 = 0 in
   def POPCrr : F3_1<2, 0b101110,
-                    (outs IntRegs:$dst), (ins IntRegs:$src),
-                    "popc $src, $dst", []>, Requires<[HasV9]>;
+                    (outs IntRegs:$rd), (ins IntRegs:$rs2),
+                    "popc $rs2, $rd", []>, Requires<[HasV9]>;
 def : Pat<(ctpop i32:$src),
           (POPCrr (SRLri $src, 0))>;
 

Added: llvm/trunk/test/MC/Disassembler/Sparc/sparc-v9.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/Disassembler/Sparc/sparc-v9.txt?rev=244064&view=auto
==============================================================================
--- llvm/trunk/test/MC/Disassembler/Sparc/sparc-v9.txt (added)
+++ llvm/trunk/test/MC/Disassembler/Sparc/sparc-v9.txt Wed Aug  5 12:00:30 2015
@@ -0,0 +1,4 @@
+# RUN: llvm-mc --disassemble %s -triple=sparcv9-unknown-linux | FileCheck %s
+
+# CHECK: popc %g1, %g2
+0x85 0x70 0x00 0x01

Modified: llvm/trunk/test/MC/Sparc/sparcv9-instructions.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/Sparc/sparcv9-instructions.s?rev=244064&r1=244063&r2=244064&view=diff
==============================================================================
--- llvm/trunk/test/MC/Sparc/sparcv9-instructions.s (original)
+++ llvm/trunk/test/MC/Sparc/sparcv9-instructions.s Wed Aug  5 12:00:30 2015
@@ -21,3 +21,8 @@
         ! V9:      subxcc %g1, %g2, %g3         ! encoding: [0x86,0xe0,0x40,0x02]
         subccc %g1, %g2, %g3
 
+        ! V8:      error: instruction requires a CPU feature not currently enabled
+        ! V8-NEXT: popc %g1, %g2
+        ! V9:      popc %g1, %g2                ! encoding: [0x85,0x70,0x00,0x01]
+        popc %g1, %g2
+




More information about the llvm-commits mailing list