[cfe-commits] [PATCH][review request] Add support for LLVM intrinsic bswap16

James Orr jorr at apple.com
Sat Mar 19 15:15:14 PDT 2011


Add support for built in 16bit byte swap.

-James

Index: include/clang/Basic/Builtins.def
===================================================================
--- include/clang/Basic/Builtins.def	(revision 127948)
+++ include/clang/Basic/Builtins.def	(working copy)
@@ -380,6 +380,7 @@
 
 // FIXME: These type signatures are not correct for targets with int != 32-bits
 // or with ULL != 64-bits.
+BUILTIN(__builtin_bswap16, "UsUs", "nc")
 BUILTIN(__builtin_bswap32, "UiUi", "nc")
 BUILTIN(__builtin_bswap64, "ULLiULLi", "nc")
 
Index: lib/CodeGen/CGBuiltin.cpp
===================================================================
--- lib/CodeGen/CGBuiltin.cpp	(revision 127948)
+++ lib/CodeGen/CGBuiltin.cpp	(working copy)
@@ -316,6 +316,7 @@
       (void)EmitScalarExpr(E->getArg(1));
     return RValue::get(EmitScalarExpr(E->getArg(0)));
   }
+  case Builtin::BI__builtin_bswap16:  
   case Builtin::BI__builtin_bswap32:
   case Builtin::BI__builtin_bswap64: {
     Value *ArgValue = EmitScalarExpr(E->getArg(0));




More information about the cfe-commits mailing list