X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=asma%2Fasma.s;fp=asma%2Fasma.s;h=9ea72d32ba5a7e8e62c46648c08337ada17bd5be;hb=0d97ed199d30d832052b90442e53d13c07ec55f0;hp=d1202ced60a193c1466f7ae3035f0d99abff2a5a;hpb=7ca578dcc2d598744196f55a89ff1e0d6dfa1fd5;p=uebersetzerbau-ss10.git diff --git a/asma/asma.s b/asma/asma.s index d1202ce..9ea72d3 100644 --- a/asma/asma.s +++ b/asma/asma.s @@ -2,17 +2,17 @@ .section .rodata .align 128 -const9a: +const65: .rept 16 - .byte 0x9a + .byte 0x65 .endr const20: .rept 16 .byte 0x20 .endr -const3f: +constc0: .rept 16 - .byte 0x3f + .byte 0xc0 .endr .text @@ -20,37 +20,41 @@ const3f: .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 */ - movdqa const9a, %xmm8 + // folgendes kann umgeformt werden: + // (mathematisch ned ganz korrekt) + // X = 'Z' + 1 + min_t - 'A' > c + min_t - 'A' ? 0xff : 0 + // X = -102 > c + 63 ? 0xff : 0 + // X = c + 63 < -102 ? 0xff : 0 + // X = -(c + 63) > 102 ? 0xff : 0 + // X = -63 - c > 102 ? 0xff : 0 + // X = -63 - c - 1 > 102 - 1 ? 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 - /*addiere in %xmm11 "min_t-'A'" - * = -128 - 65 = 63 = 0x3f - * c+min_t-'A' */ - paddb const3f, %xmm11 + // -64 - c + movdqa constc0, %xmm9 + psubb %xmm11, %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 + // "Packed COMpare Greater Than (Byte)" + // achtung beim intuitiven lesen des befehles. 'kleiner' + // ist mit 'groesser' vertauscht und vice versa + pcmpgtb const65, %xmm9 - /*Y = min(X, 'a' - 'A') - * mit "'a'-'A'= 97-65 = 32 = 0x20 */ - pminub const20, %xmm8 + // Y = min(X, 'a' - 'A') + // mit 'a'-'A'= 97-65 = 32 = 0x20 + pminub const20, %xmm9 - //retuniere an die richtige speicheradresse + // c += Y + paddb %xmm9, %xmm11 + + // retuniere an die richtige speicheradresse mov %rdi, %rax - //c += Y - psubb const3f, %xmm11 - paddb %xmm11, %xmm8 - movdqu %xmm8, (%rax) + movdqu %xmm11, (%rax) ret .LFE2: