asma: formel "umgeformt" und im endeffekt einen befehl "gewonnen" (haha)
[uebersetzerbau-ss10.git] / asma / asma.s
1         .file   "asma.c"
2
3 .section .rodata
4 .align 128
5 const65:
6         .rept 16
7         .byte 0x65
8         .endr
9 const20:
10         .rept 16
11         .byte 0x20
12         .endr
13 constc0:
14         .rept 16
15         .byte 0xc0
16         .endr
17
18         .text
19 .globl asma
20         .type   asma, @function
21 asma:
22 .LFB2:
23         // folgendes kann umgeformt werden:
24         // (mathematisch ned ganz korrekt)
25         // X = 'Z' + 1 + min_t - 'A' > c + min_t - 'A' ? 0xff : 0
26         // X = -102         >  c + 63 ? 0xff : 0
27         // X = c + 63       < -102 ? 0xff : 0
28         // X = -(c + 63)    >  102 ? 0xff : 0
29         // X = -63 - c      >  102 ? 0xff : 0
30         // X = -63 - c - 1  >  102 - 1 ? 0xff : 0
31         // X = -64 - c      >  101 ? 0xff : 0
32         // ...
33         // 101 = 0x65
34         // -64 = 0xc0
35
36         // speicheradresse des pointers zeigt auf 16*8 feld = 128bit
37         movdqu (%rdi), %xmm11
38
39         // -64 - c
40         movdqa constc0, %xmm9
41         psubb %xmm11, %xmm9
42
43         // "Packed COMpare Greater Than (Byte)"
44         // achtung beim intuitiven lesen des befehles. 'kleiner'
45         // ist mit 'groesser' vertauscht und vice versa
46         pcmpgtb const65, %xmm9
47
48         // Y = min(X, 'a' - 'A')
49         // mit 'a'-'A'= 97-65 = 32 = 0x20
50         pminub const20, %xmm9
51
52         // c += Y
53         paddb %xmm9, %xmm11
54
55         // retuniere an die richtige speicheradresse
56         mov %rdi, %rax
57         movdqu %xmm11, (%rax)
58
59         ret
60 .LFE2:
61         .size   asma, .-asma
62         .section        .eh_frame,"a",@progbits
63 .Lframe1:
64         .long   .LECIE1-.LSCIE1
65 .LSCIE1:
66         .long   0x0
67         .byte   0x1
68         .string "zR"
69         .uleb128 0x1
70         .sleb128 -8
71         .byte   0x10
72         .uleb128 0x1
73         .byte   0x3
74         .byte   0xc
75         .uleb128 0x7
76         .uleb128 0x8
77         .byte   0x90
78         .uleb128 0x1
79         .align 8
80 .LECIE1:
81 .LSFDE1:
82         .long   .LEFDE1-.LASFDE1
83 .LASFDE1:
84         .long   .LASFDE1-.Lframe1
85         .long   .LFB2
86         .long   .LFE2-.LFB2
87         .uleb128 0x0
88         .align 8
89 .LEFDE1:
90         .ident  "GCC: (Debian 4.3.2-1.1) 4.3.2"
91         .section        .note.GNU-stack,"",@progbits