Author: lattner
Date: Wed Jan 16 15:10:05 2008
New Revision: 46089

URL: http://llvm.org/viewvc/llvm-project?rev=46089&view=rev
Log:
Wire up __builtin_bswap32/64 to llvm.bswap.  This is a 4.2-only feature.


Modified:
    llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp

Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp
URL: 
http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp?rev=46089&r1=46088&r2=46089&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Wed Jan 16 15:10:05 2008
@@ -4167,6 +4167,16 @@
       Result = Builder.CreateIntCast(Result, DestTy, "cast");
     return true;
   }
+  case BUILT_IN_BSWAP32:
+  case BUILT_IN_BSWAP64: {
+    Value *Amt = Emit(TREE_VALUE(TREE_OPERAND(exp, 1)), 0);
+    EmitBuiltinUnaryIntOp(Amt, Result, Intrinsic::bswap); 
+    const Type *DestTy = ConvertType(TREE_TYPE(exp));
+    if (Result->getType() != DestTy)
+      Result = Builder.CreateIntCast(Result, DestTy, "cast");
+    return true;
+  }
+      
   case BUILT_IN_SQRT: 
   case BUILT_IN_SQRTF:
   case BUILT_IN_SQRTL:


_______________________________________________
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits

Reply via email to