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

Eli Friedman eli.friedman at gmail.com
Sat Mar 19 15:24:53 PDT 2011


On Sat, Mar 19, 2011 at 3:15 PM, James Orr <jorr at apple.com> wrote:
> Add support for built in 16bit byte swap.

Why?

-Eli

> -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));
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>




More information about the cfe-commits mailing list