[llvm] a67a377 - [AMDGPU] Tidy up some simple expressions for clarity NFC

David Stuttard via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 30 03:15:37 PDT 2021


Author: David Stuttard
Date: 2021-04-30T11:13:54+01:00
New Revision: a67a377014ceaaed55b2ba2259e080bc3fc42b43

URL: https://github.com/llvm/llvm-project/commit/a67a377014ceaaed55b2ba2259e080bc3fc42b43
DIFF: https://github.com/llvm/llvm-project/commit/a67a377014ceaaed55b2ba2259e080bc3fc42b43.diff

LOG: [AMDGPU] Tidy up some simple expressions for clarity NFC

Slight refactor for clarity.

Change-Id: Ib25e7f4582c67a7c57f066cfd5382c1405d7d4c5

Differential Revision: https://reviews.llvm.org/D101610

Added: 
    

Modified: 
    llvm/lib/Target/AMDGPU/SIInstrInfo.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/AMDGPU/SIInstrInfo.cpp b/llvm/lib/Target/AMDGPU/SIInstrInfo.cpp
index 2ba4e9bdc855..9b1c779c50b1 100644
--- a/llvm/lib/Target/AMDGPU/SIInstrInfo.cpp
+++ b/llvm/lib/Target/AMDGPU/SIInstrInfo.cpp
@@ -4244,7 +4244,7 @@ bool SIInstrInfo::verifyInstruction(const MachineInstr &MI,
       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 +4252,7 @@ bool SIInstrInfo::verifyInstruction(const MachineInstr &MI,
         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;
       }


        


More information about the llvm-commits mailing list