http://llvm.org/bugs/show_bug.cgi?id=2827

           Summary: CodeEmitterGen produce wrong values in generated
                    function getBinaryCodeForInstr(...)
           Product: tools
           Version: 2.3
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: TableGen
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]
                CC: [email protected]


In generated XXXCodeEmitter::getBinaryCodeForInstr(MachineInstr &MI) tablegen
produce wrong values, if a 32 bit instruction operand is used. So the generated
code looks like this:
    case sharc::PUSHGAddr: {
      // op: registerINumber
      op = getMachineOpValue(MI, MI.getOperand(0));
      Value |= (op & 7U) << 41;
      // op: registerMNumber
      op = getMachineOpValue(MI, MI.getOperand(1));
      Value |= (op & 7U) << 38;
      // op: immediateData
      op = getMachineOpValue(MI, MI.getOperand(2));
      Value |= op & 0U; // <<<<<<<<<<<<<<<<<<<<<<<<<<<< BUG.
      break;
    }

The reason for that is that in CodeGenEmitterGen.cpp line 190:
            unsigned opMask = (1 << N) - 1;
If N=32, than the opMask is zero, instead of 0xffffffff


Solution:
 CodeGenEmitterGen.cpp line 190:
unsigned opMask = (1ULL << N) - 1;


-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to