Skip to content

Commit bce20af

Browse files
committed
[Sparc] Fix disassembly of popc instruction.
And add tests. Patch by David Wiberg! llvm-svn: 244064
1 parent 81167fb commit bce20af

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

llvm/lib/Target/Sparc/SparcInstrInfo.td

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1221,8 +1221,8 @@ let Predicates = [HasV9] in {
12211221
// the top 32-bits before using it. To do this clearing, we use a SRLri X,0.
12221222
let rs1 = 0 in
12231223
def POPCrr : F3_1<2, 0b101110,
1224-
(outs IntRegs:$dst), (ins IntRegs:$src),
1225-
"popc $src, $dst", []>, Requires<[HasV9]>;
1224+
(outs IntRegs:$rd), (ins IntRegs:$rs2),
1225+
"popc $rs2, $rd", []>, Requires<[HasV9]>;
12261226
def : Pat<(ctpop i32:$src),
12271227
(POPCrr (SRLri $src, 0))>;
12281228

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# RUN: llvm-mc --disassemble %s -triple=sparcv9-unknown-linux | FileCheck %s
2+
3+
# CHECK: popc %g1, %g2
4+
0x85 0x70 0x00 0x01

llvm/test/MC/Sparc/sparcv9-instructions.s

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,8 @@
2121
! V9: subxcc %g1, %g2, %g3 ! encoding: [0x86,0xe0,0x40,0x02]
2222
subccc %g1, %g2, %g3
2323

24+
! V8: error: instruction requires a CPU feature not currently enabled
25+
! V8-NEXT: popc %g1, %g2
26+
! V9: popc %g1, %g2 ! encoding: [0x85,0x70,0x00,0x01]
27+
popc %g1, %g2
28+

0 commit comments

Comments
 (0)