summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
authorKrzysztof Parzyszek <kparzysz@codeaurora.org>2017-07-24 19:35:48 +0000
committerKrzysztof Parzyszek <kparzysz@codeaurora.org>2017-07-24 19:35:48 +0000
commit1fd0c7e598151adf1980487e80afe53df44260ba (patch)
tree6377dc9b8c79052e408274fb1a922126d2c13a55 /llvm
parent87c3f4a938310769ce56a0aada15ed7fdf188e60 (diff)
downloadbcm5719-llvm-1fd0c7e598151adf1980487e80afe53df44260ba.tar.gz
bcm5719-llvm-1fd0c7e598151adf1980487e80afe53df44260ba.zip
[Hexagon] Recognize C4_cmpneqi, C4_cmpltei and C4_cmplteui in NewValueJump
llvm-svn: 308914
Diffstat (limited to 'llvm')
-rw-r--r--llvm/lib/Target/Hexagon/HexagonNewValueJump.cpp26
-rw-r--r--llvm/test/CodeGen/Hexagon/newvaluejump-c4.mir48
2 files changed, 73 insertions, 1 deletions
diff --git a/llvm/lib/Target/Hexagon/HexagonNewValueJump.cpp b/llvm/lib/Target/Hexagon/HexagonNewValueJump.cpp
index e93f075f4cc..eaa9d5fde04 100644
--- a/llvm/lib/Target/Hexagon/HexagonNewValueJump.cpp
+++ b/llvm/lib/Target/Hexagon/HexagonNewValueJump.cpp
@@ -173,7 +173,7 @@ static bool commonChecksToProhibitNewValueJump(bool afterRA,
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(const HexagonInstrInfo *QII,
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(MachineInstr *MI, int reg,
: 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(MachineInstr *MI, int reg,
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::isNewValueJumpCandidate(
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:
diff --git a/llvm/test/CodeGen/Hexagon/newvaluejump-c4.mir b/llvm/test/CodeGen/Hexagon/newvaluejump-c4.mir
new file mode 100644
index 00000000000..1f6a46e2835
--- /dev/null
+++ b/llvm/test/CodeGen/Hexagon/newvaluejump-c4.mir
@@ -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:
+...
+
+
OpenPOWER on IntegriCloud