[PATCH] D30134: AMDGPU: Fold FP clamp as modifier bit

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 21 09:04:22 PST 2017

arsenm added a comment.

In https://reviews.llvm.org/D30134#682362, @mareko wrote:

> In https://reviews.llvm.org/D30134#682357, @arsenm wrote:
> > In https://reviews.llvm.org/D30134#681271, @mareko wrote:
> >
> > > I only know that exceptions won't occur with the clamp modifier. No idea about denormals.
> > >
> > > Also, shouldn't this handle MIN as well?
> >
> >
> > There's no practical reason to handle min. The higher level operation minnum(x, x) is folded to x in the IR, so this should only be appearing when we emit this pattern for the clamp operation, where max was arbitrarily chosen.
> I don't understand. FPClamp(x) = min(max(x, 0), 1). I don't see min handled here, that's why I asked.

This isn't directly matching the clamp pattern. In the DAG we match that to AMDGPUISD::CLAMP. We emit that as the max(x, x) clamp. We match that here


More information about the llvm-commits mailing list