[PATCH][AArch64] implement aarch64 neon instruction class AdvSIMD (3 diff)

Jiangning Liu liujiangning1 at gmail.com
Tue Aug 27 01:00:56 PDT 2013


> Don't these have reasonably simple LLVM IR representations? For example:
>
> define <2 x i32> @addhn(<2 x i64> %lhs, <2 x i64> %rhs) {
>   %sum = add <2 x i64> %lhs, %rhs
>   %shift = shl <2 x i64> %sum, <i64 32, i64 32>
>   %trunc = trunc <2 x i64> %shift to <2 x i32>
>   ret <2 x i32> %trunc
> }
>
>
Do you mean to use lshr instead of shl, because addhn is to get high
narrow, so we could have,

define <2 x i32> @addhn(<2 x i64> %lhs, <2 x i64> %rhs) {
  %sum = add <2 x i64> %lhs, %rhs
  %shift = lshr <2 x i64> %sum, <i64 32, i64 32>
  %trunc = trunc <2 x i64> %shift to <2 x i32>
  ret <2 x i32> %trunc
}

Thanks,
-Jiangning
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130827/8ca9b3c5/attachment.html>


More information about the llvm-commits mailing list