.file "asmb.c"
+ .data
+ .align 16
+const65:
+ .rept 16
+ .byte 0x65
+ .endr
+const20:
+ .rept 16
+ .byte 0x20
+ .endr
+constc0:
+ .rept 16
+ .byte 0xc0
+ .endr
+const00:
+ .rept 16
+ .byte 0x00
+ .endr
+
.text
.globl asmb
- .type asmb, @function
asmb:
-.LFB2:
- xor %rdx, %rdx
- xor %ecx, %ecx
-
- //soll einfach null sein
- pxor %xmm14, %xmm14
+ //speicheradresse des parameters zurueckgeben
+ mov %rdi, %rax
.nextround:
- /*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
-
//speicheradresse des pointers zeigt auf 16*8 feld = 128bit
- movdqu (%rdi, %rdx, 8), %xmm11
- movdqu (%rdi, %rdx, 8), %xmm12
-
- /*addiere in %xmm11 "min_t-'A'"
- * = -128 - 65 = 63 = 0x3f */
- mov $0x3f3f3f3f3f3f3f3f, %rax
- movq %rax, %xmm15
- movddup %xmm15, %xmm10
+ movdqu (%rdi), %xmm11
- //c+min_t-'A'
- paddb %xmm10, %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')
- pminub %xmm9, %xmm8
+.differenz:
+ // Y = min(X, 'a' - 'A')
+ pand const20, %xmm9
- //c += Y
- paddb %xmm8, %xmm12
+ // c += Y
+ paddb %xmm9, %xmm11
- //retuniere an die richtige speicheradresse
- movapd %xmm12, (%rdi, %rdx, 8)
+ // retuniere an die richtige speicheradresse
+ movdqu %xmm11, (%rdi)
- //ist ein byte groesser als 0? dann steht 0xff drin
- pcmpeqb %xmm14, %xmm12
+ //entspricht ein byte dem nullbyte dann steht an jener stelle 0xff sonst 0x00
+ pcmpeqb const00, %xmm11
//hol die MSBs aller bytes raus
- pmovmskb %xmm12, %ecx
- inc %rdx
- inc %rdx
+ pmovmskb %xmm11, %ecx
+ add $16, %rdi
+
//ist %ecx gleich null? dann die naechsten 16byte bitte
jecxz .nextround
- mov %rdi, %rax
ret
-.LFE2:
- .size asmb, .-asmb
- .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