1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-26 04:32:44 +01:00

[Sparc] Fix disassembly of popc instruction.

And add tests.

Patch by David Wiberg!

llvm-svn: 244064
This commit is contained in:
James Y Knight 2015-08-05 17:00:30 +00:00
parent 5da7c5df39
commit fd955f3e15
3 changed files with 11 additions and 2 deletions

View File

@ -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))>;

View File

@ -0,0 +1,4 @@
# RUN: llvm-mc --disassemble %s -triple=sparcv9-unknown-linux | FileCheck %s
# CHECK: popc %g1, %g2
0x85 0x70 0x00 0x01

View File

@ -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