xref: /llvm-project/llvm/test/CodeGen/PowerPC/convert-ri-addi-to-ri.mir (revision 46d5d264fc66a017bbd0182b2b5fcc0f3f23d3be)
1# RUN: llc -mtriple=powerpc64le-unknown-linux-gnu -verify-machineinstrs \
2# RUN:   -run-pass ppc-mi-peepholes -ppc-convert-rr-to-ri %s -o - | FileCheck %s
3
4---
5name: foldNewDformStore
6# CHECK: name: foldNewDformStore
7tracksRegLiveness: true
8body:             |
9  bb.0.entry:
10    liveins: $x3
11
12    %0:g8rc_and_g8rc_nox0 = COPY $x3
13    %1:g8rc_and_g8rc_nox0 = ADDI8 %0:g8rc_and_g8rc_nox0, 144
14    %2:g8rc = LI8 0
15    ; CHECK: STD killed %2, 160, killed %0
16    STD killed %2:g8rc, 16, %1:g8rc_and_g8rc_nox0
17    BLR8 implicit $lr8, implicit $rm
18...
19---
20name: foldNewDformStoreAlignNotMatch
21# CHECK: name: foldNewDformStoreAlignNotMatch
22tracksRegLiveness: true
23body:             |
24  bb.0.entry:
25    liveins: $x3
26
27    %0:g8rc_and_g8rc_nox0 = COPY $x3
28    %1:g8rc_and_g8rc_nox0 = ADDI8 %0:g8rc_and_g8rc_nox0, 141
29    %2:g8rc = LI8 0
30    ; CHECK: STD killed %2, 16, killed %1
31    STD killed %2:g8rc, 16, %1:g8rc_and_g8rc_nox0
32    BLR8 implicit $lr8, implicit $rm
33...
34---
35name: foldNewDformStoreKilledFlag
36# CHECK: name: foldNewDformStoreKilledFlag
37tracksRegLiveness: true
38body:             |
39  bb.0.entry:
40    liveins: $x3
41
42    %0:g8rc_and_g8rc_nox0 = COPY $x3
43    %1:g8rc_and_g8rc_nox0 = ADDI8 %0:g8rc_and_g8rc_nox0, 144
44    %2:g8rc = LI8 0
45    ; CHECK: STD killed %1, 0, %0
46    STD %1:g8rc_and_g8rc_nox0, 0, killed %0:g8rc_and_g8rc_nox0
47    ; CHECK: STD killed %2, 160, killed %0
48    STD killed %2:g8rc, 16, %1:g8rc_and_g8rc_nox0
49    BLR8 implicit $lr8, implicit $rm
50...
51---
52name: foldNewDformPreferLIOperand
53# CHECK: name: foldNewDformPreferLIOperand
54tracksRegLiveness: true
55body:             |
56  bb.0.entry:
57  liveins: $x3
58  %0:g8rc_and_g8rc_nox0 = COPY $x3
59  %1:g8rc = ADDI8 %0:g8rc_and_g8rc_nox0, 1
60  %2:g8rc = LI8 1
61  ; CHECK: SUBFIC8 killed %1, 1, implicit-def $carry
62  %3:g8rc = SUBFC8 killed %1:g8rc, %2:g8rc, implicit-def $carry
63  %4:g8rc = SUBFE8 %2:g8rc, %2:g8rc, implicit-def dead $carry, implicit $carry
64  %5:g8rc = NEG8 killed %4:g8rc
65  $x3 = COPY %5:g8rc
66  BLR8 implicit $lr8, implicit $rm, implicit $x3
67...
68---
69name: killFlagSameBlock
70#CHECK : name : killFlagSameBlock
71tracksRegLiveness: true
72body: |
73  bb.0.entry:
74  liveins: $x3
75    %0:g8rc_and_g8rc_nox0 = COPY $x3
76    %1:g8rc_and_g8rc_nox0 = ADDI8 killed %0:g8rc_and_g8rc_nox0, -8
77    ; CHECK: %1:g8rc_and_g8rc_nox0 = ADDI8 %0, -8
78    %2:g8rc = LI8 0
79    ; CHECK: STD killed %2, 8, killed %0
80    STD killed %2:g8rc, 16, %1:g8rc_and_g8rc_nox0
81    BLR8 implicit $lr8, implicit $rm
82...
83---
84name: killFlagDifferentBlocks
85#CHECK : name : killFlagDifferentBlocks
86tracksRegLiveness: true
87body: |
88  bb.0.entry:
89  liveins: $x3
90    %0:g8rc_and_g8rc_nox0 = COPY $x3
91    ; CHECK: %1:g8rc_and_g8rc_nox0 = ADDI8 %0, -8
92    %1:g8rc_and_g8rc_nox0 = ADDI8 killed %0:g8rc_and_g8rc_nox0, -8
93
94  bb.1:
95    %2:g8rc = LI8 0
96    ; CHECK: STD killed %2, 8, killed %0
97    STD killed %2:g8rc, 16, %1:g8rc_and_g8rc_nox0
98    BLR8 implicit $lr8, implicit $rm
99...
100