[PATCH] D99376: [AMDGPU] Mark additional VOP3 as commutable

Stanislav Mekhanoshin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 26 14:46:00 PDT 2021


rampitec added a comment.

In D99376#2653800 <https://reviews.llvm.org/D99376#2653800>, @Joe_Nash wrote:

> remove sub as commutative and add add_lshl.
> Its pretty bizarre to me that no testing cared if sub was commutative.

Check SIInstrInfo::commuteOpcode(). If there is no Commutable_REV<> it just will not be commuted.
But I also now have question how does that work if these opcodes do not define it?



================
Comment at: llvm/lib/Target/AMDGPU/VOP3Instructions.td:644
+  defm V_ADD_I32 : VOP3Inst <"v_add_i32", VOP3_Profile<VOP_I32_I32_I32_ARITH>>;
+  defm V_SUB_I32 : VOP3Inst <"v_sub_i32", VOP3_Profile<VOP_I32_I32_I32_ARITH>>;
+} // End isCommutable = 1
----------------
Joe_Nash wrote:
> rampitec wrote:
> > foad wrote:
> > > Subtraction is not commutative!
> > It is commutative since there is subrev, but it needs to define Commutable_REV<> which it does not.
> Going to leave it as not commutative for now, since no VOP3 handle Commutable_REV<> at the moment
Actually there is no subrev for VOP3 opcode too.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D99376/new/

https://reviews.llvm.org/D99376



More information about the llvm-commits mailing list