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

# CABAC decode bin
0xd0 0xde 0xd4 0xc1
# CHECK: r17:16 = decbin(r21:20,r31:30)

# Saturate
0x11 0xc0 0xd4 0x88
# CHECK: r17 = sat(r21:20)
0x91 0xc0 0xd5 0x8c
# CHECK: r17 = sath(r21)
0xb1 0xc0 0xd5 0x8c
# CHECK: r17 = satuh(r21)
0xd1 0xc0 0xd5 0x8c
# CHECK: r17 = satub(r21)
0xf1 0xc0 0xd5 0x8c
# CHECK: r17 = satb(r21)

# Swizzle bytes
0xf1 0xc0 0x95 0x8c
# CHECK: r17 = swiz(r21)

# Vector align
0x70 0xd4 0x1e 0xc2
# CHECK: r17:16 = valignb(r21:20,r31:30,p3)
0x70 0xde 0x94 0xc2
# CHECK: r17:16 = vspliceb(r21:20,r31:30,p3)

# Vector round and pack
0x91 0xc0 0x94 0x88
# CHECK: r17 = vrndwh(r21:20)
0xd1 0xc0 0x94 0x88
# CHECK: r17 = vrndwh(r21:20):sat

# Vector saturate and pack
0x11 0xc0 0x14 0x88
# CHECK: r17 = vsathub(r21:20)
0x51 0xc0 0x14 0x88
# CHECK: r17 = vsatwh(r21:20)
0x91 0xc0 0x14 0x88
# CHECK: r17 = vsatwuh(r21:20)
0xd1 0xc0 0x14 0x88
# CHECK: r17 = vsathb(r21:20)
0x11 0xc0 0x95 0x8c
# CHECK: r17 = vsathb(r21)
0x51 0xc0 0x95 0x8c
# CHECK: r17 = vsathub(r21)

# Vector saturate without pack
0x90 0xc0 0x14 0x80
# CHECK: r17:16 = vsathub(r21:20)
0xb0 0xc0 0x14 0x80
# CHECK: r17:16 = vsatwuh(r21:20)
0xd0 0xc0 0x14 0x80
# CHECK: r17:16 = vsatwh(r21:20)
0xf0 0xc0 0x14 0x80
# CHECK: r17:16 = vsathb(r21:20)

# Vector shuffle
0x50 0xde 0x14 0xc1
# CHECK: r17:16 = shuffeb(r21:20,r31:30)
0x90 0xd4 0x1e 0xc1
# CHECK: r17:16 = shuffob(r21:20,r31:30)
0xd0 0xde 0x14 0xc1
# CHECK: r17:16 = shuffeh(r21:20,r31:30)
0x10 0xd4 0x9e 0xc1
# CHECK: r17:16 = shuffoh(r21:20,r31:30)

# Vector splat bytes
0xf1 0xc0 0x55 0x8c
# CHECK: r17 = vsplatb(r21)

# Vector splat halfwords
0x50 0xc0 0x55 0x84
# CHECK: r17:16 = vsplath(r21)

# Vector splice
0x70 0xde 0x94 0xc0
# CHECK: r17:16 = vspliceb(r21:20,r31:30,#3)
0x70 0xde 0x94 0xc2
# CHECK: r17:16 = vspliceb(r21:20,r31:30,p3)

# Vector sign extend
0x10 0xc0 0x15 0x84
# CHECK: r17:16 = vsxtbh(r21)
0x90 0xc0 0x15 0x84
# CHECK: r17:16 = vsxthw(r21)

# Vector truncate
0x11 0xc0 0x94 0x88
# CHECK: r17 = vtrunohb(r21:20)
0x51 0xc0 0x94 0x88
# CHECK: r17 = vtrunehb(r21:20)
0x50 0xde 0x94 0xc1
# CHECK: r17:16 = vtrunewh(r21:20,r31:30)
0x90 0xde 0x94 0xc1
# CHECK: r17:16 = vtrunowh(r21:20,r31:30)

# Vector zero extend
0x50 0xc0 0x15 0x84
# CHECK: r17:16 = vzxtbh(r21)
0xd0 0xc0 0x15 0x84
# CHECK: r17:16 = vzxthw(r21)
