Skip to content

Commit

Permalink
align address mode
Browse files Browse the repository at this point in the history
  • Loading branch information
emmansun authored Aug 28, 2024
1 parent ae43444 commit d3727e7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
17 changes: 8 additions & 9 deletions internal/subtle/xor_s390x.s
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// Copyright 2016 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// The original code (non-vector) is ported from Golang
// https://github.com/golang/go/blob/master/src/crypto/aes/ctr_s390x.go

//go:build !purego

Expand All @@ -17,25 +16,25 @@ TEXT ·xorBytes(SB),NOSPLIT,$0-32
CMPBLT R4, $64, less_than64

loop64b:
VLM (R2)(R5*1), V0, V3
VLM (R3)(R5*1), V4, V7
VLM 0(R2)(R5*1), V0, V3
VLM 0(R3)(R5*1), V4, V7
VX V0, V4, V4
VX V1, V5, V5
VX V2, V6, V6
VX V3, V7, V7
VSTM V4, V7, (R1)(R5*1)
VSTM V4, V7, 0(R1)(R5*1)
LAY 64(R5), R5
SUB $64, R4
CMPBGE R4, $64, loop64b

less_than64:
CMPBEQ R4, $0, done // quick end
CMPBLT R4, $32, less_than32
VLM (R2)(R5*1), V0, V1
VLM (R3)(R5*1), V2, V3
VLM 0(R2)(R5*1), V0, V1
VLM 0(R3)(R5*1), V2, V3
VX V0, V2, V2
VX V1, V3, V3
VSTM V2, V3, (R1)(R5*1)
VSTM V2, V3, 0(R1)(R5*1)
LAY 32(R5), R5
SUB $32, R4

Expand Down
2 changes: 1 addition & 1 deletion internal/subtle/xor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func TestXORBytes(t *testing.T) {
}

if subtle.XORBytes(d[alignD:], p, q); !bytes.Equal(d, want) {
t.Errorf("n=%d alignP=%d alignQ=%d alignD=%d:\n\tp = %x\n\tq = %x\n\td = %x\n\twant %x\n", n, alignP, alignQ, alignD, p, q, d, want)
t.Fatalf("n=%d alignP=%d alignQ=%d alignD=%d:\n\tp = %x\n\tq = %x\n\td = %x\n\twant %x\n", n, alignP, alignQ, alignD, p, q, d, want)
}
}
}
Expand Down

0 comments on commit d3727e7

Please sign in to comment.