How to enable __fp16 type on gcc for x86_64

后端 未结 1 1933
南方客
南方客 2021-02-04 06:34

The __fp16 floating point data-type is a well known extension to the C standard used notably on ARM processors. I would like to run the IEEE version of them on my x

1条回答
  •  北荒
    北荒 (楼主)
    2021-02-04 07:14

    I did not find a way to do so in gcc (as of gcc 8.2.0).

    As for clang, in 6.0.0 the following options showed some success:

    clang -cc1 -fnative-half-type -fallow-half-arguments-and-returns
    

    The option -fnative-half-type enable the use of __fp16 type (instead of promoting them to float). While the option -fallow-half-arguments-and-returns allows to pass __fp16 by value, the API being non-standard be careful not to mix different compilers.

    That being said, it does not provide math functions using __fp16 types (it will promote them to/from float or double).

    It was sufficient for my use case.

    0 讨论(0)
提交回复
热议问题