/*
 * 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.
 */

/*
 * 32-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, %zmm0
	 * vpdpbusd	%xmm1, %xmm2, %xmm3{%k1}
	 * vpdpbusd	%xmm4, %xmm5, %xmm6{%k2}{z}
	 * vpdpbusd	%ymm7, %ymm0, %ymm1{%k3}
	 * vpdpbusd	%ymm2, %ymm3, %ymm4{%k4}{z}
	 * vpdpbusd	%zmm5, %zmm6, %zmm7{%k5}
	 * vpdpbusd	%zmm0, %zmm1, %zmm2{%k6}{z}
	 * vpdpbusd	0x64(%eax), %zmm3, %zmm4
	 * vpdpbusd	0x123456(%ebx, %ecx, 8), %zmm5, %zmm6
	 */

	.byte	0x62, 0xf2, 0x75, 0x08, 0x50, 0xd0
	.byte	0x62, 0xf2, 0x5d, 0x28, 0x50, 0xeb
	.byte	0x62, 0xf2, 0x45, 0x48, 0x50, 0xc6
	.byte	0x62, 0xf2, 0x6d, 0x09, 0x50, 0xd9
	.byte	0x62, 0xf2, 0x55, 0x8a, 0x50, 0xf4
	.byte	0x62, 0xf2, 0x7d, 0x2b, 0x50, 0xcf
	.byte	0x62, 0xf2, 0x65, 0xac, 0x50, 0xe2
	.byte	0x62, 0xf2, 0x4d, 0x4d, 0x50, 0xfd
	.byte	0x62, 0xf2, 0x75, 0xce, 0x50, 0xd0
	.byte	0x62, 0xf2, 0x65, 0x48, 0x50, 0xa0, 0x64, 0x00, 0x00, 0x00
	.byte	0x62, 0xf2, 0x55, 0x48, 0x50, 0xb4, 0xcb, 0x56, 0x34, 0x12, 0x00


	/*
	 * vpdpbusds	%xmm0, %xmm1, %xmm2
	 * vpdpbusds	%ymm3, %ymm4, %ymm5
	 * vpdpbusds	%zmm6, %zmm7, %zmm0
	 * vpdpbusds	%xmm1, %xmm2, %xmm3{%k1}
	 * vpdpbusds	%xmm4, %xmm5, %xmm6{%k2}{z}
	 * vpdpbusds	%ymm7, %ymm0, %ymm1{%k3}
	 * vpdpbusds	%ymm2, %ymm3, %ymm4{%k4}{z}
	 * vpdpbusds	%zmm5, %zmm6, %zmm7{%k5}
	 * vpdpbusds	%zmm0, %zmm1, %zmm2{%k6}{z}
	 * vpdpbusds	0x64(%eax), %zmm3, %zmm4
	 * vpdpbusds	0x123456(%ebx, %ecx, 8), %zmm5, %zmm6
	 */

	.byte	0x62, 0xf2, 0x75, 0x08, 0x51, 0xd0
	.byte	0x62, 0xf2, 0x5d, 0x28, 0x51, 0xeb
	.byte	0x62, 0xf2, 0x45, 0x48, 0x51, 0xc6
	.byte	0x62, 0xf2, 0x6d, 0x09, 0x51, 0xd9
	.byte	0x62, 0xf2, 0x55, 0x8a, 0x51, 0xf4
	.byte	0x62, 0xf2, 0x7d, 0x2b, 0x51, 0xcf
	.byte	0x62, 0xf2, 0x65, 0xac, 0x51, 0xe2
	.byte	0x62, 0xf2, 0x4d, 0x4d, 0x51, 0xfd
	.byte	0x62, 0xf2, 0x75, 0xce, 0x51, 0xd0
	.byte	0x62, 0xf2, 0x65, 0x48, 0x51, 0xa0, 0x64, 0x00, 0x00, 0x00
	.byte	0x62, 0xf2, 0x55, 0x48, 0x51, 0xb4, 0xcb, 0x56, 0x34, 0x12, 0x00

	/*
	 * vpdpwssd	%xmm0, %xmm1, %xmm2
	 * vpdpwssd	%ymm3, %ymm4, %ymm5
	 * vpdpwssd	%zmm6, %zmm7, %zmm0
	 * vpdpwssd	%xmm1, %xmm2, %xmm3{%k1}
	 * vpdpwssd	%xmm4, %xmm5, %xmm6{%k2}{z}
	 * vpdpwssd	%ymm7, %ymm0, %ymm1{%k3}
	 * vpdpwssd	%ymm2, %ymm3, %ymm4{%k4}{z}
	 * vpdpwssd	%zmm5, %zmm6, %zmm7{%k5}
	 * vpdpwssd	%zmm0, %zmm1, %zmm2{%k6}{z}
	 * vpdpwssd	0x64(%eax), %zmm3, %zmm4
	 * vpdpwssd	0x123456(%ebx, %ecx, 8), %zmm5, %zmm6
	 */

	.byte	0x62, 0xf2, 0x75, 0x08, 0x52, 0xd0
	.byte	0x62, 0xf2, 0x5d, 0x28, 0x52, 0xeb
	.byte	0x62, 0xf2, 0x45, 0x48, 0x52, 0xc6
	.byte	0x62, 0xf2, 0x6d, 0x09, 0x52, 0xd9
	.byte	0x62, 0xf2, 0x55, 0x8a, 0x52, 0xf4
	.byte	0x62, 0xf2, 0x7d, 0x2b, 0x52, 0xcf
	.byte	0x62, 0xf2, 0x65, 0xac, 0x52, 0xe2
	.byte	0x62, 0xf2, 0x4d, 0x4d, 0x52, 0xfd
	.byte	0x62, 0xf2, 0x75, 0xce, 0x52, 0xd0
	.byte	0x62, 0xf2, 0x65, 0x48, 0x52, 0xa0, 0x64, 0x00, 0x00, 0x00
	.byte	0x62, 0xf2, 0x55, 0x48, 0x52, 0xb4, 0xcb, 0x56, 0x34, 0x12, 0x00

	/*
	 * vpdpwssds	%xmm0, %xmm1, %xmm2
	 * vpdpwssds	%ymm3, %ymm4, %ymm5
	 * vpdpwssds	%zmm6, %zmm7, %zmm0
	 * vpdpwssds	%xmm1, %xmm2, %xmm3{%k1}
	 * vpdpwssds	%xmm4, %xmm5, %xmm6{%k2}{z}
	 * vpdpwssds	%ymm7, %ymm0, %ymm1{%k3}
	 * vpdpwssds	%ymm2, %ymm3, %ymm4{%k4}{z}
	 * vpdpwssds	%zmm5, %zmm6, %zmm7{%k5}
	 * vpdpwssds	%zmm0, %zmm1, %zmm2{%k6}{z}
	 * vpdpwssds	0x64(%eax), %zmm3, %zmm4
	 * vpdpwssds	0x123456(%ebx, %ecx, 8), %zmm5, %zmm6
	 */

	.byte	0x62, 0xf2, 0x75, 0x08, 0x53, 0xd0
	.byte	0x62, 0xf2, 0x5d, 0x28, 0x53, 0xeb
	.byte	0x62, 0xf2, 0x45, 0x48, 0x53, 0xc6
	.byte	0x62, 0xf2, 0x6d, 0x09, 0x53, 0xd9
	.byte	0x62, 0xf2, 0x55, 0x8a, 0x53, 0xf4
	.byte	0x62, 0xf2, 0x7d, 0x2b, 0x53, 0xcf
	.byte	0x62, 0xf2, 0x65, 0xac, 0x53, 0xe2
	.byte	0x62, 0xf2, 0x4d, 0x4d, 0x53, 0xfd
	.byte	0x62, 0xf2, 0x75, 0xce, 0x53, 0xd0
	.byte	0x62, 0xf2, 0x65, 0x48, 0x53, 0xa0, 0x64, 0x00, 0x00, 0x00
	.byte	0x62, 0xf2, 0x55, 0x48, 0x53, 0xb4, 0xcb, 0x56, 0x34, 0x12, 0x00
.size libdis_test, [.-libdis_test]
