<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html><head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <meta name="generator" content="Osso Notes">
    <title></title></head>
<body>
<p>Justin,
<br>
<br>Thank you,
<br>
<br>It is undefined address (???) only in reduced test case and was defined in original big one in first message of this thread.
<br>
<br>- Dima.
<br>
<br>----- Original message -----
<br>> Okay, few issues here:
<br>> 
<br>> First, i1 is used in the NVPTX back-end to map to the predicate (.pred)
<br>> type.   We definitely do not want to declare this type as illegal.   The
<br>> real issue is lack of complete support for this type.   The PTX language
<br>> places restrictions on what can be done with .pred registers, and it
<br>> looks like the failure is here:
<br>> 
<br>> kernelgen_hostcall.exit228:                                             ; preds =
<br>> %while.cond.i226   store i1 false, i1 addrspace(1)* undef, align 8
<br>> 
<br>> Ignoring for a second that you're storing to an undefined address (???),
<br>> the back-end does not yet handle up-casting an i1 to an appropriate type
<br>> for storage.   The memory space is not bit-addressable, so a direct store
<br>> of an i1 does not make sense.   In the short term, I would recommend that
<br>> you manually zext from/to i8 and load/store those.
<br>> 
<br>> On Sun, Jul 1, 2012 at 10:14 AM, Dmitry N. Mikushin
<br>> <<a href="mailto:maemarcus@gmail.com">maemarcus@gmail.com</a>>wrote:
<br>> 
<br>> > Hi Duncan,
<br>> > 
<br>> > Sorry I don't understand your point, could you please explain a little
<br>> > bit more?
<br>> > Why i1 should be declared illegal? Operations on byte-wide types like
<br>> > char or bool are pretty legal, according to PTX spec:
<br>> > 
<br>> > "Registers may be typed (signed integer, unsigned integer, floating
<br>> > point, predicate) or untyped. Register size is restricted; aside from
<br>> > predicate registers which are 1-bit, scalar registers have a width of
<br>> > 8-, 16-, 32-, or 64-bits, and vector registers have a width of 16-,
<br>> > 32-, 64-, or 128-bits. The most common use of 8-bit registers is with
<br>> > ld, st, and cvt instructions, or as elements of vector tuples."
<br>> > 
<br>> > Thanks,
<br>> > - D.
<br>> > 
<br>> > 2012/6/30 Duncan Sands <<a href="mailto:baldrick@free.fr">baldrick@free.fr</a>>:
<br>> > > Hi Dmitry,
<br>> > > 
<br>> > > > > did you declare i1 to be an illegal type?
<br>> > > > 
<br>> > > > 
<br>> > > > No. How?
<br>> > > 
<br>> > > 
<br>> > > I think it will be considered illegal if you don't add it to any
<br>> > > register class.
<br>> > > 
<br>> > > Ciao, Duncan.
<br>> > > 
<br>> > > 
<br>> > > > 
<br>> > > > 2012/6/30 Duncan Sands <<a href="mailto:baldrick@free.fr">baldrick@free.fr</a>>:
<br>> > > > > 
<br>> > > > > Hi Dmitry,
<br>> > > > > > 
<br>> > > > > > So instead of setOperationAction(ISD::STORE, MVT::i1, Expand);
<br>> > > > > > one should probably do setOperationAction(ISD::STORE, MVT::i1,
<br>> > > > > > Custom); and implement it in
<br>> > > > > > NVPTXTargetLowering::LowerOperation.
<br>> > > > > > 
<br>> > > > > > But this issue makes a good point about the code efficiency: I
<br>> > > > > > suspect such expansion will be very ugly in terms of
<br>> > > > > > performance. Probably we can do much better if bool would use
<br>> > > > > > i32 instead of i1. I don't know how to do that, though. Is it
<br>> > > > > > possible?
<br>> > > > > 
<br>> > > > > 
<br>> > > > > did you declare i1 to be an illegal type?   If so, you shouldn't
<br>> > > > > get any stores of i1 at this stage (you may get trunc stores to
<br>> > > > > i1, but that is different).
<br>> > > > > 
<br>> > > > > Ciao, Duncan.
<br>> > > > > 
<br>> > > > > > 
<br>> > > > > > Anyway, if this is a defect, then it's a blocker for us, and
<br>> > > > > > we'd much appreciate a fix.
<br>> > > > > > 
<br>> > > > > > - D.
<br>> > > > > > 
<br>> > > > > > 2012/6/29 Eli Friedman <<a href="mailto:eli.friedman@gmail.com">eli.friedman@gmail.com</a>>:
<br>> > > > > > > 
<br>> > > > > > > On Fri, Jun 29, 2012 at 2:11 PM, Dmitry N. Mikushin
<br>> > > > > > > <<a href="mailto:maemarcus@gmail.com">maemarcus@gmail.com</a>> wrote:
<br>> > > > > > > > 
<br>> > > > > > > > Hi again,
<br>> > > > > > > > 
<br>> > > > > > > > Kind people on #llvm helped me to utilize bugpoint to
<br>> > > > > > > > reduce the previously submitted test case. For record, it
<br>> > > > > > > > code be done with the following command:
<br>> > > > > > > > 
<br>> > > > > > > > $ bugpoint -llc-safe test.ll
<br>> > > > > > > > 
<br>> > > > > > > > The resulting IR is attached, and it is crashing in the
<br>> > > > > > > > same way. Is it a valid code?
<br>> > > > > > > 
<br>> > > > > > > 
<br>> > > > > > > Looks like a bug in the NVPTXISelLowering.cpp: it has
<br>> > > > > > > "setOperationAction(ISD::STORE, MVT::i1, Expand);", but the
<br>> > > > > > > legalizer doesn't know how to handle that.
<br>> > > > > > > 
<br>> > > > > > > -Eli
<br>> > > > > > 
<br>> > > > > > _______________________________________________
<br>> > > > > > LLVM Developers mailing list
<br>> > > > > > <a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a>                 <a href="http://llvm.cs.uiuc.edu">http://llvm.cs.uiuc.edu</a>
<br>> > > > > > <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a>
<br>> > > > > > 
<br>> > > > > 
<br>> > > > > 
<br>> > > > > _______________________________________________
<br>> > > > > LLVM Developers mailing list
<br>> > > > > <a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a>                 <a href="http://llvm.cs.uiuc.edu">http://llvm.cs.uiuc.edu</a>
<br>> > > > > <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a>
<br>> > > 
<br>> > > 
<br>> > > 
<br>> > 
<br>> > _______________________________________________
<br>> > LLVM Developers mailing list
<br>> > <a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a>                 <a href="http://llvm.cs.uiuc.edu">http://llvm.cs.uiuc.edu</a>
<br>> > <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a>
<br>> > 
<br>> 
<br>> 
<br>> 
<br>> -- 
<br>> 
<br>> Thanks,
<br>> 
<br>> Justin Holewinski
<br><br></p>
</body>
</html>