Skip to content

Commit cab7ba0

Browse files
committed
cmd/compile: use | in the most repetitive arm rules
For now, limited to the most repetitive rules that are also short and simple, so that we can have a substantial conciseness win without compromising rules readability. Ran rulegen, no change in the actual compiler code (as expected). Change-Id: Ib1d2b9fbc787379105ec9baf10d2c1e2ff3c4c5c Reviewed-on: https://go-review.googlesource.com/95615 Reviewed-by: Brad Fitzpatrick <[email protected]>
1 parent 262b524 commit cab7ba0

File tree

1 file changed

+21
-58
lines changed

1 file changed

+21
-58
lines changed

src/cmd/compile/internal/ssa/gen/ARM.rules

Lines changed: 21 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -2,35 +2,19 @@
22
// Use of this source code is governed by a BSD-style
33
// license that can be found in the LICENSE file.
44

5-
(AddPtr x y) -> (ADD x y)
6-
(Add32 x y) -> (ADD x y)
7-
(Add16 x y) -> (ADD x y)
8-
(Add8 x y) -> (ADD x y)
9-
(Add32F x y) -> (ADDF x y)
10-
(Add64F x y) -> (ADDD x y)
11-
5+
(Add(Ptr|32|16|8) x y) -> (ADD x y)
6+
(Add(32|64)F x y) -> (ADD(F|D) x y)
127
(Add32carry x y) -> (ADDS x y)
138
(Add32withcarry x y c) -> (ADC x y c)
149

15-
(SubPtr x y) -> (SUB x y)
16-
(Sub32 x y) -> (SUB x y)
17-
(Sub16 x y) -> (SUB x y)
18-
(Sub8 x y) -> (SUB x y)
19-
(Sub32F x y) -> (SUBF x y)
20-
(Sub64F x y) -> (SUBD x y)
21-
10+
(Sub(Ptr|32|16|8) x y) -> (SUB x y)
11+
(Sub(32|64)F x y) -> (SUB(F|D) x y)
2212
(Sub32carry x y) -> (SUBS x y)
2313
(Sub32withcarry x y c) -> (SBC x y c)
2414

25-
(Mul32 x y) -> (MUL x y)
26-
(Mul16 x y) -> (MUL x y)
27-
(Mul8 x y) -> (MUL x y)
28-
(Mul32F x y) -> (MULF x y)
29-
(Mul64F x y) -> (MULD x y)
30-
31-
(Hmul32 x y) -> (HMUL x y)
32-
(Hmul32u x y) -> (HMULU x y)
33-
15+
(Mul(32|16|8) x y) -> (MUL x y)
16+
(Mul(32|64)F x y) -> (MUL(F|D) x y)
17+
(Hmul(32|32u) x y) -> (HMU(L|LU) x y)
3418
(Mul32uhilo x y) -> (MULLU x y)
3519

3620
(Div32 x y) ->
@@ -44,8 +28,7 @@
4428
(Div16u x y) -> (Div32u (ZeroExt16to32 x) (ZeroExt16to32 y))
4529
(Div8 x y) -> (Div32 (SignExt8to32 x) (SignExt8to32 y))
4630
(Div8u x y) -> (Div32u (ZeroExt8to32 x) (ZeroExt8to32 y))
47-
(Div32F x y) -> (DIVF x y)
48-
(Div64F x y) -> (DIVD x y)
31+
(Div(32|64)F x y) -> (DIV(F|D) x y)
4932

5033
(Mod32 x y) ->
5134
(SUB (XOR <typ.UInt32> // negate the result if x is negative
@@ -62,28 +45,15 @@
6245
// (x + y) / 2 with x>=y -> (x - y) / 2 + y
6346
(Avg32u <t> x y) -> (ADD (SRLconst <t> (SUB <t> x y) [1]) y)
6447

65-
(And32 x y) -> (AND x y)
66-
(And16 x y) -> (AND x y)
67-
(And8 x y) -> (AND x y)
68-
69-
(Or32 x y) -> (OR x y)
70-
(Or16 x y) -> (OR x y)
71-
(Or8 x y) -> (OR x y)
72-
73-
(Xor32 x y) -> (XOR x y)
74-
(Xor16 x y) -> (XOR x y)
75-
(Xor8 x y) -> (XOR x y)
48+
(And(32|16|8) x y) -> (AND x y)
49+
(Or(32|16|8) x y) -> (OR x y)
50+
(Xor(32|16|8) x y) -> (XOR x y)
7651

7752
// unary ops
78-
(Neg32 x) -> (RSBconst [0] x)
79-
(Neg16 x) -> (RSBconst [0] x)
80-
(Neg8 x) -> (RSBconst [0] x)
81-
(Neg32F x) -> (NEGF x)
82-
(Neg64F x) -> (NEGD x)
53+
(Neg(32|16|8) x) -> (RSBconst [0] x)
54+
(Neg(32|64)F x) -> (NEG(F|D) x)
8355

84-
(Com32 x) -> (MVN x)
85-
(Com16 x) -> (MVN x)
86-
(Com8 x) -> (MVN x)
56+
(Com(32|16|8) x) -> (MVN x)
8757

8858
(Sqrt x) -> (SQRTD x)
8959

@@ -225,29 +195,25 @@
225195
(Cvt32Fto64F x) -> (MOVFD x)
226196
(Cvt64Fto32F x) -> (MOVDF x)
227197

228-
(Round32F x) -> x
229-
(Round64F x) -> x
198+
(Round(32|64)F x) -> x
230199

231200
// comparisons
232201
(Eq8 x y) -> (Equal (CMP (ZeroExt8to32 x) (ZeroExt8to32 y)))
233202
(Eq16 x y) -> (Equal (CMP (ZeroExt16to32 x) (ZeroExt16to32 y)))
234203
(Eq32 x y) -> (Equal (CMP x y))
235204
(EqPtr x y) -> (Equal (CMP x y))
236-
(Eq32F x y) -> (Equal (CMPF x y))
237-
(Eq64F x y) -> (Equal (CMPD x y))
205+
(Eq(32|64)F x y) -> (Equal (CMP(F|D) x y))
238206

239207
(Neq8 x y) -> (NotEqual (CMP (ZeroExt8to32 x) (ZeroExt8to32 y)))
240208
(Neq16 x y) -> (NotEqual (CMP (ZeroExt16to32 x) (ZeroExt16to32 y)))
241209
(Neq32 x y) -> (NotEqual (CMP x y))
242210
(NeqPtr x y) -> (NotEqual (CMP x y))
243-
(Neq32F x y) -> (NotEqual (CMPF x y))
244-
(Neq64F x y) -> (NotEqual (CMPD x y))
211+
(Neq(32|64)F x y) -> (NotEqual (CMP(F|D) x y))
245212

246213
(Less8 x y) -> (LessThan (CMP (SignExt8to32 x) (SignExt8to32 y)))
247214
(Less16 x y) -> (LessThan (CMP (SignExt16to32 x) (SignExt16to32 y)))
248215
(Less32 x y) -> (LessThan (CMP x y))
249-
(Less32F x y) -> (GreaterThan (CMPF y x)) // reverse operands to work around NaN
250-
(Less64F x y) -> (GreaterThan (CMPD y x)) // reverse operands to work around NaN
216+
(Less(32|64)F x y) -> (GreaterThan (CMP(F|D) y x)) // reverse operands to work around NaN
251217

252218
(Less8U x y) -> (LessThanU (CMP (ZeroExt8to32 x) (ZeroExt8to32 y)))
253219
(Less16U x y) -> (LessThanU (CMP (ZeroExt16to32 x) (ZeroExt16to32 y)))
@@ -256,8 +222,7 @@
256222
(Leq8 x y) -> (LessEqual (CMP (SignExt8to32 x) (SignExt8to32 y)))
257223
(Leq16 x y) -> (LessEqual (CMP (SignExt16to32 x) (SignExt16to32 y)))
258224
(Leq32 x y) -> (LessEqual (CMP x y))
259-
(Leq32F x y) -> (GreaterEqual (CMPF y x)) // reverse operands to work around NaN
260-
(Leq64F x y) -> (GreaterEqual (CMPD y x)) // reverse operands to work around NaN
225+
(Leq(32|64)F x y) -> (GreaterEqual (CMP(F|D) y x)) // reverse operands to work around NaN
261226

262227
(Leq8U x y) -> (LessEqualU (CMP (ZeroExt8to32 x) (ZeroExt8to32 y)))
263228
(Leq16U x y) -> (LessEqualU (CMP (ZeroExt16to32 x) (ZeroExt16to32 y)))
@@ -266,8 +231,7 @@
266231
(Greater8 x y) -> (GreaterThan (CMP (SignExt8to32 x) (SignExt8to32 y)))
267232
(Greater16 x y) -> (GreaterThan (CMP (SignExt16to32 x) (SignExt16to32 y)))
268233
(Greater32 x y) -> (GreaterThan (CMP x y))
269-
(Greater32F x y) -> (GreaterThan (CMPF x y))
270-
(Greater64F x y) -> (GreaterThan (CMPD x y))
234+
(Greater(32|64)F x y) -> (GreaterThan (CMP(F|D) x y))
271235

272236
(Greater8U x y) -> (GreaterThanU (CMP (ZeroExt8to32 x) (ZeroExt8to32 y)))
273237
(Greater16U x y) -> (GreaterThanU (CMP (ZeroExt16to32 x) (ZeroExt16to32 y)))
@@ -276,8 +240,7 @@
276240
(Geq8 x y) -> (GreaterEqual (CMP (SignExt8to32 x) (SignExt8to32 y)))
277241
(Geq16 x y) -> (GreaterEqual (CMP (SignExt16to32 x) (SignExt16to32 y)))
278242
(Geq32 x y) -> (GreaterEqual (CMP x y))
279-
(Geq32F x y) -> (GreaterEqual (CMPF x y))
280-
(Geq64F x y) -> (GreaterEqual (CMPD x y))
243+
(Geq(32|64)F x y) -> (GreaterEqual (CMP(F|D) x y))
281244

282245
(Geq8U x y) -> (GreaterEqualU (CMP (ZeroExt8to32 x) (ZeroExt8to32 y)))
283246
(Geq16U x y) -> (GreaterEqualU (CMP (ZeroExt16to32 x) (ZeroExt16to32 y)))

0 commit comments

Comments
 (0)