[LLVMdev] 16 bit floats

Villmow, Micah Micah.Villmow at amd.com
Thu Feb 5 14:33:22 PST 2009


Eli,
 This is similar to what I was originally thinking, but I also need to
support i16 data type and conversions between it and floating point
values. So would there be a way for me to distinguish between a half and
a short?
For example, I have the 
short a = load_from_memory(short_ptr, index);
and 
half a = load_from_memory(half_ptr, index);

if I force it to use i16 wouldn't the function be the sam in the IR?

i.e.
declare i16 @load_from_memory(i16*, i32)?

Thanks,
Micah

-----Original Message-----
From: llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu]
On Behalf Of Eli Friedman
Sent: Thursday, February 05, 2009 1:54 PM
To: LLVM Developers Mailing List
Subject: Re: [LLVMdev] 16 bit floats

On Thu, Feb 5, 2009 at 1:34 PM, Villmow, Micah <Micah.Villmow at amd.com>
wrote:
>  I need to do a similar where I convert the 16bit floats to 32bit
floats on
> memory operations for both scalar and vector formats.  So can these
> operations be implemented without adding 16 bit float support natively
to
> LLVM? If so, how?

In this case, you only really need two currently unsupported
instructions: one that does f16->f32, and one that does f32->f16;
adding target intrinsics to do that should be easy.  You can make the
instrinsics take an i16 so that the type system doesn't have to be
aware of f16 values.

-Eli
_______________________________________________
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