/*
 * This file and its contents are supplied under the terms of the
 * Common Development and Distribution License ("CDDL"), version 1.0.
 * You may only use this file in accordance with the terms of version
 * 1.0 of the CDDL.
 *
 * A full copy of the text of the CDDL should have accompanied this
 * source.  A copy of the CDDL is also available via the Internet at
 * http://www.illumos.org/license/CDDL.
 */

/*
 * Copyright 2019, Joyent, Inc.
 */

/*
 * 64-bit AVX-512 VNNI instruction disassembly.
 *
 * The support for VNNI instructions in gas is not present in the commonly used
 * versions of gas in illumos (it's not present in 2.26.1 or older). Support is
 * present in at least 2.30 (though maybe earlier). Rather than have the test
 * suite force a version upgrade, we instead encode each instruction as the
 * corresponding series of .byte expressions. Each .byte line follows a group of
 * commented out assembly instructions and has a one to one mapping between
 * them.

 */

.text
.align 16
.globl libdis_test
.type libdis_test, @function
libdis_test:
	/*
	 * vpdpbusd	%xmm0, %xmm1, %xmm2
	 * vpdpbusd	%ymm3, %ymm4, %ymm5
	 * vpdpbusd	%zmm6, %zmm7, %zmm8
	 * vpdpbusd	%xmm9, %xmm10, %xmm11{%k1}
	 * vpdpbusd	%xmm12, %xmm13, %xmm14{%k2}{z}
	 * vpdpbusd	%ymm15, %ymm16, %ymm17{%k3}
	 * vpdpbusd	%ymm18, %ymm19, %ymm20{%k4}{z}
	 * vpdpbusd	%zmm21, %zmm22, %zmm23{%k5}
	 * vpdpbusd	%zmm24, %zmm25, %zmm26{%k6}{z}
	 * vpdpbusd	0x64(%rax), %zmm27, %zmm28
	 * vpdpbusd	0x123456(%rbx, %rcx, 8), %zmm29, %zmm30
	 */

	.byte	0x62, 0xf2, 0x75, 0x08, 0x50, 0xd0
	.byte	0x62, 0xf2, 0x5d, 0x28, 0x50, 0xeb
	.byte	0x62, 0x72, 0x45, 0x48, 0x50, 0xc6
	.byte	0x62, 0x52, 0x2d, 0x09, 0x50, 0xd9
	.byte	0x62, 0x52, 0x15, 0x8a, 0x50, 0xf4
	.byte	0x62, 0xc2, 0x7d, 0x23, 0x50, 0xcf
	.byte	0x62, 0xa2, 0x65, 0xa4, 0x50, 0xe2
	.byte	0x62, 0xa2, 0x4d, 0x45, 0x50, 0xfd
	.byte	0x62, 0x02, 0x35, 0xc6, 0x50, 0xd0
	.byte	0x62, 0x62, 0x25, 0x40, 0x50, 0xa0, 0x64, 0x00, 0x00, 0x00
	.byte	0x62, 0x62, 0x15, 0x40, 0x50, 0xb4, 0xcb, 0x56, 0x34, 0x12, 0x00

	/*
	 * vpdpbusds	%xmm0, %xmm1, %xmm2
	 * vpdpbusds	%ymm3, %ymm4, %ymm5
	 * vpdpbusds	%zmm6, %zmm7, %zmm8
	 * vpdpbusds	%xmm9, %xmm10, %xmm11{%k1}
	 * vpdpbusds	%xmm12, %xmm13, %xmm14{%k2}{z}
	 * vpdpbusds	%ymm15, %ymm16, %ymm17{%k3}
	 * vpdpbusds	%ymm18, %ymm19, %ymm20{%k4}{z}
	 * vpdpbusds	%zmm21, %zmm22, %zmm23{%k5}
	 * vpdpbusds	%zmm24, %zmm25, %zmm26{%k6}{z}
	 * vpdpbusds	0x64(%rax), %zmm27, %zmm28
	 * vpdpbusds	0x123456(%rbx, %rcx, 8), %zmm29, %zmm30
	 */

	.byte	0x62, 0xf2, 0x75, 0x08, 0x51, 0xd0
	.byte	0x62, 0xf2, 0x5d, 0x28, 0x51, 0xeb
	.byte	0x62, 0x72, 0x45, 0x48, 0x51, 0xc6
	.byte	0x62, 0x52, 0x2d, 0x09, 0x51, 0xd9
	.byte	0x62, 0x52, 0x15, 0x8a, 0x51, 0xf4
	.byte	0x62, 0xc2, 0x7d, 0x23, 0x51, 0xcf
	.byte	0x62, 0xa2, 0x65, 0xa4, 0x51, 0xe2
	.byte	0x62, 0xa2, 0x4d, 0x45, 0x51, 0xfd
	.byte	0x62, 0x02, 0x35, 0xc6, 0x51, 0xd0
	.byte	0x62, 0x62, 0x25, 0x40, 0x51, 0xa0, 0x64, 0x00, 0x00, 0x00
	.byte	0x62, 0x62, 0x15, 0x40, 0x51, 0xb4, 0xcb, 0x56, 0x34, 0x12, 0x00

	/*
	 * vpdpwssd	%xmm0, %xmm1, %xmm2
	 * vpdpwssd	%ymm3, %ymm4, %ymm5
	 * vpdpwssd	%zmm6, %zmm7, %zmm8
	 * vpdpwssd	%xmm9, %xmm10, %xmm11{%k1}
	 * vpdpwssd	%xmm12, %xmm13, %xmm14{%k2}{z}
	 * vpdpwssd	%ymm15, %ymm16, %ymm17{%k3}
	 * vpdpwssd	%ymm18, %ymm19, %ymm20{%k4}{z}
	 * vpdpwssd	%zmm21, %zmm22, %zmm23{%k5}
	 * vpdpwssd	%zmm24, %zmm25, %zmm26{%k6}{z}
	 * vpdpwssd	0x64(%rax), %zmm27, %zmm28
	 * vpdpwssd	0x123456(%rbx, %rcx, 8), %zmm29, %zmm30
	 */

	.byte	0x62, 0xf2, 0x75, 0x08, 0x52, 0xd0
	.byte	0x62, 0xf2, 0x5d, 0x28, 0x52, 0xeb
	.byte	0x62, 0x72, 0x45, 0x48, 0x52, 0xc6
	.byte	0x62, 0x52, 0x2d, 0x09, 0x52, 0xd9
	.byte	0x62, 0x52, 0x15, 0x8a, 0x52, 0xf4
	.byte	0x62, 0xc2, 0x7d, 0x23, 0x52, 0xcf
	.byte	0x62, 0xa2, 0x65, 0xa4, 0x52, 0xe2
	.byte	0x62, 0xa2, 0x4d, 0x45, 0x52, 0xfd
	.byte	0x62, 0x02, 0x35, 0xc6, 0x52, 0xd0
	.byte	0x62, 0x62, 0x25, 0x40, 0x52, 0xa0, 0x64, 0x00, 0x00, 0x00
	.byte	0x62, 0x62, 0x15, 0x40, 0x52, 0xb4, 0xcb, 0x56, 0x34, 0x12, 0x00

	/*
	 * vpdpwssds	%xmm0, %xmm1, %xmm2
	 * vpdpwssds	%ymm3, %ymm4, %ymm5
	 * vpdpwssds	%zmm6, %zmm7, %zmm8
	 * vpdpwssds	%xmm9, %xmm10, %xmm11{%k1}
	 * vpdpwssds	%xmm12, %xmm13, %xmm14{%k2}{z}
	 * vpdpwssds	%ymm15, %ymm16, %ymm17{%k3}
	 * vpdpwssds	%ymm18, %ymm19, %ymm20{%k4}{z}
	 * vpdpwssds	%zmm21, %zmm22, %zmm23{%k5}
	 * vpdpwssds	%zmm24, %zmm25, %zmm26{%k6}{z}
	 * vpdpwssds	0x64(%rax), %zmm27, %zmm28
	 * vpdpwssds	0x123456(%rbx, %rcx, 8), %zmm29, %zmm30
	 */

	.byte	0x62, 0xf2, 0x75, 0x08, 0x53, 0xd0
	.byte	0x62, 0xf2, 0x5d, 0x28, 0x53, 0xeb
	.byte	0x62, 0x72, 0x45, 0x48, 0x53, 0xc6
	.byte	0x62, 0x52, 0x2d, 0x09, 0x53, 0xd9
	.byte	0x62, 0x52, 0x15, 0x8a, 0x53, 0xf4
	.byte	0x62, 0xc2, 0x7d, 0x23, 0x53, 0xcf
	.byte	0x62, 0xa2, 0x65, 0xa4, 0x53, 0xe2
	.byte	0x62, 0xa2, 0x4d, 0x45, 0x53, 0xfd
	.byte	0x62, 0x02, 0x35, 0xc6, 0x53, 0xd0
	.byte	0x62, 0x62, 0x25, 0x40, 0x53, 0xa0, 0x64, 0x00, 0x00, 0x00
	.byte	0x62, 0x62, 0x15, 0x40, 0x53, 0xb4, 0xcb, 0x56, 0x34, 0x12, 0x00
.size libdis_test, [.-libdis_test]
