[llvm-commits] [llvm-gcc] Removal of signedness from gcc/config/i386/i386.h

Reid Spencer rspencer at reidspencer.com
Wed Dec 20 16:33:12 PST 2006


The attached patch removes signedness from the i386.h file, in
particular the LLVM_TARGET_INTRINSIC_LOWER macro. The macro takes three
additional arguments and depends on a change in the function its called
from, like this:

Index: gcc/llvm-convert.cpp
===================================================================
--- gcc/llvm-convert.cpp        (revision 230)
+++ gcc/llvm-convert.cpp        (working copy)
@@ -3011,9 +3090,11 @@
   for (tree args = TREE_OPERAND(exp, 1); args; args = TREE_CHAIN(args))
     Operands.push_back(Emit(TREE_VALUE(args), 0));

+  bool ResIsSigned = !TYPE_UNSIGNED(TREE_TYPE(TREE_TYPE(fndecl)));
+  bool ExpIsSigned = !TYPE_UNSIGNED(TREE_TYPE(exp));
   unsigned FnCode = DECL_FUNCTION_CODE(fndecl);
-  LLVM_TARGET_INTRINSIC_LOWER(FnCode, DestLoc, Result,
-                              ResultType, Operands, CurBB);
+  LLVM_TARGET_INTRINSIC_LOWER(FnCode, DestLoc, Result, ResultType,
Operands,
+                              CurBB, exp, ResIsSigned, ExpIsSigned);
 #endif
   return false;
 }

This allows the macro to make signedness determinations based on the gcc
tree codes.

Although this patch removes isSigned() calls and is correct, it is not
optimal. It is still using CastInst::getCastOpcode to figure out the
casting opcode for it. Perhaps someone with a little more knowledge of
the intrinsic functions could narrow these down to the appropriate cast
opcode.

Please review and commit when you can.

Reid.




More information about the llvm-commits mailing list