arm64: codea/abgabe_aa.0
[uebersetzerbau-ss10.git] / asmb / asmb.s
1         .file   "asmb.c"
2         .data
3         .align 16
4 const65:
5         .rept 16
6         .byte 0x65
7         .endr
8 const20:
9         .rept 16
10         .byte 0x20
11         .endr
12 constc0:
13         .rept 16
14         .byte 0xc0
15         .endr
16 const00:
17         .rept 16
18         .byte 0x00
19         .endr
20
21         .text
22 .globl asmb
23 asmb:
24         //speicheradresse des parameters zurueckgeben
25         mov %rdi, %rax
26
27 .nextround:
28         //speicheradresse des pointers zeigt auf 16*8 feld = 128bit
29         movdqu (%rdi), %xmm11
30
31         // -64 - c
32         movdqa constc0, %xmm9
33         psubb %xmm11, %xmm9
34
35         // Packed COMpare Greater Than (Byte)"
36         // achtung beim intuitiven lesen des befehles. 'kleiner'
37         // ist mit 'groesser' vertauscht und vice versa
38         pcmpgtb const65, %xmm9
39
40 .differenz:
41         // Y = min(X, 'a' - 'A')
42         pand const20, %xmm9
43
44         // c += Y
45         paddb %xmm9, %xmm11
46
47         // retuniere an die richtige speicheradresse
48         movdqu %xmm11, (%rdi)
49
50         //entspricht ein byte dem nullbyte dann steht an jener stelle 0xff sonst 0x00
51         pcmpeqb const00, %xmm11
52         //hol die MSBs aller bytes raus
53         pmovmskb %xmm11, %ecx
54         add $16, %rdi
55
56         //ist %ecx gleich null? dann die naechsten 16byte bitte
57         jecxz .nextround
58
59         ret