[PATCH] D81829: [LangRef] Element-wise Integral Reduction Intrinsics

Simon Moll via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 16 06:37:19 PDT 2020


simoll added inline comments.


================
Comment at: llvm/docs/LangRef.rst:15218-15219
+
+      declare i32 @llvm.abs.i32(i32 <src>, i1 <is_int_min_poison>)
+      declare <4 x i32> @llvm.abs.v4i32(<4 x i32> <src>, i1 <is_int_min_poison>)
+
----------------
lebedev.ri wrote:
> nikic wrote:
> > spatel wrote:
> > > Do we need to include the poison option? 
> > > 
> > > The SDAG node only has:
> > >   /// Note: A value of INT_MIN will return INT_MIN, no saturation or overflow
> > >   /// is performed.
> > The poison option is the equivalent of the sub nsw flag that was used previously. It doesn't matter for lowering, but it is used for analysis sometimes, in particular we can only assume that the `llvm.abs()` result is actually positive if the poison flag is set.
> > The poison option is the equivalent of the sub nsw flag that was used previously.
> 
> Precisely, yes. This intrinsic will be pretty powerless without that flag.
Couldn't we add integer overflow flags to CallInsts the same way we have fast math flags? That should make this extra argument redundant.
Also, this would allow us to have `nsw`, `nuw` on VP intrinsics (https://llvm.org/docs/LangRef.html#id2355) and other integer intrinsics.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D81829/new/

https://reviews.llvm.org/D81829





More information about the llvm-commits mailing list