[cfe-dev] [RFC] implementation of _Float16

Hal Finkel via cfe-dev cfe-dev at lists.llvm.org
Wed May 10 03:38:40 PDT 2017


On 05/10/2017 05:18 AM, Sjoerd Meijer via cfe-dev wrote:
>
> Hi,
>
> ARMv8.2-A introduces as an optional extension half-precision 
> data-processing instructions for Advanced SIMD and floating-point in 
> both AArch64 and AArch32 states [1], and we are looking into 
> implementing C/C++-language support for these new ARMv8.2-A 
> half-precision instructions.
>
> We would like to introduce a new Clang type. The reason is that we 
> e.g. cannot use type __fp16 (defined in the ARM C Language Extensions 
> [2]) because it is a storage type only. This means when using standard 
> C operators values of __fp16 type promote to float when used in 
> arithmetic operations, which we would like to avoid for the ARMv8.2-A 
> half-precision instructions. Please note that the LLVM IR already has 
> a half precision type, onto which for example __fp16 is mapped, so 
> there are no changes or additions required for the LLVM IR.
>
> As a new Clang type we would like to propose _Float16 as defined in a 
> C11 extension, see [3]. Arithmetic is well defined, it is not only a 
> storage type as __fp16. Our question is whether a partial 
> implementation, just implementing this type and not claiming (full) 
> C11 conformance is acceptable?
>

I would very much like to see fp16 as a first-class floating-point type 
in Clang and LLVM (i.e. handling that is not just a storage type). Doing 
this in Clang in a way that is specified by C11 seems like the right 
approach. I don't see why implementing this would be predicated on 
implementing other parts of C11.

  -Hal

> [1] ARM ARM: 
> https://static.docs.arm.com/ddi0487/b/DDI0487B_a_armv8_arm.pdf
>
> [2] ARM C Language Extensions 2.1: 
> http://infocenter.arm.com/help/topic/com.arm.doc.ihi0053d/IHI0053D_acle_2_1.pdf
>
> [3] ISO/IEC TS 18661-3  interchange and extended types: 
> http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1945.pdf
>
> Cheers,
>
> Sjoerd.
>
> IMPORTANT NOTICE: The contents of this email and any attachments are 
> confidential and may also be privileged. If you are not the intended 
> recipient, please notify the sender immediately and do not disclose 
> the contents to any other person, use it for any purpose, or store or 
> copy the information in any medium. Thank you.
>
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev

-- 
Hal Finkel
Lead, Compiler Technology and Programming Languages
Leadership Computing Facility
Argonne National Laboratory

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20170510/47d23f5a/attachment.html>


More information about the cfe-dev mailing list