[PATCH] Add support bswap16 to/from memory compiling to rev16 on ARM/Thumb

Louis Gerbarg lgg at apple.com
Mon May 12 10:36:56 PDT 2014


On May 10, 2014, at 1:32 PM, Renato Golin <renato.golin at linaro.org> wrote:

> On 9 May 2014 23:27, Louis Gerbarg <lgg at apple.com> wrote:
>> Currently most __builtin_bswap16() intrinsics from the frontend end up generating sup-optimal code due to legalization promoting some of the operands to i32s during load/stores. That results in the backend generating a rev and an lsr instead of a rev16. This patch adds patterns that catch those situations and generate a rev16.
> 
> Hi Louis,
> 
> Nice catch. Though, on current trunk, your test2 is already producing
> rev16 on both ARM and Thumb.

Yes it is, but there is no test case for it. Since I was in the neighborhood anyway it seemed prudent to add it (also, I wanted to make sure i didn’t inadvertently break it when I was poking around).

Louis



More information about the llvm-commits mailing list