asmb: ups @ alignment und mehr testfaelle
[uebersetzerbau-ss10.git] / asmb / asmbtest.c
index 45c13956309edf77cae0f52e589227433a1434f3..1e536fa2a7f039a0dfd22505f6869c0d71b3d535 100644 (file)
@@ -39,6 +39,31 @@ static void hexdump(void *d, int len) {
        }
 }
 
+static void fillregisters(void)
+{
+       __asm__("push %rdx\n\t");
+       __asm__("mov $12345678, %rdx\n\t");
+
+       __asm__("movq %rdx, %xmm0\n\t");
+       __asm__("movq %rdx, %xmm1\n\t");
+       __asm__("movq %rdx, %xmm2\n\t");
+       __asm__("movq %rdx, %xmm3\n\t");
+       __asm__("movq %rdx, %xmm4\n\t");
+       __asm__("movq %rdx, %xmm5\n\t");
+       __asm__("movq %rdx, %xmm6\n\t");
+       __asm__("movq %rdx, %xmm7\n\t");
+       __asm__("movq %rdx, %xmm8\n\t");
+       __asm__("movq %rdx, %xmm9\n\t");
+       __asm__("movq %rdx, %xmm10\n\t");
+       __asm__("movq %rdx, %xmm11\n\t");
+       __asm__("movq %rdx, %xmm12\n\t");
+       __asm__("movq %rdx, %xmm13\n\t");
+       __asm__("movq %rdx, %xmm14\n\t");
+       __asm__("movq %rdx, %xmm15\n\t");
+       __asm__("pop %rdx\n\t");
+}
+
+
 #define NUM_TESTCASES 18
 int main()
 {
@@ -82,6 +107,26 @@ int main()
                16,
                17,
        };
+       int off[NUM_TESTCASES] = {
+               0,
+               0,
+               0,
+               0,
+               1,
+               2,
+               2,
+               1,
+               3,
+               6,
+               5,
+               6,
+               6,
+               2,
+               0,
+               0,
+               0,
+               0,
+       };
        char *output_our, *output_ref;
        char *input_our,  *input_ref;
        int right=0, wrong=0, neither=0, i;
@@ -93,8 +138,9 @@ int main()
                (void) memcpy(input_our, input[i], len[i]+1);
                (void) memcpy(input_ref, input[i], len[i]+1);
 
-               output_our = (char *) asmb((unsigned char *) input_our);
-               output_ref = (char *) asmb_ref((unsigned char *) input_ref);
+               fillregisters();
+               output_our = (char *) asmb((unsigned char *) input_our+off[i]);
+               output_ref = (char *) asmb_ref((unsigned char *) input_ref+off[i]);
 
                if(memcmp(output_our,output_ref, len[i]) != 0) {
                        if(strncmp(output_our, output_ref, len[i]) == 0) {