1# RUN: llc -mtriple=ve -verify-machineinstrs -run-pass peephole-opt -o - %s | FileCheck %s
2
3---
4## Ensure fold immediate as simm7 at rhs
5#CHECK-LABEL: name: addsl_ri
6#CHECK: %2:i64 = nsw ADDSLri %0, 5
7name:            addsl_ri
8alignment:       16
9exposesReturnsTwice: false
10legalized:       false
11regBankSelected: false
12selected:        false
13failedISel:      false
14tracksRegLiveness: true
15hasWinCFI:       false
16registers:
17  - { id: 0, class: i64, preferred-register: '' }
18  - { id: 1, class: i64, preferred-register: '' }
19liveins:
20  - { reg: '$sx0', virtual-reg: '%0' }
21frameInfo:
22  isFrameAddressTaken: false
23  isReturnAddressTaken: false
24  hasStackMap:     false
25  hasPatchPoint:   false
26  stackSize:       0
27  offsetAdjustment: 0
28  maxAlignment:    8
29  adjustsStack:    false
30  hasCalls:        false
31  stackProtector:  ''
32  maxCallFrameSize: 4294967295
33  cvBytesOfCalleeSavedRegisters: 0
34  hasOpaqueSPAdjustment: false
35  hasVAStart:      false
36  hasMustTailInVarArgFunc: false
37  localFrameSize:  0
38  savePoint:       ''
39  restorePoint:    ''
40fixedStack:      []
41stack:           []
42callSites:       []
43debugValueSubstitutions: []
44constants:       []
45machineFunctionInfo: {}
46body:             |
47  bb.0:
48    liveins: $sx0
49
50    %0:i64 = COPY $sx0
51    %1:i64 = ORim 5, 0
52    %2:i64 = nsw ADDSLrr %0, %1
53    $sx0 = COPY %2
54    RET implicit $sx10, implicit $sx0
55
56...
57
58---
59## Ensure fold immediate as mimm at rhs
60#CHECK-LABEL: name: addsl_rm
61#CHECK: %2:i64 = nsw ADDSLrm %0, 120
62name:            addsl_rm
63alignment:       16
64exposesReturnsTwice: false
65legalized:       false
66regBankSelected: false
67selected:        false
68failedISel:      false
69tracksRegLiveness: true
70hasWinCFI:       false
71registers:
72  - { id: 0, class: i64, preferred-register: '' }
73  - { id: 1, class: i64, preferred-register: '' }
74liveins:
75  - { reg: '$sx0', virtual-reg: '%0' }
76frameInfo:
77  isFrameAddressTaken: false
78  isReturnAddressTaken: false
79  hasStackMap:     false
80  hasPatchPoint:   false
81  stackSize:       0
82  offsetAdjustment: 0
83  maxAlignment:    8
84  adjustsStack:    false
85  hasCalls:        false
86  stackProtector:  ''
87  maxCallFrameSize: 4294967295
88  cvBytesOfCalleeSavedRegisters: 0
89  hasOpaqueSPAdjustment: false
90  hasVAStart:      false
91  hasMustTailInVarArgFunc: false
92  localFrameSize:  0
93  savePoint:       ''
94  restorePoint:    ''
95fixedStack:      []
96stack:           []
97callSites:       []
98debugValueSubstitutions: []
99constants:       []
100machineFunctionInfo: {}
101body:             |
102  bb.0:
103    liveins: $sx0
104
105    %0:i64 = COPY $sx0
106    %1:i64 = ORim 0, 120
107    %2:i64 = nsw ADDSLrr %0, %1
108    $sx0 = COPY %2
109    RET implicit $sx10, implicit $sx0
110
111...
112
113---
114## Ensure fold immediate as simm7 at lhs
115#CHECK-LABEL: name: addsl_ri_com
116#CHECK: %2:i64 = nsw ADDSLri %0, 5
117name:            addsl_ri_com
118alignment:       16
119exposesReturnsTwice: false
120legalized:       false
121regBankSelected: false
122selected:        false
123failedISel:      false
124tracksRegLiveness: true
125hasWinCFI:       false
126registers:
127  - { id: 0, class: i64, preferred-register: '' }
128  - { id: 1, class: i64, preferred-register: '' }
129liveins:
130  - { reg: '$sx0', virtual-reg: '%0' }
131frameInfo:
132  isFrameAddressTaken: false
133  isReturnAddressTaken: false
134  hasStackMap:     false
135  hasPatchPoint:   false
136  stackSize:       0
137  offsetAdjustment: 0
138  maxAlignment:    8
139  adjustsStack:    false
140  hasCalls:        false
141  stackProtector:  ''
142  maxCallFrameSize: 4294967295
143  cvBytesOfCalleeSavedRegisters: 0
144  hasOpaqueSPAdjustment: false
145  hasVAStart:      false
146  hasMustTailInVarArgFunc: false
147  localFrameSize:  0
148  savePoint:       ''
149  restorePoint:    ''
150fixedStack:      []
151stack:           []
152callSites:       []
153debugValueSubstitutions: []
154constants:       []
155machineFunctionInfo: {}
156body:             |
157  bb.0:
158    liveins: $sx0
159
160    %0:i64 = COPY $sx0
161    %1:i64 = ORim 5, 0
162    %2:i64 = nsw ADDSLrr %1, %0
163    $sx0 = COPY %2
164    RET implicit $sx10, implicit $sx0
165
166...
167
168---
169## Ensure fold immediate as mimm at rhs
170#CHECK-LABEL: name: addsl_rm_com
171#CHECK: %2:i64 = nsw ADDSLrm %0, 120
172name:            addsl_rm_com
173alignment:       16
174exposesReturnsTwice: false
175legalized:       false
176regBankSelected: false
177selected:        false
178failedISel:      false
179tracksRegLiveness: true
180hasWinCFI:       false
181registers:
182  - { id: 0, class: i64, preferred-register: '' }
183  - { id: 1, class: i64, preferred-register: '' }
184liveins:
185  - { reg: '$sx0', virtual-reg: '%0' }
186frameInfo:
187  isFrameAddressTaken: false
188  isReturnAddressTaken: false
189  hasStackMap:     false
190  hasPatchPoint:   false
191  stackSize:       0
192  offsetAdjustment: 0
193  maxAlignment:    8
194  adjustsStack:    false
195  hasCalls:        false
196  stackProtector:  ''
197  maxCallFrameSize: 4294967295
198  cvBytesOfCalleeSavedRegisters: 0
199  hasOpaqueSPAdjustment: false
200  hasVAStart:      false
201  hasMustTailInVarArgFunc: false
202  localFrameSize:  0
203  savePoint:       ''
204  restorePoint:    ''
205fixedStack:      []
206stack:           []
207callSites:       []
208debugValueSubstitutions: []
209constants:       []
210machineFunctionInfo: {}
211body:             |
212  bb.0:
213    liveins: $sx0
214
215    %0:i64 = COPY $sx0
216    %1:i64 = ORim 0, 120
217    %2:i64 = nsw ADDSLrr %1, %0
218    $sx0 = COPY %2
219    RET implicit $sx10, implicit $sx0
220
221...
222