[llvm-dev] Issues in Vector Add Instruction Machine Code Emission (original) (raw)

Craig Topper via llvm-dev llvm-dev at lists.llvm.org
Mon Sep 4 15:29:49 PDT 2017


Does your ADD instruction have VEX_4V or EVEX_4V as part of its declaration in the td file?

~Craig

On Mon, Sep 4, 2017 at 2:11 PM, hameeza ahmed <hahmed2305 at gmail.com> wrote:

Hello, I am trying to emit binary for my implemented vector instructions. Although yet i havent done any change or addition in MC framework, For vector load instruction there are no error coming. But for vector add

instruction is something like this; > %R0REG2048b1 = P256BVADD %R0REG2048b1, %R0REG2048b0 I am getting the following error: Unknown immediate size UNREACHABLE executed at /lib/Target/X86/MCTargetDesc/X86BaseInfo.h:574!

i made extensive use of gdb and after debugging i found the line with issue in X86MCCodeEmitter.cpp. Here NumOps=3 (all registers). and CurOp is 1st initialized to 0. then, the following code gets executed; case X86II::MRMDestReg: { EmitByte(BaseOpcode, CurByte, OS); unsigned SrcRegNum = CurOp + 1; //SrcRegNum=1 EmitRegModRMByte(MI.getOperand(CurOp), GetX86RegNum(MI.getOperand(SrcRegNum)), CurByte, OS); CurOp = SrcRegNum + 1; break; } so here CurOp becomes 2. After this; it comes to; else { // If there is a remaining operand, it must be a trailing immediate. Emit it // according to the right size for the instruction. Some instructions // (SSE4a extrq and insertq) have two trailing immediates. _while (CurOp != NumOps && NumOps - CurOp <= 2) {_ _EmitImmediate(MI.getOperand(CurOp++), MI.getLoc(),_ _X86II::getSizeOfImm(TSFlags), getImmFixupKind(TSFlags),_ _CurByte, OS, Fixups);_ _}_ _here CurOp=2 !=NumOps=3 && 3-2<=2_ _so while condition is satisfied and it goes to emitimmediate which is_ _wrong and there prints error message._ _Since, there are no immediate involved in instruction, it should not go to_ _emitimmediate. How to solve this issue?_ _Please help._ _Thank You_ -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170904/68da319d/attachment.html>



More information about the llvm-dev mailing list