[llvm-commits] [llvm] r75629 - in /llvm/trunk/lib/Target/MSIL: MSILWriter.cpp MSILWriter.h

Bill Wendling isanbard at gmail.com
Tue Jul 14 11:30:16 PDT 2009


On Tue, Jul 14, 2009 at 11:22 AM, Artur Pietrek<pietreka at gmail.com> wrote:
> On Tue, Jul 14, 2009 at 8:10 PM, Bill Wendling <isanbard at gmail.com> wrote:
>>
>> On Tue, Jul 14, 2009 at 2:53 AM, Anton Korobeynikov<asl at math.spbu.ru>
>> wrote:
>> > Author: asl
>> > Date: Tue Jul 14 04:53:14 2009
>> > New Revision: 75629
>> >
>> > URL: http://llvm.org/viewvc/llvm-project?rev=75629&view=rev
>> > Log:
>> > Add extra sign extension to the same bit width before int sign
>> > extension to another bit width. This is needed to get correct singed
>> > value.
>> > Patch by Artur Pietrek!
>> >
>> > Modified:
>> >    llvm/trunk/lib/Target/MSIL/MSILWriter.cpp
>> >    llvm/trunk/lib/Target/MSIL/MSILWriter.h
>> >
>> > Modified: llvm/trunk/lib/Target/MSIL/MSILWriter.cpp
>> > URL:
>> > http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/MSIL/MSILWriter.cpp?rev=75629&r1=75628&r2=75629&view=diff
>> >
>> >
>> > ==============================================================================
>> > --- llvm/trunk/lib/Target/MSIL/MSILWriter.cpp (original)
>> > +++ llvm/trunk/lib/Target/MSIL/MSILWriter.cpp Tue Jul 14 04:53:14 2009
>> > @@ -670,12 +670,18 @@
>> >
>> >
>> >  void MSILWriter::printCastInstruction(unsigned int Op, const Value* V,
>> > -                                      const Type* Ty) {
>> > +                                      const Type* Ty, const Type*
>> > SrcTy) {
>> >   std::string Tmp("");
>> >   printValueLoad(V);
>> >   switch (Op) {
>> >   // Signed
>> >   case Instruction::SExt:
>> > +    // If sign extending int, convert first from unsigned to signed
>> > +    // with the same bit size - because otherwise we will loose the
>> > sign.
>> > +    if (SrcTy) {
>> > +      Tmp = "conv."+getTypePostfix(SrcTy,false,true);
>> > +      printSimpleInstruction(Tmp.c_str());
>> > +    }
>> >   case Instruction::SIToFP:
>> >   case Instruction::FPToSI:
>>
>> If this fall-through is expected, could you place a comment there saying
>> so?
>>
>> -bw
>
> Yes, it is. I'll submit patch with comment tomorrow, I'm away from my PC
> (and files) right now.
>
No worries. I added the comment.

-bw




More information about the llvm-commits mailing list