[PATCH RFC 3/4] R600: Implement iterative algorithm for udivrem

Jan Vesely jan.vesely at rutgers.edu
Fri Apr 25 12:40:31 PDT 2014

On Fri, 2014-04-25 at 12:16 -0700, Matt Arsenault wrote:
> On Apr 25, 2014, at 12:08 PM, Jan Vesely <jan.vesely at rutgers.edu> wrote:
> > @@ -429,6 +429,56 @@ void AMDGPUTargetLowering::ReplaceNodeResults(SDNode *N,
> >     Results.push_back(UDIVREM.getValue(1));
> >     break;
> >   }
> > +  case ISD::UDIVREM: {
> > +
> Why is this in ReplaceNodeResults? i64 is legal for SI, so does this not work for SI for some reason?

I have not really considered non EG/NI hw (BFE should probably be hidden
behind a better check as well)

My understanding is that llvm first runs legalizeTypes, replacing all
nodes that have output of illegal type. So this function should not be
called for SI on UDIV/UREM/UDIVREM nodes.

With all types legal it calls legalizeOps that tries to lower nodes of
unsupported ops. So in my understanding, this code should never run for
SI hw and SI target should use something else (with 64 bit ops it would
probably be faster anyway).

setOprerationAction should be set to Expand for SI+, I can fix that in


Jan Vesely <jan.vesely at rutgers.edu>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140425/904026fd/attachment.sig>

More information about the llvm-commits mailing list