[LLVMbugs] [Bug 2827] New: CodeEmitterGen produce wrong values in generated function getBinaryCodeForInstr (...)
bugzilla-daemon at cs.uiuc.edu
bugzilla-daemon at cs.uiuc.edu
Wed Sep 24 02:14:11 PDT 2008
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: unassignedbugs at nondot.org
ReportedBy: waldemar.knorr at eckcellent-it.de
CC: llvmbugs at cs.uiuc.edu
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.
More information about the llvm-bugs
mailing list