#BEGIN_LEGAL
#
#Copyright (c) 2016 Intel Corporation
#
#  Licensed under the Apache License, Version 2.0 (the "License");
#  you may not use this file except in compliance with the License.
#  You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
#  Unless required by applicable law or agreed to in writing, software
#  distributed under the License is distributed on an "AS IS" BASIS,
#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#  See the License for the specific language governing permissions and
#  limitations under the License.
#  
#END_LEGAL

NOSWIZD()::
SWIZ=0b000 | CONVERT=0 ELEMENT_SIZE=32 NELEM=16 TYPE=XED_OPERAND_ELEMENT_TYPE_UINT
SWIZ=0b001 | error
SWIZ=0b010 | error
SWIZ=0b011 | error
SWIZ=0b100 | error
SWIZ=0b101 | error
SWIZ=0b110 | error
SWIZ=0b111 | error

NOSWIZF32()::
SWIZ=0b000 | CONVERT=0 ELEMENT_SIZE=32 NELEM=16 TYPE=XED_OPERAND_ELEMENT_TYPE_SINGLE
SWIZ=0b001 | error
SWIZ=0b010 | error
SWIZ=0b011 | error
SWIZ=0b100 | error
SWIZ=0b101 | error
SWIZ=0b110 | error
SWIZ=0b111 | error

NOSWIZQ()::
SWIZ=0b000 | CONVERT=0 ELEMENT_SIZE=64 NELEM=8 TYPE=XED_OPERAND_ELEMENT_TYPE_UINT
SWIZ=0b001 | error
SWIZ=0b010 | error
SWIZ=0b011 | error
SWIZ=0b100 | error
SWIZ=0b101 | error
SWIZ=0b110 | error
SWIZ=0b111 | error

UPCONVERT_FLT64()::
SWIZ=0b000 | CONVERT=0 ELEMENT_SIZE=64 NELEM=8 TYPE=XED_OPERAND_ELEMENT_TYPE_DOUBLE
SWIZ=0b001 | CONVERT=1 ELEMENT_SIZE=64 NELEM=1 TYPE=XED_OPERAND_ELEMENT_TYPE_DOUBLE
SWIZ=0b010 | CONVERT=2 ELEMENT_SIZE=64 NELEM=4 TYPE=XED_OPERAND_ELEMENT_TYPE_DOUBLE
SWIZ=0b011 | error
SWIZ=0b100 | error
SWIZ=0b101 | error
SWIZ=0b110 | error
SWIZ=0b111 | error

UPCONVERT_FLT64_LOAD()::
SWIZ=0b000 | CONVERT=0 ELEMENT_SIZE=64 NELEM=8   TYPE=XED_OPERAND_ELEMENT_TYPE_DOUBLE
SWIZ=0b001 | error
SWIZ=0b010 | error
SWIZ=0b011 | error
SWIZ=0b100 | error
SWIZ=0b101 | error
SWIZ=0b110 | error
SWIZ=0b111 | error

###




UPCONVERT_FLT32()::
SWIZ=0b000 | CONVERT=0 ELEMENT_SIZE=32 NELEM=16   TYPE=XED_OPERAND_ELEMENT_TYPE_SINGLE
SWIZ=0b001 | CONVERT=9 ELEMENT_SIZE=32 NELEM=1      TYPE=XED_OPERAND_ELEMENT_TYPE_SINGLE
SWIZ=0b010 | CONVERT=10 ELEMENT_SIZE=32 NELEM=4      TYPE=XED_OPERAND_ELEMENT_TYPE_SINGLE
SWIZ=0b011 | CONVERT=3 ELEMENT_SIZE=16 NELEM=16   TYPE=XED_OPERAND_ELEMENT_TYPE_FLOAT16
SWIZ=0b100 | CONVERT=4 ELEMENT_SIZE=8  NELEM=16     TYPE=XED_OPERAND_ELEMENT_TYPE_UINT
SWIZ=0b101 | CONVERT=5 ELEMENT_SIZE=8  NELEM=16     TYPE=XED_OPERAND_ELEMENT_TYPE_INT
SWIZ=0b110 | CONVERT=6 ELEMENT_SIZE=16 NELEM=16   TYPE=XED_OPERAND_ELEMENT_TYPE_UINT
SWIZ=0b111 | CONVERT=7 ELEMENT_SIZE=16 NELEM=16   TYPE=XED_OPERAND_ELEMENT_TYPE_INT


UPCONVERT_FLT32_LIMITED()::
SWIZ=0b000 | CONVERT=0 ELEMENT_SIZE=32 NELEM=16   TYPE=XED_OPERAND_ELEMENT_TYPE_SINGLE
SWIZ=0b001 | error
SWIZ=0b010 | CONVERT=10 ELEMENT_SIZE=32 NELEM=4      TYPE=XED_OPERAND_ELEMENT_TYPE_SINGLE
SWIZ=0b011 | error
SWIZ=0b100 | error
SWIZ=0b101 | error
SWIZ=0b110 | error
SWIZ=0b111 | error

# VCVTPS2PD has special upconvert semantics
UPCONVERT_FLT32_HALF()::
SWIZ=0b000 | CONVERT=0 ELEMENT_SIZE=32 NELEM=8     TYPE=XED_OPERAND_ELEMENT_TYPE_SINGLE
SWIZ=0b001 | CONVERT=9 ELEMENT_SIZE=32 NELEM=1   TYPE=XED_OPERAND_ELEMENT_TYPE_SINGLE
SWIZ=0b010 | CONVERT=10 ELEMENT_SIZE=32 NELEM=4   TYPE=XED_OPERAND_ELEMENT_TYPE_SINGLE
SWIZ=0b011 | error
SWIZ=0b100 | error
SWIZ=0b101 | error 
SWIZ=0b110 | error
SWIZ=0b111 | error


UPCONVERT_FLT32_LOAD()::
SWIZ=0b000 | CONVERT=0 ELEMENT_SIZE=32 NELEM=16    TYPE=XED_OPERAND_ELEMENT_TYPE_SINGLE
SWIZ=0b001 | error
SWIZ=0b010 | error
SWIZ=0b011 | CONVERT=3 ELEMENT_SIZE=16 NELEM=16    TYPE=XED_OPERAND_ELEMENT_TYPE_FLOAT16
SWIZ=0b100 | CONVERT=4 ELEMENT_SIZE=8    NELEM=16    TYPE=XED_OPERAND_ELEMENT_TYPE_UINT
#
# SPECIAL CASE: f32 loads use int8 for case 5
#
SWIZ=0b101 | CONVERT=8 ELEMENT_SIZE=8    NELEM=16    TYPE=XED_OPERAND_ELEMENT_TYPE_INT
#
SWIZ=0b110 | CONVERT=6 ELEMENT_SIZE=16 NELEM=16    TYPE=XED_OPERAND_ELEMENT_TYPE_UINT
SWIZ=0b111 | CONVERT=7 ELEMENT_SIZE=16 NELEM=16    TYPE=XED_OPERAND_ELEMENT_TYPE_INT

###


UPCONVERT_INT64()::
SWIZ=0b000 | CONVERT=0 ELEMENT_SIZE=64 NELEM=8   TYPE=XED_OPERAND_ELEMENT_TYPE_INT
SWIZ=0b001 | CONVERT=1 ELEMENT_SIZE=64 NELEM=1   TYPE=XED_OPERAND_ELEMENT_TYPE_INT
SWIZ=0b010 | CONVERT=2 ELEMENT_SIZE=64 NELEM=4   TYPE=XED_OPERAND_ELEMENT_TYPE_INT
SWIZ=0b011 | error
SWIZ=0b100 | error
SWIZ=0b101 | error
SWIZ=0b110 | error
SWIZ=0b111 | error

UPCONVERT_INT64_LOAD()::
SWIZ=0b000 | CONVERT=0 ELEMENT_SIZE=64 NELEM=8   TYPE=XED_OPERAND_ELEMENT_TYPE_INT
SWIZ=0b001 | error
SWIZ=0b010 | error
SWIZ=0b011 | error
SWIZ=0b100 | error
SWIZ=0b101 | error
SWIZ=0b110 | error
SWIZ=0b111 | error

###

UPCONVERT_INT32()::
SWIZ=0b000 | CONVERT=0 ELEMENT_SIZE=32 NELEM=16 TYPE=XED_OPERAND_ELEMENT_TYPE_INT
SWIZ=0b001 | CONVERT=9 ELEMENT_SIZE=32 NELEM=1    TYPE=XED_OPERAND_ELEMENT_TYPE_INT
SWIZ=0b010 | CONVERT=10 ELEMENT_SIZE=32 NELEM=4    TYPE=XED_OPERAND_ELEMENT_TYPE_INT
SWIZ=0b011 | error
SWIZ=0b100 | CONVERT=4 ELEMENT_SIZE=8  NELEM=16   TYPE=XED_OPERAND_ELEMENT_TYPE_UINT 
SWIZ=0b101 | CONVERT=5 ELEMENT_SIZE=8  NELEM=16    TYPE=XED_OPERAND_ELEMENT_TYPE_INT
SWIZ=0b110 | CONVERT=6 ELEMENT_SIZE=16 NELEM=16 TYPE=XED_OPERAND_ELEMENT_TYPE_UINT
SWIZ=0b111 | CONVERT=7 ELEMENT_SIZE=16 NELEM=16 TYPE=XED_OPERAND_ELEMENT_TYPE_INT


UPCONVERT_INT32_LIMITED()::
SWIZ=0b000 | CONVERT=0 ELEMENT_SIZE=32 NELEM=16 TYPE=XED_OPERAND_ELEMENT_TYPE_INT
SWIZ=0b001 | error
SWIZ=0b010 | CONVERT=10 ELEMENT_SIZE=32 NELEM=4    TYPE=XED_OPERAND_ELEMENT_TYPE_INT
SWIZ=0b011 | error
SWIZ=0b100 | error
SWIZ=0b101 | error
SWIZ=0b110 | error
SWIZ=0b111 | error



# VCVTDQ2PD and VCVTUDQ2PD have special upconvert restrictions
UPCONVERT_INT32_HALF()::
SWIZ=0b000 | CONVERT=0    ELEMENT_SIZE=32 NELEM=8  TYPE=XED_OPERAND_ELEMENT_TYPE_INT
SWIZ=0b001 | CONVERT=9 ELEMENT_SIZE=32 NELEM=1  TYPE=XED_OPERAND_ELEMENT_TYPE_INT
SWIZ=0b010 | CONVERT=10 ELEMENT_SIZE=32 NELEM=4  TYPE=XED_OPERAND_ELEMENT_TYPE_INT
SWIZ=0b011 | error
SWIZ=0b100 | error
SWIZ=0b101 | error
SWIZ=0b110 | error
SWIZ=0b111 | error

UPCONVERT_INT32_LOAD()::
SWIZ=0b000 | CONVERT=0 ELEMENT_SIZE=32 NELEM=16   TYPE=XED_OPERAND_ELEMENT_TYPE_INT
SWIZ=0b001 | error
SWIZ=0b010 | error
SWIZ=0b011 | error
SWIZ=0b100 | CONVERT=4 ELEMENT_SIZE=8  NELEM=16    TYPE=XED_OPERAND_ELEMENT_TYPE_UINT 
SWIZ=0b101 | CONVERT=5 ELEMENT_SIZE=8  NELEM=16    TYPE=XED_OPERAND_ELEMENT_TYPE_INT
SWIZ=0b110 | CONVERT=6 ELEMENT_SIZE=16 NELEM=16  TYPE=XED_OPERAND_ELEMENT_TYPE_UINT
SWIZ=0b111 | CONVERT=7 ELEMENT_SIZE=16 NELEM=16  TYPE=XED_OPERAND_ELEMENT_TYPE_INT


###

DNCONVERT_FLT32()::
SWIZ=0b000 | CONVERT=0 ELEMENT_SIZE=32 NELEM=16  TYPE=XED_OPERAND_ELEMENT_TYPE_SINGLE
SWIZ=0b001 | error
SWIZ=0b010 | error
SWIZ=0b011 | CONVERT=3 ELEMENT_SIZE=16 NELEM=16  TYPE=XED_OPERAND_ELEMENT_TYPE_FLOAT16
SWIZ=0b100 | CONVERT=4 ELEMENT_SIZE=8  NELEM=16    TYPE=XED_OPERAND_ELEMENT_TYPE_UINT
SWIZ=0b101 | CONVERT=5 ELEMENT_SIZE=8  NELEM=16    TYPE=XED_OPERAND_ELEMENT_TYPE_INT
SWIZ=0b110 | CONVERT=6 ELEMENT_SIZE=16 NELEM=16  TYPE=XED_OPERAND_ELEMENT_TYPE_UINT
SWIZ=0b111 | CONVERT=7 ELEMENT_SIZE=16 NELEM=16  TYPE=XED_OPERAND_ELEMENT_TYPE_INT





###

DNCONVERT_INT32()::
SWIZ=0b000 | CONVERT=0 ELEMENT_SIZE=32 NELEM=16  TYPE=XED_OPERAND_ELEMENT_TYPE_INT
SWIZ=0b001 | error
SWIZ=0b010 | error
SWIZ=0b011 | error
SWIZ=0b100 | CONVERT=4 ELEMENT_SIZE=8  NELEM=16    TYPE=XED_OPERAND_ELEMENT_TYPE_UINT
SWIZ=0b101 | CONVERT=5 ELEMENT_SIZE=8  NELEM=16    TYPE=XED_OPERAND_ELEMENT_TYPE_INT
SWIZ=0b110 | CONVERT=6 ELEMENT_SIZE=16 NELEM=16  TYPE=XED_OPERAND_ELEMENT_TYPE_UINT
SWIZ=0b111 | CONVERT=7 ELEMENT_SIZE=16 NELEM=16  TYPE=XED_OPERAND_ELEMENT_TYPE_INT

DNCONVERT_INT64()::
SWIZ=0b000 | CONVERT=0 ELEMENT_SIZE=64 NELEM=8   TYPE=XED_OPERAND_ELEMENT_TYPE_INT
SWIZ=0b001 | error
SWIZ=0b010 | error
SWIZ=0b011 | error
SWIZ=0b100 | error
SWIZ=0b101 | error
SWIZ=0b110 | error
SWIZ=0b111 | error

DNCONVERT_FLT64()::
SWIZ=0b000 | CONVERT=0 ELEMENT_SIZE=64 NELEM=8   TYPE=XED_OPERAND_ELEMENT_TYPE_DOUBLE
SWIZ=0b001 | error
SWIZ=0b010 | error
SWIZ=0b011 | error
SWIZ=0b100 | error
SWIZ=0b101 | error
SWIZ=0b110 | error
SWIZ=0b111 | error


#############################

REG_SWIZZLE64()::
SWIZ=0b000 | REGSWIZ=0 SWIZZLE_SIZE=8 NELEM=4
SWIZ=0b001 | REGSWIZ=1 SWIZZLE_SIZE=8 NELEM=4
SWIZ=0b010 | REGSWIZ=2 SWIZZLE_SIZE=8 NELEM=4
SWIZ=0b011 | REGSWIZ=3 SWIZZLE_SIZE=8 NELEM=4
SWIZ=0b100 | REGSWIZ=4 SWIZZLE_SIZE=8 NELEM=1
SWIZ=0b101 | REGSWIZ=5 SWIZZLE_SIZE=8 NELEM=1
SWIZ=0b110 | REGSWIZ=6 SWIZZLE_SIZE=8 NELEM=1
SWIZ=0b111 | REGSWIZ=7 SWIZZLE_SIZE=8 NELEM=1

REG_SWIZZLE32()::
SWIZ=0b000 | REGSWIZ=0 SWIZZLE_SIZE=7 NELEM=4
SWIZ=0b001 | REGSWIZ=1 SWIZZLE_SIZE=7 NELEM=4
SWIZ=0b010 | REGSWIZ=2 SWIZZLE_SIZE=7 NELEM=4
SWIZ=0b011 | REGSWIZ=3 SWIZZLE_SIZE=7 NELEM=4
SWIZ=0b100 | REGSWIZ=4 SWIZZLE_SIZE=7 NELEM=1
SWIZ=0b101 | REGSWIZ=5 SWIZZLE_SIZE=7 NELEM=1
SWIZ=0b110 | REGSWIZ=6 SWIZZLE_SIZE=7 NELEM=1
SWIZ=0b111 | REGSWIZ=7 SWIZZLE_SIZE=7 NELEM=1


###

KNC_SAE()::
SWIZ=0b000 | SAE=0 
SWIZ=0b001 | SAE=0 
SWIZ=0b010 | SAE=0 
SWIZ=0b011 | SAE=0 
SWIZ=0b100 | SAE=1 
SWIZ=0b101 | SAE=1 
SWIZ=0b110 | SAE=1 
SWIZ=0b111 | SAE=1 

NOSAE()::
SWIZ=0b000 | 
SWIZ=0b001 | 
SWIZ=0b010 | 
SWIZ=0b011 | 
SWIZ=0b100 | error
SWIZ=0b101 | error
SWIZ=0b110 | error
SWIZ=0b111 | error

ROUND()::
SWIZ=0b000 | ROUNDC=1
SWIZ=0b001 | ROUNDC=2
SWIZ=0b010 | ROUNDC=3
SWIZ=0b011 | ROUNDC=4
SWIZ=0b100 | ROUNDC=1
SWIZ=0b101 | ROUNDC=2
SWIZ=0b110 | ROUNDC=3
SWIZ=0b111 | ROUNDC=4

NOROUND()::
SWIZ=0b000 | 
SWIZ=0b001 | error
SWIZ=0b010 | error
SWIZ=0b011 | error
SWIZ=0b100 | 
SWIZ=0b101 | error
SWIZ=0b110 | error
SWIZ=0b111 | error

