ld: Move the .note.build-id section to near the start of the memory map.
[binutils-gdb.git] / sim / testsuite / bfin / loop_strncpy.s
blob13b3711986dea9f61a8d3da84ac3aa06a4fa1d84
1 # Blackfin testcase for loop counter values when jumping out from the last insn
2 # mach: bfin
4 .include "testutils.inc"
5 start
7 init_r_regs 0;
8 ASTAT = R0;
10 loadsym r1, dest;
11 r0 = r1;
12 loadsym r1, src;
13 r2 = 0x10;
15 _strncpy:
16 CC = R2 == 0;
17 if CC JUMP 4f;
19 P2 = R2 ; /* size */
20 P0 = R0 ; /* dst*/
21 P1 = R1 ; /* src*/
23 LSETUP (1f, 2f) LC0 = P2;
25 R1 = B [P1++] (Z);
26 B [P0++] = R1;
27 CC = R1 == 0;
29 if CC jump 3f;
31 fail
33 /* if src is shorter than n, we need to null pad bytes in dest
34 * but, we can get here when the last byte is zero, and we don't
35 * want to copy an extra byte at the end, so we need to check
38 R2 = LC0;
39 CHECKREG R2, 0x0a;
41 CC = R2
42 if ! CC jump 4f;
44 LSETUP(5f, 5f) LC0;
46 B [P0++] = R1;
49 loadsym P1, answer;
50 P0 = R0;
51 p2 = 0x20;
52 LSETUP (6f, 7f) LC0 = P2;
54 R1 = B [P0++];
55 R2 = B [P1++];
56 CC = R1 == R2
57 IF ! CC JUMP wrong;
59 NOP;
61 pass
63 wrong:
64 fail
66 .data
67 dest:
68 .db 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F
69 .db 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F
71 src:
72 .db 0x21, 0x22, 0x23, 0x24, 0x25, 0x00, 0x27, 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F, 0x30
74 answer:
75 .db 0x21, 0x22, 0x23, 0x24, 0x25, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
76 .db 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F