aboutsummaryrefslogtreecommitdiff
path: root/test/codegen/rotate.go
diff options
context:
space:
mode:
Diffstat (limited to 'test/codegen/rotate.go')
-rw-r--r--test/codegen/rotate.go42
1 files changed, 40 insertions, 2 deletions
diff --git a/test/codegen/rotate.go b/test/codegen/rotate.go
index 519cc83263..204efaeafc 100644
--- a/test/codegen/rotate.go
+++ b/test/codegen/rotate.go
@@ -34,8 +34,15 @@ func rot64(x uint64) uint64 {
// ppc64le:"ROTL\t[$]9"
a += x<<9 ^ x>>55
- // s390x:"RISBGZ\t[$]0, [$]63, [$]7, "
+ // amd64:"ROLQ\t[$]10"
+ // arm64:"ROR\t[$]54"
+ // s390x:"RISBGZ\t[$]0, [$]63, [$]10, "
+ // ppc64:"ROTL\t[$]10"
+ // ppc64le:"ROTL\t[$]10"
// arm64:"ROR\t[$]57" // TODO this is not great line numbering, but then again, the instruction did appear
+ // s390x:"RISBGZ\t[$]0, [$]63, [$]7, " // TODO ditto
+ a += bits.RotateLeft64(x, 10)
+
return a
}
@@ -64,8 +71,16 @@ func rot32(x uint32) uint32 {
// ppc64le:"ROTLW\t[$]9"
a += x<<9 ^ x>>23
- // s390x:"RLL\t[$]7"
+ // amd64:"ROLL\t[$]10"
+ // arm:"MOVW\tR\\d+@>22"
+ // arm64:"RORW\t[$]22"
+ // s390x:"RLL\t[$]10"
+ // ppc64:"ROTLW\t[$]10"
+ // ppc64le:"ROTLW\t[$]10"
// arm64:"RORW\t[$]25" // TODO this is not great line numbering, but then again, the instruction did appear
+ // s390x:"RLL\t[$]7" // TODO ditto
+ a += bits.RotateLeft32(x, 10)
+
return a
}
@@ -211,3 +226,26 @@ func checkMaskedRotate32(a []uint32, r int) {
a[i] = bits.RotateLeft32(a[3], 4) & 0xFFF00FFF
i++
}
+
+// combined arithmetic and rotate on arm64
+func checkArithmeticWithRotate(a *[1000]uint64) {
+ // arm64: "AND\tR[0-9]+@>51, R[0-9]+, R[0-9]+"
+ a[2] = a[1] & bits.RotateLeft64(a[0], 13)
+ // arm64: "ORR\tR[0-9]+@>51, R[0-9]+, R[0-9]+"
+ a[5] = a[4] | bits.RotateLeft64(a[3], 13)
+ // arm64: "EOR\tR[0-9]+@>51, R[0-9]+, R[0-9]+"
+ a[8] = a[7] ^ bits.RotateLeft64(a[6], 13)
+ // arm64: "MVN\tR[0-9]+@>51, R[0-9]+"
+ a[10] = ^bits.RotateLeft64(a[9], 13)
+ // arm64: "BIC\tR[0-9]+@>51, R[0-9]+, R[0-9]+"
+ a[13] = a[12] &^ bits.RotateLeft64(a[11], 13)
+ // arm64: "EON\tR[0-9]+@>51, R[0-9]+, R[0-9]+"
+ a[16] = a[15] ^ ^bits.RotateLeft64(a[14], 13)
+ // arm64: "ORN\tR[0-9]+@>51, R[0-9]+, R[0-9]+"
+ a[19] = a[18] | ^bits.RotateLeft64(a[17], 13)
+ // arm64: "TST\tR[0-9]+@>51, R[0-9]+"
+ if a[18]&bits.RotateLeft64(a[19], 13) == 0 {
+ a[20] = 1
+ }
+
+}