[PATCH] D87936: [GISel] Add new combines for G_ADD

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 18 13:46:47 PDT 2020


arsenm added inline comments.


================
Comment at: llvm/include/llvm/CodeGen/GlobalISel/CombinerHelper.h:322
+  /// Transform G_ADD(x, -cst) to G_SUB(x, cst).
+  bool matchAddNegConstant(MachineInstr &MI, int64_t &Cst);
+  bool applyAddNegConstant(MachineInstr &MI, int64_t &Cst);
----------------
APInt to allow it to work for wide integers?


================
Comment at: llvm/test/CodeGen/AArch64/GlobalISel/combine-add.mir:85
+    $w0 = COPY %5
+...
----------------
Add an s128 case? This currently won't work for vectors, but it would be nice to handle a few vector tests too


================
Comment at: llvm/test/CodeGen/AMDGPU/GlobalISel/extractelement.i128.ll:23-24
 ; GFX8-NEXT:    s_load_dwordx16 s[8:23], s[2:3], 0x0
-; GFX8-NEXT:    s_lshl_b32 m0, s4, 1
+; GFX8-NEXT:    s_lshl_b32 s2, s4, 1
+; GFX8-NEXT:    s_mov_b32 m0, s2
 ; GFX8-NEXT:    s_waitcnt lgkmcnt(0)
----------------
I don't understand where this regression came from (but isn't particularly important)


================
Comment at: llvm/test/CodeGen/AMDGPU/GlobalISel/extractelement.i128.ll:54-62
+; GFX9-NEXT:    s_lshl_b32 s1, s0, 1
+; GFX9-NEXT:    s_set_gpr_idx_on s1, gpr_idx(SRC0)
 ; GFX9-NEXT:    s_waitcnt vmcnt(0)
 ; GFX9-NEXT:    v_mov_b32_e32 v0, v2
 ; GFX9-NEXT:    v_mov_b32_e32 v1, v3
+; GFX9-NEXT:    s_set_gpr_idx_off
+; GFX9-NEXT:    s_or_b32 s0, s0, 1
----------------
This is a much more interesting regression


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D87936



More information about the llvm-commits mailing list