blob: 7b6044c9a502a9d02f5476f67f9e442781c10a84 [file] [log] [blame]
Krzysztof Parzyszek3818aea2017-10-20 16:56:33 +00001# RUN: llc -march=hexagon -run-pass hwloops %s -o - | FileCheck %s
2
3# Normally, if the registers holding the induction variable's bounds
4# are redefined inside of the loop's body, the loop cannot be converted
5# to a hardware loop. However, if the redefining instruction is actually
6# loading an immediate value into the register, this conversion is both
7# possible and legal (since the immediate itself will be used in the
8# loop setup in the preheader).
9
Justin Bogner6c452832017-10-24 18:04:54 +000010# CHECK: [[R0:%[0-9]+]]:intregs = A2_tfrsi 1920
Francis Visoiu Mistrih25528d62017-12-04 17:18:51 +000011# CHECK: J2_loop0r %bb.1, [[R0]]
Krzysztof Parzyszek3818aea2017-10-20 16:56:33 +000012#
13# CHECK: bb.1.b1 (address-taken):
Francis Visoiu Mistrih25528d62017-12-04 17:18:51 +000014# CHECK: ENDLOOP0 %bb.1
Krzysztof Parzyszek3818aea2017-10-20 16:56:33 +000015
16
17--- |
18 define void @fred() {
19 b0:
20 br label %b1
21 b1:
22 br label %b2
23 b2:
24 ret void
25 }
26...
27
28---
29name: fred
30tracksRegLiveness: true
31registers:
32 - { id: 0, class: intregs }
33 - { id: 1, class: intregs }
34 - { id: 2, class: intregs }
35 - { id: 3, class: intregs }
36 - { id: 4, class: intregs }
37 - { id: 5, class: intregs }
38 - { id: 6, class: intregs }
39 - { id: 7, class: intregs }
40 - { id: 8, class: predregs }
41body: |
42 bb.0.b0:
43 liveins: %r0
44 successors: %bb.1
45 %0 = A2_tfrsi 0
46 %1 = A2_tfrsi 0
47 %2 = COPY %r0
48
49 bb.1.b1:
50 successors: %bb.1, %bb.2
51 %3 = PHI %0, %bb.0, %6, %bb.1
52 %4 = PHI %1, %bb.0, %5, %bb.1
53 S4_storerh_rr %2, %4, 0, %3
54 %5 = A2_addi %4, 2
55 %6 = A2_addi %3, 1
56 ; This definition of %7 should not prevent conversion to hardware loop.
57 %7 = A2_tfrsi 3840
58 %8 = C2_cmpeq %5, %7
59 J2_jumpf %8, %bb.1, implicit-def %pc
60 J2_jump %bb.2, implicit-def %pc
61
62 bb.2.b2:
63...