[PATCH][X86] Add ISel patterns to select 'fp32_to_fp16' and 'fp16_to_fp32' dag nodes.

Jim Grosbach grosbach at apple.com
Fri Jun 20 13:32:44 PDT 2014


I agree calling library helpers is the correct fallback here.

What’s the behavior with soft-float? Specifically,

+  if (!TM.Options.UseSoftFloat && !Subtarget->hasF16C()) {

-Jim

> On Jun 19, 2014, at 6:53 AM, Andrea Di Biagio <andrea.dibiagio at gmail.com> wrote:
> 
> Hi,
> 
> this patch:
> 1) Adds tablegen patterns to select F16C float-to-half-float
> conversion instructions (and vice versa) from 'f32_to_f16' (and
> 'f16_to_f32') dag nodes;
> 
> 2) Teaches the backend how to emit compiler runtime library call to
> __gnu_f2h_ieee and __gnu_h2f_ieee if there is no F16C support.
> 
> About point 2.
> I am not sure if there is a better ways to fix/workaround this
> problem. In general, my opinion is that the backend shouldn't raise a
> error if we don't have F16C and the DAG contains
> 'f32_to_f16/f16_to_f32' nodes.
> 
> The compiler already knows about the existence of libcalls
> '__gnu_f2h_ieee' and '__gnu_h2f_ieee2' (see TargetLoweringBase.cpp).
> So, my idea (if you agree) is to generate runtime calls instead of
> returning an ISel error.
> However, this could result later on in a linker error if the runtime
> library doesn't define '__gnu_f2h_ieee' and '__gnu_h2f_ieee'.
> 
> Please let me know what you think.
> 
> Thanks!
> Andrea Di Biagio
> <patch-f16c-conv.diff>





More information about the llvm-commits mailing list