diff options
| -rw-r--r-- | main.c | 7 | ||||
| -rw-r--r-- | test/test.sh | 25 |
2 files changed, 15 insertions, 17 deletions
@@ -1,5 +1,4 @@ #include "minias.h" -#include <getopt.h> /* Parsed assembly */ static AsmLine *allasm = NULL; @@ -29,7 +28,7 @@ static Section *datarel = NULL; static char *infilename = "<stdin>"; static size_t curlineno = 0; -void lfatal(const char *fmt, ...) { +static void lfatal(const char *fmt, ...) { va_list ap; fprintf(stderr, "%s:%ld: ", infilename, curlineno); va_start(ap, fmt); @@ -155,7 +154,7 @@ static void initsections(void) { datarel->hdr.sh_entsize = sizeof(Elf64_Rela); } -Relocation *newreloc() { +static Relocation *newreloc() { if (nrelocs == reloccap) { reloccap = nrelocs ? nrelocs * 2 : 64; relocs = xreallocarray(relocs, reloccap, sizeof(Relocation)); @@ -559,7 +558,7 @@ static void assemblexchg(const Instr *xchg) { rex = (Rex){ .required = isrexreg(xchg->arg1->kind) || isrexreg(xchg->arg2->kind), .w = isreg64(xchg->arg1->kind) || isreg64(xchg->arg2->kind), - .r = !!(regbits(reg) & (1 << 3)), + .b = !!(regbits(reg) & (1 << 3)), }; assembleplusr(rex, prefix, opcode, regbits(reg)); } else { diff --git a/test/test.sh b/test/test.sh index 7ee3855..f1015a4 100644 --- a/test/test.sh +++ b/test/test.sh @@ -30,6 +30,18 @@ t () { echo -n "." } +# Various regression tests first. +t "xchgq %r13, %rax" +t "movl \$1000, %r8d" +t "movb %sil, (%rdi)" +t "movsbq (%rax), %rbx" +t "movq $-4132994306676758123, %rcx" +t "mov \$17293822569102704639, %rax" +t "callq *%rax" +t "callq *%r10" +t "movb %r11b, (%rsi, %r12, 1)" + + for r in rax r10 do for x in xmm0 xmm13 @@ -41,19 +53,6 @@ do done done -t "movl \$1000, %r8d" - -t "movb %sil, (%rdi)" - -t "movsbq (%rax), %rbx" - -t "movq $-4132994306676758123, %rcx" -t "mov \$17293822569102704639, %rax" - -t "callq *%rax" -t "callq *%r10" - -t "movb %r11b, (%rsi, %r12, 1)" t "cvttsd2si %xmm1, %rax" t "cvttsd2si %xmm10, %rax" |
