[PATCH]Clang and AArch64 backend patches to support sshll/ushll instructions
Hao Liu
Hao.Liu at arm.com
Fri Aug 16 09:15:54 PDT 2013
Hi Jiangning and Tim,
I create a patch to reuse vshll_n and vget_high.
As a result, there is no built-in
__builtin_neon_vshll_high_n_v/__builtin_neon_vmovl_high_n_v and no need to
handle them in CGBuiltin.cpp.
Thanks,
-Hao
-----Original Message-----
From: Tim Northover [mailto:t.p.northover at gmail.com]
Sent: Friday, August 16, 2013 10:40 AM
To: Jiangning Liu
Cc: Hao Liu; Jiangning Liu; llvm-commits
Subject: Re: [PATCH]Clang and AArch64 backend patches to support sshll/ushll
instructions
Hi Jiangning,
> Should this be changed to
>
> #define vshll_high_n_s8(a, __b) __extension__ ({ \
> int64x2_t __a = (a); \
> (int16x8_t)vshll_n_s8(vget_high_s8(__a), __b); })
That sounds like a really good idea. Definitely an improvement on the lots
of repetitious C++ code we're going to end up with at the moment.
Tim.
-----
Hi Hao,
In arm_neon.h we have the following generated,
#define vshll_high_n_s8(a, __b) __extension__ ({ \
int8x16_t __a = (a); \
(int16x8_t)__builtin_neon_vshll_high_n_v(__a, __b, 33); })
Should this be changed to
#define vshll_high_n_s8(a, __b) __extension__ ({ \
int64x2_t __a = (a); \
(int16x8_t)vshll_n_s8(vget_high_s8(__a), __b); })
This would bring some benefits,
1) avoid defining new built-in __builtin_neon_vshll_high_n_v
2) the lowering in CGBuiltin.cpp can be simpler because we needn't to lower
__builtin_neon_vshll_high_n_v any longer
3) this looks more natural to explain the semantics of long2/wide2 type of
aarch64 neon instructions
+ if (isHigh){
+ unsigned NumElts = VTy->getNumElements();
+ unsigned EltBits = VTy->getElementType()->getPrimitiveSizeInBits();
+ llvm::Type *EltTy =
+ llvm::IntegerType::get(VTy->getContext(), EltBits / 2);
+ // The source operand type has twice as many elements of half the size.
+ llvm::Type *SrcTy = llvm::VectorType::get(EltTy, NumElts * 2);
+ SmallVector<Constant*, 8> Indices;
+ for (unsigned i = 0; i != NumElts; i++)
+ Indices.push_back(Builder.getInt32(i + NumElts));
+ Value *SV = llvm::ConstantVector::get(Indices);
+ Value *Undef = llvm::UndefValue::get(SrcTy);
+ Ops[0] = Builder.CreateBitCast(Ops[0], SrcTy);
+ Ops[0] = Builder.CreateShuffleVector(Ops[0], Undef, SV);
This piece of code would be unnecessary.
Thanks,
-Jiangning
-------------- next part --------------
A non-text attachment was scrubbed...
Name: clang-AArch64Neon-shiftLeft-shiftLong-movLong-v2+.patch.patch
Type: application/octet-stream
Size: 4922 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130816/4eddda16/attachment.obj>
More information about the llvm-commits
mailing list