1/*
2 * Some or all of this work - Copyright (c) 2006 - 2021, Intel Corp.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without modification,
6 * are permitted provided that the following conditions are met:
7 *
8 * Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer.
10 * Redistributions in binary form must reproduce the above copyright notice,
11 * this list of conditions and the following disclaimer in the documentation
12 * and/or other materials provided with the distribution.
13 * Neither the name of Intel Corporation nor the names of its contributors
14 * may be used to endorse or promote products derived from this software
15 * without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
21 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
25 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
26 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29/*
30 * Test of Impllicit Return
31 *
32 * The last operation of Methods is Add.
33 */
34
35Name(z136, 136)
36
37Method(mf71,, Serialized)
38{
39	Name(fl00, 0)
40	Name(i000, 0xabcd0000)
41	Name(i001, 0)
42
43	Method(m000)
44	{
45		Store(Add(0xabcd0002, i001), Local1)
46		if (fl00) {
47			Store(0xdddd0000, i001)
48			Return (0)
49		}
50	}
51
52	Method(m001)
53	{
54		if (fl00) {
55			Store(0xdddd0001, i001)
56			Return (0)
57		}
58		Store(Add(0xabcd0003, i001), Local1)
59	}
60
61	Method(m002, 1)
62	{
63		if (fl00) {
64			Store(0xdddd0002, i001)
65			Return (0)
66		}
67		if (fl00) {
68			Return (0)
69		}
70		if (arg0) {
71			Store(Add(0xabcd0004, i001), Local1)
72		}
73	}
74
75	Method(m003, 1)
76	{
77		if (fl00) {
78			Store(0xdddd0003, i001)
79			Return (0)
80		}
81		if (fl00) {
82			Return (0)
83		}
84		if (arg0) {
85			Store(Add(0xabcd0005, i001), Local1)
86		} else {
87			Store(Add(0xabcd0006, i001), Local1)
88		}
89	}
90
91	Method(m004, 1)
92	{
93		if (fl00) {
94			Return (0)
95		}
96
97		switch (arg0) {
98			case (0) {
99				Store(Add(0xabcd0007, i001), Local1)
100			}
101			case (0x12345678) {
102				Store(Add(0xabcd0008, i001), Local1)
103			}
104			default {
105				Store(Add(0xabcd0009, i001), Local1)
106			}
107		}
108	}
109
110	Method(m005)
111	{
112		if (fl00) {
113			Return (0)
114		}
115
116		While (1) {
117			Store(Add(0xabcd000a, i001), Local1)
118			Break
119		}
120	}
121
122	Method(m006)
123	{
124		if (fl00) {
125			Return (0)
126		}
127
128		Store(Add(0xabcd000b, i001), Local1)
129		While (0xabcd0003) {
130			Break
131		}
132	}
133
134	Method(m007,, Serialized)
135	{
136		Name(i000, 0)
137		Name(num, 0)
138		Name(lpN0, 0)
139		Name(lpC0, 0)
140
141		Store(10, num)
142
143		Store(num, lpN0)
144		Store(0, lpC0)
145
146		if (fl00) {
147			Return (0)
148		}
149
150		While (lpN0) {
151			if (i000) {
152				Break
153			}
154			Decrement(lpN0)
155			Increment(lpC0)
156			Store(0xabcd0001, i000)
157			Store(Add(0xabcd000c, i001), Local1)
158			Continue
159		}
160	}
161
162	Method(m008)
163	{
164		Method(m000)
165		{
166			Store(Add(0xabcd000d, i001), Local1)
167		}
168
169		if (fl00) {
170			Return (0)
171		}
172
173		m000()
174	}
175
176
177	// m000
178
179	Store(0xabcd9000, i000)
180
181	CH03("", z136, 0x100, __LINE__, 0)
182
183	Store(m000(), i000)
184
185	if (SLCK) {
186		CH03("", z136, 0x101, __LINE__, 0)
187		if (y901) {
188			Store(0, Local0)
189		} else {
190			Store(0xabcd0002, Local0)
191		}
192		if (LNotEqual(i000, Local0)) {
193			err("", z136, __LINE__, 0, 0, i000, Local0)
194		}
195	} else {
196		CH04("", 0, 0xff, z136, __LINE__, 0, 0)
197	}
198
199	// m001
200
201	Store(0xabcd9001, i000)
202
203	CH03("", z136, 0x104, __LINE__, 0)
204
205	Store(m001(), i000)
206
207	if (SLCK) {
208		CH03("", z136, 0x105, __LINE__, 0)
209		if (LNotEqual(i000, 0xabcd0003)) {
210			err("", z136, __LINE__, 0, 0, i000, 0xabcd0003)
211		}
212	} else {
213		CH04("", 0, 0xff, z136, __LINE__, 0, 0)
214	}
215
216	// m002
217
218	Store(0xabcd9002, i000)
219
220	CH03("", z136, 0x108, __LINE__, 0)
221
222	Store(m002(1), i000)
223
224	if (SLCK) {
225		CH03("", z136, 0x109, __LINE__, 0)
226		if (LNotEqual(i000, 0xabcd0004)) {
227			err("", z136, __LINE__, 0, 0, i000, 0xabcd0004)
228		}
229	} else {
230		CH04("", 0, 0xff, z136, __LINE__, 0, 0)
231	}
232
233	// m003
234
235	Store(0xabcd9003, i000)
236
237	CH03("", z136, 0x10c, __LINE__, 0)
238
239	Store(m003(0), i000)
240
241	if (SLCK) {
242		CH03("", z136, 0x10d, __LINE__, 0)
243		if (LNotEqual(i000, 0xabcd0006)) {
244			err("", z136, __LINE__, 0, 0, i000, 0xabcd0006)
245		}
246	} else {
247		CH04("", 0, 0xff, z136, __LINE__, 0, 0)
248	}
249
250	// m004(0)
251
252	Store(0xabcd9004, i000)
253
254	CH03("", z136, 0x110, __LINE__, 0)
255
256	Store(m004(0), i000)
257
258	if (SLCK) {
259		CH03("", z136, 0x111, __LINE__, 0)
260		if (LNotEqual(i000, 0xabcd0007)) {
261			err("", z136, __LINE__, 0, 0, i000, 0xabcd0007)
262		}
263	} else {
264		CH04("", 0, 0xff, z136, __LINE__, 0, 0)
265	}
266
267	// m004(0x12345678)
268
269	Store(0xabcd9005, i000)
270
271	CH03("", z136, 0x114, __LINE__, 0)
272
273	Store(m004(0x12345678), i000)
274
275	if (SLCK) {
276		CH03("", z136, 0x115, __LINE__, 0)
277		if (LNotEqual(i000, 0xabcd0008)) {
278			err("", z136, __LINE__, 0, 0, i000, 0xabcd0008)
279		}
280	} else {
281		CH04("", 0, 0xff, z136, __LINE__, 0, 0)
282	}
283
284	// m004(Default)
285
286	Store(0xabcd9006, i000)
287
288	CH03("", z136, 0x118, __LINE__, 0)
289
290	Store(m004(1111), i000)
291
292	if (SLCK) {
293		CH03("", z136, 0x119, __LINE__, 0)
294		if (LNotEqual(i000, 0xabcd0009)) {
295			err("", z136, __LINE__, 0, 0, i000, 0xabcd0009)
296		}
297	} else {
298		CH04("", 0, 0xff, z136, __LINE__, 0, 0)
299	}
300
301	// m005
302
303	Store(0xabcd9007, i000)
304
305	CH03("", z136, 0x11c, __LINE__, 0)
306
307	Store(m005(), i000)
308
309	if (SLCK) {
310		CH03("", z136, 0x11d, __LINE__, 0)
311		if (LNotEqual(i000, 0xabcd000a)) {
312			err("", z136, __LINE__, 0, 0, i000, 0xabcd000a)
313		}
314	} else {
315		CH04("", 0, 0xff, z136, __LINE__, 0, 0)
316	}
317
318	// m006
319
320	Store(0xabcd9008, i000)
321
322	CH03("", z136, 0x120, __LINE__, 0)
323
324	Store(m006(), i000)
325
326	if (SLCK) {
327		CH03("", z136, 0x121, __LINE__, 0)
328		if (y901) {
329			Store(0xabcd0003, Local0)
330		} else {
331			Store(0xabcd000b, Local0)
332		}
333		if (LNotEqual(i000, Local0)) {
334			err("", z136, __LINE__, 0, 0, i000, Local0)
335		}
336	} else {
337		CH04("", 0, 0xff, z136, __LINE__, 0, 0)
338	}
339
340	// m007
341
342	Store(0xabcd9009, i000)
343
344	CH03("", z136, 0x124, __LINE__, 0)
345
346	Store(m007(), i000)
347
348	if (SLCK) {
349		CH03("", z136, 0x125, __LINE__, 0)
350		if (y901) {
351			Store(0xabcd0001, Local0)
352		} else {
353			Store(0xabcd000c, Local0)
354		}
355		if (LNotEqual(i000, Local0)) {
356			err("", z136, __LINE__, 0, 0, i000, Local0)
357		}
358	} else {
359		CH04("", 0, 0xff, z136, __LINE__, 0, 0)
360	}
361
362	// m008
363
364	Store(0xabcd900a, i000)
365
366	CH03("", z136, 0x128, __LINE__, 0)
367
368	Store(m008(), i000)
369
370	if (SLCK) {
371		CH03("", z136, 0x129, __LINE__, 0)
372		if (LNotEqual(i000, 0xabcd000d)) {
373			err("", z136, __LINE__, 0, 0, i000, 0xabcd000d)
374		}
375	} else {
376		CH04("", 0, 0xff, z136, __LINE__, 0, 0)
377	}
378}
379
380// Implements mf71 where i001 relocated with Local0
381// to extend implicit return conditions checked
382Method(mff0,, Serialized)
383{
384	Name(fl00, 0)
385	Name(i000, 0xabcd0000)
386
387	Method(m000)
388	{
389		Store(0, Local0)
390
391		Store(Add(0xabcd0002, Local0), Local1)
392		if (fl00) {
393			Store(0xdddd0000, Local0)
394			Return (0)
395		}
396	}
397
398	Method(m001)
399	{
400		Store(0, Local0)
401
402		if (fl00) {
403			Store(0xdddd0001, Local0)
404			Return (0)
405		}
406		Store(Add(0xabcd0003, Local0), Local1)
407	}
408
409	Method(m002, 1)
410	{
411		Store(0, Local0)
412
413		if (fl00) {
414			Store(0xdddd0002, Local0)
415			Return (0)
416		}
417		if (fl00) {
418			Return (0)
419		}
420		if (arg0) {
421			Store(Add(0xabcd0004, Local0), Local1)
422		}
423	}
424
425	Method(m003, 1)
426	{
427		Store(0, Local0)
428
429		if (fl00) {
430			Store(0xdddd0003, Local0)
431			Return (0)
432		}
433		if (fl00) {
434			Return (0)
435		}
436		if (arg0) {
437			Store(Add(0xabcd0005, Local0), Local1)
438		} else {
439			Store(Add(0xabcd0006, Local0), Local1)
440		}
441	}
442
443	Method(m004, 1)
444	{
445		Store(0, Local0)
446
447		if (fl00) {
448			Return (0)
449		}
450
451		switch (arg0) {
452			case (0) {
453				Store(Add(0xabcd0007, Local0), Local1)
454			}
455			case (0x12345678) {
456				Store(Add(0xabcd0008, Local0), Local1)
457			}
458			default {
459				Store(Add(0xabcd0009, Local0), Local1)
460			}
461		}
462	}
463
464	Method(m005)
465	{
466		Store(0, Local0)
467
468		if (fl00) {
469			Return (0)
470		}
471
472		While (1) {
473			Store(Add(0xabcd000a, Local0), Local1)
474			Break
475		}
476	}
477
478	Method(m006)
479	{
480		Store(0, Local0)
481
482		if (fl00) {
483			Return (0)
484		}
485
486		Store(Add(0xabcd000b, Local0), Local1)
487		While (0xabcd0002) {
488			Break
489		}
490	}
491
492	Method(m007,, Serialized)
493	{
494		Name(i000, 0)
495		Name(num, 0)
496		Name(lpN0, 0)
497		Name(lpC0, 0)
498
499		Store(10, num)
500
501		Store(num, lpN0)
502		Store(0, lpC0)
503
504		if (fl00) {
505			Return (0)
506		}
507
508		Store(0, Local0)
509
510		While (lpN0) {
511			if (i000) {
512				Break
513			}
514			Decrement(lpN0)
515			Increment(lpC0)
516			Store(0xabcd0005, i000)
517			Store(Add(0xabcd000c, Local0), Local1)
518			Continue
519		}
520	}
521
522	Method(m008)
523	{
524		Method(m000)
525		{
526			Store(0, Local0)
527
528			Store(Add(0xabcd000d, Local0), Local1)
529		}
530
531		if (fl00) {
532			Return (0)
533		}
534
535		m000()
536	}
537
538	Method(m009)
539	{
540		Method(m000)
541		{
542			Store(0, Local0)
543
544			Store(Add(Local0, 0xabcd000e, Local0), Local1)
545			m001(Local0)
546		}
547
548		Method(m001, 1)
549		{
550			Store(arg0, Local0)
551		}
552
553		if (fl00) {
554			Return (0)
555		}
556
557		m000()
558	}
559
560	// m000
561
562	Store(0xabcd9000, i000)
563
564	CH03("", z136, 0x12c, __LINE__, 0)
565
566	Store(m000(), i000)
567
568	if (SLCK) {
569		CH03("", z136, 0x12d, __LINE__, 0)
570		if (y901) {
571			Store(0, Local0)
572		} else {
573			Store(0xabcd0002, Local0)
574		}
575		if (LNotEqual(i000, Local0)) {
576			err("", z136, __LINE__, 0, 0, i000, Local0)
577		}
578	} else {
579		CH04("", 0, 0xff, z136, __LINE__, 0, 0)
580	}
581
582	// m001
583
584	Store(0xabcd9001, i000)
585
586	CH03("", z136, 0x130, __LINE__, 0)
587
588	Store(m001(), i000)
589
590	if (SLCK) {
591		CH03("", z136, 0x131, __LINE__, 0)
592		if (LNotEqual(i000, 0xabcd0003)) {
593			err("", z136, __LINE__, 0, 0, i000, 0xabcd0003)
594		}
595	} else {
596		CH04("", 0, 0xff, z136, __LINE__, 0, 0)
597	}
598
599	// m002
600
601	Store(0xabcd9002, i000)
602
603	CH03("", z136, 0x134, __LINE__, 0)
604
605	Store(m002(1), i000)
606
607	if (SLCK) {
608		CH03("", z136, 0x135, __LINE__, 0)
609		if (LNotEqual(i000, 0xabcd0004)) {
610			err("", z136, __LINE__, 0, 0, i000, 0xabcd0004)
611		}
612	} else {
613		CH04("", 0, 0xff, z136, __LINE__, 0, 0)
614	}
615
616	// m003
617
618	Store(0xabcd9003, i000)
619
620	CH03("", z136, 0x138, __LINE__, 0)
621
622	Store(m003(0), i000)
623
624	if (SLCK) {
625		CH03("", z136, 0x139, __LINE__, 0)
626		if (LNotEqual(i000, 0xabcd0006)) {
627			err("", z136, __LINE__, 0, 0, i000, 0xabcd0006)
628		}
629	} else {
630		CH04("", 0, 0xff, z136, __LINE__, 0, 0)
631	}
632
633	// m004(0)
634
635	Store(0xabcd9004, i000)
636
637	CH03("", z136, 0x13b, __LINE__, 0)
638
639	Store(m004(0), i000)
640
641	if (SLCK) {
642		CH03("", z136, 0x13c, __LINE__, 0)
643		if (LNotEqual(i000, 0xabcd0007)) {
644			err("", z136, __LINE__, 0, 0, i000, 0xabcd0007)
645		}
646	} else {
647		CH04("", 0, 0xff, z136, __LINE__, 0, 0)
648	}
649
650	// m004(0x12345678)
651
652	Store(0xabcd9005, i000)
653
654	CH03("", z136, 0x13f, __LINE__, 0)
655
656	Store(m004(0x12345678), i000)
657
658	if (SLCK) {
659		CH03("", z136, 0x140, __LINE__, 0)
660		if (LNotEqual(i000, 0xabcd0008)) {
661			err("", z136, __LINE__, 0, 0, i000, 0xabcd0008)
662		}
663	} else {
664		CH04("", 0, 0xff, z136, __LINE__, 0, 0)
665	}
666
667	// m004(Default)
668
669	Store(0xabcd9006, i000)
670
671	CH03("", z136, 0x143, __LINE__, 0)
672
673	Store(m004(1111), i000)
674
675	if (SLCK) {
676		CH03("", z136, 0x144, __LINE__, 0)
677		if (LNotEqual(i000, 0xabcd0009)) {
678			err("", z136, __LINE__, 0, 0, i000, 0xabcd0009)
679		}
680	} else {
681		CH04("", 0, 0xff, z136, __LINE__, 0, 0)
682	}
683
684	// m005
685
686	Store(0xabcd9007, i000)
687
688	CH03("", z136, 0x147, __LINE__, 0)
689
690	Store(m005(), i000)
691
692	if (SLCK) {
693		CH03("", z136, 0x148, __LINE__, 0)
694		if (LNotEqual(i000, 0xabcd000a)) {
695			err("", z136, __LINE__, 0, 0, i000, 0xabcd000a)
696		}
697	} else {
698		CH04("", 0, 0xff, z136, __LINE__, 0, 0)
699	}
700
701	// m006
702
703	Store(0xabcd9008, i000)
704
705	CH03("", z136, 0x14b, __LINE__, 0)
706
707	Store(m006(), i000)
708
709	if (SLCK) {
710		CH03("", z136, 0x14c, __LINE__, 0)
711		if (y901) {
712			Store(0xabcd0002, Local0)
713		} else {
714			Store(0xabcd000b, Local0)
715		}
716		if (LNotEqual(i000, Local0)) {
717			err("", z136, __LINE__, 0, 0, i000, Local0)
718		}
719	} else {
720		CH04("", 0, 0xff, z136, __LINE__, 0, 0)
721	}
722
723	// m007
724
725	Store(0xabcd9009, i000)
726
727	CH03("", z136, 0x14f, __LINE__, 0)
728
729	Store(m007(), i000)
730
731	if (SLCK) {
732		CH03("", z136, 0x150, __LINE__, 0)
733		if (y901) {
734			Store(0xabcd0005, Local0)
735		} else {
736			Store(0xabcd000c, Local0)
737		}
738		if (LNotEqual(i000, Local0)) {
739			err("", z136, __LINE__, 0, 0, i000, Local0)
740		}
741	} else {
742		CH04("", 0, 0xff, z136, __LINE__, 0, 0)
743	}
744
745	// m008
746
747	Store(0xabcd900a, i000)
748
749	CH03("", z136, 0x153, __LINE__, 0)
750
751	Store(m008(), i000)
752
753	if (SLCK) {
754		CH03("", z136, 0x154, __LINE__, 0)
755		if (LNotEqual(i000, 0xabcd000d)) {
756			err("", z136, __LINE__, 0, 0, i000, 0xabcd000d)
757		}
758	} else {
759		CH04("", 0, 0xff, z136, __LINE__, 0, 0)
760	}
761
762	// m009
763
764	Store(0xabcd900b, i000)
765
766	CH03("", z136, 0x157, __LINE__, 0)
767
768	Store(m009(), i000)
769
770	if (SLCK) {
771		CH03("", z136, 0x158, __LINE__, 0)
772		if (LNotEqual(i000, 0xabcd000e)) {
773			err("", z136, __LINE__, 0, 0, i000, 0xabcd000e)
774		}
775	} else {
776		CH04("", 0, 0xff, z136, __LINE__, 0, 0)
777	}
778
779}
780