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

Chris Lattner clattner at apple.com
Sat Mar 19 19:25:51 PDT 2011


On Mar 19, 2011, at 3:24 PM, Eli Friedman wrote:

> 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?

Yes, why?  GCC doesn't support this either IIRC.

-Chris

> 
> -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
>> 
> 
> _______________________________________________
> 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