+ if (Encoding == X86Local::EVEX) {
+ if (HasVEX_LPrefix && HasEVEX_L2Prefix) {
+ errs() << "Don't support VEX.L if EVEX_L2 is enabled: " << Name << "\n";
+ llvm_unreachable("Don't support VEX.L if EVEX_L2 is enabled");
+ }
+ // VEX_L & VEX_W
+ if (HasVEX_LPrefix && HasVEX_WPrefix) {
+ if (OpPrefix == X86Local::PD)
+ insnContext = EVEX_KB(IC_EVEX_L_W_OPSIZE);
+ else if (OpPrefix == X86Local::XS)
+ insnContext = EVEX_KB(IC_EVEX_L_W_XS);
+ else if (OpPrefix == X86Local::XD)
+ insnContext = EVEX_KB(IC_EVEX_L_W_XD);
+ else if (OpPrefix == X86Local::PS)
+ insnContext = EVEX_KB(IC_EVEX_L_W);
+ else {
+ errs() << "Instruction does not use a prefix: " << Name << "\n";
+ llvm_unreachable("Invalid prefix");
+ }
+ } else if (HasVEX_LPrefix) {
+ // VEX_L
+ if (OpPrefix == X86Local::PD)
+ insnContext = EVEX_KB(IC_EVEX_L_OPSIZE);
+ else if (OpPrefix == X86Local::XS)
+ insnContext = EVEX_KB(IC_EVEX_L_XS);
+ else if (OpPrefix == X86Local::XD)
+ insnContext = EVEX_KB(IC_EVEX_L_XD);
+ else if (OpPrefix == X86Local::PS)
+ insnContext = EVEX_KB(IC_EVEX_L);
+ else {
+ errs() << "Instruction does not use a prefix: " << Name << "\n";
+ llvm_unreachable("Invalid prefix");
+ }
+ }
+ else if (HasEVEX_L2Prefix && HasVEX_WPrefix) {
+ // EVEX_L2 & VEX_W
+ if (OpPrefix == X86Local::PD)
+ insnContext = EVEX_KB(IC_EVEX_L2_W_OPSIZE);
+ else if (OpPrefix == X86Local::XS)
+ insnContext = EVEX_KB(IC_EVEX_L2_W_XS);
+ else if (OpPrefix == X86Local::XD)
+ insnContext = EVEX_KB(IC_EVEX_L2_W_XD);
+ else if (OpPrefix == X86Local::PS)
+ insnContext = EVEX_KB(IC_EVEX_L2_W);
+ else {
+ errs() << "Instruction does not use a prefix: " << Name << "\n";
+ llvm_unreachable("Invalid prefix");
+ }
+ } else if (HasEVEX_L2Prefix) {
+ // EVEX_L2
+ if (OpPrefix == X86Local::PD)
+ insnContext = EVEX_KB(IC_EVEX_L2_OPSIZE);
+ else if (OpPrefix == X86Local::XD)
+ insnContext = EVEX_KB(IC_EVEX_L2_XD);
+ else if (OpPrefix == X86Local::XS)
+ insnContext = EVEX_KB(IC_EVEX_L2_XS);
+ else if (OpPrefix == X86Local::PS)
+ insnContext = EVEX_KB(IC_EVEX_L2);
+ else {
+ errs() << "Instruction does not use a prefix: " << Name << "\n";
+ llvm_unreachable("Invalid prefix");
+ }
+ }
+ else if (HasVEX_WPrefix) {
+ // VEX_W
+ if (OpPrefix == X86Local::PD)
+ insnContext = EVEX_KB(IC_EVEX_W_OPSIZE);
+ else if (OpPrefix == X86Local::XS)
+ insnContext = EVEX_KB(IC_EVEX_W_XS);
+ else if (OpPrefix == X86Local::XD)
+ insnContext = EVEX_KB(IC_EVEX_W_XD);
+ else if (OpPrefix == X86Local::PS)
+ insnContext = EVEX_KB(IC_EVEX_W);
+ else {
+ errs() << "Instruction does not use a prefix: " << Name << "\n";
+ llvm_unreachable("Invalid prefix");
+ }
+ }
+ // No L, no W
+ else if (OpPrefix == X86Local::PD)
+ insnContext = EVEX_KB(IC_EVEX_OPSIZE);
+ else if (OpPrefix == X86Local::XD)
+ insnContext = EVEX_KB(IC_EVEX_XD);
+ else if (OpPrefix == X86Local::XS)
+ insnContext = EVEX_KB(IC_EVEX_XS);
+ else
+ insnContext = EVEX_KB(IC_EVEX);
+ /// eof EVEX
+ } else if (Encoding == X86Local::VEX || Encoding == X86Local::XOP) {
+ if (HasVEX_LPrefix && HasVEX_WPrefix) {
+ if (OpPrefix == X86Local::PD)
+ insnContext = IC_VEX_L_W_OPSIZE;
+ else if (OpPrefix == X86Local::XS)
+ insnContext = IC_VEX_L_W_XS;
+ else if (OpPrefix == X86Local::XD)
+ insnContext = IC_VEX_L_W_XD;
+ else if (OpPrefix == X86Local::PS)
+ insnContext = IC_VEX_L_W;
+ else {
+ errs() << "Instruction does not use a prefix: " << Name << "\n";
+ llvm_unreachable("Invalid prefix");
+ }
+ } else if (OpPrefix == X86Local::PD && HasVEX_LPrefix)
+ insnContext = IC_VEX_L_OPSIZE;
+ else if (OpPrefix == X86Local::PD && HasVEX_WPrefix)
+ insnContext = IC_VEX_W_OPSIZE;
+ else if (OpPrefix == X86Local::PD)
+ insnContext = IC_VEX_OPSIZE;
+ else if (HasVEX_LPrefix && OpPrefix == X86Local::XS)
+ insnContext = IC_VEX_L_XS;
+ else if (HasVEX_LPrefix && OpPrefix == X86Local::XD)
+ insnContext = IC_VEX_L_XD;
+ else if (HasVEX_WPrefix && OpPrefix == X86Local::XS)
+ insnContext = IC_VEX_W_XS;
+ else if (HasVEX_WPrefix && OpPrefix == X86Local::XD)
+ insnContext = IC_VEX_W_XD;
+ else if (HasVEX_WPrefix && OpPrefix == X86Local::PS)
+ insnContext = IC_VEX_W;
+ else if (HasVEX_LPrefix && OpPrefix == X86Local::PS)
+ insnContext = IC_VEX_L;
+ else if (OpPrefix == X86Local::XD)
+ insnContext = IC_VEX_XD;
+ else if (OpPrefix == X86Local::XS)
+ insnContext = IC_VEX_XS;
+ else if (OpPrefix == X86Local::PS)
+ insnContext = IC_VEX;
+ else {
+ errs() << "Instruction does not use a prefix: " << Name << "\n";
+ llvm_unreachable("Invalid prefix");
+ }
+ } else if (Is64Bit || HasREX_WPrefix || AdSize == X86Local::AdSize64) {
+ if (HasREX_WPrefix && (OpSize == X86Local::OpSize16 || OpPrefix == X86Local::PD))