[llvm-dev] Handling native i16 types in clang and opt
Alex Susu via llvm-dev
llvm-dev at lists.llvm.org
Sun May 21 01:22:20 PDT 2017
Hello.
My target architecture supports natively 16 bit integers (i16).
Whenever I write in C programs using only short types, clang compiles the program to
LLVM and converts the i16 data to i32 to perform arithmetic operations and then truncates
the results to i16. Then, the InstructionCombining (INSTCOMBINE or IC) pass removes these
conversions back and forth from i16, except for the (s)div LLVM IR operation.
Is there a way to avoid these conversion made by clang back and forth from i16 to
i32, if my source program uses only short types?
Otherwise, how can I make the IC pass handle sdiv the way it does with add (sub),
mul? (that is, if the input operands are i16, the add/mul operation will eventually be
i16, with any unnecessary conversion back and forth from i32 removed).
Thank you,
Alex
More information about the llvm-dev
mailing list