On Jul 7, 2010, at 4:52 AM, Patrick Marlier wrote:> Which one is correct ? > - movl $tm_nest_level at TPOFF, %ecx > or > - movq $tm_nest_level at TPOFF, %rcx > or > - movl tm_nest_level at TPOFF, %ecx >I believe this is initial exec and so from: http://people.redhat.com/drepper/tls.pdf it would be movl tm_nest_level at TPOFF, %ecx> Otherwise, Is there a way to remove this $ character? > > I found that it is here in lib/Target/X86/AsmPrinter/X86ATTInstPrinter.cpp > > void X86ATTInstPrinter::printOperand(const MCInst *MI, unsigned OpNo, > raw_ostream &O) { > const MCOperand &Op = MI->getOperand(OpNo); > if (Op.isReg()) { > O << '%' << getRegisterName(Op.getReg()); > } else if (Op.isImm()) { > ... > } else { > assert(Op.isExpr() && "unknown operand kind in printOperand"); > // HERE I remove the '$' to make it work > O << '$' << *Op.getExpr(); > } >Hrm. Something is wonky here. Can you file a testcase with a .i file I can compile please? -eric
On 07/07/2010 08:20 PM, Eric Christopher wrote:> > On Jul 7, 2010, at 4:52 AM, Patrick Marlier wrote: > >> Which one is correct ? >> - movl $tm_nest_level at TPOFF, %ecx >> or >> - movq $tm_nest_level at TPOFF, %rcx >> or >> - movl tm_nest_level at TPOFF, %ecx >> > > I believe this is initial exec and so from: > > http://people.redhat.com/drepper/tls.pdf > > it would be movl tm_nest_level at TPOFF, %ecx > >> Otherwise, Is there a way to remove this $ character? >> >> I found that it is here in lib/Target/X86/AsmPrinter/X86ATTInstPrinter.cpp >> >> void X86ATTInstPrinter::printOperand(const MCInst *MI, unsigned OpNo, >> raw_ostream&O) { >> const MCOperand&Op = MI->getOperand(OpNo); >> if (Op.isReg()) { >> O<< '%'<< getRegisterName(Op.getReg()); >> } else if (Op.isImm()) { >> ... >> } else { >> assert(Op.isExpr()&& "unknown operand kind in printOperand"); >> // HERE I remove the '$' to make it work >> O<< '$'<< *Op.getExpr(); >> } >> > > Hrm. Something is wonky here. Can you file a testcase with a .i file I can compile please? > > -ericIs the testcase from Eli Friedman not enough? http://llvm.org/bugs/show_bug.cgi?id=5081 Eli Friedman 2009-10-02 20:15:35 CDT Reduced testcase: target triple = "x86_64-unknown-linux-gnu" @tm_nest_level = internal thread_local global i32 0 define i64 @z() nounwind { ret i64 and (i64 ptrtoint (i32* @tm_nest_level to i64), i64 100) } Because actually, the C application where it happens is really huge and I don't know if I will be able to provide you a really simple testcase. Tell me if it is really required I can try to do it tomorrow. Patrick Marlier.
>> > > Is the testcase from Eli Friedman not enough? >Hey look, a testcase.> http://llvm.org/bugs/show_bug.cgi?id=5081 > Eli Friedman 2009-10-02 20:15:35 CDT > Reduced testcase: > > target triple = "x86_64-unknown-linux-gnu" > @tm_nest_level = internal thread_local global i32 0 > define i64 @z() nounwind { > ret i64 and (i64 ptrtoint (i32* @tm_nest_level to i64), i64 100) > } > > Because actually, the C application where it happens is really huge and I don't know if I will be able to provide you a really simple testcase. > > Tell me if it is really required I can try to do it tomorrow.Nah, that's fine. I just didn't get anything on this and I don't have a linux machine I can assemble on. -eric
On Jul 7, 2010, at 11:20 AM, Eric Christopher wrote:> > On Jul 7, 2010, at 4:52 AM, Patrick Marlier wrote: > >> Which one is correct ? >> - movl $tm_nest_level at TPOFF, %ecx >> or >> - movq $tm_nest_level at TPOFF, %rcx >> or >> - movl tm_nest_level at TPOFF, %ecx >> > > I believe this is initial exec and so from: > > http://people.redhat.com/drepper/tls.pdf > > it would be movl tm_nest_level at TPOFF, %ecxAs a correction, I don't know that any of these is correct. I need to look into this a bit more. I think that it requires the relocation to be off of a register, i.e. movabs $foo at tpoff, %rax add $foo at tpoff, %rax mov foo at tpoff(%rbx), %eax are all legal, while: mov foo at tpoff(%ebx), %eax call foo at tpoff mov $foo at tpoff, %eax mov $foo at tpoff, %ax mov $foo at tpoff, %al are all illegal. So we appear to be lowering something, and trying to make an illegal move out of it. Unfortunately we're really short on testcases here. :) I've made an attempt that works for the current test and passes our set of tests in: Sending lib/Target/X86/X86Instr64bit.td Sending test/CodeGen/X86/x86-64-tls-1.ll Transmitting file data .. Committed revision 107860. Going to need some more testcases soon though if you run into any more problems :) -eric
On 07/08/2010 09:37 AM, Eric Christopher wrote:> > On Jul 7, 2010, at 11:20 AM, Eric Christopher wrote: > >> >> On Jul 7, 2010, at 4:52 AM, Patrick Marlier wrote: >> >>> Which one is correct ? >>> - movl $tm_nest_level at TPOFF, %ecx >>> or >>> - movq $tm_nest_level at TPOFF, %rcx >>> or >>> - movl tm_nest_level at TPOFF, %ecx >>> >> >> I believe this is initial exec and so from: >> >> http://people.redhat.com/drepper/tls.pdf >> >> it would be movl tm_nest_level at TPOFF, %ecx > > As a correction, I don't know that any of these is correct. > I need to look into this a bit more. I think that it requires the > relocation to be off of a register, i.e. > > movabs $foo at tpoff, %rax > add $foo at tpoff, %rax > mov foo at tpoff(%rbx), %eax > > are all legal, while: > > mov foo at tpoff(%ebx), %eax > call foo at tpoff > mov $foo at tpoff, %eax > mov $foo at tpoff, %ax > mov $foo at tpoff, %al > > are all illegal. > > So we appear to be lowering something, and trying to make > an illegal move out of it. > > Unfortunately we're really short on testcases here. :) I've made > an attempt that works for the current test and passes our set of tests > in: > > Sending lib/Target/X86/X86Instr64bit.td > Sending test/CodeGen/X86/x86-64-tls-1.ll > Transmitting file data .. > Committed revision 107860. > > Going to need some more testcases soon though if you run into > any more problems :)I tested on our application and now it compiles :) Thank you so much! Have an nice day, Patrick Marlier.