[LLVMdev] fixed point types

me22 me22.ca at gmail.com
Tue Nov 30 23:11:41 PST 2010


On Tue, Nov 30, 2010 at 05:48, Jonas Paulsson <jnspaulsson at hotmail.com> wrote:
>
> May I ask then, what could one expect from various optimizations when using
> intrinsics to support the fixed point type? LTO, Value optimizations, mem ??
>

Can you not just lower your fixed-point operations to widen, perform
normal integer operation, shift and truncate?  With LLVM's support for
arbitrary-width integer types, it might work surprisingly nicely.  For
instance, a 8.24 multiply would be:
- widen the i32s to i56s
- multiply
- shift right 24
- truncate to i32

Then you'd get working code free from LLVM's type legalizer and
friends, and it would just be up to the backends to recognize the
possibilities for doing things smarter, if they have relevant
instructions.  (Just like it is for rotation, etc.)  Optimizations
would see normal operations they already know how to simplify and
fold.  And anything special -- like saturating -- would fall out from
the normal integer operations.

Hoping there isn't some really obvious reason that would fail,
~ Scott



More information about the llvm-dev mailing list