[PATCH] Generation of PSAD in LoopVectorizer
James Molloy
james.molloy at arm.com
Mon Apr 6 11:01:00 PDT 2015
Hi Vj,
I've given some more comments. Sorry for any lag on this review, I'm moving house and it's the Easter break.
Cheers,
James
REPOSITORY
rL LLVM
================
Comment at: include/llvm/CodeGen/ISDOpcodes.h:647
@@ +646,3 @@
+ /// SAD - This corresponds to a Sum of Absolute Difference(SAD) instruction.
+ /// The operands are vectors of char type with length of vector being power
+ /// of 2 and the result is a scalar integer.
----------------
Vijender wrote:
> jmolloy wrote:
> > "of char type"? Do you mean i8? Why only i8? Why is the (scalar part of the) input type not the same as the output type?
> [VJ] - The Sum of absolute difference instruction is only appropriate for char Types. It is a byte level reduction operation. If you have a look at PSAD in X86 or USAD in ARM, all happen at byte level.
> [VJ] - The scalar type of output is not same as scalar type of input because sum of eight i8's may not fit properly in an i8 without data lose.
>
Hi,
No they don't, not in ARM at least. We have i8, i16, i32 and i64 variants. Also, we mustn't tie target agnostic intrinsics to a specific target or set of targets. It should work with whatever types make sense to it.
Also, ARM at least does not return a scalar. Its SAD instructions happen elementwise on a vector (see VABA/UABA/SABA). So we'd need support for this too. Does X86 have this?
================
Comment at: include/llvm/IR/Intrinsics.td:597
@@ +596,3 @@
+// Only vectors of char Type are allowed.
+def int_sad : Intrinsic<[llvm_i32_ty],
+ [llvm_anyvector_ty, llvm_anyvector_ty],
----------------
Vijender wrote:
> jmolloy wrote:
> > What is the signedness of this operation? Is there a floating point equivalent? If not, why not?
> [VJ] - There is no floating point equivalent of SAD.
Not in X86, but why not in LLVM? LLVM's target agnostic layer is not X86. Does SAD not make sense on FP types?
Also, what about signedness?
http://reviews.llvm.org/D8136
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
More information about the llvm-commits
mailing list