[LLVMdev] [PATCH] OpenCL half support

David Neto dneto.llvm at gmail.com
Fri May 11 09:08:32 PDT 2012


I've got comments on the code change.   The test cases look ok, but I
haven't fully checked the math on the half-values.
I checked with reference to trunk top-of-tree at revision 156617.   I
have not compiled the code.


lib/AsmParser/LLLexer.cpp

   Adds support to parse format: 0xH<hexdigits>
      Tha 0xH format should be described in LangRef.html alongside
0xK<hex> and 0xM<hex>

   The code looks good though.


lib/VMCore/AsmWriter.cpp
   The change updates Printing support for half data type, so it uses
   the new special 0xH<hex> form.

   Declaration of "int shiftcount" should be moved to smallest nesting
   possible, right after "if ( const ConstantFP ..." at line 710

   (The code makes a lot more sense with a good comment on the definition
   of shiftcount.  I prefer to add this comment:
      int shiftcount; // bit position, in the current word, of the
next nibble to print.
   This is a problem with the original code, not the patch.)

   The patch removes half case from the code for single and double.
   So you should remove the "bool isHalf" variable in that spot. (line 720)

   Line 762.  Update the comment
       // Some form of long double.  These appear as a magic letter identifying

   Before:
    // Some form of long double.  These appear as a magic letter identifying
    // the type, then a fixed number of hex digits.
   After:
    // Either half, or some form of long double.
    // These appear as a magic letter identifying the type, then a
    // fixed number of hex digits.

   The rest of this patch to AsmWriter.cpp looks good.



On Fri, Apr 20, 2012 at 7:15 AM, Anton Lokhmotov
<Anton.Lokhmotov at arm.com> wrote:
> Several companies have expressed interest in adding support for the half
> data type.  Some code from our previous patch
> (http://lists.cs.uiuc.edu/pipermail/llvmdev/2011-July/042043.html) made it
> into ToT (at http://llvm.org/viewvc/llvm-project?view=rev&revision=146786).
>
> Please review further changes required.
>
> Many thanks,
> Anton.
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>




More information about the llvm-dev mailing list