1 // SPDX-License-Identifier: 0BSD
3 ///////////////////////////////////////////////////////////////////////////////
5 /// \file testfilegen-arm64.c
6 /// \brief Generates uncompressed test file for the ARM64 filter
8 // Author: Lasse Collin
10 ///////////////////////////////////////////////////////////////////////////////
17 static uint32_t pc4
= 0;
23 putchar((v
>> 0) & 0xFF);
24 putchar((v
>> 8) & 0xFF);
25 putchar((v
>> 16) & 0xFF);
26 putchar((v
>> 24) & 0xFF);
34 imm
&= (1U << 26) - 1;
41 putadrp32(uint32_t imm
)
45 // fprintf(stderr, "ADRP 0x%08X\n", imm);
47 uint32_t instr
= 0x90000000;
48 instr
|= (pc4
* 5 + 11) & 0x1F;
49 instr
|= (imm
& 3) << 29;
50 instr
|= (imm
>> 2) << 5;
96 for (unsigned rep
= 0; rep
< 2; ++rep
) {
97 while ((pc4
<< 2) & 4095)
100 for (unsigned i
= 10; i
<= 21; ++i
) {
101 const uint32_t neg
= (0x1FFF00 >> (21 - i
)) & ~255U;
102 const uint32_t plus
= 1U << (i
- 1);
103 putadrp32(0x000000 | plus
);
104 putadrp32(0x000005 | plus
);
105 putadrp32(0x0000FE | plus
);
106 putadrp32(0x0000FF | plus
);
108 putadrp32(0x000000 | neg
);
109 putadrp32(0x000005 | neg
);
110 putadrp32(0x0000FE | neg
);
111 putadrp32(0x0000FF | neg
);