1# sh testcase for neg $rm, $rn -*- Asm -*- 2# mach: all 3# as: -isa=shcompact 4# ld: -m shelf32 5 6 .include "compact/testutils.inc" 7 8 .macro signbit sign 9 shlr16 r1 10 shlr8 r1 11 shlr r1 12 shlr r1 13 shlr r1 14 shlr r1 15 shlr r1 16 shlr r1 17 shlr r1 18 assert r1, \sign 19 .endm 20 start 21 22 .global neg 23neg: 24 mov #0, r0 25 neg r0, r1 26 signbit #0 27 28 mov #42, r0 29 neg r0, r1 30 signbit #1 31 32 mov #0, r0 33 or #25, r0 34 neg r0, r1 35 signbit #1 36 37 # neg(0) is 0. 38 mov #0, r0 39 neg r0, r1 40 signbit #0 41 42 # neg(neg(x)) = x. 43 mov #42, r0 44 neg r0, r1 45 signbit #1 46 mov #42, r0 47 neg r0, r2 48 neg r2, r1 49 signbit #0 50 51okay: 52 pass 53 54wrong: 55 fail 56