[PATCH] D83020: [AMDGPU] Avoid using s_cmpk when src0 is not register
Ruiling, Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 1 21:39:11 PDT 2020
ruiling updated this revision to Diff 275003.
ruiling added a comment.
auto-generate the checks in test
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D83020/new/
https://reviews.llvm.org/D83020
Files:
llvm/lib/Target/AMDGPU/SIShrinkInstructions.cpp
llvm/test/CodeGen/AMDGPU/cmp_shrink.mir
Index: llvm/test/CodeGen/AMDGPU/cmp_shrink.mir
===================================================================
--- /dev/null
+++ llvm/test/CodeGen/AMDGPU/cmp_shrink.mir
@@ -0,0 +1,11 @@
+# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
+# RUN: llc -march=amdgcn -mcpu=gfx900 -run-pass si-shrink-instructions -verify-machineinstrs %s -o - | FileCheck -check-prefix=GCN %s
+
+---
+name: not_shrink_icmp
+body: |
+ bb.0:
+ ; GCN-LABEL: name: not_shrink_icmp
+ ; GCN: S_CMP_GT_I32 1, 65, implicit-def $scc
+ S_CMP_GT_I32 1, 65, implicit-def $scc
+...
Index: llvm/lib/Target/AMDGPU/SIShrinkInstructions.cpp
===================================================================
--- llvm/lib/Target/AMDGPU/SIShrinkInstructions.cpp
+++ llvm/lib/Target/AMDGPU/SIShrinkInstructions.cpp
@@ -185,6 +185,11 @@
if (!MI.getOperand(0).isReg())
TII->commuteInstruction(MI, false, 0, 1);
+ // cmpk requires src0 to be a register
+ const MachineOperand &Src0 = MI.getOperand(0);
+ if (!Src0.isReg())
+ return;
+
const MachineOperand &Src1 = MI.getOperand(1);
if (!Src1.isImm())
return;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D83020.275003.patch
Type: text/x-patch
Size: 1159 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200702/4e1f388e/attachment.bin>
More information about the llvm-commits
mailing list