1# mach: all 2# output: 3# sim: --environment operating 4 5.include "t-macros.i" 6 7 start 8 9;; The d10v implements negated addition for subtraction 10 11 .macro check_subi s x y r c v 12 ;; clear carry 13 ldi r6,#0x8004 14 mvtc r6,cr0 15 ;; subtract 16 ldi r10,#\x 17 SUBI r10,#\y 18 ;; verify result 19 ldi r11, #\r 20 cmpeq r10, r11 21 brf0t 1f 22 ldi r6, 1 23 ldi r2, \s 24 trap 15 251: 26 ;; verify carry 27 mvfc r6, cr0 28 and3 r6, r6, #1 29 cmpeqi r6, #\c 30 brf0t 1f 31 ldi r6, 1 32 ldi r2, \s 33 trap 15 341: 35 .endm 36 37 check_subi 1 0000 0x0000 0xfff0 00 ;; 0 - 0x10 38 check_subi 2 0x0000 0x0001 0xffff 0 0 39 check_subi 3 0x0001 0x0000 0xfff1 0 0 40 check_subi 4 0x0001 0x0001 0x0000 1 0 41 check_subi 5 0x8000 0x0001 0x7fff 1 1 42 43 exit0 44