aboutsummaryrefslogtreecommitdiff
path: root/test/codegen/arithmetic.go
diff options
context:
space:
mode:
authorBen Shi <powerman1st@163.com>2018-10-15 02:25:10 +0000
committerCherry Zhang <cherryyz@google.com>2018-10-15 02:41:33 +0000
commitc3208842e138a4dd51499ca84b3bdba99ac4d413 (patch)
treecd4c559cef780fd2ea0516514c52f9eef20f5ef1 /test/codegen/arithmetic.go
parent389e942745ddd7eef44b71571c463b0dfc3dcac2 (diff)
downloadgo-c3208842e138a4dd51499ca84b3bdba99ac4d413.tar.xz
test/codegen: add tests for multiplication-subtraction
This CL adds tests for armv7's MULS and arm64's MSUBW. Change-Id: Id0fd5d26fd477e4ed14389b0d33cad930423eb5b Reviewed-on: https://go-review.googlesource.com/c/141651 Run-TryBot: Ben Shi <powerman1st@163.com> Reviewed-by: Cherry Zhang <cherryyz@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
Diffstat (limited to 'test/codegen/arithmetic.go')
-rw-r--r--test/codegen/arithmetic.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/codegen/arithmetic.go b/test/codegen/arithmetic.go
index 879aaf285c..b1cdef6eee 100644
--- a/test/codegen/arithmetic.go
+++ b/test/codegen/arithmetic.go
@@ -227,3 +227,16 @@ func MULA(a, b, c uint32) (uint32, uint32, uint32) {
r2 := b*64 + c
return r0, r1, r2
}
+
+func MULS(a, b, c uint32) (uint32, uint32, uint32) {
+ // arm/7:`MULS`,-`MUL\s`
+ // arm64:`MSUBW`,-`MULW`
+ r0 := c - a*b
+ // arm/7:`MULS`-`MUL\s`
+ // arm64:`MSUBW`,-`MULW`
+ r1 := a - c*79
+ // arm/7:`SUB`,-`MULS`-`MUL\s`
+ // arm64:`SUB`,-`MSUBW`,-`MULW`
+ r2 := c - b*64
+ return r0, r1, r2
+}