[PATCH] D103321: [AMDGPU] Stop mulhi from doing 24 bit mul for uniform values
Jay Foad via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 21 06:30:39 PDT 2021
foad accepted this revision.
foad added a comment.
This revision is now accepted and ready to land.
LGTM with some extra test coverage for s_mul_hi_u32.
================
Comment at: llvm/lib/Target/AMDGPU/AMDGPUSubtarget.h:166
+ bool hasSMulHi() const {
+ return HasSMulHi;
+ }
----------------
dstuttard wrote:
> dstuttard wrote:
> > foad wrote:
> > > dstuttard wrote:
> > > > foad wrote:
> > > > > I would just put the >= GFX9 test in here. No need for a HasSMulHi field. There are plenty of precedents for this.
> > > > Having given this some thought I'm not sure that I agree - the precedent in the implementation is to do something like I've implemented. That's the consistent thing to do.
> > > > Is there a good reason not to (other than it is slightly less code?) - implemented this way it is a lot clearer too.
> > > Both implementations ultimately say that s_mul_hi is supported on gfx9+. Mine just has fewer moving parts. I don't find yours clearer.
> > Until there's a variant at some point in the future that doesn't have SMulHi (although I guess the implementation can be changed if that ever occurs).
> Actually - this is the way that this is handled in other cases. Because this test is inside AMDGPUISelLowering it has to use the SubTarget - so the test function has to be exposed from AMDGPUSubtarget - the getGeneration is only supported in GCNSubtarget (and defaults to false for the others - which is correct).
>
>
Fair enough.
================
Comment at: llvm/test/CodeGen/AMDGPU/mul_int24.ll:3
+; RUN: llc -march=amdgcn -mcpu=tonga -mattr=-flat-for-global -verify-machineinstrs < %s | FileCheck -check-prefixes=GCN,VI,FUNC,SIVI %s
+; RUN: llc -march=amdgcn -mcpu=gfx900 -mattr=-flat-for-global -verify-machineinstrs < %s | FileCheck -check-prefixes=GCN,FUNC,GFX9 %s
; RUN: llc -march=r600 -mcpu=redwood < %s | FileCheck -check-prefix=EG -check-prefix=FUNC %s
----------------
Could you also add GFX9 coverage in mul_uint24-amdgcn.ll?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D103321/new/
https://reviews.llvm.org/D103321
More information about the llvm-commits
mailing list