# RUN: llvm-mc -triple=hexagon -disassemble < %s | FileCheck %s
# Hexagon Programmer's Reference Manual 11.10.7 XTYPE/PRED

# Bounds check
0x83 0xf4 0x10 0xd2
# CHECK: p3 = boundscheck(r17:16, r21:20):raw:lo
0xa3 0xf4 0x10 0xd2
# CHECK: p3 = boundscheck(r17:16, r21:20):raw:hi

# Compare byte
0x43 0xd5 0xd1 0xc7
# CHECK: p3 = cmpb.gt(r17, r21)
0xc3 0xd5 0xd1 0xc7
# CHECK: p3 = cmpb.eq(r17, r21)
0xe3 0xd5 0xd1 0xc7
# CHECK: p3 = cmpb.gtu(r17, r21)
0xa3 0xc2 0x11 0xdd
# CHECK: p3 = cmpb.eq(r17, #21)
0xa3 0xc2 0x31 0xdd
# CHECK: p3 = cmpb.gt(r17, #21)
0xa3 0xc2 0x51 0xdd
# CHECK: p3 = cmpb.gtu(r17, #21)

# Compare half
0x63 0xd5 0xd1 0xc7
# CHECK: p3 = cmph.eq(r17, r21)
0x83 0xd5 0xd1 0xc7
# CHECK: p3 = cmph.gt(r17, r21)
0xa3 0xd5 0xd1 0xc7
# CHECK: p3 = cmph.gtu(r17, r21)
0xab 0xc2 0x11 0xdd
# CHECK: p3 = cmph.eq(r17, #21)
0xab 0xc2 0x31 0xdd
# CHECK: p3 = cmph.gt(r17, #21)
0xab 0xc2 0x51 0xdd
# CHECK: p3 = cmph.gtu(r17, #21)

# Compare doublewords
0x03 0xde 0x94 0xd2
# CHECK: p3 = cmp.eq(r21:20, r31:30)
0x43 0xde 0x94 0xd2
# CHECK: p3 = cmp.gt(r21:20, r31:30)
0x83 0xde 0x94 0xd2
# CHECK: p3 = cmp.gtu(r21:20, r31:30)

# Compare bitmask
0x03 0xd5 0x91 0x85
# CHECK: p3 = bitsclr(r17, #21)
0x03 0xd5 0xb1 0x85
# CHECK: p3 = !bitsclr(r17, #21)
0x03 0xd5 0x51 0xc7
# CHECK: p3 = bitsset(r17, r21)
0x03 0xd5 0x71 0xc7
# CHECK: p3 = !bitsset(r17, r21)
0x03 0xd5 0x91 0xc7
# CHECK: p3 = bitsclr(r17, r21)
0x03 0xd5 0xb1 0xc7
# CHECK: p3 = !bitsclr(r17, r21)

# mask generate from predicate
0x10 0xc3 0x00 0x86
# CHECK: r17:16 = mask(p3)

# Check for TLB match
0x63 0xf5 0x10 0xd2
# CHECK: p3 = tlbmatch(r17:16, r21)

# Predicate Transfer
0x03 0xc0 0x45 0x85
# CHECK: p3 = r5
0x05 0xc0 0x43 0x89
# CHECK: r5 = p3

# Test bit
0x03 0xd5 0x11 0x85
# CHECK: p3 = tstbit(r17, #21)
0x03 0xd5 0x31 0x85
# CHECK: p3 = !tstbit(r17, #21)
0x03 0xd5 0x11 0xc7
# CHECK: p3 = tstbit(r17, r21)
0x03 0xd5 0x31 0xc7
# CHECK: p3 = !tstbit(r17, r21)

# Vector compare halfwords
0x63 0xde 0x14 0xd2
# CHECK: p3 = vcmph.eq(r21:20, r31:30)
0x83 0xde 0x14 0xd2
# CHECK: p3 = vcmph.gt(r21:20, r31:30)
0xa3 0xde 0x14 0xd2
# CHECK: p3 = vcmph.gtu(r21:20, r31:30)
0xeb 0xc3 0x14 0xdc
# CHECK: p3 = vcmph.eq(r21:20, #31)
0xeb 0xc3 0x34 0xdc
# CHECK: p3 = vcmph.gt(r21:20, #31)
0xeb 0xc3 0x54 0xdc
# CHECK: p3 = vcmph.gtu(r21:20, #31)

# Vector compare bytes for any match
0x03 0xfe 0x14 0xd2
# CHECK: p3 = any8(vcmpb.eq(r21:20, r31:30))

# Vector compare bytes
0x63 0xde 0x14 0xd2
# CHECK: p3 = vcmph.eq(r21:20, r31:30)
0x83 0xde 0x14 0xd2
# CHECK: p3 = vcmph.gt(r21:20, r31:30)
0xa3 0xde 0x14 0xd2
# CHECK: p3 = vcmph.gtu(r21:20, r31:30)
0xeb 0xc3 0x14 0xdc
# CHECK: p3 = vcmph.eq(r21:20, #31)
0xeb 0xc3 0x34 0xdc
# CHECK: p3 = vcmph.gt(r21:20, #31)
0xeb 0xc3 0x54 0xdc
# CHECK: p3 = vcmph.gtu(r21:20, #31)

# Vector compare words
0x03 0xde 0x14 0xd2
# CHECK: p3 = vcmpw.eq(r21:20, r31:30)
0x23 0xde 0x14 0xd2
# CHECK: p3 = vcmpw.gt(r21:20, r31:30)
0x43 0xde 0x14 0xd2
# CHECK: p3 = vcmpw.gtu(r21:20, r31:30)
0xf3 0xc3 0x14 0xdc
# CHECK: p3 = vcmpw.eq(r21:20, #31)
0xf3 0xc3 0x34 0xdc
# CHECK: p3 = vcmpw.gt(r21:20, #31)
0xf3 0xc3 0x54 0xdc
# CHECK: p3 = vcmpw.gtu(r21:20, #31)

# Viterbi pack even and odd predicate bits
0x11 0xc2 0x03 0x89
# CHECK: r17 = vitpack(p3, p2)

# Vector mux
0x70 0xde 0x14 0xd1
# CHECK: r17:16 = vmux(p3, r21:20, r31:30)
