[PATCH] D26072: [PPC] add absolute difference altivec instructions and matching intrinsics

Sean Fertile via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 28 11:58:34 PDT 2016

sfertile marked 5 inline comments as done.
sfertile added inline comments.

Comment at: include/llvm/IR/IntrinsicsPowerPC.td:697
+def int_ppc_altivec_vabsdub :
+      PowerPC_Vec_Intrinsic<"vabsdub", [llvm_v16i8_ty],
+                            [llvm_v16i8_ty, llvm_v16i8_ty], [IntrNoMem]>;
nemanjai wrote:
> Been a while since I looked at this, but do the PowerPC_Vec_BBB_Intrinsic and it's halfword and word equivalent not have the same definition as this (and therefore allow you to more concisely define these)? Basically what I'm getting at is using the most specialized class that has the right form.
Your right, I've updated them to use the specialized formats.

Comment at: lib/Target/PowerPC/PPCInstrAltivec.td:1410-1419
+// Absolute Difference
+def VABSDUB : VXForm_1<1027, (outs vrrc:$vD), (ins vrrc:$vA, vrrc:$vB),
+                      "vabsdub $vD, $vA, $vB", IIC_VecGeneral,
+                      [(set v16i8:$vD, (int_ppc_altivec_vabsdub v16i8:$vA, v16i8:$vB))]>;
+def VABSDUH : VXForm_1<1091, (outs vrrc:$vD), (ins vrrc:$vA, vrrc:$vB),
+                       "vabsduh $vD, $vA, $vB", IIC_VecGeneral,
+                       [(set v8i16:$vD, (int_ppc_altivec_vabsduh v8i16:$vA, v8i16:$vB))]>;
nemanjai wrote:
> amehsan wrote:
> > IIRC, when I was doing the patches that I sent you, there was a generic absolute value intrinsic, that I could use. That is better than the PPC intrinsics, because it is more likely that optimizations understand it. Could you use the generic one here?
> I don't think there is a generic one for integer types, but I might be wrong. I think there's only llvm.fabs.
I checked, there isn't a generic version of absolute difference to use.


More information about the llvm-commits mailing list