#BEGIN_LEGAL
#
#Copyright (c) 2017 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


INSTRUCTIONS()::

UDELETE: NOP0F1E

{
ICLASS    : NOP
#UNAME     : NOP0F1E
CPL       : 3
CATEGORY  : WIDENOP
EXTENSION : BASE
ATTRIBUTES: NOP
ISA_SET   : PPRO
COMMENT   : reg form MODRM.MOD=3 & MODRM.REG=0b001  f3 prefix is RDSSP{D,Q}

# mem forms

PATTERN   : 0x0F 0x1E MOD[mm] MOD!=3 REG[rrr] RM[nnn] MODRM() 
OPERANDS  : MEM0:r:v REG0=GPRv_R():r
IFORM     : NOP_MEMv_GPRv_0F1E


# reg forms

PATTERN   : 0x0F 0x1E MOD[0b11] MOD=3 REG[rrr] RM[nnn] no_refining_prefix
OPERANDS  : REG0=GPRv_B():r REG1=GPRv_R():r
IFORM     : NOP_GPRv_GPRv_0F1E

PATTERN   : 0x0F 0x1E MOD[0b11] MOD=3 REG[rrr] RM[nnn] f2_refining_prefix
OPERANDS  : REG0=GPRv_B():r REG1=GPRv_R():r
IFORM     : NOP_GPRv_GPRv_0F1E

PATTERN   : 0x0F 0x1E MOD[0b11] MOD=3 REG[rrr] RM[nnn] osz_refining_prefix
OPERANDS  : REG0=GPRv_B():r REG1=GPRv_R():r
IFORM     : NOP_GPRv_GPRv_0F1E






PATTERN   : 0x0F 0x1E MOD[0b11] MOD=3 REG[0b000] RM[nnn] f3_refining_prefix
OPERANDS  : REG0=GPRv_B():r REG1=GPRv_R():r
IFORM     : NOP_GPRv_GPRv_0F1E

# ...
# F3 with MODRM.REG=0b001 is for CET for all values of RM.
# ...

PATTERN   : 0x0F 0x1E MOD[0b11] MOD=3 REG[0b010] RM[nnn] f3_refining_prefix
OPERANDS  : REG0=GPRv_B():r REG1=GPRv_R():r
IFORM     : NOP_GPRv_GPRv_0F1E
PATTERN   : 0x0F 0x1E MOD[0b11] MOD=3 REG[0b011] RM[nnn] f3_refining_prefix
OPERANDS  : REG0=GPRv_B():r REG1=GPRv_R():r
IFORM     : NOP_GPRv_GPRv_0F1E
PATTERN   : 0x0F 0x1E MOD[0b11] MOD=3 REG[0b100] RM[nnn] f3_refining_prefix
OPERANDS  : REG0=GPRv_B():r REG1=GPRv_R():r
IFORM     : NOP_GPRv_GPRv_0F1E
PATTERN   : 0x0F 0x1E MOD[0b11] MOD=3 REG[0b101] RM[nnn] f3_refining_prefix
OPERANDS  : REG0=GPRv_B():r REG1=GPRv_R():r
IFORM     : NOP_GPRv_GPRv_0F1E
PATTERN   : 0x0F 0x1E MOD[0b11] MOD=3 REG[0b110] RM[nnn] f3_refining_prefix
OPERANDS  : REG0=GPRv_B():r REG1=GPRv_R():r
IFORM     : NOP_GPRv_GPRv_0F1E


PATTERN   : 0x0F 0x1E MOD[0b11] MOD=3 REG[0b111] RM[0b000] f3_refining_prefix
OPERANDS  : REG0=GPRv_B():r REG1=GPRv_R():r
IFORM     : NOP_GPRv_GPRv_0F1E
PATTERN   : 0x0F 0x1E MOD[0b11] MOD=3 REG[0b111] RM[0b001] f3_refining_prefix
OPERANDS  : REG0=GPRv_B():r REG1=GPRv_R():r
IFORM     : NOP_GPRv_GPRv_0F1E

# ...
# F3 with MODRM.REG=0b111  with RM=2 or RM=3 is for CET
# ...

PATTERN   : 0x0F 0x1E MOD[0b11] MOD=3 REG[0b111] RM[0b100] f3_refining_prefix
OPERANDS  : REG0=GPRv_B():r REG1=GPRv_R():r
IFORM     : NOP_GPRv_GPRv_0F1E
PATTERN   : 0x0F 0x1E MOD[0b11] MOD=3 REG[0b111] RM[0b101] f3_refining_prefix
OPERANDS  : REG0=GPRv_B():r REG1=GPRv_R():r
IFORM     : NOP_GPRv_GPRv_0F1E
PATTERN   : 0x0F 0x1E MOD[0b11] MOD=3 REG[0b111] RM[0b110] f3_refining_prefix
OPERANDS  : REG0=GPRv_B():r REG1=GPRv_R():r
IFORM     : NOP_GPRv_GPRv_0F1E
PATTERN   : 0x0F 0x1E MOD[0b11] MOD=3 REG[0b111] RM[0b111] f3_refining_prefix
OPERANDS  : REG0=GPRv_B():r REG1=GPRv_R():r
IFORM     : NOP_GPRv_GPRv_0F1E


}


# REPLACE CERTAIN NOPS WITH MODAL OPTIONS  basd on CET=0/1
{
ICLASS    : NOP
#UNAME     : NOP0F1E
CPL       : 3
CATEGORY  : WIDENOP
EXTENSION : BASE
ATTRIBUTES: NOP
ISA_SET   : PPRO

PATTERN   : 0x0F 0x1E MOD[0b11] MOD=3  REG[0b111] RM[0b010]  f3_refining_prefix CET=0
OPERANDS  : REG0=GPRv_B():r REG1=GPRv_R():r
IFORM     : NOP_GPRv_GPRv_0F1E

PATTERN   : 0x0F 0x1E MOD[0b11] MOD=3  REG[0b111] RM[0b011]  f3_refining_prefix CET=0
OPERANDS  : REG0=GPRv_B():r REG1=GPRv_R():r
IFORM     : NOP_GPRv_GPRv_0F1E
}


{
ICLASS    : NOP
#UNAME     : NOP0F1E
CPL       : 3
CATEGORY  : WIDENOP
EXTENSION : BASE
ATTRIBUTES: NOP
ISA_SET   : PPRO

PATTERN   : 0x0F 0x1E MOD[0b11] MOD=3  REG[0b001] RM[nnn]  f3_refining_prefix W0 CET=0
OPERANDS  : REG0=GPRv_B():r REG1=GPRv_R():r
IFORM     : NOP_GPRv_GPRv_0F1E

PATTERN   : 0x0F 0x1E MOD[0b11] MOD=3  REG[0b001] RM[nnn]  f3_refining_prefix W1 mode64  CET=0
OPERANDS  : REG0=GPRv_B():r REG1=GPRv_R():r
IFORM     : NOP_GPRv_GPRv_0F1E
}
