X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=asma%2Fasma.s;h=d17f4e1ae72efd795c7fe7a832dd7d7328ece8ff;hb=HEAD;hp=4881e0b0924b2bc6f955b1fd1cebbce808fa6329;hpb=e195ada341d6b5f6aa5f8969430fee9a6a4780b9;p=uebersetzerbau-ss10.git diff --git a/asma/asma.s b/asma/asma.s index 4881e0b..d17f4e1 100644 --- a/asma/asma.s +++ b/asma/asma.s @@ -1,81 +1,52 @@ - .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 %xmm1 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, %rbx - movq %rbx, %xmm7 - movddup %xmm7, %xmm1 - - //init %xmm2 mit "'a'-'A'= 97-65 = 32 = 0x20 - mov $0x2020202020202020, %rbx - movq %rbx, %xmm7 - movddup %xmm7, %xmm2 - - //speicheradresse des pointers zeigt auf 16*8 feld = 128bit - movdqu (%rdi), %xmm4 - movdqu (%rdi), %xmm5 - - /*addiere in %xmm4 "min_t-'A'" - * = -128 - 65 = 63 = 0x3f */ - mov $0x3f3f3f3f3f3f3f3f, %rbx - movq %rbx, %xmm7 - movddup %xmm7, %xmm3 - - //c+min_t-'A' - paddb %xmm3, %xmm4 - - /*"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 %xmm4, %xmm1 - - //Y = min(X, 'a' - 'A') - pminub %xmm2, %xmm1 - - //c += Y - paddb %xmm1, %xmm5 - - //retuniere an die richtige speicheradresse + // 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 + movdqu (%rdi), %xmm11 + + // -64 - c + movdqa constc0, %xmm9 + psubb %xmm11, %xmm9 + + // "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 + pand const20, %xmm9 + + // c += Y + paddb %xmm9, %xmm11 + + // retuniere an die richtige speicheradresse mov %rdi, %rax - movapd %xmm5, (%rax) + movdqu %xmm11, (%rax) + ret -.LFE2: - .size asma, .-asma - .section .eh_frame,"a",@progbits -.Lframe1: - .long .LECIE1-.LSCIE1 -.LSCIE1: - .long 0x0 - .byte 0x1 - .string "zR" - .uleb128 0x1 - .sleb128 -8 - .byte 0x10 - .uleb128 0x1 - .byte 0x3 - .byte 0xc - .uleb128 0x7 - .uleb128 0x8 - .byte 0x90 - .uleb128 0x1 - .align 8 -.LECIE1: -.LSFDE1: - .long .LEFDE1-.LASFDE1 -.LASFDE1: - .long .LASFDE1-.Lframe1 - .long .LFB2 - .long .LFE2-.LFB2 - .uleb128 0x0 - .align 8 -.LEFDE1: - .ident "GCC: (Debian 4.3.2-1.1) 4.3.2" - .section .note.GNU-stack,"",@progbits