2
; Copyright 1992 by Jutta Degener and Carsten Bormann, Technische
3
; Universitaet Berlin. See the accompanying file "COPYRIGHT" for
4
; details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE.
7
; Lines starting with ' (in the first col) are echoed.
8
; Lines starting with " (in the first col) are echoed to stderr.
9
; Lines starting with ; or empty lines are ignored.
11
; The part after (including) a trailing '=' is what you expect;
12
; there will be output if the result is different.
14
; - and + by itself mean MIN_WORD and MAX_WORD, respectively;
15
; -- and ++ mean MIN_LONGWORD and MAX_LONGWORD.
18
'test the basic arithmetic operations used for the rpe-ltd filtering.
51
add -1 -32766 = -32767
59
'L_add ================
77
; (max-longword = 2147483647)
80
L_add -1 ++ = 2147483646
81
L_add 2147483646 2 = ++
82
L_add 1 2147483645 = 2147483646
85
; (min-longword = -2147483648)
89
L_add 1 -- = -2147483647
90
L_add -2147483647 -2 = --
91
L_add -1 -2147483646 = -2147483647
92
L_add -2147483647 -1 = --
139
'L_sub ================
160
L_sub ++ 1 = 2147483646
161
L_sub 1 ++ = -2147483646
162
L_sub 0 ++ = -2147483647
166
L_sub -- -1 = -2147483647
173
L_sub -2147483647 2 = --
177
'abs ================
193
'mult ================
194
; actually, a * b >> 15
199
mult 4711 0x4000 = 2355
204
mult -0x100 0x100 = -2
205
mult 0x100 -0x100 = -2
206
mult -0x100 -0x100 = 2
208
mult -4711 0x4000 = -2356
209
mult 4711 -0x4000 = -2356
210
mult -4711 -0x4000 = 2355
214
mult + 0x4000 = 0x3fff
215
mult 0x4000 + = 0x3fff
229
'mult_r ================
230
; actually, (a * b + 16384) >> 15
234
mult_r 0x100 0x100 = 2
235
mult_r 4711 0x4000 = 2356
240
mult_r -0x100 0x100 = -2
241
mult_r 0x100 -0x100 = -2
242
mult_r -0x100 -0x100 = 2
244
mult_r -4711 0x4000 = -2355
245
mult_r 4711 -0x4000 = -2355
246
mult_r -4711 -0x4000 = 2356
250
mult_r + 32766 = 32765
251
mult_r 32766 + = 32765
252
mult_r + 0x4000 = 0x4000
253
mult_r 0x4000 + = 0x4000
254
mult_r + 0x4001 = 0x4000
255
mult_r 0x4001 + = 0x4000
271
'L_mult ================
272
; actually, (a * b) << 1
273
; assert (a != MIN_WORD && b != MIN_WORD)
278
L_mult 4711 5 = 47110
285
L_mult -4711 5 = -47110
286
L_mult 4711 -5 = -47110
287
L_mult -4711 -5 = 47110
290
L_mult + + = 2147352578
291
L_mult + -32767 = -2147352578
292
L_mult -32767 + = -2147352578
300
'div ================
301
; actually, (32767 * a) / b
302
; assert (a > 0 && b >= a)
313
div 0x4000 + = 0x4000
317
'norm ================
367
'L_>> ================
378
L_>> 0x88 -5 = 0x1100
385
L_>> ++ 1 = 1073741823
386
L_>> -- 1 = -1073741824
400
<< 0x1100 -5 = 0x0088
413
'L_<< ================
418
L_<< 0x0088 5 = 0x1100
424
L_<< 0x1100 -5 = 0x0088
432
L_<< -4711 -4711 = -1
439
'add ================
470
M_add -1 -32766 = -32767
478
'L_add ================
496
; (max-longword = 2147483647)
499
M_L_add -1 ++ = 2147483646
500
M_L_add 2147483646 2 = ++
501
M_L_add 1 2147483645 = 2147483646
504
; (min-longword = -2147483648)
508
M_L_add 1 -- = -2147483647
509
M_L_add -2147483647 -2 = --
510
M_L_add -1 -2147483646 = -2147483647
511
M_L_add -2147483647 -1 = --
518
'sub ================
558
'abs ================
574
'mult ================
575
; actually, a * b >> 15
579
M_mult 0x100 0x100 = 2
580
M_mult 4711 0x4000 = 2355
585
M_mult -0x100 0x100 = -2
586
M_mult 0x100 -0x100 = -2
587
M_mult -0x100 -0x100 = 2
589
M_mult -4711 0x4000 = -2356
590
M_mult 4711 -0x4000 = -2356
591
M_mult -4711 -0x4000 = 2355
595
M_mult + 0x4000 = 0x3fff
596
M_mult 0x4000 + = 0x3fff
602
; M_mult - - = + assert !(a == b && b == MIN_WORD)
612
'mult_r ================
613
; actually, (a * b + 16384) >> 15
617
M_mult_r 0x100 0x100 = 2
618
M_mult_r 4711 0x4000 = 2356
623
M_mult_r -0x100 0x100 = -2
624
M_mult_r 0x100 -0x100 = -2
625
M_mult_r -0x100 -0x100 = 2
627
M_mult_r -4711 0x4000 = -2355
628
M_mult_r 4711 -0x4000 = -2355
629
M_mult_r -4711 -0x4000 = 2356
633
M_mult_r + 32766 = 32765
634
M_mult_r 32766 + = 32765
635
M_mult_r + 0x4000 = 0x4000
636
M_mult_r 0x4000 + = 0x4000
637
M_mult_r + 0x4001 = 0x4000
638
M_mult_r 0x4001 + = 0x4000
646
; M_mult_r - - = + assert !(a == b && b == MIN_WORD)
647
M_mult_r - -32767 = +
648
M_mult_r -32767 - = +
649
M_mult_r - + = -32767
650
M_mult_r + - = -32767
656
'L_mult ================
657
; actually, (a * b) << 1
658
; assert (a != MIN_WORD && b != MIN_WORD)
663
M_L_mult 4711 5 = 47110
670
M_L_mult -4711 5 = -47110
671
M_L_mult 4711 -5 = -47110
672
M_L_mult -4711 -5 = 47110
675
M_L_mult + + = 2147352578
676
M_L_mult + -32767 = -2147352578
677
M_L_mult -32767 + = -2147352578
678
M_L_mult + 2 = 131068