[MIPS GlobalISel] Combine extending loads
[llvm-complete.git] / test / CodeGen / Mips / GlobalISel / mips-prelegalizer-combiner / zextLoad_and_sextLoad.mir
blobc1c6974bf992b5c43934923fafde92cd85fdcb5f
1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -O0 -mtriple=mipsel-linux-gnu -run-pass=mips-prelegalizer-combiner -verify-machineinstrs %s -o - | FileCheck %s -check-prefixes=MIPS32
3 --- |
5   define void @load1_s8_to_zextLoad1_s32(i8* %px) {entry: ret void}
6   define void @load2_s16_to_zextLoad2_s32(i16* %px) {entry: ret void}
7   define void @load1_s8_to_zextLoad1_s16(i8* %px) {entry: ret void}
8   define void @load1_s8_to_zextLoad1_s16_to_zextLoad1_s32(i8* %px) {entry: ret void}
9   define void @load1_s8_to_sextLoad1_s32(i8* %px) {entry: ret void}
10   define void @load2_s16_to_sextLoad2_s32(i16* %px) {entry: ret void}
11   define void @load1_s8_to_sextLoad1_s16(i8* %px) {entry: ret void}
12   define void @load1_s8_to_sextLoad1_s16_to_sextLoad1_s32(i8* %px) {entry: ret void}
14 ...
15 ---
16 name:            load1_s8_to_zextLoad1_s32
17 alignment:       2
18 tracksRegLiveness: true
19 body:             |
20   bb.1.entry:
21     liveins: $a0
23     ; MIPS32-LABEL: name: load1_s8_to_zextLoad1_s32
24     ; MIPS32: liveins: $a0
25     ; MIPS32: [[COPY:%[0-9]+]]:_(p0) = COPY $a0
26     ; MIPS32: [[ZEXTLOAD:%[0-9]+]]:_(s32) = G_ZEXTLOAD [[COPY]](p0) :: (load 1 from %ir.px)
27     ; MIPS32: $v0 = COPY [[ZEXTLOAD]](s32)
28     ; MIPS32: RetRA implicit $v0
29     %0:_(p0) = COPY $a0
30     %1:_(s8) = G_LOAD %0(p0) :: (load 1 from %ir.px)
31     %2:_(s32) = G_ZEXT %1(s8)
32     $v0 = COPY %2(s32)
33     RetRA implicit $v0
35 ...
36 ---
37 name:            load2_s16_to_zextLoad2_s32
38 alignment:       2
39 tracksRegLiveness: true
40 body:             |
41   bb.1.entry:
42     liveins: $a0
44     ; MIPS32-LABEL: name: load2_s16_to_zextLoad2_s32
45     ; MIPS32: liveins: $a0
46     ; MIPS32: [[COPY:%[0-9]+]]:_(p0) = COPY $a0
47     ; MIPS32: [[ZEXTLOAD:%[0-9]+]]:_(s32) = G_ZEXTLOAD [[COPY]](p0) :: (load 2 from %ir.px)
48     ; MIPS32: $v0 = COPY [[ZEXTLOAD]](s32)
49     ; MIPS32: RetRA implicit $v0
50     %0:_(p0) = COPY $a0
51     %1:_(s16) = G_LOAD %0(p0) :: (load 2 from %ir.px)
52     %2:_(s32) = G_ZEXT %1(s16)
53     $v0 = COPY %2(s32)
54     RetRA implicit $v0
56 ...
57 ---
58 name:            load1_s8_to_zextLoad1_s16
59 alignment:       2
60 tracksRegLiveness: true
61 body:             |
62   bb.1.entry:
63     liveins: $a0
65     ; MIPS32-LABEL: name: load1_s8_to_zextLoad1_s16
66     ; MIPS32: liveins: $a0
67     ; MIPS32: [[COPY:%[0-9]+]]:_(p0) = COPY $a0
68     ; MIPS32: [[ZEXTLOAD:%[0-9]+]]:_(s16) = G_ZEXTLOAD [[COPY]](p0) :: (load 1 from %ir.px)
69     ; MIPS32: [[ANYEXT:%[0-9]+]]:_(s32) = G_ANYEXT [[ZEXTLOAD]](s16)
70     ; MIPS32: $v0 = COPY [[ANYEXT]](s32)
71     ; MIPS32: RetRA implicit $v0
72     %0:_(p0) = COPY $a0
73     %1:_(s8) = G_LOAD %0(p0) :: (load 1 from %ir.px)
74     %2:_(s16) = G_ZEXT %1(s8)
75     %3:_(s32) = G_ANYEXT %2(s16)
76     $v0 = COPY %3(s32)
77     RetRA implicit $v0
79 ...
80 ---
81 name:            load1_s8_to_zextLoad1_s16_to_zextLoad1_s32
82 alignment:       2
83 tracksRegLiveness: true
84 body:             |
85   bb.1.entry:
86     liveins: $a0
88     ; MIPS32-LABEL: name: load1_s8_to_zextLoad1_s16_to_zextLoad1_s32
89     ; MIPS32: liveins: $a0
90     ; MIPS32: [[COPY:%[0-9]+]]:_(p0) = COPY $a0
91     ; MIPS32: [[ZEXTLOAD:%[0-9]+]]:_(s32) = G_ZEXTLOAD [[COPY]](p0) :: (load 1 from %ir.px)
92     ; MIPS32: $v0 = COPY [[ZEXTLOAD]](s32)
93     ; MIPS32: RetRA implicit $v0
94     %0:_(p0) = COPY $a0
95     %1:_(s8) = G_LOAD %0(p0) :: (load 1 from %ir.px)
96     %2:_(s16) = G_ZEXT %1(s8)
97     %3:_(s32) = G_ZEXT %2(s16)
98     $v0 = COPY %3(s32)
99     RetRA implicit $v0
103 name:            load1_s8_to_sextLoad1_s32
104 alignment:       2
105 tracksRegLiveness: true
106 body:             |
107   bb.1.entry:
108     liveins: $a0
110     ; MIPS32-LABEL: name: load1_s8_to_sextLoad1_s32
111     ; MIPS32: liveins: $a0
112     ; MIPS32: [[COPY:%[0-9]+]]:_(p0) = COPY $a0
113     ; MIPS32: [[SEXTLOAD:%[0-9]+]]:_(s32) = G_SEXTLOAD [[COPY]](p0) :: (load 1 from %ir.px)
114     ; MIPS32: $v0 = COPY [[SEXTLOAD]](s32)
115     ; MIPS32: RetRA implicit $v0
116     %0:_(p0) = COPY $a0
117     %1:_(s8) = G_LOAD %0(p0) :: (load 1 from %ir.px)
118     %2:_(s32) = G_SEXT %1(s8)
119     $v0 = COPY %2(s32)
120     RetRA implicit $v0
124 name:            load2_s16_to_sextLoad2_s32
125 alignment:       2
126 tracksRegLiveness: true
127 body:             |
128   bb.1.entry:
129     liveins: $a0
131     ; MIPS32-LABEL: name: load2_s16_to_sextLoad2_s32
132     ; MIPS32: liveins: $a0
133     ; MIPS32: [[COPY:%[0-9]+]]:_(p0) = COPY $a0
134     ; MIPS32: [[SEXTLOAD:%[0-9]+]]:_(s32) = G_SEXTLOAD [[COPY]](p0) :: (load 2 from %ir.px)
135     ; MIPS32: $v0 = COPY [[SEXTLOAD]](s32)
136     ; MIPS32: RetRA implicit $v0
137     %0:_(p0) = COPY $a0
138     %1:_(s16) = G_LOAD %0(p0) :: (load 2 from %ir.px)
139     %2:_(s32) = G_SEXT %1(s16)
140     $v0 = COPY %2(s32)
141     RetRA implicit $v0
145 name:            load1_s8_to_sextLoad1_s16
146 alignment:       2
147 tracksRegLiveness: true
148 body:             |
149   bb.1.entry:
150     liveins: $a0
152     ; MIPS32-LABEL: name: load1_s8_to_sextLoad1_s16
153     ; MIPS32: liveins: $a0
154     ; MIPS32: [[COPY:%[0-9]+]]:_(p0) = COPY $a0
155     ; MIPS32: [[SEXTLOAD:%[0-9]+]]:_(s16) = G_SEXTLOAD [[COPY]](p0) :: (load 1 from %ir.px)
156     ; MIPS32: [[ANYEXT:%[0-9]+]]:_(s32) = G_ANYEXT [[SEXTLOAD]](s16)
157     ; MIPS32: $v0 = COPY [[ANYEXT]](s32)
158     ; MIPS32: RetRA implicit $v0
159     %0:_(p0) = COPY $a0
160     %1:_(s8) = G_LOAD %0(p0) :: (load 1 from %ir.px)
161     %2:_(s16) = G_SEXT %1(s8)
162     %3:_(s32) = G_ANYEXT %2(s16)
163     $v0 = COPY %3(s32)
164     RetRA implicit $v0
168 name:            load1_s8_to_sextLoad1_s16_to_sextLoad1_s32
169 alignment:       2
170 tracksRegLiveness: true
171 body:             |
172   bb.1.entry:
173     liveins: $a0
175     ; MIPS32-LABEL: name: load1_s8_to_sextLoad1_s16_to_sextLoad1_s32
176     ; MIPS32: liveins: $a0
177     ; MIPS32: [[COPY:%[0-9]+]]:_(p0) = COPY $a0
178     ; MIPS32: [[SEXTLOAD:%[0-9]+]]:_(s32) = G_SEXTLOAD [[COPY]](p0) :: (load 1 from %ir.px)
179     ; MIPS32: $v0 = COPY [[SEXTLOAD]](s32)
180     ; MIPS32: RetRA implicit $v0
181     %0:_(p0) = COPY $a0
182     %1:_(s8) = G_LOAD %0(p0) :: (load 1 from %ir.px)
183     %2:_(s16) = G_SEXT %1(s8)
184     %3:_(s32) = G_SEXT %2(s16)
185     $v0 = COPY %3(s32)
186     RetRA implicit $v0