Skip to content

Commit

Permalink
internal/subtle: s390x, handle tail
Browse files Browse the repository at this point in the history
  • Loading branch information
emmansun authored Aug 28, 2024
1 parent e3fba24 commit eb36af5
Showing 1 changed file with 22 additions and 7 deletions.
29 changes: 22 additions & 7 deletions internal/subtle/xor_s390x.s
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ TEXT ·xorBytes(SB),NOSPLIT,$0-32
MOVD n+24(FP), R4

MOVD $0, R5
CMPBLT R4, $16, less_than16
CMPBLT R4, $16, tail

loop16b:
VL 0(R2)(R5*1), V0
Expand All @@ -24,24 +24,39 @@ loop16b:
SUB $16, R4
CMPBGE R4, $16, loop16b

less_than16:
CMPBLT R4, $8, tail
tail:
CMPBLT R4, $8, less_than8
MOVD 0(R2)(R5*1), R7
MOVD 0(R3)(R5*1), R8
XOR R7, R8
MOVD R8, 0(R1)(R5*1)
LAY 8(R5), R5
SUB $8, R4

tail:
less_than8:
CMPBLT R4, $4, less_than4
MOVWZ 0(R2)(R5*1), R7
MOVWZ 0(R3)(R5*1), R8
XOR R7, R8
MOVW R8, 0(R1)(R5*1)
LAY 4(R5), R5
SUB $4, R4

less_than4:
CMPBLT R4, $2, less_than2
MOVHZ 0(R2)(R5*1), R7
MOVHZ 0(R3)(R5*1), R8
XOR R7, R8
MOVH R8, 0(R1)(R5*1)
LAY 2(R5), R5
SUB $2, R4

less_than2:
CMPBEQ R4, $0, done
MOVB 0(R2)(R5*1), R7
MOVB 0(R3)(R5*1), R8
XOR R7, R8
MOVB R8, 0(R1)(R5*1)
LAY 1(R5), R5
SUB $1, R4
BR tail

done:
RET

0 comments on commit eb36af5

Please sign in to comment.