[PATCH] D101610: [AMDGPU] Tidy up some simple expressions for clarity NFC
David Stuttard via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 30 02:48:43 PDT 2021
dstuttard created this revision.
Herald added subscribers: kerbowa, hiraditya, t-tye, tpr, yaxunl, nhaehnle, jvesely, kzhuravl, arsenm.
dstuttard requested review of this revision.
Herald added subscribers: llvm-commits, wdng.
Herald added a project: LLVM.
Slight refactor for clarity.
Change-Id: Ib25e7f4582c67a7c57f066cfd5382c1405d7d4c5
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D101610
Files:
llvm/lib/Target/AMDGPU/SIInstrInfo.cpp
Index: llvm/lib/Target/AMDGPU/SIInstrInfo.cpp
===================================================================
--- llvm/lib/Target/AMDGPU/SIInstrInfo.cpp
+++ llvm/lib/Target/AMDGPU/SIInstrInfo.cpp
@@ -26,6 +26,7 @@
#include "llvm/IR/DiagnosticInfo.h"
#include "llvm/IR/IntrinsicsAMDGPU.h"
#include "llvm/Support/CommandLine.h"
+#include "llvm/Support/MathExtras.h"
#include "llvm/Target/TargetMachine.h"
using namespace llvm;
@@ -4244,7 +4245,7 @@
unsigned AddrComponents = (BaseOpcode->Coordinates ? Dim->NumCoords : 0) +
(BaseOpcode->LodOrClampOrMip ? 1 : 0);
if (IsA16)
- AddrWords += (AddrComponents + 1) / 2;
+ AddrWords += divideCeil(AddrComponents, 2);
else
AddrWords += AddrComponents;
@@ -4252,7 +4253,7 @@
if (PackDerivatives)
// There are two gradients per coordinate, we pack them separately.
// For the 3d case, we get (dy/du, dx/du) (-, dz/du) (dy/dv, dx/dv) (-, dz/dv)
- AddrWords += (Dim->NumGradients / 2 + 1) / 2 * 2;
+ AddrWords += alignTo<2>(Dim->NumGradients / 2);
else
AddrWords += Dim->NumGradients;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D101610.341820.patch
Type: text/x-patch
Size: 1190 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210430/3c567a1c/attachment.bin>
More information about the llvm-commits
mailing list