[LLVMdev] Failure handling half type

Jim Grosbach grosbach at apple.com
Mon Jun 17 14:16:58 PDT 2013


Make sure you’re running LLVM with assertions enabled. You’ll get more information about what’s going wrong that way.

That said, yes, this looks like a bug. Specifically, SelectionDAGLegalize::ExpandConstantFP() assumes that f32 is the smallest floating point constant type it’ll need to handle, and that MVT enum ordering reflects that.

  while (SVT != MVT::f32) {                                                      
    SVT = (MVT::SimpleValueType)(SVT.getSimpleVT().SimpleTy - 1); 
    ...
  }

That function, and possibly others, need to be taught how to handle half-floats, it looks like.

-Jim

On Jun 17, 2013, at 6:59 AM, Alessio Giovanni Baroni <alessiogiovanni.baroni at gmail.com> wrote:

> Hi,
> 
> if I write the following simple program:
> 
> target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
> target triple = "x86_64-unknown-linux-gnu"
> 
> define void @foo () {
>     %1 = alloca half
>     store half 0xH42CC, half* %1   ; 0xH42CC = 3.4
>     %2 = load half* %1
>     ret void
> }
> 
> llc goes in SIGABRT. In the reference manual says that it's  correct syntax.
> 
> It's a bug?
> 
> Thanks.
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130617/98b2a96d/attachment.html>


More information about the llvm-dev mailing list