-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathZennyInstViewController.m
4018 lines (2976 loc) · 235 KB
/
ZennyInstViewController.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
//
// ZennyInstViewController.m
// CPU Dasher
//
// Created by adwo on 12-5-26.
// Copyright (c) 2012年 __MyCompanyName__. All rights reserved.
//
#import "ZennyInstViewController.h"
#import "LavenderDeviceInfo.h"
#include "ZennyUITag.h"
#import <QuartzCore/QuartzCore.h>
@interface ZennyInstViewController ()
@end
#define ZENNY_ISA_NUMBER_OF_TEST_INSTRUCTIONS 60.0
@implementation ZennyInstViewController
static NSString* GetInstructionCyclesString(int (*pFunc)(int, void*), int nLoop, void *pMem)
{
volatile NSTimeInterval timeBegin[100];
volatile NSTimeInterval timeEnd[100];
NSTimeInterval retTime;
for(int i = 0; i < 100; i++)
{
timeBegin[i] = [[NSProcessInfo processInfo] systemUptime];
(*pFunc)(nLoop, pMem);
timeEnd[i] = [[NSProcessInfo processInfo] systemUptime];
}
retTime = timeEnd[0] - timeBegin[0];
for(int i = 1; i < 100; i++)
{
NSTimeInterval deltaTime = timeEnd[i] - timeBegin[i];
if(retTime > deltaTime)
retTime = deltaTime;
}
double totalCycles = retTime * [LavenderDeviceInfo getInstance]->absoluteFrequency;
totalCycles /= (double)nLoop * ZENNY_ISA_NUMBER_OF_TEST_INSTRUCTIONS;
return [ZennyInstViewController getFilteredFloatString:[NSString stringWithFormat:@"%.1f", totalCycles]];
}
+ (NSString*)getFilteredFloatString:(NSString*)orgStr
{
unichar orgBuffer[32] = { };
unichar dstBuffer[32] = { };
NSUInteger len = [orgStr length];
[orgStr getCharacters:orgBuffer range:NSMakeRange(0, len)];
NSUInteger index, dstIndex;
BOOL hasPoint = NO;
BOOL hasZero = NO;
NSUInteger anchor = 0;
for(index = 0, dstIndex = 0; index < len; index++)
{
unichar ch = orgBuffer[index];
if(!hasPoint)
{
if(ch == L'.')
hasPoint = YES;
dstBuffer[dstIndex++] = ch;
}
else
{
if(!hasZero)
{
if(ch == L'0')
{
hasZero = YES;
anchor = index;
}
else
dstBuffer[dstIndex++] = ch;
}
else
{
NSUInteger zeroCursor;
for(zeroCursor = index; zeroCursor < len; zeroCursor++)
{
unichar ch = orgBuffer[zeroCursor];
if(ch != L'0')
{
for(NSUInteger i = anchor; i <= zeroCursor; i++)
dstBuffer[dstIndex++] = orgBuffer[i];
hasZero = NO;
index = zeroCursor;
break;
}
}
if(zeroCursor + 1 == len)
break;
}
}
}
dstBuffer[dstIndex] = L'0';
if(dstBuffer[dstIndex - 1] == (unichar)L'.')
dstIndex--;
return [NSString stringWithCharacters:dstBuffer length:dstIndex];
}
#pragma mark - calculation selectors
static NSString* GetMiscCyclesString(int (*pFunc)(void*, int), void *pMem, int nLoop)
{
volatile NSTimeInterval timeBegin[100];
volatile NSTimeInterval timeEnd[100];
NSTimeInterval retTime;
for(int i = 0; i < 100; i++)
{
timeBegin[i] = [[NSProcessInfo processInfo] systemUptime];
(*pFunc)(pMem, nLoop);
timeEnd[i] = [[NSProcessInfo processInfo] systemUptime];
}
retTime = timeEnd[0] - timeBegin[0];
for(int i = 1; i < 100; i++)
{
NSTimeInterval deltaTime = timeEnd[i] - timeBegin[i];
if(retTime > deltaTime)
retTime = deltaTime;
}
double totalCycles = retTime * [LavenderDeviceInfo getInstance]->absoluteFrequency;
totalCycles /= (double)nLoop * 32;
return [ZennyInstViewController getFilteredFloatString:[NSString stringWithFormat:@"%.1f", totalCycles]];
}
static NSString* doADC(ZennyInstViewController* controller)
{
NSMutableString *str = [NSMutableString stringWithCapacity:1024];
[str appendString:@"Description:\nAdd with Carry adds a value(the second source operand) and the carry flag value to a register value(the first source operand), and writes the result to the destination register. It can optionally update the condition flags based on the result.\n\n"];
[str appendFormat:@"ADC (immediate) Maximum Cycles: %@\n", GetInstructionCyclesString(&adcImmMinTest, 10000, NULL)];
[str appendFormat:@"ADC (immediate) Minimum Cycles: %@\n\n", GetInstructionCyclesString(&adcImmMaxTest, 10000, NULL)];
[str appendFormat:@"ADC (register) Maximum Cycles: %@\n", GetInstructionCyclesString(&adcRegMinTest, 10000, NULL)];
[str appendFormat:@"ADC (register) Minimum Cycles: %@\n\n", GetInstructionCyclesString(&adcRegMaxTest, 10000, NULL)];
[str appendFormat:@"ADC (register-shifted register) Maximum Cycles: %@\n", GetInstructionCyclesString(&adcShftMinTest, 10000, NULL)];
[str appendFormat:@"ADC (register-shifted register) Minimum Cycles: %@\n\n", GetInstructionCyclesString(&adcShftMaxTest, 10000, NULL)];
return str;
}
static NSString* doADD(ZennyInstViewController* controller)
{
NSMutableString *descStr = [NSMutableString stringWithCapacity:1024];
[descStr appendString:@"Description:\nThis instruction adds a register value and an optionally-shifted register value, and writes the result to the destination register. It can optionally update the condition flags based on the result.\n\n"];
[descStr appendFormat:@"ADD (immediate) Maximum Cycles: %@\n", GetInstructionCyclesString(&addImmMinTest, 10000, NULL)];
[descStr appendFormat:@"ADD (immediate) Minimum Cycles: %@\n\n", GetInstructionCyclesString(&addImmMaxTest, 10000, NULL)];
[descStr appendFormat:@"ADD (register) Maximum Cycles: %@\n", GetInstructionCyclesString(&addRegMinTest, 10000, NULL)];
[descStr appendFormat:@"ADD (register) Minimum Cycles: %@\n\n", GetInstructionCyclesString(&addRegMaxTest, 10000, NULL)];
[descStr appendFormat:@"ADD (register-shifted register) Maximum Cycles: %@\n", GetInstructionCyclesString(&addShftMinTest, 10000, NULL)];
[descStr appendFormat:@"ADD (register-shifted register) Minimum Cycles: %@\n\n", GetInstructionCyclesString(&addShftMaxTest, 10000, NULL)];
return descStr;
}
static NSString* doADDThumbImm(ZennyInstViewController* controller)
{
NSMutableString *descStr = [NSMutableString stringWithCapacity:1024];
[descStr appendString:@"Description:\nThis instruction adds an immediate value to a register value, and writes the result to the destination register. It can optionally update the condition flags based on the result.\n\n"];
[descStr appendFormat:@"ADD (Thumb, T1) Maximum Cycles: %@\n", GetInstructionCyclesString(&addThumbImmT1MaxTest, 10000, NULL)];
[descStr appendFormat:@"ADD (Thumb, T1) Minimum Cycles: %@\n\n", GetInstructionCyclesString(&addThumbImmT1MinTest, 10000, NULL)];
[descStr appendFormat:@"ADD (Thumb, T2) Maximum Cycles: %@\n", GetInstructionCyclesString(&addThumbImmT2MaxTest, 10000, NULL)];
[descStr appendFormat:@"ADD (Thumb, T2) Minimum Cycles: %@\n\n", GetInstructionCyclesString(&addThumbImmT2MinTest, 10000, NULL)];
[descStr appendFormat:@"ADD (Thumb, T3) Maximum Cycles: %@\n", GetInstructionCyclesString(&addThumbImmT3MaxTest, 10000, NULL)];
[descStr appendFormat:@"ADD (Thumb, T3) Minimum Cycles: %@\n\n", GetInstructionCyclesString(&addThumbImmT3MinTest, 10000, NULL)];
[descStr appendFormat:@"ADD (Thumb, T4) Maximum Cycles: %@\n", GetInstructionCyclesString(&addThumbImmT4MaxTest, 10000, NULL)];
[descStr appendFormat:@"ADD (Thumb, T4) Minimum Cycles: %@\n\n", GetInstructionCyclesString(&addThumbImmT4MinTest, 10000, NULL)];
return descStr;
}
static NSString* doADDThumbReg(ZennyInstViewController* controller)
{
NSMutableString *descStr = [NSMutableString stringWithCapacity:1024];
[descStr appendString:@"Description:\nThis instruction adds a register value and an optionally-shifted register value, and writes the result to the destination register. It can optionally update the condition flags based on the result.\n\n"];
[descStr appendFormat:@"ADD (Thumb, T1) Maximum Cycles: %@\n", GetInstructionCyclesString(&addThumbRegT1MaxTest, 10000, NULL)];
[descStr appendFormat:@"ADD (Thumb, T1) Minimum Cycles: %@\n\n", GetInstructionCyclesString(&addThumbRegT1MinTest, 10000, NULL)];
[descStr appendFormat:@"ADD (Thumb, T2) Maximum Cycles: %@\n", GetInstructionCyclesString(&addThumbRegT2MaxTest, 10000, NULL)];
[descStr appendFormat:@"ADD (Thumb, T2) Minimum Cycles: %@\n\n", GetInstructionCyclesString(&addThumbRegT2MinTest, 10000, NULL)];
[descStr appendFormat:@"ADD (Thumb, T3) Maximum Cycles: %@\n", GetInstructionCyclesString(&addThumbRegT3MaxTest, 10000, NULL)];
[descStr appendFormat:@"ADD (Thumb, T3) Minimum Cycles: %@\n\n", GetInstructionCyclesString(&addThumbRegT3MinTest, 10000, NULL)];
return descStr;
}
static NSString* doAND(ZennyInstViewController* controller)
{
NSMutableString *descStr = [NSMutableString stringWithCapacity:1000];
[descStr appendString:@"Description:\nThis instruction performs a bitwise AND of a register value(the first source operand) and another value(the second source operand), and writes the result to the destination register.\n\n"];
[descStr appendFormat:@"AND (immediate) Maximum Cycles: %@\n", GetInstructionCyclesString(&andImmMinTest, 10000, NULL)];
[descStr appendFormat:@"AND (immediate) Minimum Cycles: %@\n\n", GetInstructionCyclesString(&andImmMaxTest, 10000, NULL)];
[descStr appendFormat:@"AND (register) Maximum Cycles: %@\n", GetInstructionCyclesString(&andRegMinTest, 10000, NULL)];
[descStr appendFormat:@"AND (register) Minimum Cycles: %@\n\n", GetInstructionCyclesString(&andRegMaxTest, 10000, NULL)];
[descStr appendFormat:@"AND (register-shifted register) Maximum Cycles: %@\n", GetInstructionCyclesString(&andShftMinTest, 10000, NULL)];
[descStr appendFormat:@"AND (register-shifted register) Minimum Cycles: %@\n\n", GetInstructionCyclesString(&andShftMaxTest, 10000, NULL)];
return descStr;
}
static NSString* doASR(ZennyInstViewController* controller)
{
NSMutableString *descStr = [NSMutableString stringWithCapacity:1000];
[descStr appendString:@"Description:\nArithmetic Shift Right shifts a register value right by a number of bits, shifting in copies of its sign bit, and writes the result to the destination register. It can optionally update the condition flags based on the result.\n\n"];
[descStr appendFormat:@"ASR (immediate) Maximum Cycles: %@\n", GetInstructionCyclesString(&asrImmMinTest, 10000, NULL)];
[descStr appendFormat:@"ASR (immediate) Minimum Cycles: %@\n\n", GetInstructionCyclesString(&asrImmMaxTest, 10000, NULL)];
[descStr appendFormat:@"ASR (register) Maximum Cycles: %@\n", GetInstructionCyclesString(&asrRegMinTest, 10000, NULL)];
[descStr appendFormat:@"ASR (register) Minimum Cycles: %@\n\n", GetInstructionCyclesString(&asrRegMaxTest, 10000, NULL)];
return descStr;
}
static NSString* doBFC(ZennyInstViewController* controller)
{
NSMutableString *descStr = [NSMutableString stringWithCapacity:1000];
[descStr appendString:@"Description:\nBit Field Clear clears any number of adjacent bits at any position in a register, without affecting the other bits in the register.\n\n"];
[descStr appendFormat:@"BFC Maximum Cycles: %@\n", GetInstructionCyclesString(&bfcMinTest, 10000, NULL)];
[descStr appendFormat:@"BFC Minimum Cycles: %@\n\n", GetInstructionCyclesString(&bfcMaxTest, 10000, NULL)];
return descStr;
}
static NSString* doBFI(ZennyInstViewController* controller)
{
NSMutableString *descStr = [NSMutableString stringWithCapacity:1000];
[descStr appendString:@"Description:\nBit Field Insert copies any number of low order bits from a register into the same number of adjacent bits at any position in the destination register.\n\n"];
[descStr appendFormat:@"BFI Maximum Cycles: %@\n", GetInstructionCyclesString(&bfiMinTest, 10000, NULL)];
[descStr appendFormat:@"BFI Minimum Cycles: %@\n\n", GetInstructionCyclesString(&bfiMaxTest, 10000, NULL)];
return descStr;
}
static NSString* doBIC(ZennyInstViewController* controller)
{
NSMutableString *descStr = [NSMutableString stringWithCapacity:1000];
[descStr appendString:@"Description:\nBitwise Bit Clear performs a bitwise AND of a register value and the complement of the third operand, and writes the result to the destination register. It can optionally update the condition flags based on the result.\n\n"];
[descStr appendFormat:@"BIC (immediate) Maximum Cycles: %@\n", GetInstructionCyclesString(&bicImmMinTest, 10000, NULL)];
[descStr appendFormat:@"BIC (immediate) Minimum Cycles: %@\n\n", GetInstructionCyclesString(&bicImmMaxTest, 10000, NULL)];
[descStr appendFormat:@"BIC (register) Maximum Cycles: %@\n", GetInstructionCyclesString(&bicRegMinTest, 10000, NULL)];
[descStr appendFormat:@"BIC (register) Minimum Cycles: %@\n\n", GetInstructionCyclesString(&bicRegMaxTest, 10000, NULL)];
[descStr appendFormat:@"BIC (register-shifted register) Maximum Cycles: %@\n", GetInstructionCyclesString(&bicShftMinTest, 10000, NULL)];
[descStr appendFormat:@"BIC (register-shifted register) Minimum Cycles: %@\n\n", GetInstructionCyclesString(&bicShftMaxTest, 10000, NULL)];
return descStr;
}
static NSString* doCBNZ(ZennyInstViewController* controller)
{
NSMutableString *descStr = [NSMutableString stringWithCapacity:1000];
[descStr appendString:@"Description:\nCompare and Branch on Nonzero and Compare and Branch on Zero compare the value in a register with zero, and conditionally branch forward a constant value. They do not affect the condition flags. (Thumb T1)\n\n"];
[descStr appendFormat:@"CBNZ Average Cycles: %@\n", GetInstructionCyclesString(&cbnzAvgTest, 10000, NULL)];
return descStr;
}
static NSString* doCLZ(ZennyInstViewController* controller)
{
NSMutableString *descStr = [NSMutableString stringWithCapacity:1000];
[descStr appendString:@"Description:\nCount Leading Zeros returns the number of binary zero bits before the first binary one bit in a value.\n\n"];
[descStr appendFormat:@"CLZ Maximum Cycles: %@\n", GetInstructionCyclesString(&clzMinTest, 10000, NULL)];
[descStr appendFormat:@"CLZ Minimum Cycles: %@\n\n", GetInstructionCyclesString(&clzMaxTest, 10000, NULL)];
return descStr;
}
static NSString* doCMN(ZennyInstViewController* controller)
{
NSMutableString *descStr = [NSMutableString stringWithCapacity:1000];
[descStr appendString:@"Description:\nCompare Negative adds a register value and another value. It updates the condition flags based on the result, and discards the result.\n\n"];
[descStr appendFormat:@"CMN (immediate) Maximum Cycles: %@\n", GetInstructionCyclesString(&cmnImmMinTest, 10000, NULL)];
[descStr appendFormat:@"CMN (immediate) Minimum Cycles: %@\n\n", GetInstructionCyclesString(&cmnImmMaxTest, 10000, NULL)];
[descStr appendFormat:@"CMN (register) Maximum Cycles: %@\n", GetInstructionCyclesString(&cmnRegMinTest, 10000, NULL)];
[descStr appendFormat:@"CMN (register) Minimum Cycles: %@\n\n", GetInstructionCyclesString(&cmnRegMaxTest, 10000, NULL)];
[descStr appendFormat:@"CMN (register-shifted register) Maximum Cycles: %@\n", GetInstructionCyclesString(&cmnShftMinTest, 10000, NULL)];
[descStr appendFormat:@"CMN (register-shifted register) Minimum Cycles: %@\n\n", GetInstructionCyclesString(&cmnShftMaxTest, 10000, NULL)];
return descStr;
}
static NSString* doCMP(ZennyInstViewController* controller)
{
NSMutableString *descStr = [NSMutableString stringWithCapacity:1000];
[descStr appendString:@"Description:\nCompare subtracts a value(second source) from a register value(first source). It updates the condition flags based on the result, and discards the result.\n\n"];
[descStr appendFormat:@"CMN (immediate) Maximum Cycles: %@\n", GetInstructionCyclesString(&cmpImmMinTest, 10000, NULL)];
[descStr appendFormat:@"CMN (immediate) Minimum Cycles: %@\n\n", GetInstructionCyclesString(&cmpImmMaxTest, 10000, NULL)];
[descStr appendFormat:@"CMN (register) Maximum Cycles: %@\n", GetInstructionCyclesString(&cmpRegMinTest, 10000, NULL)];
[descStr appendFormat:@"CMN (register) Minimum Cycles: %@\n\n", GetInstructionCyclesString(&cmpRegMaxTest, 10000, NULL)];
[descStr appendFormat:@"CMN (register-shifted register) Maximum Cycles: %@\n", GetInstructionCyclesString(&cmpShftMaxTest, 10000, NULL)];
[descStr appendFormat:@"CMN (register-shifted register) Minimum Cycles: %@\n\n", GetInstructionCyclesString(&cmpShftMaxTest, 10000, NULL)];
return descStr;
}
static NSString* doEOR(ZennyInstViewController* controller)
{
NSMutableString *descStr = [NSMutableString stringWithCapacity:1000];
[descStr appendString:@"Description:\nBitwise Exclusive OR performs a bitwise Exclusive OR of a register value and a second source value, and writes the result to the destination register. It can optionally update the condition flags based on the result.\n\n"];
[descStr appendFormat:@"EOR (immediate) Maximum Cycles: %@\n", GetInstructionCyclesString(&eorImmMinTest, 10000, NULL)];
[descStr appendFormat:@"EOR (immediate) Minimum Cycles: %@\n\n", GetInstructionCyclesString(&eorImmMaxTest, 10000, NULL)];
[descStr appendFormat:@"EOR (register) Maximum Cycles: %@\n", GetInstructionCyclesString(&eorRegMinTest, 10000, NULL)];
[descStr appendFormat:@"EOR (register) Minimum Cycles: %@\n\n", GetInstructionCyclesString(&eorRegMaxTest, 10000, NULL)];
[descStr appendFormat:@"EOR (register-shifted register) Maximum Cycles: %@\n", GetInstructionCyclesString(&eorShftMinTest, 10000, NULL)];
[descStr appendFormat:@"EOR (register-shifted register) Minimum Cycles: %@\n\n", GetInstructionCyclesString(&eorShftMaxTest, 10000, NULL)];
return descStr;
}
static NSString* doLSL(ZennyInstViewController* controller)
{
NSMutableString *descStr = [NSMutableString stringWithCapacity:1000];
[descStr appendString:@"Description:\nLogical Shift Left shifts the first source register value left by the second source number of bits, shifting in zeros, and writes the result to the destination register. It can optionally update the condition flags based on the result.\n\n"];
[descStr appendFormat:@"LSL (immediate) Maximum Cycles: %@\n", GetInstructionCyclesString(&lslImmMinTest, 10000, NULL)];
[descStr appendFormat:@"LSL (immediate) Minimum Cycles: %@\n\n", GetInstructionCyclesString(&lslImmMaxTest, 10000, NULL)];
[descStr appendFormat:@"LSL (register) Maximum Cycles: %@\n", GetInstructionCyclesString(&lslRegMinTest, 10000, NULL)];
[descStr appendFormat:@"LSL (register) Minimum Cycles: %@\n\n", GetInstructionCyclesString(&lslRegMaxTest, 10000, NULL)];
return descStr;
}
static NSString* doLSR(ZennyInstViewController* controller)
{
NSMutableString *descStr = [NSMutableString stringWithCapacity:1000];
[descStr appendString:@"Description:\nLogical Shift Right shifts the first source register value right by the second source number of bits, shifting in zeros, and writes the result to the destination register. It can optionally update the condition flags based on the result.\n\n"];
[descStr appendFormat:@"LSR (immediate) Maximum Cycles: %@\n", GetInstructionCyclesString(&lsrImmMinTest, 10000, NULL)];
[descStr appendFormat:@"LSR (immediate) Minimum Cycles: %@\n\n", GetInstructionCyclesString(&lsrImmMaxTest, 10000, NULL)];
[descStr appendFormat:@"LSR (register) Maximum Cycles: %@\n", GetInstructionCyclesString(&lsrRegMinTest, 10000, NULL)];
[descStr appendFormat:@"LSR (register) Minimum Cycles: %@\n\n", GetInstructionCyclesString(&lsrRegMaxTest, 10000, NULL)];
return descStr;
}
static NSString* doMLA(ZennyInstViewController* controller)
{
NSMutableString *descStr = [NSMutableString stringWithCapacity:1000];
[descStr appendString:@"Description:\nMultiply Accumulate multiplies two register values, and adds a third register value. The least significant 32 bits of the result are written to the destination register. These 32 bits do not depend on whether the source register values are considered to be signed values or unsigned values.\nIn ARM code, the condition flags can optionally be updated based on the result. Use of this option adversely affects performance on many processor implementations.\n\n"];
[descStr appendFormat:@"MLA Maximum Cycles: %@\n", GetInstructionCyclesString(&mlaMinTest, 10000, NULL)];
[descStr appendFormat:@"MLA Minimum Cycles: %@\n\n", GetInstructionCyclesString(&mlaMaxTest, 10000, NULL)];
return descStr;
}
static NSString* doMLS(ZennyInstViewController* controller)
{
NSMutableString *descStr = [NSMutableString stringWithCapacity:1000];
[descStr appendString:@"Description:\nMultiply and Subtract multiplies two register values, and subtracts the product from a third register value. The least significant 32 bits of the result are written to the destination register. These 32 bits do not depend on whether the source register values are considered to be signed values or unsigned values.\nIn ARM code, the condition flags can optionally be updated based on the result. Use of this option adversely affects performance on many processor implementations.\n\n"];
[descStr appendFormat:@"MLS Maximum Cycles: %@\n", GetInstructionCyclesString(&mlsMinTest, 10000, NULL)];
[descStr appendFormat:@"MLS Minimum Cycles: %@\n\n", GetInstructionCyclesString(&mlsMaxTest, 10000, NULL)];
return descStr;
}
static NSString* doMOV(ZennyInstViewController* controller)
{
NSMutableString *descStr = [NSMutableString stringWithCapacity:1000];
[descStr appendString:@"Description:\nMove writes the source value to the destination register. It can optionally update the condition flags based on the value.\n\n"];
[descStr appendFormat:@"MOV (immediate) Maximum Cycles: %@\n", GetInstructionCyclesString(&movImmMinTest, 10000, NULL)];
[descStr appendFormat:@"MOV (immediate) Minimum Cycles: %@\n\n", GetInstructionCyclesString(&movImmMaxTest, 10000, NULL)];
[descStr appendFormat:@"MOV (register) Maximum Cycles: %@\n", GetInstructionCyclesString(&movRegMinTest, 10000, NULL)];
[descStr appendFormat:@"MOV (register) Minimum Cycles: %@\n\n", GetInstructionCyclesString(&movRegMaxTest, 10000, NULL)];
[descStr appendFormat:@"MOV (register-shifted register) Maximum Cycles: %@\n", GetInstructionCyclesString(&movShftMinTest, 10000, NULL)];
[descStr appendFormat:@"MOV (register-shifted register) Minimum Cycles: %@\n\n", GetInstructionCyclesString(&movShftMaxTest, 10000, NULL)];
return descStr;
}
static NSString* doMOVT(ZennyInstViewController* controller)
{
NSMutableString *descStr = [NSMutableString stringWithCapacity:1000];
[descStr appendString:@"Description:\nMove Top writes an immediate value to the top halfword of the destination register. It does not affect the contents of the bottom halfword.\n\n"];
[descStr appendFormat:@"MOVT Maximum Cycles: %@\n", GetInstructionCyclesString(&movtMinTest, 10000, NULL)];
[descStr appendFormat:@"MOVT Minimum Cycles: %@\n\n", GetInstructionCyclesString(&movtMaxTest, 10000, NULL)];
return descStr;
}
static NSString* doMUL(ZennyInstViewController* controller)
{
NSMutableString *descStr = [NSMutableString stringWithCapacity:1000];
[descStr appendString:@"Description:\nMultiply multiplies two register values. The least significant 32 bits of the result are written to the destination register. These 32 bits do not depend on whether the source register values are considered to be signed values or unsigned values.\nOptionally, it can update the condition flags based on the result. In the Thumb instruction set, this option is limited to only a few forms of the instruction. Use of this option adversely affects performance on many processor implementations.\n\n"];
[descStr appendFormat:@"MUL Maximum Cycles: %@\n", GetInstructionCyclesString(&mulMinTest, 10000, NULL)];
[descStr appendFormat:@"MUL Minimum Cycles: %@\n\n", GetInstructionCyclesString(&mulMaxTest, 10000, NULL)];
return descStr;
}
static NSString* doMVN(ZennyInstViewController* controller)
{
NSMutableString *descStr = [NSMutableString stringWithCapacity:1000];
[descStr appendString:@"Description:\nBitwise NOT writes the bitwise inverse of the source value to the destination register. It can optionally update the condition flags based on the value.\n\n"];
[descStr appendFormat:@"MVN (immediate) Maximum Cycles: %@\n", GetInstructionCyclesString(&mvnImmMinTest, 10000, NULL)];
[descStr appendFormat:@"MVN (immediate) Minimum Cycles: %@\n\n", GetInstructionCyclesString(&mvnImmMaxTest, 10000, NULL)];
[descStr appendFormat:@"MVN (register) Maximum Cycles: %@\n", GetInstructionCyclesString(&mvnRegMinTest, 10000, NULL)];
[descStr appendFormat:@"MVN (register) Minimum Cycles: %@\n\n", GetInstructionCyclesString(&mvnRegMaxTest, 10000, NULL)];
[descStr appendFormat:@"MVN (register-shifted register) Maximum Cycles: %@\n", GetInstructionCyclesString(&mvnShftMinTest, 10000, NULL)];
[descStr appendFormat:@"MVN (register-shifted register) Minimum Cycles: %@\n\n", GetInstructionCyclesString(&mvnShftMaxTest, 10000, NULL)];
return descStr;
}
static NSString* doORN(ZennyInstViewController* controller)
{
NSMutableString *descStr = [NSMutableString stringWithCapacity:1000];
[descStr appendString:@"Description:\nBitwise OR NOT performs a bitwise (inclusive) OR of a register value and the complement of the second source value, and writes the result to the destination register. It can optionally update the condition flags based on the result. (Thumb T1)\n\n"];
[descStr appendFormat:@"ORN (immediate) Maximum Cycles: %@\n", GetInstructionCyclesString(&ornImmMinTest, 10000, NULL)];
[descStr appendFormat:@"ORN (immediate) Minimum Cycles: %@\n\n", GetInstructionCyclesString(&ornImmMaxTest, 10000, NULL)];
[descStr appendFormat:@"ORN (register) Maximum Cycles: %@\n", GetInstructionCyclesString(&ornRegMinTest, 10000, NULL)];
[descStr appendFormat:@"ORN (register) Minimum Cycles: %@\n\n", GetInstructionCyclesString(&ornRegMaxTest, 10000, NULL)];
return descStr;
}
static NSString* doORR(ZennyInstViewController* controller)
{
NSMutableString *descStr = [NSMutableString stringWithCapacity:1000];
[descStr appendString:@"Description:\nBitwise OR performs a bitwise (inclusive) OR of a register value and the second source value, and writes the result to the destination register. It can optionally update the condition flags based on the result.\n\n"];
[descStr appendFormat:@"ORR (immediate) Maximum Cycles: %@\n", GetInstructionCyclesString(&orrImmMinTest, 10000, NULL)];
[descStr appendFormat:@"ORR (immediate) Minimum Cycles: %@\n\n", GetInstructionCyclesString(&orrImmMaxTest, 10000, NULL)];
[descStr appendFormat:@"ORR (register) Maximum Cycles: %@\n", GetInstructionCyclesString(&orrRegMinTest, 10000, NULL)];
[descStr appendFormat:@"ORR (register) Minimum Cycles: %@\n\n", GetInstructionCyclesString(&orrRegMaxTest, 10000, NULL)];
[descStr appendFormat:@"ORR (register-shifted register) Maximum Cycles: %@\n", GetInstructionCyclesString(&orrShftMinTest, 10000, NULL)];
[descStr appendFormat:@"ORR (register-shifted register) Minimum Cycles: %@\n\n", GetInstructionCyclesString(&orrShftMaxTest, 10000, NULL)];
return descStr;
}
static NSString* doPKH(ZennyInstViewController* controller)
{
NSMutableString *descStr = [NSMutableString stringWithCapacity:1000];
[descStr appendString:@"Description:\nPack Halfword combines one halfword of its first operand with the other halfword of its shifted second operand.\n\n"];
[descStr appendFormat:@"PKH Maximum Cycles: %@\n", GetInstructionCyclesString(&pkhMinTest, 10000, NULL)];
[descStr appendFormat:@"PKH Minimum Cycles: %@\n\n", GetInstructionCyclesString(&pkhMaxTest, 10000, NULL)];
return descStr;
}
static NSString* doQADD(ZennyInstViewController* controller)
{
NSMutableString *descStr = [NSMutableString stringWithCapacity:1000];
[descStr appendString:@"Description:\nSaturating Add adds two register values, saturates the result to the 32-bit signed integer range –2^31 ≤ x ≤ 2^31 – 1, and writes the result to the destination register. If saturation occurs, it sets the Q flag in the APSR.\n\n"];
[descStr appendFormat:@"QADD Maximum Cycles: %@\n", GetInstructionCyclesString(&qaddMinTest, 10000, NULL)];
[descStr appendFormat:@"QADD Minimum Cycles: %@\n\n", GetInstructionCyclesString(&qaddMaxTest, 10000, NULL)];
return descStr;
}
static NSString* doQADD16(ZennyInstViewController* controller)
{
NSMutableString *descStr = [NSMutableString stringWithCapacity:1000];
[descStr appendString:@"Saturating Add 16 performs two 16-bit integer additions, saturates the results to the 16-bit signed integer range –2^15 ≤ x ≤ 2^15 – 1, and writes the results to the destination register.\n\n"];
[descStr appendFormat:@"QADD16 Maximum Cycles: %@\n", GetInstructionCyclesString(&qadd16MinTest, 10000, NULL)];
[descStr appendFormat:@"QADD16 Minimum Cycles: %@\n\n", GetInstructionCyclesString(&qadd16MaxTest, 10000, NULL)];
return descStr;
}
static NSString* doQADD8(ZennyInstViewController* controller)
{
NSMutableString *descStr = [NSMutableString stringWithCapacity:1000];
[descStr appendString:@"Saturating Add 8 performs four 8-bit integer additions, saturates the results to the 8-bit signed integer range –2^7 ≤ x ≤ 2^7 – 1, and writes the results to the destination register.\n\n"];
[descStr appendFormat:@"QADD8 Maximum Cycles: %@\n", GetInstructionCyclesString(&qadd8MinTest, 10000, NULL)];
[descStr appendFormat:@"QADD8 Minimum Cycles: %@\n\n", GetInstructionCyclesString(&qadd8MaxTest, 10000, NULL)];
return descStr;
}
static NSString* doQASX(ZennyInstViewController* controller)
{
NSMutableString *descStr = [NSMutableString stringWithCapacity:1000];
[descStr appendString:@"Saturating Add and Subtract with Exchange exchanges the two halfwords of the second operand, performs one 16-bit integer addition and one 16-bit subtraction, saturates the results to the 16-bit signed integer range –2^15 ≤ x ≤ 2^15 – 1, and writes the results to the destination register.\nThe pre-UAL syntax QADDSUBX<c> is equivalent to QASX<c>.\n\n"];
[descStr appendFormat:@"QASX Maximum Cycles: %@\n", GetInstructionCyclesString(&qasxMinTest, 10000, NULL)];
[descStr appendFormat:@"QASX Minimum Cycles: %@\n\n", GetInstructionCyclesString(&qasxMaxTest, 10000, NULL)];
return descStr;
}
static NSString* doQDADD(ZennyInstViewController* controller)
{
NSMutableString *descStr = [NSMutableString stringWithCapacity:1000];
[descStr appendString:@"Saturating Double and Add adds a doubled register value to another register value, and writes the result to the destination register. Both the doubling and the addition have their results saturated to the 32-bit signed integer range –2^31 ≤ x ≤ 2^31 – 1. If saturation occurs in either operation, it sets the Q flag in the APSR.\n\n"];
[descStr appendFormat:@"QDADD Maximum Cycles: %@\n", GetInstructionCyclesString(&qdaddMinTest, 10000, NULL)];
[descStr appendFormat:@"QDADD Minimum Cycles: %@\n\n", GetInstructionCyclesString(&qdaddMaxTest, 10000, NULL)];
return descStr;
}
static NSString* doQDSUB(ZennyInstViewController* controller)
{
NSMutableString *descStr = [NSMutableString stringWithCapacity:1000];
[descStr appendString:@"Saturating Double and Subtract subtracts a doubled register value from another register value, and writes the result to the destination register. Both the doubling and the subtraction have their results saturated to the 32-bit signed integer range –2^31 ≤ x ≤ 2^31 – 1. If saturation occurs in either operation, it sets the Q flag in the APSR.\n\n"];
[descStr appendFormat:@"QDSUB Maximum Cycles: %@\n", GetInstructionCyclesString(&qdsubMinTest, 10000, NULL)];
[descStr appendFormat:@"QDSUB Minimum Cycles: %@\n\n", GetInstructionCyclesString(&qdsubMaxTest, 10000, NULL)];
return descStr;
}
static NSString* doQSAX(ZennyInstViewController* controller)
{
NSMutableString *descStr = [NSMutableString stringWithCapacity:1000];
[descStr appendString:@"Saturating Subtract and Add with Exchange exchanges the two halfwords of the second operand, performs one 16-bit integer subtraction and one 16-bit addition, saturates the results to the 16-bit signed integer range –2^15 ≤ x ≤ 2^15 – 1, and writes the results to the destination register.\nThe pre-UAL syntax QSUBADDX<c> is equivalent to QSAX<c>.\n\n"];
[descStr appendFormat:@"QSAX Maximum Cycles: %@\n", GetInstructionCyclesString(&qsaxMinTest, 10000, NULL)];
[descStr appendFormat:@"QSAX Minimum Cycles: %@\n\n", GetInstructionCyclesString(&qsaxMaxTest, 10000, NULL)];
return descStr;
}
static NSString* doQSUB(ZennyInstViewController* controller)
{
NSMutableString *descStr = [NSMutableString stringWithCapacity:1000];
[descStr appendString:@"Saturating Subtract subtracts one register value from another register value, saturates the result to the 32-bit signed integer range –2^31 ≤ x ≤ 2^31 – 1, and writes the result to the destination register. If saturation occurs, it sets the Q flag in the APSR.\n\n"];
[descStr appendFormat:@"QSUB Maximum Cycles: %@\n", GetInstructionCyclesString(&qsubMinTest, 10000, NULL)];
[descStr appendFormat:@"QSUB Minimum Cycles: %@\n\n", GetInstructionCyclesString(&qsubMaxTest, 10000, NULL)];
return descStr;
}
static NSString* doQSUB16(ZennyInstViewController* controller)
{
NSMutableString *descStr = [NSMutableString stringWithCapacity:1000];
[descStr appendString:@"Saturating Subtract 16 performs two 16-bit integer subtractions, saturates the results to the 16-bit signed integer range –2^15 ≤ x ≤ 2^15 – 1, and writes the results to the destination register.\n\n"];
[descStr appendFormat:@"QSUB16 Maximum Cycles: %@\n", GetInstructionCyclesString(&qsub16MinTest, 10000, NULL)];
[descStr appendFormat:@"QSUB16 Minimum Cycles: %@\n\n", GetInstructionCyclesString(&qsub16MaxTest, 10000, NULL)];
return descStr;
}
static NSString* doQSUB8(ZennyInstViewController* controller)
{
NSMutableString *descStr = [NSMutableString stringWithCapacity:1000];
[descStr appendString:@"Saturating Subtract 8 performs four 8-bit integer subtractions, saturates the results to the 8-bit signed integer range –2^7 ≤ x ≤ 2^7 – 1, and writes the results to the destination register.\n\n"];
[descStr appendFormat:@"QSUB8 Maximum Cycles: %@\n", GetInstructionCyclesString(&qsub8MinTest, 10000, NULL)];
[descStr appendFormat:@"QSUB8 Minimum Cycles: %@\n\n", GetInstructionCyclesString(&qsub8MaxTest, 10000, NULL)];
return descStr;
}
static NSString* doRBIT(ZennyInstViewController* controller)
{
NSMutableString *descStr = [NSMutableString stringWithCapacity:1000];
[descStr appendString:@"Reverse Bits reverses the bit order in a 32-bit register.\n\n"];
[descStr appendFormat:@"RBIT Maximum Cycles: %@\n", GetInstructionCyclesString(&rbitMinTest, 10000, NULL)];
[descStr appendFormat:@"RBIT Minimum Cycles: %@\n\n", GetInstructionCyclesString(&rbitMaxTest, 10000, NULL)];
return descStr;
}
static NSString* doREV(ZennyInstViewController* controller)
{
NSMutableString *descStr = [NSMutableString stringWithCapacity:1000];
[descStr appendString:@"Byte-Reverse Word reverses the byte order in a 32-bit register.\n\n"];
[descStr appendFormat:@"REV Maximum Cycles: %@\n", GetInstructionCyclesString(&revMinTest, 10000, NULL)];
[descStr appendFormat:@"REV Minimum Cycles: %@\n\n", GetInstructionCyclesString(&revMaxTest, 10000, NULL)];
return descStr;
}
static NSString* doREV16(ZennyInstViewController* controller)
{
NSMutableString *descStr = [NSMutableString stringWithCapacity:1000];
[descStr appendString:@"Byte-Reverse Packed Halfword reverses the byte order in each16-bit halfword of a 32-bit register.\n\n"];
[descStr appendFormat:@"REV16 Maximum Cycles: %@\n", GetInstructionCyclesString(&rev16MinTest, 10000, NULL)];
[descStr appendFormat:@"REV16 Minimum Cycles: %@\n\n", GetInstructionCyclesString(&rev16MaxTest, 10000, NULL)];
return descStr;
}
static NSString* doREVSH(ZennyInstViewController* controller)
{
NSMutableString *descStr = [NSMutableString stringWithCapacity:1000];
[descStr appendString:@"Byte-Reverse Signed Halfword reverses the byte order in the lower 16-bit halfword of a 32-bit register, and sign-extends the result to 32 bits.\n\n"];
[descStr appendFormat:@"REVSH Maximum Cycles: %@\n", GetInstructionCyclesString(&revshMinTest, 10000, NULL)];
[descStr appendFormat:@"REVSH Minimum Cycles: %@\n\n", GetInstructionCyclesString(&revshMaxTest, 10000, NULL)];
return descStr;
}
static NSString* doROR(ZennyInstViewController* controller)
{
NSMutableString *descStr = [NSMutableString stringWithCapacity:1000];
[descStr appendString:@"Description:\nRotate Right provides the value of the contents of a register rotated by a variable number of bits. The bits that are rotated off the right end are inserted into the vacated bit positions on the left. The variable number of bits is read from the bottom byte of a register. It can optionally update the condition flags based on the result.\n\n"];
[descStr appendFormat:@"ROR (immediate) Maximum Cycles: %@\n", GetInstructionCyclesString(&rorImmMinTest, 10000, NULL)];
[descStr appendFormat:@"ROR (immediate) Minimum Cycles: %@\n\n", GetInstructionCyclesString(&rorImmMaxTest, 10000, NULL)];
[descStr appendFormat:@"ROR (register) Maximum Cycles: %@\n", GetInstructionCyclesString(&rorRegMinTest, 10000, NULL)];
[descStr appendFormat:@"ROR (register) Minimum Cycles: %@\n\n", GetInstructionCyclesString(&rorRegMaxTest, 10000, NULL)];
return descStr;
}
static NSString* doRRX(ZennyInstViewController* controller)
{
NSMutableString *descStr = [NSMutableString stringWithCapacity:1000];
[descStr appendString:@"Rotate Right with Extend provides the value of the contentsof a register shifted right by one place, with the carry flag shifted into bit [31].\nRRX can optionally update the condition flags based on the result. In that case, bit [0] is shifted into the carry flag.\n\n"];
[descStr appendFormat:@"RRX Maximum Cycles: %@\n", GetInstructionCyclesString(&rrxMinTest, 10000, NULL)];
[descStr appendFormat:@"RRX Minimum Cycles: %@\n\n", GetInstructionCyclesString(&rrxMaxTest, 10000, NULL)];
return descStr;
}
static NSString* doRSB(ZennyInstViewController* controller)
{
NSMutableString *descStr = [NSMutableString stringWithCapacity:1000];
[descStr appendString:@"Description:\nReverse Subtract subtracts the first source operand value from the second source operand, and writes the result to the destination register. It can optionally update the condition flags based on the result.\n\n"];
[descStr appendFormat:@"RSB (immediate) Maximum Cycles: %@\n", GetInstructionCyclesString(&rsbImmMinTest, 10000, NULL)];
[descStr appendFormat:@"RSB (immediate) Minimum Cycles: %@\n\n", GetInstructionCyclesString(&rsbImmMaxTest, 10000, NULL)];
[descStr appendFormat:@"RSB (register) Maximum Cycles: %@\n", GetInstructionCyclesString(&rsbRegMinTest, 10000, NULL)];
[descStr appendFormat:@"RSB (register) Minimum Cycles: %@\n\n", GetInstructionCyclesString(&rsbRegMaxTest, 10000, NULL)];
[descStr appendFormat:@"RSB (register-shifted register) Maximum Cycles: %@\n", GetInstructionCyclesString(&rsbShftMinTest, 10000, NULL)];
[descStr appendFormat:@"RSB (register-shifted register) Minimum Cycles: %@\n\n", GetInstructionCyclesString(&rsbShftMaxTest, 10000, NULL)];
return descStr;
}
static NSString* doRSC(ZennyInstViewController* controller)
{
NSMutableString *descStr = [NSMutableString stringWithCapacity:1000];
[descStr appendString:@"Description:\nReverse Subtract with Carry subtracts the first source operand value and the value of NOT (Carry flag) from the second source operand value, and writes the result to the destination register. It can optionally update the condition flags based on the result.\n\n"];
[descStr appendFormat:@"RSC (immediate) Maximum Cycles: %@\n", GetInstructionCyclesString(&rscImmMinTest, 10000, NULL)];
[descStr appendFormat:@"RSC (immediate) Minimum Cycles: %@\n\n", GetInstructionCyclesString(&rscImmMaxTest, 10000, NULL)];
[descStr appendFormat:@"RSC (register) Maximum Cycles: %@\n", GetInstructionCyclesString(&rscRegMinTest, 10000, NULL)];
[descStr appendFormat:@"RSC (register) Minimum Cycles: %@\n\n", GetInstructionCyclesString(&rscRegMaxTest, 10000, NULL)];
[descStr appendFormat:@"RSC (register-shifted register) Maximum Cycles: %@\n", GetInstructionCyclesString(&rscShftMinTest, 10000, NULL)];
[descStr appendFormat:@"RSC (register-shifted register) Minimum Cycles: %@\n\n", GetInstructionCyclesString(&rscShftMaxTest, 10000, NULL)];
return descStr;
}
static NSString* doSADD16(ZennyInstViewController* controller)
{
NSMutableString *descStr = [NSMutableString stringWithCapacity:1000];
[descStr appendString:@"Signed Add 16 performs two 16-bit signed integer additions, and writes the results to the destination register. It sets the APSR.GE bits according to the results of the additions.\n\n"];
[descStr appendFormat:@"SADD16 Maximum Cycles: %@\n", GetInstructionCyclesString(&sadd16MinTest, 10000, NULL)];
[descStr appendFormat:@"SADD16 Minimum Cycles: %@\n\n", GetInstructionCyclesString(&sadd16MaxTest, 10000, NULL)];
return descStr;
}
static NSString* doSADD8(ZennyInstViewController* controller)
{
NSMutableString *descStr = [NSMutableString stringWithCapacity:1000];
[descStr appendString:@"Signed Add 8 performs four 8-bit signed integer additions, and writes the results to the destination register. It sets the APSR.GE bits according to the results of the additions.\n\n"];
[descStr appendFormat:@"SADD8 Maximum Cycles: %@\n", GetInstructionCyclesString(&sadd8MinTest, 10000, NULL)];
[descStr appendFormat:@"SADD8 Minimum Cycles: %@\n\n", GetInstructionCyclesString(&sadd8MaxTest, 10000, NULL)];
return descStr;
}
static NSString* doSASX(ZennyInstViewController* controller)
{
NSMutableString *descStr = [NSMutableString stringWithCapacity:1000];
[descStr appendString:@"Signed Add and Subtract with Exchange exchanges the two halfwords of the second operand, performs one 16-bit integer addition and one 16-bit subtraction, and writes the results to the destination register. It sets the APSR.GE bits according to the results.\nThe pre-UAL syntax SADDSUBX<c> is equivalent to SASX<c>.\n\n"];
[descStr appendFormat:@"SASX Maximum Cycles: %@\n", GetInstructionCyclesString(&sasxMinTest, 10000, NULL)];
[descStr appendFormat:@"SASX Minimum Cycles: %@\n\n", GetInstructionCyclesString(&sasxMaxTest, 10000, NULL)];
return descStr;
}
static NSString* doSBC(ZennyInstViewController* controller)
{
NSMutableString *descStr = [NSMutableString stringWithCapacity:1000];
[descStr appendString:@"Description:\nSubtract with Carry subtracts the second source operand value and the value of NOT (Carry flag) from the first source operand value, and writes the result to the destination register. It can optionally update the condition flags based on the result.\n\n"];
[descStr appendFormat:@"SBC (immediate) Maximum Cycles: %@\n", GetInstructionCyclesString(&sbcImmMinTest, 10000, NULL)];
[descStr appendFormat:@"SBC (immediate) Minimum Cycles: %@\n\n", GetInstructionCyclesString(&sbcImmMaxTest, 10000, NULL)];
[descStr appendFormat:@"SBC (register) Maximum Cycles: %@\n", GetInstructionCyclesString(&sbcRegMinTest, 10000, NULL)];
[descStr appendFormat:@"SBC (register) Minimum Cycles: %@\n\n", GetInstructionCyclesString(&sbcRegMaxTest, 10000, NULL)];
[descStr appendFormat:@"SBC(register-shifted register) Maximum Cycles: %@\n", GetInstructionCyclesString(&sbcShftMinTest, 10000, NULL)];
[descStr appendFormat:@"SBC(register-shifted register) Minimum Cycles: %@\n\n", GetInstructionCyclesString(&sbcShftMaxTest, 10000, NULL)];
return descStr;
}
static NSString* doSBFX(ZennyInstViewController* controller)
{
NSMutableString *descStr = [NSMutableString stringWithCapacity:1000];
[descStr appendString:@"Signed Bit Field Extract extracts any number of adjacent bits at any position from a register, sign-extends them to 32 bits, and writes the result to the destination register.\n\n"];
[descStr appendFormat:@"SBFX Maximum Cycles: %@\n", GetInstructionCyclesString(&sbfxMinTest, 10000, NULL)];
[descStr appendFormat:@"SBFX Minimum Cycles: %@\n\n", GetInstructionCyclesString(&sbfxMaxTest, 10000, NULL)];
return descStr;
}
static NSString* doSEL(ZennyInstViewController* controller)
{
NSMutableString *descStr = [NSMutableString stringWithCapacity:1000];
[descStr appendString:@"Select Bytes selects each byte of its result from either its first operand or its second operand, according to the values of the GE flags.\n\n"];
[descStr appendFormat:@"SEL Maximum Cycles: %@\n", GetInstructionCyclesString(&selMinTest, 10000, NULL)];
[descStr appendFormat:@"SEL Minimum Cycles: %@\n\n", GetInstructionCyclesString(&selMaxTest, 10000, NULL)];
return descStr;
}
static NSString* SHADD16(ZennyInstViewController* controller)
{
NSMutableString *descStr = [NSMutableString stringWithCapacity:1000];
[descStr appendString:@"Signed Halving Add 16 performs two signed 16-bit integer additions, halves the results, and writes the results to the destination register.\n\n"];
[descStr appendFormat:@"SHADD16 Maximum Cycles: %@\n", GetInstructionCyclesString(&shadd16MinTest, 10000, NULL)];
[descStr appendFormat:@"SHADD16 Minimum Cycles: %@\n\n", GetInstructionCyclesString(&shadd16MaxTest, 10000, NULL)];
return descStr;
}
static NSString* SHADD8(ZennyInstViewController* controller)
{
NSMutableString *descStr = [NSMutableString stringWithCapacity:1000];
[descStr appendString:@"Signed Halving Add 8 performs four signed 8-bit integer additions, halves the results, and writes the results to the destination register.\n\n"];
[descStr appendFormat:@"SHADD8 Maximum Cycles: %@\n", GetInstructionCyclesString(&shadd8MinTest, 10000, NULL)];
[descStr appendFormat:@"SHADD8 Minimum Cycles: %@\n\n", GetInstructionCyclesString(&shadd8MaxTest, 10000, NULL)];
return descStr;
}
static NSString* SHASX(ZennyInstViewController* controller)
{
NSMutableString *descStr = [NSMutableString stringWithCapacity:1000];
[descStr appendString:@"Signed Halving Add and Subtract with Exchange exchanges the two halfwords of the second operand, performs one signed 16-bit integer addition and one signed 16-bit subtraction, halves the results, and writes the results to the destination register.\nThe pre-UAL syntax SHADDSUBX<c> is equivalent to SHASX<c>.\n\n"];
[descStr appendFormat:@"SHASX Maximum Cycles: %@\n", GetInstructionCyclesString(&shasxMinTest, 10000, NULL)];
[descStr appendFormat:@"SHASX Minimum Cycles: %@\n\n", GetInstructionCyclesString(&shasxMaxTest, 10000, NULL)];
return descStr;
}
static NSString* doSHSAX(ZennyInstViewController* controller)
{
NSMutableString *descStr = [NSMutableString stringWithCapacity:1000];
[descStr appendString:@"Signed Halving Subtract and Add with Exchange exchanges the two halfwords of the second operand, performs one signed 16-bit integer subtraction and one signed 16-bit addition, halves the results, and writes the results to the destination register.\nThe pre-UAL syntax SHSUBADDX<c> is equivalent to SHSAX<c>.\n\n"];
[descStr appendFormat:@"SHSAX Maximum Cycles: %@\n", GetInstructionCyclesString(&shsaxMinTest, 10000, NULL)];
[descStr appendFormat:@"SHSAX Minimum Cycles: %@\n\n", GetInstructionCyclesString(&shsaxMaxTest, 10000, NULL)];
return descStr;
}
static NSString* doSHSUB16(ZennyInstViewController* controller)
{
NSMutableString *descStr = [NSMutableString stringWithCapacity:1000];
[descStr appendString:@"Signed Halving Subtract 16 performs two signed 16-bit integer subtractions, halves the results, and writes the results to the destination register.\n\n"];
[descStr appendFormat:@"SHSUB16 Maximum Cycles: %@\n", GetInstructionCyclesString(&shsub16MinTest, 10000, NULL)];
[descStr appendFormat:@"SHSUB16 Minimum Cycles: %@\n\n", GetInstructionCyclesString(&shsub16MaxTest, 10000, NULL)];
return descStr;
}
static NSString* doSHSUB8(ZennyInstViewController* controller)
{
NSMutableString *descStr = [NSMutableString stringWithCapacity:1000];
[descStr appendString:@"Signed Halving Subtract 8 performs four signed 8-bit integer subtractions, halves the results, and writes the results to the destination register.\n\n"];
[descStr appendFormat:@"SHSUB8 Maximum Cycles: %@\n", GetInstructionCyclesString(&shsub8MinTest, 10000, NULL)];
[descStr appendFormat:@"SHSUB8 Minimum Cycles: %@\n\n", GetInstructionCyclesString(&shsub8MaxTest, 10000, NULL)];
return descStr;
}
static NSString* doSMLA(ZennyInstViewController* controller)
{
NSMutableString *descStr = [NSMutableString stringWithCapacity:1000];
[descStr appendString:@"Signed Multiply Accumulate (halfwords) performs a signed multiply-accumulate operation. The multiply acts on two signed 16-bit quantities, taken from either the bottom or the top half of their respective source registers. The other halves of these source registers are ignored. The 32-bit product is added to a 32-bit accumulate value and the result is written to the destination register.\nIf overflow occurs during the addition of the accumulate value, the instruction sets the Q flag in the APSR. It is not possible for overflow to occur during the multiplication.\n\n"];
[descStr appendFormat:@"SMLA Maximum Cycles: %@\n", GetInstructionCyclesString(&smlaMinTest, 10000, NULL)];
[descStr appendFormat:@"SMLA Minimum Cycles: %@\n\n", GetInstructionCyclesString(&smlaMaxTest, 10000, NULL)];
return descStr;
}
static NSString* doSMLAD(ZennyInstViewController* controller)
{
NSMutableString *descStr = [NSMutableString stringWithCapacity:1000];
[descStr appendString:@"Signed Multiply Accumulate Dual performs two signed 16 x 16-bit multiplications. It adds the products to a 32-bit accumulate operand.\nOptionally, you can exchange the halfwords of the second operand before performing the arithmetic. This produces top × bottom and bottom × top multiplication.\nThis instruction sets the Q flag if the accumulate operation overflows. Overflow cannot occur during the multiplications.\n\n"];
[descStr appendFormat:@"SMLAD Maximum Cycles: %@\n", GetInstructionCyclesString(&smladMinTest, 10000, NULL)];
[descStr appendFormat:@"SMLAD Minimum Cycles: %@\n\n", GetInstructionCyclesString(&smladMaxTest, 10000, NULL)];
return descStr;
}
static NSString* doSMLAL(ZennyInstViewController* controller)
{
NSMutableString *descStr = [NSMutableString stringWithCapacity:1000];
[descStr appendString:@"Signed Multiply Accumulate Long multiplies two signed 32-bit values to produce a 64-bit value, and accumulates this with a 64-bit value.\nIn ARM code, the condition flags can optionally be updated based on the result. Use of this option adversely affects performance on many processor implementations.\n\n"];
[descStr appendFormat:@"SMLAL Maximum Cycles: %@\n", GetInstructionCyclesString(&smlalMinTest, 10000, NULL)];
[descStr appendFormat:@"SMLAL Minimum Cycles: %@\n\n", GetInstructionCyclesString(&smlalMaxTest, 10000, NULL)];
return descStr;
}
static NSString* doSMLALxy(ZennyInstViewController* controller)
{
NSMutableString *descStr = [NSMutableString stringWithCapacity:1000];
[descStr appendString:@"Signed Multiply Accumulate Long (halfwords) multiplies two signed 16-bit values to produce a 32-bit value, and accumulates this with a 64-bit value. The multiply acts on two signed 16-bit quantities, taken from either the bottom or the top half of their respective source registers. The other halves of these source registers are ignored. The 32-bit product is sign-extended and accumulated with a 64-bit accumulate value.\nOverflow is possible during this instruction, but only as a result of the 64-bit addition. This overflow is not detected if it occurs. Instead, the result wraps around modulo 2^64\n\n"];
[descStr appendFormat:@"SMLAL<x><y> Maximum Cycles: %@\n", GetInstructionCyclesString(&smlalxyMinTest, 10000, NULL)];
[descStr appendFormat:@"SMLAL<x><y> Minimum Cycles: %@\n\n", GetInstructionCyclesString(&smlalxyMaxTest, 10000, NULL)];
return descStr;
}
static NSString* doSMLALD(ZennyInstViewController* controller)
{
NSMutableString *descStr = [NSMutableString stringWithCapacity:1000];
[descStr appendString:@"Signed Multiply Accumulate Long Dual performs two signed 16 × 16-bit multiplications. It adds the products to a 64-bit accumulate operand.\nOptionally, you can exchange the halfwords of the second operand before performing the arithmetic. This produces top × bottom and bottom × top multiplication.\nOverflow is possible during this instruction, but only as a result of the 64-bit addition. This overflow is not detected if it occurs. Instead, the result wraps around modulo 2^64.\n\n"];
[descStr appendFormat:@"SMLALD Maximum Cycles: %@\n", GetInstructionCyclesString(&smlaldMinTest, 10000, NULL)];
[descStr appendFormat:@"SMLALD Minimum Cycles: %@\n\n", GetInstructionCyclesString(&smlaldMaxTest, 10000, NULL)];
return descStr;
}
static NSString* doSMLALW(ZennyInstViewController* controller)
{
NSMutableString *descStr = [NSMutableString stringWithCapacity:1000];
[descStr appendString:@"Signed Multiply Accumulate (word by halfword) performs a signed multiply-accumulate operation. The multiply acts on a signed 32-bit quantity and a signed 16-bit quantity. The signed 16-bit quantity is taken from either the bottom or the top half of its source register. The other half of the second source register is ignored. The top 32 bits of the 48-bit product are added to a 32-bit accumulate value and the result is written to the destination register. The bottom 16 bits of the 48-bit product are ignored.\nIf overflow occurs during the addition of the accumulate value, the instruction sets the Q flag in the APSR. No overflow can occur during the multiplication.\n\n"];
[descStr appendFormat:@"SMLAW Maximum Cycles: %@\n", GetInstructionCyclesString(&smlawMinTest, 10000, NULL)];
[descStr appendFormat:@"SMLAW Minimum Cycles: %@\n", GetInstructionCyclesString(&smlawMaxTest, 10000, NULL)];
return descStr;
}
static NSString* doSMLSD(ZennyInstViewController* controller)
{
NSMutableString *descStr = [NSMutableString stringWithCapacity:1000];
[descStr appendString:@"Signed Multiply Subtract Dual performs two signed 16 × 16-bit multiplications. It adds the difference of the products to a 32-bit accumulate operand.\nOptionally, you can exchange the halfwords of the second operand before performing the arithmetic. This produces top × bottom and bottom × top multiplication.\nThis instruction sets the Q flag if the accumulate operation overflows. Overflow cannot occur during the multiplications or subtraction.\n\n"];
[descStr appendFormat:@"SMLSD Maximum Cycles: %@\n", GetInstructionCyclesString(&smlsdMinTest, 10000, NULL)];
[descStr appendFormat:@"SMLSD Minimum Cycles: %@\n\n", GetInstructionCyclesString(&smlsdMaxTest, 10000, NULL)];
return descStr;
}
static NSString* doSMLSLD(ZennyInstViewController* controller)
{
NSMutableString *descStr = [NSMutableString stringWithCapacity:1000];
[descStr appendString:@"Signed Multiply Subtract Long Dual performs two signed 16 × 16-bit multiplications. It adds the difference of the products to a 64-bit accumulate operand.\nOptionally, you can exchange the halfwords of the second operand before performing the arithmetic. This produces top × bottom and bottom × top multiplication.\nOverflow is possible during this instruction, but only as a result of the 64-bit addition. This overflow is not detected if it occurs. Instead, the result wraps around modulo 2^64.\n\n"];
[descStr appendFormat:@"SMLSLD Maximum Cycles: %@\n", GetInstructionCyclesString(&smlsldMinTest, 10000, NULL)];
[descStr appendFormat:@"SMLSLD Minimum Cycles: %@\n\n", GetInstructionCyclesString(&smlsldMaxTest, 10000, NULL)];
return descStr;
}
static NSString* doSMMLA(ZennyInstViewController* controller)
{
NSMutableString *descStr = [NSMutableString stringWithCapacity:1000];
[descStr appendString:@"Signed Most Significant Word Multiply Accumulate multiplies two signed 32-bit values, extracts the most significant 32 bits of the result, and adds an accumulate value.\nOptionally, you can specify that the result is rounded instead of being truncated. In this case, the constant 0x80000000 is added to the product before the high word is extracted.\n\n"];
[descStr appendFormat:@"SMMLA Maximum Cycles: %@\n", GetInstructionCyclesString(&smmlaMinTest, 10000, NULL)];
[descStr appendFormat:@"SMMLA Minimum Cycles: %@\n\n", GetInstructionCyclesString(&smmlaMaxTest, 10000, NULL)];
return descStr;
}
static NSString* doSMMLS(ZennyInstViewController* controller)
{
NSMutableString *descStr = [NSMutableString stringWithCapacity:1000];
[descStr appendString:@"Signed Most Significant Word Multiply Subtract multiplies two signed 32-bit values, extracts the most significant 32 bits of the result, and subtracts it from an accumulate value.\nOptionally, you can specify that the result is rounded instead of being truncated. In this case, the constant 0x80000000 is added to the product before the high word is extracted.\n\n"];
[descStr appendFormat:@"SMMLS Maximum Cycles: %@\n", GetInstructionCyclesString(&smmlsMinTest, 10000, NULL)];
[descStr appendFormat:@"SMMLS Minimum Cycles: %@\n\n", GetInstructionCyclesString(&smmlsMaxTest, 10000, NULL)];
return descStr;
}
static NSString* doSMMUL(ZennyInstViewController* controller)
{
NSMutableString *descStr = [NSMutableString stringWithCapacity:1000];
[descStr appendString:@"Signed Most Significant Word Multiply multiplies two signed 32-bit values, extracts the most significant 32 bits of the result, and writes those bits to the destination register.\nOptionally, you can specify that the result is rounded instead of being truncated. In this case, the constant 0x80000000 is added to the product before the high word is extracted.\n\n"];
[descStr appendFormat:@"SMMUL Maximum Cycles: %@\n", GetInstructionCyclesString(&smmlsMinTest, 10000, NULL)];
[descStr appendFormat:@"SMMUL Minimum Cycles: %@\n\n", GetInstructionCyclesString(&smmlsMaxTest, 10000, NULL)];
return descStr;
}
static NSString* doSMUAD(ZennyInstViewController* controller)
{
NSMutableString *descStr = [NSMutableString stringWithCapacity:1000];
[descStr appendString:@"Signed Dual Multiply Add performs two signed 16 × 16-bit multiplications. It adds the products together, and writes the result to the destination register.\nOptionally, you can exchange the halfwords of the second operand before performing the arithmetic. This produces top × bottom and bottom × top multiplication.\nThis instruction sets the Q flag if the addition overflows. The multiplications cannot overflow.\n\n"];
[descStr appendFormat:@"SMUAD Maximum Cycles: %@\n", GetInstructionCyclesString(&smuadMinTest, 10000, NULL)];
[descStr appendFormat:@"SMUAD Minimum Cycles: %@\n\n", GetInstructionCyclesString(&smuadMaxTest, 10000, NULL)];
return descStr;
}
static NSString* doSMUL(ZennyInstViewController* controller)
{
NSMutableString *descStr = [NSMutableString stringWithCapacity:1000];
[descStr appendString:@"Signed Multiply (halfwords) multiplies two signed 16-bit quantities, taken from either the bottom or the top half of their respective source registers. The other halves of these source registers are ignored. The 32-bit product is written to the destination register. No overflow is possible during this instruction.\n\n"];
[descStr appendFormat:@"SMUL Maximum Cycles: %@\n", GetInstructionCyclesString(&smulMinTest, 10000, NULL)];
[descStr appendFormat:@"SMUL Minimum Cycles: %@\n\n", GetInstructionCyclesString(&smulMaxTest, 10000, NULL)];
return descStr;
}
static NSString* doSMULL(ZennyInstViewController* controller)
{
NSMutableString *descStr = [NSMutableString stringWithCapacity:1000];
[descStr appendString:@"Signed Multiply Long multiplies two 32-bit signed values to produce a 64-bit result.\nIn ARM code, the condition flags can optionally be updated based on the result. Use of this option adversely affects performance on many processor implementations.\n\n"];
[descStr appendFormat:@"SMULL Maximum Cycles: %@\n", GetInstructionCyclesString(&smullMinTest, 10000, NULL)];
[descStr appendFormat:@"SMULL Minimum Cycles: %@\n\n", GetInstructionCyclesString(&smullMaxTest, 10000, NULL)];
return descStr;