1 // Code generated from _gen/PPC64latelower.rules using 'go generate'; DO NOT EDIT.
5 import "internal/buildcfg"
6 import "cmd/compile/internal/types"
8 func rewriteValuePPC64latelower(v *Value) bool {
11 return rewriteValuePPC64latelower_OpPPC64AND(v)
13 return rewriteValuePPC64latelower_OpPPC64ISEL(v)
15 return rewriteValuePPC64latelower_OpPPC64RLDICL(v)
17 return rewriteValuePPC64latelower_OpPPC64SETBC(v)
19 return rewriteValuePPC64latelower_OpPPC64SETBCR(v)
23 func rewriteValuePPC64latelower_OpPPC64AND(v *Value) bool {
27 typ := &b.Func.Config.Types
28 // match: (AND <t> x:(MOVDconst [m]) n)
29 // cond: t.Size() <= 2
30 // result: (Select0 (ANDCCconst [int64(int16(m))] n))
33 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
35 if x.Op != OpPPC64MOVDconst {
38 m := auxIntToInt64(x.AuxInt)
44 v0 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
45 v0.AuxInt = int64ToAuxInt(int64(int16(m)))
52 // match: (AND x:(MOVDconst [m]) n)
53 // cond: isPPC64ValidShiftMask(m)
54 // result: (RLDICL [encodePPC64RotateMask(0,m,64)] n)
56 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
58 if x.Op != OpPPC64MOVDconst {
61 m := auxIntToInt64(x.AuxInt)
63 if !(isPPC64ValidShiftMask(m)) {
66 v.reset(OpPPC64RLDICL)
67 v.AuxInt = int64ToAuxInt(encodePPC64RotateMask(0, m, 64))
73 // match: (AND x:(MOVDconst [m]) n)
74 // cond: m != 0 && isPPC64ValidShiftMask(^m)
75 // result: (RLDICR [encodePPC64RotateMask(0,m,64)] n)
77 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
79 if x.Op != OpPPC64MOVDconst {
82 m := auxIntToInt64(x.AuxInt)
84 if !(m != 0 && isPPC64ValidShiftMask(^m)) {
87 v.reset(OpPPC64RLDICR)
88 v.AuxInt = int64ToAuxInt(encodePPC64RotateMask(0, m, 64))
94 // match: (AND <t> x:(MOVDconst [m]) n)
95 // cond: t.Size() == 4 && isPPC64WordRotateMask(m)
96 // result: (RLWINM [encodePPC64RotateMask(0,m,32)] n)
99 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
101 if x.Op != OpPPC64MOVDconst {
104 m := auxIntToInt64(x.AuxInt)
106 if !(t.Size() == 4 && isPPC64WordRotateMask(m)) {
109 v.reset(OpPPC64RLWINM)
110 v.AuxInt = int64ToAuxInt(encodePPC64RotateMask(0, m, 32))
118 func rewriteValuePPC64latelower_OpPPC64ISEL(v *Value) bool {
122 // match: (ISEL [a] x (MOVDconst [0]) z)
123 // result: (ISELZ [a] x z)
125 a := auxIntToInt32(v.AuxInt)
127 if v_1.Op != OpPPC64MOVDconst || auxIntToInt64(v_1.AuxInt) != 0 {
131 v.reset(OpPPC64ISELZ)
132 v.AuxInt = int32ToAuxInt(a)
136 // match: (ISEL [a] (MOVDconst [0]) y z)
137 // result: (ISELZ [a^0x4] y z)
139 a := auxIntToInt32(v.AuxInt)
140 if v_0.Op != OpPPC64MOVDconst || auxIntToInt64(v_0.AuxInt) != 0 {
145 v.reset(OpPPC64ISELZ)
146 v.AuxInt = int32ToAuxInt(a ^ 0x4)
152 func rewriteValuePPC64latelower_OpPPC64RLDICL(v *Value) bool {
154 // match: (RLDICL [em] x:(SRDconst [s] a))
155 // cond: (em&0xFF0000)==0
156 // result: (RLDICL [mergePPC64RLDICLandSRDconst(em, s)] a)
158 em := auxIntToInt64(v.AuxInt)
160 if x.Op != OpPPC64SRDconst {
163 s := auxIntToInt64(x.AuxInt)
165 if !((em & 0xFF0000) == 0) {
168 v.reset(OpPPC64RLDICL)
169 v.AuxInt = int64ToAuxInt(mergePPC64RLDICLandSRDconst(em, s))
175 func rewriteValuePPC64latelower_OpPPC64SETBC(v *Value) bool {
178 typ := &b.Func.Config.Types
179 // match: (SETBC [2] cmp)
180 // cond: buildcfg.GOPPC64 <= 9
181 // result: (ISELZ [2] (MOVDconst [1]) cmp)
183 if auxIntToInt32(v.AuxInt) != 2 {
187 if !(buildcfg.GOPPC64 <= 9) {
190 v.reset(OpPPC64ISELZ)
191 v.AuxInt = int32ToAuxInt(2)
192 v0 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
193 v0.AuxInt = int64ToAuxInt(1)
197 // match: (SETBC [0] cmp)
198 // cond: buildcfg.GOPPC64 <= 9
199 // result: (ISELZ [0] (MOVDconst [1]) cmp)
201 if auxIntToInt32(v.AuxInt) != 0 {
205 if !(buildcfg.GOPPC64 <= 9) {
208 v.reset(OpPPC64ISELZ)
209 v.AuxInt = int32ToAuxInt(0)
210 v0 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
211 v0.AuxInt = int64ToAuxInt(1)
215 // match: (SETBC [1] cmp)
216 // cond: buildcfg.GOPPC64 <= 9
217 // result: (ISELZ [1] (MOVDconst [1]) cmp)
219 if auxIntToInt32(v.AuxInt) != 1 {
223 if !(buildcfg.GOPPC64 <= 9) {
226 v.reset(OpPPC64ISELZ)
227 v.AuxInt = int32ToAuxInt(1)
228 v0 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
229 v0.AuxInt = int64ToAuxInt(1)
235 func rewriteValuePPC64latelower_OpPPC64SETBCR(v *Value) bool {
238 typ := &b.Func.Config.Types
239 // match: (SETBCR [2] cmp)
240 // cond: buildcfg.GOPPC64 <= 9
241 // result: (ISELZ [6] (MOVDconst [1]) cmp)
243 if auxIntToInt32(v.AuxInt) != 2 {
247 if !(buildcfg.GOPPC64 <= 9) {
250 v.reset(OpPPC64ISELZ)
251 v.AuxInt = int32ToAuxInt(6)
252 v0 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
253 v0.AuxInt = int64ToAuxInt(1)
257 // match: (SETBCR [0] cmp)
258 // cond: buildcfg.GOPPC64 <= 9
259 // result: (ISELZ [4] (MOVDconst [1]) cmp)
261 if auxIntToInt32(v.AuxInt) != 0 {
265 if !(buildcfg.GOPPC64 <= 9) {
268 v.reset(OpPPC64ISELZ)
269 v.AuxInt = int32ToAuxInt(4)
270 v0 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
271 v0.AuxInt = int64ToAuxInt(1)
275 // match: (SETBCR [1] cmp)
276 // cond: buildcfg.GOPPC64 <= 9
277 // result: (ISELZ [5] (MOVDconst [1]) cmp)
279 if auxIntToInt32(v.AuxInt) != 1 {
283 if !(buildcfg.GOPPC64 <= 9) {
286 v.reset(OpPPC64ISELZ)
287 v.AuxInt = int32ToAuxInt(5)
288 v0 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
289 v0.AuxInt = int64ToAuxInt(1)
295 func rewriteBlockPPC64latelower(b *Block) bool {