erifan01
159b2de442
cmd/compile: optimize math/bits.Div32 for arm64
...
Benchmark:
name old time/op new time/op delta
Div-8 22.0ns ± 0% 22.0ns ± 0% ~ (all equal)
Div32-8 6.51ns ± 0% 3.00ns ± 0% -53.90% (p=0.000 n=10+8)
Div64-8 22.5ns ± 0% 22.5ns ± 0% ~ (all equal)
Code:
func div32(hi, lo, y uint32) (q, r uint32) {return bits.Div32(hi, lo, y)}
Before:
0x0020 00032 (test.go:24) MOVWU "".y+8(FP), R0
0x0024 00036 ($GOROOT/src/math/bits/bits.go:472) CBZW R0, 132
0x0028 00040 ($GOROOT/src/math/bits/bits.go:472) MOVWU "".hi(FP), R1
0x002c 00044 ($GOROOT/src/math/bits/bits.go:472) CMPW R1, R0
0x0030 00048 ($GOROOT/src/math/bits/bits.go:472) BLS 96
0x0034 00052 ($GOROOT/src/math/bits/bits.go:475) MOVWU "".lo+4(FP), R2
0x0038 00056 ($GOROOT/src/math/bits/bits.go:475) ORR R1<<32, R2, R1
0x003c 00060 ($GOROOT/src/math/bits/bits.go:476) CBZ R0, 140
0x0040 00064 ($GOROOT/src/math/bits/bits.go:476) UDIV R0, R1, R2
0x0044 00068 (test.go:24) MOVW R2, "".q+16(FP)
0x0048 00072 ($GOROOT/src/math/bits/bits.go:476) UREM R0, R1, R0
0x0050 00080 (test.go:24) MOVW R0, "".r+20(FP)
0x0054 00084 (test.go:24) MOVD -8(RSP), R29
0x0058 00088 (test.go:24) MOVD.P 32(RSP), R30
0x005c 00092 (test.go:24) RET (R30)
After:
0x001c 00028 (test.go:24) MOVWU "".y+8(FP), R0
0x0020 00032 (test.go:24) CBZW R0, 92
0x0024 00036 (test.go:24) MOVWU "".hi(FP), R1
0x0028 00040 (test.go:24) CMPW R0, R1
0x002c 00044 (test.go:24) BHS 84
0x0030 00048 (test.go:24) MOVWU "".lo+4(FP), R2
0x0034 00052 (test.go:24) ORR R1<<32, R2, R4
0x0038 00056 (test.go:24) UDIV R0, R4, R3
0x003c 00060 (test.go:24) MSUB R3, R4, R0, R4
0x0040 00064 (test.go:24) MOVW R3, "".q+16(FP)
0x0044 00068 (test.go:24) MOVW R4, "".r+20(FP)
0x0048 00072 (test.go:24) MOVD -8(RSP), R29
0x004c 00076 (test.go:24) MOVD.P 16(RSP), R30
0x0050 00080 (test.go:24) RET (R30)
UREM instruction in the previous assembly code will be converted to UDIV and MSUB instructions
on arm64. However the UDIV instruction in UREM is unnecessary, because it's a duplicate of the
previous UDIV. This CL adds a rule to have this extra UDIV instruction removed by CSE.
Change-Id: Ie2508784320020b2de022806d09f75a7871bb3d7
Reviewed-on: https://go-review.googlesource.com/c/159577
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-03-03 20:20:10 +00:00
..
2017-01-20 05:55:53 +00:00
2018-09-24 17:11:42 +00:00
2019-02-06 20:54:16 +00:00
2018-11-08 17:29:23 +00:00
2019-03-03 20:20:10 +00:00
2016-05-02 13:43:18 +00:00
2013-01-11 22:00:48 +01:00
2019-03-01 15:36:52 +00:00
2016-05-02 13:43:18 +00:00
2015-10-07 14:37:44 +00:00
2017-04-24 12:37:49 +00:00
2017-03-16 02:44:16 +00:00
2018-05-31 17:36:45 +00:00
2017-02-08 20:59:45 +00:00
2014-01-07 13:26:48 +01:00
2018-03-01 21:11:16 +00:00
2016-05-02 13:43:18 +00:00
2018-04-03 05:34:20 +00:00
2016-07-06 20:48:41 +00:00
2013-01-30 20:21:08 +01:00
2016-04-24 21:36:52 +00:00
2016-05-02 13:43:18 +00:00
2018-04-05 22:01:17 +00:00
2017-01-20 05:55:53 +00:00
2016-05-02 13:43:18 +00:00
2018-04-09 18:57:37 +00:00
2018-05-06 04:28:23 +00:00
2018-05-06 04:28:23 +00:00
2012-11-08 09:04:27 -08:00
2017-05-11 13:53:54 +00:00
2014-10-06 17:16:39 -04:00
2016-03-17 04:20:02 +00:00
2013-02-12 13:17:49 -05:00
2015-12-02 18:26:38 +00:00
2013-10-08 14:36:20 -04:00
2012-09-10 13:03:07 -07:00
2016-05-02 13:43:18 +00:00
2018-05-29 02:39:16 +00:00
2018-11-26 14:06:28 +00:00
2014-12-08 22:18:17 +00:00
2018-09-24 21:20:51 +00:00
2014-10-31 11:08:27 -04:00
2015-01-29 13:07:30 +00:00
2015-02-03 15:48:48 +00:00
2018-10-06 15:40:03 +00:00
2018-08-14 09:19:38 +00:00
2012-07-01 21:59:50 +04:00
2014-01-31 00:30:56 +01:00
2015-06-26 03:38:21 +00:00
2019-03-01 05:58:51 +00:00
2017-03-15 22:45:17 +00:00
2017-03-15 22:45:17 +00:00
2017-03-15 22:45:17 +00:00
2017-04-24 12:37:49 +00:00
2016-05-02 13:43:18 +00:00
2018-04-09 23:19:45 +00:00
2012-09-28 08:30:30 -07:00
2015-07-11 14:36:33 +00:00
2015-07-11 14:36:33 +00:00
2016-05-02 13:43:18 +00:00
2016-09-17 01:12:24 +00:00
2016-05-02 13:43:18 +00:00
2016-10-04 17:10:47 +00:00
2015-05-07 23:54:28 +00:00
2012-07-03 09:09:05 +10:00
2019-03-01 05:58:51 +00:00
2013-02-12 13:17:49 -05:00
2017-08-11 17:41:17 +00:00
2016-05-02 13:43:18 +00:00
2016-05-02 13:43:18 +00:00
2013-02-12 13:17:49 -05:00
2012-10-07 21:52:57 +02:00
2013-02-12 13:17:49 -05:00
2014-01-24 22:35:11 +04:00
2018-05-31 17:36:45 +00:00
2017-03-14 18:49:23 +00:00
2016-05-02 13:43:18 +00:00
2016-05-02 13:43:18 +00:00
2016-05-02 13:43:18 +00:00
2016-05-02 13:43:18 +00:00
2018-09-20 09:46:11 +00:00
2018-09-20 09:46:11 +00:00
2016-05-02 13:43:18 +00:00
2018-06-06 20:35:23 +00:00
2018-12-04 23:01:00 +00:00
2018-03-28 16:56:03 +00:00
2019-02-21 15:14:45 +00:00
2016-05-02 13:43:18 +00:00
2017-02-15 01:33:03 +00:00
2016-05-02 13:43:18 +00:00
2016-10-10 12:09:16 +00:00
2016-05-02 13:43:18 +00:00
2016-05-02 13:43:18 +00:00
2016-05-02 13:43:18 +00:00
2019-02-21 15:14:45 +00:00
2016-05-02 13:43:18 +00:00
2016-05-02 13:43:18 +00:00
2016-05-02 13:43:18 +00:00
2016-05-02 13:43:18 +00:00
2013-02-12 13:17:49 -05:00
2014-12-08 22:22:58 +00:00
2015-11-03 18:57:18 +00:00
2016-09-14 16:39:47 +00:00
2016-05-02 13:43:18 +00:00
2013-02-12 13:17:49 -05:00
2013-02-12 13:17:49 -05:00
2013-03-15 15:24:13 -04:00
2016-05-02 13:43:18 +00:00
2016-05-02 13:43:18 +00:00
2016-05-02 13:43:18 +00:00
2016-05-02 13:43:18 +00:00
2016-05-02 13:43:18 +00:00
2018-04-30 19:39:18 +00:00
2018-05-08 21:15:48 +00:00
2016-05-02 13:43:18 +00:00
2018-05-31 17:36:45 +00:00
2017-04-19 02:27:58 +00:00
2015-11-12 18:32:13 +00:00
2018-05-31 17:36:45 +00:00
2013-12-12 19:02:11 -08:00
2016-05-02 13:43:18 +00:00
2012-10-07 23:22:01 +02:00
2017-03-24 20:07:15 +00:00
2017-02-10 01:22:30 +00:00
2016-05-02 13:43:18 +00:00
2016-05-02 13:43:18 +00:00
2016-05-02 13:43:18 +00:00
2016-05-02 13:43:18 +00:00
2016-05-02 13:43:18 +00:00
2017-03-06 23:48:37 +00:00
2017-04-24 12:37:49 +00:00
2015-09-05 02:25:01 +00:00
2018-07-24 16:11:08 +00:00
2019-01-08 21:54:04 +00:00
2019-01-08 21:54:04 +00:00
2017-03-03 21:29:32 +00:00
2018-08-30 22:48:28 +00:00
2018-03-13 20:34:03 +00:00
2018-11-08 17:29:23 +00:00
2017-10-10 19:43:38 +00:00
2016-09-19 19:03:01 +00:00
2017-04-12 14:27:45 +00:00
2016-05-02 13:43:18 +00:00
2018-04-30 19:39:18 +00:00
2016-05-02 13:43:18 +00:00
2017-02-08 20:59:45 +00:00
2018-04-30 19:39:18 +00:00
2018-04-30 19:39:18 +00:00
2016-05-02 13:43:18 +00:00
2019-02-19 22:45:09 +00:00
2013-02-12 13:17:49 -05:00
2016-05-02 13:43:18 +00:00
2018-10-03 19:54:16 +00:00
2018-11-08 17:29:23 +00:00
2018-10-15 16:07:52 +00:00
2018-04-05 10:53:40 +00:00
2018-12-07 23:04:58 +00:00
2017-08-15 05:54:24 +00:00
2018-03-14 08:36:15 +00:00
2017-04-24 12:37:49 +00:00
2017-04-24 12:37:49 +00:00
2014-08-06 17:02:55 -04:00
2018-05-08 21:15:16 +00:00
2014-10-27 18:59:02 -04:00
2017-09-03 14:29:38 +00:00
2016-03-17 00:38:15 +00:00
2017-10-12 20:50:20 +00:00
2012-10-07 23:22:01 +02:00
2016-05-02 13:43:18 +00:00
2017-10-12 20:50:20 +00:00
2018-04-06 15:39:11 +00:00
2013-02-11 18:20:52 -05:00
2016-05-02 13:43:18 +00:00
2016-05-02 13:43:18 +00:00
2013-02-12 13:17:49 -05:00
2016-05-02 13:43:18 +00:00
2016-05-02 13:43:18 +00:00
2018-11-26 14:13:53 +00:00
2016-05-02 13:43:18 +00:00
2018-11-27 15:36:08 +00:00
2018-11-26 14:13:53 +00:00
2018-11-26 14:13:53 +00:00
2018-11-26 14:13:53 +00:00
2018-11-26 14:13:53 +00:00
2019-02-26 02:44:45 +00:00
2016-10-15 17:58:14 +00:00
2018-12-05 21:54:54 +00:00
2018-11-02 19:53:59 +00:00
2017-10-29 19:36:44 +00:00
2016-10-25 22:28:40 +00:00
2017-01-09 21:01:29 +00:00
2018-04-30 19:39:18 +00:00
2016-09-13 20:06:13 +00:00
2018-05-31 17:36:45 +00:00
2017-09-26 04:08:38 +00:00
2018-05-31 17:36:45 +00:00
2019-01-02 19:28:06 +00:00
2017-09-12 05:50:54 +00:00
2018-03-03 19:52:00 +00:00
2016-05-02 13:43:18 +00:00
2016-05-02 13:43:18 +00:00
2016-05-02 13:43:18 +00:00
2018-01-10 01:35:45 +00:00
2017-04-24 12:37:49 +00:00
2016-05-02 13:43:18 +00:00
2016-03-11 21:19:20 +00:00
2016-03-11 21:19:20 +00:00
2016-03-11 21:19:20 +00:00
2016-03-11 22:07:02 +00:00
2017-08-22 13:44:35 +00:00
2016-05-02 13:43:18 +00:00
2016-05-02 13:43:18 +00:00
2017-02-11 21:46:21 +00:00
2018-03-01 21:11:16 +00:00
2016-05-02 13:43:18 +00:00
2016-05-02 13:43:18 +00:00
2016-05-02 13:43:18 +00:00
2016-05-02 13:43:18 +00:00
2016-05-02 13:43:18 +00:00
2016-05-02 13:43:18 +00:00
2018-12-11 20:24:45 +00:00
2016-05-02 13:43:18 +00:00
2017-03-01 01:06:32 +00:00
2017-12-01 20:39:50 +00:00
2016-05-02 13:43:18 +00:00
2018-05-31 17:36:45 +00:00
2018-04-30 19:39:18 +00:00
2018-12-03 16:48:21 +00:00
2016-05-02 13:43:18 +00:00
2016-05-02 13:43:18 +00:00
2016-05-02 13:43:18 +00:00
2016-05-02 13:43:18 +00:00
2018-03-08 22:25:25 +00:00
2018-10-03 19:54:29 +00:00
2018-10-03 19:54:16 +00:00
2018-10-03 19:54:16 +00:00
2018-06-12 19:10:34 +00:00
2016-03-30 22:27:13 +00:00
2013-12-12 17:17:02 -08:00
2012-08-08 14:01:23 -07:00
2016-05-02 13:43:18 +00:00
2016-08-19 01:10:21 +00:00
2012-08-03 21:47:26 +02:00
2013-03-15 00:35:09 -04:00
2018-10-16 21:54:35 +00:00
2017-02-02 17:36:43 +00:00
2017-05-19 18:11:51 +00:00
2013-03-15 00:35:09 -04:00
2015-11-03 18:57:18 +00:00
2014-07-01 09:20:51 +02:00
2014-01-03 21:03:20 +01:00
2015-09-06 23:50:51 +00:00
2018-10-04 00:49:49 +00:00
2018-10-04 00:49:49 +00:00
2018-10-14 05:21:00 +00:00
2016-07-06 20:48:41 +00:00
2016-05-02 13:43:18 +00:00
2016-05-02 13:43:18 +00:00
2018-11-29 22:23:02 +00:00
2016-12-23 17:35:24 +00:00