[llvm] r308914 - [Hexagon] Recognize C4_cmpneqi, C4_cmpltei and C4_cmplteui in NewValueJump
Krzysztof Parzyszek via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 24 12:35:48 PDT 2017
Author: kparzysz
Date: Mon Jul 24 12:35:48 2017
New Revision: 308914
URL: http://llvm.org/viewvc/llvm-project?rev=308914&view=rev
Log:
[Hexagon] Recognize C4_cmpneqi, C4_cmpltei and C4_cmplteui in NewValueJump
Added:
llvm/trunk/test/CodeGen/Hexagon/newvaluejump-c4.mir
Modified:
llvm/trunk/lib/Target/Hexagon/HexagonNewValueJump.cpp
Modified: llvm/trunk/lib/Target/Hexagon/HexagonNewValueJump.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Hexagon/HexagonNewValueJump.cpp?rev=308914&r1=308913&r2=308914&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Hexagon/HexagonNewValueJump.cpp (original)
+++ llvm/trunk/lib/Target/Hexagon/HexagonNewValueJump.cpp Mon Jul 24 12:35:48 2017
@@ -173,7 +173,7 @@ static bool commonChecksToProhibitNewVal
MachineBasicBlock::iterator MII) {
// If store in path, bail out.
- if (MII->getDesc().mayStore())
+ if (MII->mayStore())
return false;
// if call in path, bail out.
@@ -227,10 +227,13 @@ static bool canCompareBeNewValueJump(con
switch (MI.getOpcode()) {
case Hexagon::C2_cmpeqi:
+ case Hexagon::C4_cmpneqi:
case Hexagon::C2_cmpgti:
+ case Hexagon::C4_cmpltei:
Valid = (isUInt<5>(v) || v == -1);
break;
case Hexagon::C2_cmpgtui:
+ case Hexagon::C4_cmplteui:
Valid = isUInt<5>(v);
break;
case Hexagon::S2_tstbit_i:
@@ -328,6 +331,13 @@ static unsigned getNewValueJumpOpcode(Ma
: Hexagon::J4_cmpeqn1_t_jumpnv_nt;
}
+ case Hexagon::C4_cmpneqi:
+ if (reg >= 0)
+ return taken ? Hexagon::J4_cmpeqi_f_jumpnv_t
+ : Hexagon::J4_cmpeqi_f_jumpnv_nt;
+ return taken ? Hexagon::J4_cmpeqn1_f_jumpnv_t :
+ Hexagon::J4_cmpeqn1_f_jumpnv_nt;
+
case Hexagon::C2_cmpgt: {
if (secondRegNewified)
return taken ? Hexagon::J4_cmplt_t_jumpnv_t
@@ -377,6 +387,17 @@ static unsigned getNewValueJumpOpcode(Ma
return taken ? Hexagon::J4_cmpgtu_f_jumpnv_t
: Hexagon::J4_cmpgtu_f_jumpnv_nt;
+ case Hexagon::C4_cmpltei:
+ if (reg >= 0)
+ return taken ? Hexagon::J4_cmpgti_f_jumpnv_t :
+ Hexagon::J4_cmpgti_f_jumpnv_nt;
+ return taken ? Hexagon::J4_cmpgtn1_f_jumpnv_t :
+ Hexagon::J4_cmpgtn1_f_jumpnv_nt;
+
+ case Hexagon::C4_cmplteui:
+ return taken ? Hexagon::J4_cmpgtui_f_jumpnv_t :
+ Hexagon::J4_cmpgtui_f_jumpnv_nt;
+
default:
llvm_unreachable("Could not find matching New Value Jump instruction.");
}
@@ -394,8 +415,11 @@ bool HexagonNewValueJump::isNewValueJump
case Hexagon::C2_cmpgtu:
case Hexagon::C2_cmpgtui:
case Hexagon::C4_cmpneq:
+ case Hexagon::C4_cmpneqi:
case Hexagon::C4_cmplte:
case Hexagon::C4_cmplteu:
+ case Hexagon::C4_cmpltei:
+ case Hexagon::C4_cmplteui:
return true;
default:
Added: llvm/trunk/test/CodeGen/Hexagon/newvaluejump-c4.mir
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Hexagon/newvaluejump-c4.mir?rev=308914&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/Hexagon/newvaluejump-c4.mir (added)
+++ llvm/trunk/test/CodeGen/Hexagon/newvaluejump-c4.mir Mon Jul 24 12:35:48 2017
@@ -0,0 +1,48 @@
+# RUN: llc -march=hexagon -run-pass hexagon-nvj %s -o - | FileCheck %s
+
+---
+# CHECK-LABEL: name: test0
+# CHECK: J4_cmpeqi_f_jumpnv_t killed %r1, 0
+name: test0
+tracksRegLiveness: true
+
+body: |
+ bb.0:
+ liveins: %r0
+ %r1 = A2_addi %r0, -1
+ %p0 = C4_cmpneqi killed %r1, 0
+ J2_jumpt killed %p0, %bb.1, implicit-def %pc
+ bb.1:
+...
+
+---
+# CHECK-LABEL: name: test1
+# CHECK: J4_cmpgti_f_jumpnv_t killed %r1, 27
+name: test1
+tracksRegLiveness: true
+
+body: |
+ bb.0:
+ liveins: %r0
+ %r1 = A2_addi %r0, -1
+ %p0 = C4_cmpltei killed %r1, 27
+ J2_jumpt killed %p0, %bb.1, implicit-def %pc
+ bb.1:
+...
+
+---
+# CHECK-LABEL: name: test2
+# CHECK: J4_cmpgtui_f_jumpnv_t killed %r1, 31
+name: test2
+tracksRegLiveness: true
+
+body: |
+ bb.0:
+ liveins: %r0
+ %r1 = A2_addi %r0, -1
+ %p0 = C4_cmplteui killed %r1, 31
+ J2_jumpt killed %p0, %bb.1, implicit-def %pc
+ bb.1:
+...
+
+
More information about the llvm-commits
mailing list