[PATCH] D102391: [AMDGPU][GlobalISel] Legalize G_ABS

Jay Foad via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 13 05:55:36 PDT 2021


foad added inline comments.


================
Comment at: llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp:2008
+    Observer.changingInstr(MI);
+    widenScalarSrc(MI, WideTy, 1, TargetOpcode::G_ANYEXT);
+    widenScalarDst(MI, WideTy);
----------------
This has to be a signext, so the wide value gets the same sign as the narrow value. Otherwise the wide G_ABS might behave differently from the narrow G_ABS.


================
Comment at: llvm/lib/Target/AMDGPU/VOP3Instructions.td:773
+>;
+def : GCNPat <
+  (i16 (abs i16:$src)),
----------------
Don't bother with this pattern, just make G_ABS s16 only legal on subtargets that have 16 bit instructions.


================
Comment at: llvm/test/CodeGen/AMDGPU/GlobalISel/llvm.abs.ll:10
+
+define amdgpu_cs i16 @abs_sgrp_i16(i16 inreg %arg) {
+; GFX-LABEL: abs_sgrp_i16:
----------------
Typo "sgpr" in lots of function names.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D102391



More information about the llvm-commits mailing list