X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=asma%2Fasma.s;h=cb1e8bcf36317fda065159f731e50d9f0ef17882;hb=020045d98425b700c8b80b25b43584e0f5ce0dfc;hp=84151dbc1036afc4dc32a8cf596cccca3de318f8;hpb=6cdccfe4958f645af86bf210f33c05f0f8221172;p=uebersetzerbau-ss10.git diff --git a/asma/asma.s b/asma/asma.s index 84151db..cb1e8bc 100644 --- a/asma/asma.s +++ b/asma/asma.s @@ -1,51 +1,58 @@ .file "asma.c" + + .data + .align 16 +const65: + .rept 16 + .byte 0x65 + .endr +const20: + .rept 16 + .byte 0x20 + .endr +constc0: + .rept 16 + .byte 0xc0 + .endr + .text .globl asma .type asma, @function asma: .LFB2: - /*init %xmm8 mit "'Z' + 1 + min_t - 'A'" fuer jedes byte - * 'Z' + 1 + min_t - 'A' = 90 + 1 - 128 - 65 = -102 - * 102 = 01100110 - * ~102 = 10011001 - * (~102)+1 = 10011010 = 0x9A */ - mov $0x9a9a9a9a9a9a9a9a, %rax - movq %rax, %xmm15 - movddup %xmm15, %xmm8 - - //init %xmm9 mit "'a'-'A'= 97-65 = 32 = 0x20 - mov $0x2020202020202020, %rax - movq %rax, %xmm15 - movddup %xmm15, %xmm9 + // folgendes kann umgeformt werden (max_t = 127) + // X = 'Z' + 1 + min_t - 'A' > c + min_t - 'A' ? 0xff : 0 + // X = -c + max_t + 'A' > - 'Z' -1 + max_t + 'A' ? 0xff : 0 + // X = -c + 127 + 65 > - 90 - 1 + 127 + 65 ? 0xff : 0 + // X = -c - 64 > 101 ? 0xff : 0 + // X = -64 - c > 101 ? 0xff : 0 + // ... + // 101 = 0x65 + // -64 = 0xc0 - //speicheradresse des pointers zeigt auf 16*8 feld = 128bit + // speicheradresse des pointers zeigt auf 16*8 feld = 128bit movdqu (%rdi), %xmm11 - movdqu (%rdi), %xmm12 - /*addiere in %xmm11 "min_t-'A'" - * = -128 - 65 = 63 = 0x3f */ - mov $0x3f3f3f3f3f3f3f3f, %rax - movq %rax, %xmm15 - movddup %xmm15, %xmm10 + // -64 - c + movdqa constc0, %xmm9 + psubb %xmm11, %xmm9 - //c+min_t-'A' - paddb %xmm10, %xmm11 + // "Packed COMpare Greater Than (Byte)" + // achtung beim intuitiven lesen des befehles. 'kleiner' + // ist mit 'groesser' vertauscht und vice versa + pcmpgtb const65, %xmm9 - /*"Packed COMpare Greater Than (Byte)" - * X = 'Z' + 1 + min_t - 'A' > c + min_t - 'A' ? 0xff : 0 - * achtung beim intuitiven lesen des befehles. 'kleiner' - * ist mit 'groesser' vertauscht und vice versa */ - pcmpgtb %xmm11, %xmm8 + // Y = min(X, 'a' - 'A') + // mit 'a'-'A'= 97-65 = 32 = 0x20 + pminub const20, %xmm9 - //Y = min(X, 'a' - 'A') - pminub %xmm9, %xmm8 + // c += Y + paddb %xmm9, %xmm11 - //c += Y - paddb %xmm8, %xmm12 - - //retuniere an die richtige speicheradresse + // retuniere an die richtige speicheradresse mov %rdi, %rax - movapd %xmm12, (%rax) + movdqu %xmm11, (%rax) + ret .LFE2: .size asma, .-asma