github.com/tidwall/go@v0.0.0-20170415222209-6694a6888b7d/src/cmd/compile/internal/ssa/gen/386.rules (about) 1 // Copyright 2016 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 // Lowering arithmetic 6 (AddPtr x y) -> (ADDL x y) 7 (Add32 x y) -> (ADDL x y) 8 (Add16 x y) -> (ADDL x y) 9 (Add8 x y) -> (ADDL x y) 10 (Add32F x y) -> (ADDSS x y) 11 (Add64F x y) -> (ADDSD x y) 12 13 (Add32carry x y) -> (ADDLcarry x y) 14 (Add32withcarry x y c) -> (ADCL x y c) 15 16 (SubPtr x y) -> (SUBL x y) 17 (Sub32 x y) -> (SUBL x y) 18 (Sub16 x y) -> (SUBL x y) 19 (Sub8 x y) -> (SUBL x y) 20 (Sub32F x y) -> (SUBSS x y) 21 (Sub64F x y) -> (SUBSD x y) 22 23 (Sub32carry x y) -> (SUBLcarry x y) 24 (Sub32withcarry x y c) -> (SBBL x y c) 25 26 (Mul32 x y) -> (MULL x y) 27 (Mul16 x y) -> (MULL x y) 28 (Mul8 x y) -> (MULL x y) 29 (Mul32F x y) -> (MULSS x y) 30 (Mul64F x y) -> (MULSD x y) 31 32 (Mul32uhilo x y) -> (MULLQU x y) 33 34 (Avg32u x y) -> (AVGLU x y) 35 36 (Div32F x y) -> (DIVSS x y) 37 (Div64F x y) -> (DIVSD x y) 38 39 (Div32 x y) -> (DIVL x y) 40 (Div32u x y) -> (DIVLU x y) 41 (Div16 x y) -> (DIVW x y) 42 (Div16u x y) -> (DIVWU x y) 43 (Div8 x y) -> (DIVW (SignExt8to16 x) (SignExt8to16 y)) 44 (Div8u x y) -> (DIVWU (ZeroExt8to16 x) (ZeroExt8to16 y)) 45 46 (Hmul32 x y) -> (HMULL x y) 47 (Hmul32u x y) -> (HMULLU x y) 48 49 (Mod32 x y) -> (MODL x y) 50 (Mod32u x y) -> (MODLU x y) 51 (Mod16 x y) -> (MODW x y) 52 (Mod16u x y) -> (MODWU x y) 53 (Mod8 x y) -> (MODW (SignExt8to16 x) (SignExt8to16 y)) 54 (Mod8u x y) -> (MODWU (ZeroExt8to16 x) (ZeroExt8to16 y)) 55 56 (And32 x y) -> (ANDL x y) 57 (And16 x y) -> (ANDL x y) 58 (And8 x y) -> (ANDL x y) 59 60 (Or32 x y) -> (ORL x y) 61 (Or16 x y) -> (ORL x y) 62 (Or8 x y) -> (ORL x y) 63 64 (Xor32 x y) -> (XORL x y) 65 (Xor16 x y) -> (XORL x y) 66 (Xor8 x y) -> (XORL x y) 67 68 (Neg32 x) -> (NEGL x) 69 (Neg16 x) -> (NEGL x) 70 (Neg8 x) -> (NEGL x) 71 (Neg32F x) && !config.use387 -> (PXOR x (MOVSSconst <types.Float32> [f2i(math.Copysign(0, -1))])) 72 (Neg64F x) && !config.use387 -> (PXOR x (MOVSDconst <types.Float64> [f2i(math.Copysign(0, -1))])) 73 (Neg32F x) && config.use387 -> (FCHS x) 74 (Neg64F x) && config.use387 -> (FCHS x) 75 76 (Com32 x) -> (NOTL x) 77 (Com16 x) -> (NOTL x) 78 (Com8 x) -> (NOTL x) 79 80 // Lowering boolean ops 81 (AndB x y) -> (ANDL x y) 82 (OrB x y) -> (ORL x y) 83 (Not x) -> (XORLconst [1] x) 84 85 // Lowering pointer arithmetic 86 (OffPtr [off] ptr) -> (ADDLconst [off] ptr) 87 88 (Bswap32 x) -> (BSWAPL x) 89 90 (Sqrt x) -> (SQRTSD x) 91 92 // Lowering extension 93 (SignExt8to16 x) -> (MOVBLSX x) 94 (SignExt8to32 x) -> (MOVBLSX x) 95 (SignExt16to32 x) -> (MOVWLSX x) 96 97 (ZeroExt8to16 x) -> (MOVBLZX x) 98 (ZeroExt8to32 x) -> (MOVBLZX x) 99 (ZeroExt16to32 x) -> (MOVWLZX x) 100 101 (Signmask x) -> (SARLconst x [31]) 102 (Zeromask <t> x) -> (XORLconst [-1] (SBBLcarrymask <t> (CMPLconst x [1]))) 103 (Slicemask <t> x) -> (SARLconst (NEGL <t> x) [31]) 104 105 // Lowering truncation 106 // Because we ignore high parts of registers, truncates are just copies. 107 (Trunc16to8 x) -> x 108 (Trunc32to8 x) -> x 109 (Trunc32to16 x) -> x 110 111 // Lowering float <-> int 112 (Cvt32to32F x) -> (CVTSL2SS x) 113 (Cvt32to64F x) -> (CVTSL2SD x) 114 115 (Cvt32Fto32 x) -> (CVTTSS2SL x) 116 (Cvt64Fto32 x) -> (CVTTSD2SL x) 117 118 (Cvt32Fto64F x) -> (CVTSS2SD x) 119 (Cvt64Fto32F x) -> (CVTSD2SS x) 120 121 (Round32F x) -> x 122 (Round64F x) -> x 123 124 // Lowering shifts 125 // Unsigned shifts need to return 0 if shift amount is >= width of shifted value. 126 // result = (arg << shift) & (shift >= argbits ? 0 : 0xffffffffffffffff) 127 (Lsh32x32 <t> x y) -> (ANDL (SHLL <t> x y) (SBBLcarrymask <t> (CMPLconst y [32]))) 128 (Lsh32x16 <t> x y) -> (ANDL (SHLL <t> x y) (SBBLcarrymask <t> (CMPWconst y [32]))) 129 (Lsh32x8 <t> x y) -> (ANDL (SHLL <t> x y) (SBBLcarrymask <t> (CMPBconst y [32]))) 130 131 (Lsh16x32 <t> x y) -> (ANDL (SHLL <t> x y) (SBBLcarrymask <t> (CMPLconst y [32]))) 132 (Lsh16x16 <t> x y) -> (ANDL (SHLL <t> x y) (SBBLcarrymask <t> (CMPWconst y [32]))) 133 (Lsh16x8 <t> x y) -> (ANDL (SHLL <t> x y) (SBBLcarrymask <t> (CMPBconst y [32]))) 134 135 (Lsh8x32 <t> x y) -> (ANDL (SHLL <t> x y) (SBBLcarrymask <t> (CMPLconst y [32]))) 136 (Lsh8x16 <t> x y) -> (ANDL (SHLL <t> x y) (SBBLcarrymask <t> (CMPWconst y [32]))) 137 (Lsh8x8 <t> x y) -> (ANDL (SHLL <t> x y) (SBBLcarrymask <t> (CMPBconst y [32]))) 138 139 (Rsh32Ux32 <t> x y) -> (ANDL (SHRL <t> x y) (SBBLcarrymask <t> (CMPLconst y [32]))) 140 (Rsh32Ux16 <t> x y) -> (ANDL (SHRL <t> x y) (SBBLcarrymask <t> (CMPWconst y [32]))) 141 (Rsh32Ux8 <t> x y) -> (ANDL (SHRL <t> x y) (SBBLcarrymask <t> (CMPBconst y [32]))) 142 143 (Rsh16Ux32 <t> x y) -> (ANDL (SHRW <t> x y) (SBBLcarrymask <t> (CMPLconst y [16]))) 144 (Rsh16Ux16 <t> x y) -> (ANDL (SHRW <t> x y) (SBBLcarrymask <t> (CMPWconst y [16]))) 145 (Rsh16Ux8 <t> x y) -> (ANDL (SHRW <t> x y) (SBBLcarrymask <t> (CMPBconst y [16]))) 146 147 (Rsh8Ux32 <t> x y) -> (ANDL (SHRB <t> x y) (SBBLcarrymask <t> (CMPLconst y [8]))) 148 (Rsh8Ux16 <t> x y) -> (ANDL (SHRB <t> x y) (SBBLcarrymask <t> (CMPWconst y [8]))) 149 (Rsh8Ux8 <t> x y) -> (ANDL (SHRB <t> x y) (SBBLcarrymask <t> (CMPBconst y [8]))) 150 151 // Signed right shift needs to return 0/-1 if shift amount is >= width of shifted value. 152 // We implement this by setting the shift value to -1 (all ones) if the shift value is >= width. 153 154 (Rsh32x32 <t> x y) -> (SARL <t> x (ORL <y.Type> y (NOTL <y.Type> (SBBLcarrymask <y.Type> (CMPLconst y [32]))))) 155 (Rsh32x16 <t> x y) -> (SARL <t> x (ORL <y.Type> y (NOTL <y.Type> (SBBLcarrymask <y.Type> (CMPWconst y [32]))))) 156 (Rsh32x8 <t> x y) -> (SARL <t> x (ORL <y.Type> y (NOTL <y.Type> (SBBLcarrymask <y.Type> (CMPBconst y [32]))))) 157 158 (Rsh16x32 <t> x y) -> (SARW <t> x (ORL <y.Type> y (NOTL <y.Type> (SBBLcarrymask <y.Type> (CMPLconst y [16]))))) 159 (Rsh16x16 <t> x y) -> (SARW <t> x (ORL <y.Type> y (NOTL <y.Type> (SBBLcarrymask <y.Type> (CMPWconst y [16]))))) 160 (Rsh16x8 <t> x y) -> (SARW <t> x (ORL <y.Type> y (NOTL <y.Type> (SBBLcarrymask <y.Type> (CMPBconst y [16]))))) 161 162 (Rsh8x32 <t> x y) -> (SARB <t> x (ORL <y.Type> y (NOTL <y.Type> (SBBLcarrymask <y.Type> (CMPLconst y [8]))))) 163 (Rsh8x16 <t> x y) -> (SARB <t> x (ORL <y.Type> y (NOTL <y.Type> (SBBLcarrymask <y.Type> (CMPWconst y [8]))))) 164 (Rsh8x8 <t> x y) -> (SARB <t> x (ORL <y.Type> y (NOTL <y.Type> (SBBLcarrymask <y.Type> (CMPBconst y [8]))))) 165 166 // constant shifts 167 // generic opt rewrites all constant shifts to shift by Const64 168 (Lsh32x64 x (Const64 [c])) && uint64(c) < 32 -> (SHLLconst x [c]) 169 (Rsh32x64 x (Const64 [c])) && uint64(c) < 32 -> (SARLconst x [c]) 170 (Rsh32Ux64 x (Const64 [c])) && uint64(c) < 32 -> (SHRLconst x [c]) 171 (Lsh16x64 x (Const64 [c])) && uint64(c) < 16 -> (SHLLconst x [c]) 172 (Rsh16x64 x (Const64 [c])) && uint64(c) < 16 -> (SARWconst x [c]) 173 (Rsh16Ux64 x (Const64 [c])) && uint64(c) < 16 -> (SHRWconst x [c]) 174 (Lsh8x64 x (Const64 [c])) && uint64(c) < 8 -> (SHLLconst x [c]) 175 (Rsh8x64 x (Const64 [c])) && uint64(c) < 8 -> (SARBconst x [c]) 176 (Rsh8Ux64 x (Const64 [c])) && uint64(c) < 8 -> (SHRBconst x [c]) 177 178 // large constant shifts 179 (Lsh32x64 _ (Const64 [c])) && uint64(c) >= 32 -> (Const32 [0]) 180 (Rsh32Ux64 _ (Const64 [c])) && uint64(c) >= 32 -> (Const32 [0]) 181 (Lsh16x64 _ (Const64 [c])) && uint64(c) >= 16 -> (Const16 [0]) 182 (Rsh16Ux64 _ (Const64 [c])) && uint64(c) >= 16 -> (Const16 [0]) 183 (Lsh8x64 _ (Const64 [c])) && uint64(c) >= 8 -> (Const8 [0]) 184 (Rsh8Ux64 _ (Const64 [c])) && uint64(c) >= 8 -> (Const8 [0]) 185 186 // large constant signed right shift, we leave the sign bit 187 (Rsh32x64 x (Const64 [c])) && uint64(c) >= 32 -> (SARLconst x [31]) 188 (Rsh16x64 x (Const64 [c])) && uint64(c) >= 16 -> (SARWconst x [15]) 189 (Rsh8x64 x (Const64 [c])) && uint64(c) >= 8 -> (SARBconst x [7]) 190 191 // Lowering comparisons 192 (Less32 x y) -> (SETL (CMPL x y)) 193 (Less16 x y) -> (SETL (CMPW x y)) 194 (Less8 x y) -> (SETL (CMPB x y)) 195 (Less32U x y) -> (SETB (CMPL x y)) 196 (Less16U x y) -> (SETB (CMPW x y)) 197 (Less8U x y) -> (SETB (CMPB x y)) 198 // Use SETGF with reversed operands to dodge NaN case 199 (Less64F x y) -> (SETGF (UCOMISD y x)) 200 (Less32F x y) -> (SETGF (UCOMISS y x)) 201 202 (Leq32 x y) -> (SETLE (CMPL x y)) 203 (Leq16 x y) -> (SETLE (CMPW x y)) 204 (Leq8 x y) -> (SETLE (CMPB x y)) 205 (Leq32U x y) -> (SETBE (CMPL x y)) 206 (Leq16U x y) -> (SETBE (CMPW x y)) 207 (Leq8U x y) -> (SETBE (CMPB x y)) 208 // Use SETGEF with reversed operands to dodge NaN case 209 (Leq64F x y) -> (SETGEF (UCOMISD y x)) 210 (Leq32F x y) -> (SETGEF (UCOMISS y x)) 211 212 (Greater32 x y) -> (SETG (CMPL x y)) 213 (Greater16 x y) -> (SETG (CMPW x y)) 214 (Greater8 x y) -> (SETG (CMPB x y)) 215 (Greater32U x y) -> (SETA (CMPL x y)) 216 (Greater16U x y) -> (SETA (CMPW x y)) 217 (Greater8U x y) -> (SETA (CMPB x y)) 218 // Note Go assembler gets UCOMISx operand order wrong, but it is right here 219 // Bug is accommodated at generation of assembly language. 220 (Greater64F x y) -> (SETGF (UCOMISD x y)) 221 (Greater32F x y) -> (SETGF (UCOMISS x y)) 222 223 (Geq32 x y) -> (SETGE (CMPL x y)) 224 (Geq16 x y) -> (SETGE (CMPW x y)) 225 (Geq8 x y) -> (SETGE (CMPB x y)) 226 (Geq32U x y) -> (SETAE (CMPL x y)) 227 (Geq16U x y) -> (SETAE (CMPW x y)) 228 (Geq8U x y) -> (SETAE (CMPB x y)) 229 // Note Go assembler gets UCOMISx operand order wrong, but it is right here 230 // Bug is accommodated at generation of assembly language. 231 (Geq64F x y) -> (SETGEF (UCOMISD x y)) 232 (Geq32F x y) -> (SETGEF (UCOMISS x y)) 233 234 (Eq32 x y) -> (SETEQ (CMPL x y)) 235 (Eq16 x y) -> (SETEQ (CMPW x y)) 236 (Eq8 x y) -> (SETEQ (CMPB x y)) 237 (EqB x y) -> (SETEQ (CMPB x y)) 238 (EqPtr x y) -> (SETEQ (CMPL x y)) 239 (Eq64F x y) -> (SETEQF (UCOMISD x y)) 240 (Eq32F x y) -> (SETEQF (UCOMISS x y)) 241 242 (Neq32 x y) -> (SETNE (CMPL x y)) 243 (Neq16 x y) -> (SETNE (CMPW x y)) 244 (Neq8 x y) -> (SETNE (CMPB x y)) 245 (NeqB x y) -> (SETNE (CMPB x y)) 246 (NeqPtr x y) -> (SETNE (CMPL x y)) 247 (Neq64F x y) -> (SETNEF (UCOMISD x y)) 248 (Neq32F x y) -> (SETNEF (UCOMISS x y)) 249 250 // Lowering loads 251 (Load <t> ptr mem) && (is32BitInt(t) || isPtr(t)) -> (MOVLload ptr mem) 252 (Load <t> ptr mem) && is16BitInt(t) -> (MOVWload ptr mem) 253 (Load <t> ptr mem) && (t.IsBoolean() || is8BitInt(t)) -> (MOVBload ptr mem) 254 (Load <t> ptr mem) && is32BitFloat(t) -> (MOVSSload ptr mem) 255 (Load <t> ptr mem) && is64BitFloat(t) -> (MOVSDload ptr mem) 256 257 // Lowering stores 258 // These more-specific FP versions of Store pattern should come first. 259 (Store {t} ptr val mem) && t.(Type).Size() == 8 && is64BitFloat(val.Type) -> (MOVSDstore ptr val mem) 260 (Store {t} ptr val mem) && t.(Type).Size() == 4 && is32BitFloat(val.Type) -> (MOVSSstore ptr val mem) 261 262 (Store {t} ptr val mem) && t.(Type).Size() == 4 -> (MOVLstore ptr val mem) 263 (Store {t} ptr val mem) && t.(Type).Size() == 2 -> (MOVWstore ptr val mem) 264 (Store {t} ptr val mem) && t.(Type).Size() == 1 -> (MOVBstore ptr val mem) 265 266 // Lowering moves 267 (Move [0] _ _ mem) -> mem 268 (Move [1] dst src mem) -> (MOVBstore dst (MOVBload src mem) mem) 269 (Move [2] dst src mem) -> (MOVWstore dst (MOVWload src mem) mem) 270 (Move [4] dst src mem) -> (MOVLstore dst (MOVLload src mem) mem) 271 (Move [3] dst src mem) -> 272 (MOVBstore [2] dst (MOVBload [2] src mem) 273 (MOVWstore dst (MOVWload src mem) mem)) 274 (Move [5] dst src mem) -> 275 (MOVBstore [4] dst (MOVBload [4] src mem) 276 (MOVLstore dst (MOVLload src mem) mem)) 277 (Move [6] dst src mem) -> 278 (MOVWstore [4] dst (MOVWload [4] src mem) 279 (MOVLstore dst (MOVLload src mem) mem)) 280 (Move [7] dst src mem) -> 281 (MOVLstore [3] dst (MOVLload [3] src mem) 282 (MOVLstore dst (MOVLload src mem) mem)) 283 (Move [8] dst src mem) -> 284 (MOVLstore [4] dst (MOVLload [4] src mem) 285 (MOVLstore dst (MOVLload src mem) mem)) 286 287 // Adjust moves to be a multiple of 4 bytes. 288 (Move [s] dst src mem) 289 && s > 8 && s%4 != 0 -> 290 (Move [s-s%4] 291 (ADDLconst <dst.Type> dst [s%4]) 292 (ADDLconst <src.Type> src [s%4]) 293 (MOVLstore dst (MOVLload src mem) mem)) 294 295 // Medium copying uses a duff device. 296 (Move [s] dst src mem) 297 && s > 8 && s <= 4*128 && s%4 == 0 298 && !config.noDuffDevice -> 299 (DUFFCOPY [10*(128-s/4)] dst src mem) 300 // 10 and 128 are magic constants. 10 is the number of bytes to encode: 301 // MOVL (SI), CX 302 // ADDL $4, SI 303 // MOVL CX, (DI) 304 // ADDL $4, DI 305 // and 128 is the number of such blocks. See src/runtime/duff_386.s:duffcopy. 306 307 // Large copying uses REP MOVSL. 308 (Move [s] dst src mem) && (s > 4*128 || config.noDuffDevice) && s%4 == 0 -> 309 (REPMOVSL dst src (MOVLconst [s/4]) mem) 310 311 // Lowering Zero instructions 312 (Zero [0] _ mem) -> mem 313 (Zero [1] destptr mem) -> (MOVBstoreconst [0] destptr mem) 314 (Zero [2] destptr mem) -> (MOVWstoreconst [0] destptr mem) 315 (Zero [4] destptr mem) -> (MOVLstoreconst [0] destptr mem) 316 317 (Zero [3] destptr mem) -> 318 (MOVBstoreconst [makeValAndOff(0,2)] destptr 319 (MOVWstoreconst [0] destptr mem)) 320 (Zero [5] destptr mem) -> 321 (MOVBstoreconst [makeValAndOff(0,4)] destptr 322 (MOVLstoreconst [0] destptr mem)) 323 (Zero [6] destptr mem) -> 324 (MOVWstoreconst [makeValAndOff(0,4)] destptr 325 (MOVLstoreconst [0] destptr mem)) 326 (Zero [7] destptr mem) -> 327 (MOVLstoreconst [makeValAndOff(0,3)] destptr 328 (MOVLstoreconst [0] destptr mem)) 329 330 // Strip off any fractional word zeroing. 331 (Zero [s] destptr mem) && s%4 != 0 && s > 4 -> 332 (Zero [s-s%4] (ADDLconst destptr [s%4]) 333 (MOVLstoreconst [0] destptr mem)) 334 335 // Zero small numbers of words directly. 336 (Zero [8] destptr mem) -> 337 (MOVLstoreconst [makeValAndOff(0,4)] destptr 338 (MOVLstoreconst [0] destptr mem)) 339 (Zero [12] destptr mem) -> 340 (MOVLstoreconst [makeValAndOff(0,8)] destptr 341 (MOVLstoreconst [makeValAndOff(0,4)] destptr 342 (MOVLstoreconst [0] destptr mem))) 343 (Zero [16] destptr mem) -> 344 (MOVLstoreconst [makeValAndOff(0,12)] destptr 345 (MOVLstoreconst [makeValAndOff(0,8)] destptr 346 (MOVLstoreconst [makeValAndOff(0,4)] destptr 347 (MOVLstoreconst [0] destptr mem)))) 348 349 // Medium zeroing uses a duff device. 350 (Zero [s] destptr mem) 351 && s > 16 && s <= 4*128 && s%4 == 0 352 && !config.noDuffDevice -> 353 (DUFFZERO [1*(128-s/4)] destptr (MOVLconst [0]) mem) 354 // 1 and 128 are magic constants. 1 is the number of bytes to encode STOSL. 355 // 128 is the number of STOSL instructions in duffzero. 356 // See src/runtime/duff_386.s:duffzero. 357 358 // Large zeroing uses REP STOSQ. 359 (Zero [s] destptr mem) 360 && (s > 4*128 || (config.noDuffDevice && s > 16)) 361 && s%4 == 0 -> 362 (REPSTOSL destptr (MOVLconst [s/4]) (MOVLconst [0]) mem) 363 364 // Lowering constants 365 (Const8 [val]) -> (MOVLconst [val]) 366 (Const16 [val]) -> (MOVLconst [val]) 367 (Const32 [val]) -> (MOVLconst [val]) 368 (Const32F [val]) -> (MOVSSconst [val]) 369 (Const64F [val]) -> (MOVSDconst [val]) 370 (ConstNil) -> (MOVLconst [0]) 371 (ConstBool [b]) -> (MOVLconst [b]) 372 373 // Lowering calls 374 (StaticCall [argwid] {target} mem) -> (CALLstatic [argwid] {target} mem) 375 (ClosureCall [argwid] entry closure mem) -> (CALLclosure [argwid] entry closure mem) 376 (InterCall [argwid] entry mem) -> (CALLinter [argwid] entry mem) 377 378 // Miscellaneous 379 (Convert <t> x mem) -> (MOVLconvert <t> x mem) 380 (IsNonNil p) -> (SETNE (TESTL p p)) 381 (IsInBounds idx len) -> (SETB (CMPL idx len)) 382 (IsSliceInBounds idx len) -> (SETBE (CMPL idx len)) 383 (NilCheck ptr mem) -> (LoweredNilCheck ptr mem) 384 (GetG mem) -> (LoweredGetG mem) 385 (GetClosurePtr) -> (LoweredGetClosurePtr) 386 (Addr {sym} base) -> (LEAL {sym} base) 387 388 // block rewrites 389 (If (SETL cmp) yes no) -> (LT cmp yes no) 390 (If (SETLE cmp) yes no) -> (LE cmp yes no) 391 (If (SETG cmp) yes no) -> (GT cmp yes no) 392 (If (SETGE cmp) yes no) -> (GE cmp yes no) 393 (If (SETEQ cmp) yes no) -> (EQ cmp yes no) 394 (If (SETNE cmp) yes no) -> (NE cmp yes no) 395 (If (SETB cmp) yes no) -> (ULT cmp yes no) 396 (If (SETBE cmp) yes no) -> (ULE cmp yes no) 397 (If (SETA cmp) yes no) -> (UGT cmp yes no) 398 (If (SETAE cmp) yes no) -> (UGE cmp yes no) 399 400 // Special case for floating point - LF/LEF not generated 401 (If (SETGF cmp) yes no) -> (UGT cmp yes no) 402 (If (SETGEF cmp) yes no) -> (UGE cmp yes no) 403 (If (SETEQF cmp) yes no) -> (EQF cmp yes no) 404 (If (SETNEF cmp) yes no) -> (NEF cmp yes no) 405 406 (If cond yes no) -> (NE (TESTB cond cond) yes no) 407 408 // *************************** 409 // Above: lowering rules 410 // Below: optimizations 411 // *************************** 412 // TODO: Should the optimizations be a separate pass? 413 414 // Fold boolean tests into blocks 415 (NE (TESTB (SETL cmp) (SETL cmp)) yes no) -> (LT cmp yes no) 416 (NE (TESTB (SETLE cmp) (SETLE cmp)) yes no) -> (LE cmp yes no) 417 (NE (TESTB (SETG cmp) (SETG cmp)) yes no) -> (GT cmp yes no) 418 (NE (TESTB (SETGE cmp) (SETGE cmp)) yes no) -> (GE cmp yes no) 419 (NE (TESTB (SETEQ cmp) (SETEQ cmp)) yes no) -> (EQ cmp yes no) 420 (NE (TESTB (SETNE cmp) (SETNE cmp)) yes no) -> (NE cmp yes no) 421 (NE (TESTB (SETB cmp) (SETB cmp)) yes no) -> (ULT cmp yes no) 422 (NE (TESTB (SETBE cmp) (SETBE cmp)) yes no) -> (ULE cmp yes no) 423 (NE (TESTB (SETA cmp) (SETA cmp)) yes no) -> (UGT cmp yes no) 424 (NE (TESTB (SETAE cmp) (SETAE cmp)) yes no) -> (UGE cmp yes no) 425 426 // Special case for floating point - LF/LEF not generated 427 (NE (TESTB (SETGF cmp) (SETGF cmp)) yes no) -> (UGT cmp yes no) 428 (NE (TESTB (SETGEF cmp) (SETGEF cmp)) yes no) -> (UGE cmp yes no) 429 (NE (TESTB (SETEQF cmp) (SETEQF cmp)) yes no) -> (EQF cmp yes no) 430 (NE (TESTB (SETNEF cmp) (SETNEF cmp)) yes no) -> (NEF cmp yes no) 431 432 // fold constants into instructions 433 (ADDL x (MOVLconst [c])) -> (ADDLconst [c] x) 434 (ADDLcarry x (MOVLconst [c])) -> (ADDLconstcarry [c] x) 435 (ADCL x (MOVLconst [c]) f) -> (ADCLconst [c] x f) 436 (ADCL (MOVLconst [c]) x f) -> (ADCLconst [c] x f) 437 438 (SUBL x (MOVLconst [c])) -> (SUBLconst x [c]) 439 (SUBL (MOVLconst [c]) x) -> (NEGL (SUBLconst <v.Type> x [c])) 440 (SUBLcarry x (MOVLconst [c])) -> (SUBLconstcarry [c] x) 441 (SBBL x (MOVLconst [c]) f) -> (SBBLconst [c] x f) 442 443 (MULL x (MOVLconst [c])) -> (MULLconst [c] x) 444 445 (ANDL x (MOVLconst [c])) -> (ANDLconst [c] x) 446 447 (ANDLconst [c] (ANDLconst [d] x)) -> (ANDLconst [c & d] x) 448 449 (XORLconst [c] (XORLconst [d] x)) -> (XORLconst [c ^ d] x) 450 451 (MULLconst [c] (MULLconst [d] x)) -> (MULLconst [int64(int32(c * d))] x) 452 453 (ORL x (MOVLconst [c])) -> (ORLconst [c] x) 454 455 (XORL x (MOVLconst [c])) -> (XORLconst [c] x) 456 457 (SHLL x (MOVLconst [c])) -> (SHLLconst [c&31] x) 458 (SHRL x (MOVLconst [c])) -> (SHRLconst [c&31] x) 459 (SHRW x (MOVLconst [c])) && c&31 < 16 -> (SHRWconst [c&31] x) 460 (SHRW _ (MOVLconst [c])) && c&31 >= 16 -> (MOVLconst [0]) 461 (SHRB x (MOVLconst [c])) && c&31 < 8 -> (SHRBconst [c&31] x) 462 (SHRB _ (MOVLconst [c])) && c&31 >= 8 -> (MOVLconst [0]) 463 464 (SARL x (MOVLconst [c])) -> (SARLconst [c&31] x) 465 (SARW x (MOVLconst [c])) -> (SARWconst [min(c&31,15)] x) 466 (SARB x (MOVLconst [c])) -> (SARBconst [min(c&31,7)] x) 467 468 (SARL x (ANDLconst [31] y)) -> (SARL x y) 469 470 (SHLL x (ANDLconst [31] y)) -> (SHLL x y) 471 472 (SHRL x (ANDLconst [31] y)) -> (SHRL x y) 473 474 // Rotate instructions 475 476 (ADDL (SHLLconst [c] x) (SHRLconst [d] x)) && d == 32-c -> (ROLLconst [c] x) 477 ( ORL (SHLLconst [c] x) (SHRLconst [d] x)) && d == 32-c -> (ROLLconst [c] x) 478 (XORL (SHLLconst [c] x) (SHRLconst [d] x)) && d == 32-c -> (ROLLconst [c] x) 479 480 (ADDL <t> (SHLLconst x [c]) (SHRWconst x [d])) && c < 16 && d == 16-c && t.Size() == 2 -> (ROLWconst x [c]) 481 ( ORL <t> (SHLLconst x [c]) (SHRWconst x [d])) && c < 16 && d == 16-c && t.Size() == 2 -> (ROLWconst x [c]) 482 (XORL <t> (SHLLconst x [c]) (SHRWconst x [d])) && c < 16 && d == 16-c && t.Size() == 2 -> (ROLWconst x [c]) 483 484 (ADDL <t> (SHLLconst x [c]) (SHRBconst x [d])) && c < 8 && d == 8-c && t.Size() == 1 -> (ROLBconst x [c]) 485 ( ORL <t> (SHLLconst x [c]) (SHRBconst x [d])) && c < 8 && d == 8-c && t.Size() == 1 -> (ROLBconst x [c]) 486 (XORL <t> (SHLLconst x [c]) (SHRBconst x [d])) && c < 8 && d == 8-c && t.Size() == 1 -> (ROLBconst x [c]) 487 488 (ROLLconst [c] (ROLLconst [d] x)) -> (ROLLconst [(c+d)&31] x) 489 (ROLWconst [c] (ROLWconst [d] x)) -> (ROLWconst [(c+d)&15] x) 490 (ROLBconst [c] (ROLBconst [d] x)) -> (ROLBconst [(c+d)& 7] x) 491 492 // Constant shift simplifications 493 494 (SHLLconst x [0]) -> x 495 (SHRLconst x [0]) -> x 496 (SARLconst x [0]) -> x 497 498 (SHRWconst x [0]) -> x 499 (SARWconst x [0]) -> x 500 501 (SHRBconst x [0]) -> x 502 (SARBconst x [0]) -> x 503 504 (ROLLconst [0] x) -> x 505 (ROLWconst [0] x) -> x 506 (ROLBconst [0] x) -> x 507 508 // Note: the word and byte shifts keep the low 5 bits (not the low 4 or 3 bits) 509 // because the x86 instructions are defined to use all 5 bits of the shift even 510 // for the small shifts. I don't think we'll ever generate a weird shift (e.g. 511 // (SHRW x (MOVLconst [24])), but just in case. 512 513 (CMPL x (MOVLconst [c])) -> (CMPLconst x [c]) 514 (CMPL (MOVLconst [c]) x) -> (InvertFlags (CMPLconst x [c])) 515 (CMPW x (MOVLconst [c])) -> (CMPWconst x [int64(int16(c))]) 516 (CMPW (MOVLconst [c]) x) -> (InvertFlags (CMPWconst x [int64(int16(c))])) 517 (CMPB x (MOVLconst [c])) -> (CMPBconst x [int64(int8(c))]) 518 (CMPB (MOVLconst [c]) x) -> (InvertFlags (CMPBconst x [int64(int8(c))])) 519 520 // strength reduction 521 // Assumes that the following costs from https://gmplib.org/~tege/x86-timing.pdf: 522 // 1 - addq, shlq, leaq, negq 523 // 3 - imulq 524 // This limits the rewrites to two instructions. 525 // TODO: 27, 81 526 (MULLconst [-1] x) -> (NEGL x) 527 (MULLconst [0] _) -> (MOVLconst [0]) 528 (MULLconst [1] x) -> x 529 (MULLconst [3] x) -> (LEAL2 x x) 530 (MULLconst [5] x) -> (LEAL4 x x) 531 (MULLconst [7] x) -> (LEAL8 (NEGL <v.Type> x) x) 532 (MULLconst [9] x) -> (LEAL8 x x) 533 (MULLconst [11] x) -> (LEAL2 x (LEAL4 <v.Type> x x)) 534 (MULLconst [13] x) -> (LEAL4 x (LEAL2 <v.Type> x x)) 535 (MULLconst [21] x) -> (LEAL4 x (LEAL4 <v.Type> x x)) 536 (MULLconst [25] x) -> (LEAL8 x (LEAL2 <v.Type> x x)) 537 (MULLconst [37] x) -> (LEAL4 x (LEAL8 <v.Type> x x)) 538 (MULLconst [41] x) -> (LEAL8 x (LEAL4 <v.Type> x x)) 539 (MULLconst [73] x) -> (LEAL8 x (LEAL8 <v.Type> x x)) 540 541 (MULLconst [c] x) && isPowerOfTwo(c) -> (SHLLconst [log2(c)] x) 542 (MULLconst [c] x) && isPowerOfTwo(c+1) && c >= 15 -> (SUBL (SHLLconst <v.Type> [log2(c+1)] x) x) 543 (MULLconst [c] x) && isPowerOfTwo(c-1) && c >= 17 -> (LEAL1 (SHLLconst <v.Type> [log2(c-1)] x) x) 544 (MULLconst [c] x) && isPowerOfTwo(c-2) && c >= 34 -> (LEAL2 (SHLLconst <v.Type> [log2(c-2)] x) x) 545 (MULLconst [c] x) && isPowerOfTwo(c-4) && c >= 68 -> (LEAL4 (SHLLconst <v.Type> [log2(c-4)] x) x) 546 (MULLconst [c] x) && isPowerOfTwo(c-8) && c >= 136 -> (LEAL8 (SHLLconst <v.Type> [log2(c-8)] x) x) 547 (MULLconst [c] x) && c%3 == 0 && isPowerOfTwo(c/3) -> (SHLLconst [log2(c/3)] (LEAL2 <v.Type> x x)) 548 (MULLconst [c] x) && c%5 == 0 && isPowerOfTwo(c/5) -> (SHLLconst [log2(c/5)] (LEAL4 <v.Type> x x)) 549 (MULLconst [c] x) && c%9 == 0 && isPowerOfTwo(c/9) -> (SHLLconst [log2(c/9)] (LEAL8 <v.Type> x x)) 550 551 // combine add/shift into LEAL 552 (ADDL x (SHLLconst [3] y)) -> (LEAL8 x y) 553 (ADDL x (SHLLconst [2] y)) -> (LEAL4 x y) 554 (ADDL x (SHLLconst [1] y)) -> (LEAL2 x y) 555 (ADDL x (ADDL y y)) -> (LEAL2 x y) 556 (ADDL x (ADDL x y)) -> (LEAL2 y x) 557 558 // combine ADDL/ADDLconst into LEAL1 559 (ADDLconst [c] (ADDL x y)) -> (LEAL1 [c] x y) 560 (ADDL (ADDLconst [c] x) y) -> (LEAL1 [c] x y) 561 562 // fold ADDL into LEAL 563 (ADDLconst [c] (LEAL [d] {s} x)) && is32Bit(c+d) -> (LEAL [c+d] {s} x) 564 (LEAL [c] {s} (ADDLconst [d] x)) && is32Bit(c+d) -> (LEAL [c+d] {s} x) 565 (LEAL [c] {s} (ADDL x y)) && x.Op != OpSB && y.Op != OpSB -> (LEAL1 [c] {s} x y) 566 (ADDL x (LEAL [c] {s} y)) && x.Op != OpSB && y.Op != OpSB -> (LEAL1 [c] {s} x y) 567 568 // fold ADDLconst into LEALx 569 (ADDLconst [c] (LEAL1 [d] {s} x y)) && is32Bit(c+d) -> (LEAL1 [c+d] {s} x y) 570 (ADDLconst [c] (LEAL2 [d] {s} x y)) && is32Bit(c+d) -> (LEAL2 [c+d] {s} x y) 571 (ADDLconst [c] (LEAL4 [d] {s} x y)) && is32Bit(c+d) -> (LEAL4 [c+d] {s} x y) 572 (ADDLconst [c] (LEAL8 [d] {s} x y)) && is32Bit(c+d) -> (LEAL8 [c+d] {s} x y) 573 (LEAL1 [c] {s} (ADDLconst [d] x) y) && is32Bit(c+d) && x.Op != OpSB -> (LEAL1 [c+d] {s} x y) 574 (LEAL2 [c] {s} (ADDLconst [d] x) y) && is32Bit(c+d) && x.Op != OpSB -> (LEAL2 [c+d] {s} x y) 575 (LEAL2 [c] {s} x (ADDLconst [d] y)) && is32Bit(c+2*d) && y.Op != OpSB -> (LEAL2 [c+2*d] {s} x y) 576 (LEAL4 [c] {s} (ADDLconst [d] x) y) && is32Bit(c+d) && x.Op != OpSB -> (LEAL4 [c+d] {s} x y) 577 (LEAL4 [c] {s} x (ADDLconst [d] y)) && is32Bit(c+4*d) && y.Op != OpSB -> (LEAL4 [c+4*d] {s} x y) 578 (LEAL8 [c] {s} (ADDLconst [d] x) y) && is32Bit(c+d) && x.Op != OpSB -> (LEAL8 [c+d] {s} x y) 579 (LEAL8 [c] {s} x (ADDLconst [d] y)) && is32Bit(c+8*d) && y.Op != OpSB -> (LEAL8 [c+8*d] {s} x y) 580 581 // fold shifts into LEALx 582 (LEAL1 [c] {s} x (SHLLconst [1] y)) -> (LEAL2 [c] {s} x y) 583 (LEAL1 [c] {s} x (SHLLconst [2] y)) -> (LEAL4 [c] {s} x y) 584 (LEAL1 [c] {s} x (SHLLconst [3] y)) -> (LEAL8 [c] {s} x y) 585 (LEAL2 [c] {s} x (SHLLconst [1] y)) -> (LEAL4 [c] {s} x y) 586 (LEAL2 [c] {s} x (SHLLconst [2] y)) -> (LEAL8 [c] {s} x y) 587 (LEAL4 [c] {s} x (SHLLconst [1] y)) -> (LEAL8 [c] {s} x y) 588 589 // reverse ordering of compare instruction 590 (SETL (InvertFlags x)) -> (SETG x) 591 (SETG (InvertFlags x)) -> (SETL x) 592 (SETB (InvertFlags x)) -> (SETA x) 593 (SETA (InvertFlags x)) -> (SETB x) 594 (SETLE (InvertFlags x)) -> (SETGE x) 595 (SETGE (InvertFlags x)) -> (SETLE x) 596 (SETBE (InvertFlags x)) -> (SETAE x) 597 (SETAE (InvertFlags x)) -> (SETBE x) 598 (SETEQ (InvertFlags x)) -> (SETEQ x) 599 (SETNE (InvertFlags x)) -> (SETNE x) 600 601 // sign extended loads 602 // Note: The combined instruction must end up in the same block 603 // as the original load. If not, we end up making a value with 604 // memory type live in two different blocks, which can lead to 605 // multiple memory values alive simultaneously. 606 // Make sure we don't combine these ops if the load has another use. 607 // This prevents a single load from being split into multiple loads 608 // which then might return different values. See test/atomicload.go. 609 (MOVBLSX x:(MOVBload [off] {sym} ptr mem)) && x.Uses == 1 && clobber(x) -> @x.Block (MOVBLSXload <v.Type> [off] {sym} ptr mem) 610 (MOVBLZX x:(MOVBload [off] {sym} ptr mem)) && x.Uses == 1 && clobber(x) -> @x.Block (MOVBload <v.Type> [off] {sym} ptr mem) 611 (MOVWLSX x:(MOVWload [off] {sym} ptr mem)) && x.Uses == 1 && clobber(x) -> @x.Block (MOVWLSXload <v.Type> [off] {sym} ptr mem) 612 (MOVWLZX x:(MOVWload [off] {sym} ptr mem)) && x.Uses == 1 && clobber(x) -> @x.Block (MOVWload <v.Type> [off] {sym} ptr mem) 613 614 (MOVBLZX x:(MOVBloadidx1 [off] {sym} ptr idx mem)) && x.Uses == 1 && clobber(x) -> @x.Block (MOVBloadidx1 <v.Type> [off] {sym} ptr idx mem) 615 (MOVWLZX x:(MOVWloadidx1 [off] {sym} ptr idx mem)) && x.Uses == 1 && clobber(x) -> @x.Block (MOVWloadidx1 <v.Type> [off] {sym} ptr idx mem) 616 (MOVWLZX x:(MOVWloadidx2 [off] {sym} ptr idx mem)) && x.Uses == 1 && clobber(x) -> @x.Block (MOVWloadidx2 <v.Type> [off] {sym} ptr idx mem) 617 618 // replace load from same location as preceding store with copy 619 (MOVBload [off] {sym} ptr (MOVBstore [off2] {sym2} ptr2 x _)) && sym == sym2 && off == off2 && isSamePtr(ptr, ptr2) -> x 620 (MOVWload [off] {sym} ptr (MOVWstore [off2] {sym2} ptr2 x _)) && sym == sym2 && off == off2 && isSamePtr(ptr, ptr2) -> x 621 (MOVLload [off] {sym} ptr (MOVLstore [off2] {sym2} ptr2 x _)) && sym == sym2 && off == off2 && isSamePtr(ptr, ptr2) -> x 622 623 // Fold extensions and ANDs together. 624 (MOVBLZX (ANDLconst [c] x)) -> (ANDLconst [c & 0xff] x) 625 (MOVWLZX (ANDLconst [c] x)) -> (ANDLconst [c & 0xffff] x) 626 (MOVBLSX (ANDLconst [c] x)) && c & 0x80 == 0 -> (ANDLconst [c & 0x7f] x) 627 (MOVWLSX (ANDLconst [c] x)) && c & 0x8000 == 0 -> (ANDLconst [c & 0x7fff] x) 628 629 // Don't extend before storing 630 (MOVWstore [off] {sym} ptr (MOVWLSX x) mem) -> (MOVWstore [off] {sym} ptr x mem) 631 (MOVBstore [off] {sym} ptr (MOVBLSX x) mem) -> (MOVBstore [off] {sym} ptr x mem) 632 (MOVWstore [off] {sym} ptr (MOVWLZX x) mem) -> (MOVWstore [off] {sym} ptr x mem) 633 (MOVBstore [off] {sym} ptr (MOVBLZX x) mem) -> (MOVBstore [off] {sym} ptr x mem) 634 635 // fold constants into memory operations 636 // Note that this is not always a good idea because if not all the uses of 637 // the ADDQconst get eliminated, we still have to compute the ADDQconst and we now 638 // have potentially two live values (ptr and (ADDQconst [off] ptr)) instead of one. 639 // Nevertheless, let's do it! 640 (MOVLload [off1] {sym} (ADDLconst [off2] ptr) mem) && is32Bit(off1+off2) -> (MOVLload [off1+off2] {sym} ptr mem) 641 (MOVWload [off1] {sym} (ADDLconst [off2] ptr) mem) && is32Bit(off1+off2) -> (MOVWload [off1+off2] {sym} ptr mem) 642 (MOVBload [off1] {sym} (ADDLconst [off2] ptr) mem) && is32Bit(off1+off2) -> (MOVBload [off1+off2] {sym} ptr mem) 643 (MOVSSload [off1] {sym} (ADDLconst [off2] ptr) mem) && is32Bit(off1+off2) -> (MOVSSload [off1+off2] {sym} ptr mem) 644 (MOVSDload [off1] {sym} (ADDLconst [off2] ptr) mem) && is32Bit(off1+off2) -> (MOVSDload [off1+off2] {sym} ptr mem) 645 646 (MOVLstore [off1] {sym} (ADDLconst [off2] ptr) val mem) && is32Bit(off1+off2) -> (MOVLstore [off1+off2] {sym} ptr val mem) 647 (MOVWstore [off1] {sym} (ADDLconst [off2] ptr) val mem) && is32Bit(off1+off2) -> (MOVWstore [off1+off2] {sym} ptr val mem) 648 (MOVBstore [off1] {sym} (ADDLconst [off2] ptr) val mem) && is32Bit(off1+off2) -> (MOVBstore [off1+off2] {sym} ptr val mem) 649 (MOVSSstore [off1] {sym} (ADDLconst [off2] ptr) val mem) && is32Bit(off1+off2) -> (MOVSSstore [off1+off2] {sym} ptr val mem) 650 (MOVSDstore [off1] {sym} (ADDLconst [off2] ptr) val mem) && is32Bit(off1+off2) -> (MOVSDstore [off1+off2] {sym} ptr val mem) 651 652 // Fold constants into stores. 653 (MOVLstore [off] {sym} ptr (MOVLconst [c]) mem) && validOff(off) -> 654 (MOVLstoreconst [makeValAndOff(int64(int32(c)),off)] {sym} ptr mem) 655 (MOVWstore [off] {sym} ptr (MOVLconst [c]) mem) && validOff(off) -> 656 (MOVWstoreconst [makeValAndOff(int64(int16(c)),off)] {sym} ptr mem) 657 (MOVBstore [off] {sym} ptr (MOVLconst [c]) mem) && validOff(off) -> 658 (MOVBstoreconst [makeValAndOff(int64(int8(c)),off)] {sym} ptr mem) 659 660 // Fold address offsets into constant stores. 661 (MOVLstoreconst [sc] {s} (ADDLconst [off] ptr) mem) && ValAndOff(sc).canAdd(off) -> 662 (MOVLstoreconst [ValAndOff(sc).add(off)] {s} ptr mem) 663 (MOVWstoreconst [sc] {s} (ADDLconst [off] ptr) mem) && ValAndOff(sc).canAdd(off) -> 664 (MOVWstoreconst [ValAndOff(sc).add(off)] {s} ptr mem) 665 (MOVBstoreconst [sc] {s} (ADDLconst [off] ptr) mem) && ValAndOff(sc).canAdd(off) -> 666 (MOVBstoreconst [ValAndOff(sc).add(off)] {s} ptr mem) 667 668 // We need to fold LEAQ into the MOVx ops so that the live variable analysis knows 669 // what variables are being read/written by the ops. 670 // Note: we turn off this merging for operations on globals when building 671 // position-independent code (when Flag_shared is set). 672 // PIC needs a spare register to load the PC into. Having the LEAL be 673 // a separate instruction gives us that register. Having the LEAL be 674 // a separate instruction also allows it to be CSEd (which is good because 675 // it compiles to a thunk call). 676 (MOVLload [off1] {sym1} (LEAL [off2] {sym2} base) mem) && is32Bit(off1+off2) && canMergeSym(sym1, sym2) 677 && (base.Op != OpSB || !config.ctxt.Flag_shared) -> 678 (MOVLload [off1+off2] {mergeSym(sym1,sym2)} base mem) 679 (MOVWload [off1] {sym1} (LEAL [off2] {sym2} base) mem) && is32Bit(off1+off2) && canMergeSym(sym1, sym2) 680 && (base.Op != OpSB || !config.ctxt.Flag_shared) -> 681 (MOVWload [off1+off2] {mergeSym(sym1,sym2)} base mem) 682 (MOVBload [off1] {sym1} (LEAL [off2] {sym2} base) mem) && is32Bit(off1+off2) && canMergeSym(sym1, sym2) 683 && (base.Op != OpSB || !config.ctxt.Flag_shared) -> 684 (MOVBload [off1+off2] {mergeSym(sym1,sym2)} base mem) 685 (MOVSSload [off1] {sym1} (LEAL [off2] {sym2} base) mem) && is32Bit(off1+off2) && canMergeSym(sym1, sym2) 686 && (base.Op != OpSB || !config.ctxt.Flag_shared) -> 687 (MOVSSload [off1+off2] {mergeSym(sym1,sym2)} base mem) 688 (MOVSDload [off1] {sym1} (LEAL [off2] {sym2} base) mem) && is32Bit(off1+off2) && canMergeSym(sym1, sym2) 689 && (base.Op != OpSB || !config.ctxt.Flag_shared) -> 690 (MOVSDload [off1+off2] {mergeSym(sym1,sym2)} base mem) 691 692 (MOVBLSXload [off1] {sym1} (LEAL [off2] {sym2} base) mem) && is32Bit(off1+off2) && canMergeSym(sym1, sym2) 693 && (base.Op != OpSB || !config.ctxt.Flag_shared) -> 694 (MOVBLSXload [off1+off2] {mergeSym(sym1,sym2)} base mem) 695 (MOVWLSXload [off1] {sym1} (LEAL [off2] {sym2} base) mem) && is32Bit(off1+off2) && canMergeSym(sym1, sym2) 696 && (base.Op != OpSB || !config.ctxt.Flag_shared) -> 697 (MOVWLSXload [off1+off2] {mergeSym(sym1,sym2)} base mem) 698 699 (MOVLstore [off1] {sym1} (LEAL [off2] {sym2} base) val mem) && is32Bit(off1+off2) && canMergeSym(sym1, sym2) 700 && (base.Op != OpSB || !config.ctxt.Flag_shared) -> 701 (MOVLstore [off1+off2] {mergeSym(sym1,sym2)} base val mem) 702 (MOVWstore [off1] {sym1} (LEAL [off2] {sym2} base) val mem) && is32Bit(off1+off2) && canMergeSym(sym1, sym2) 703 && (base.Op != OpSB || !config.ctxt.Flag_shared) -> 704 (MOVWstore [off1+off2] {mergeSym(sym1,sym2)} base val mem) 705 (MOVBstore [off1] {sym1} (LEAL [off2] {sym2} base) val mem) && is32Bit(off1+off2) && canMergeSym(sym1, sym2) 706 && (base.Op != OpSB || !config.ctxt.Flag_shared) -> 707 (MOVBstore [off1+off2] {mergeSym(sym1,sym2)} base val mem) 708 (MOVSSstore [off1] {sym1} (LEAL [off2] {sym2} base) val mem) && is32Bit(off1+off2) && canMergeSym(sym1, sym2) 709 && (base.Op != OpSB || !config.ctxt.Flag_shared) -> 710 (MOVSSstore [off1+off2] {mergeSym(sym1,sym2)} base val mem) 711 (MOVSDstore [off1] {sym1} (LEAL [off2] {sym2} base) val mem) && is32Bit(off1+off2) && canMergeSym(sym1, sym2) 712 && (base.Op != OpSB || !config.ctxt.Flag_shared) -> 713 (MOVSDstore [off1+off2] {mergeSym(sym1,sym2)} base val mem) 714 715 (MOVLstoreconst [sc] {sym1} (LEAL [off] {sym2} ptr) mem) && canMergeSym(sym1, sym2) && ValAndOff(sc).canAdd(off) 716 && (ptr.Op != OpSB || !config.ctxt.Flag_shared) -> 717 (MOVLstoreconst [ValAndOff(sc).add(off)] {mergeSym(sym1, sym2)} ptr mem) 718 (MOVWstoreconst [sc] {sym1} (LEAL [off] {sym2} ptr) mem) && canMergeSym(sym1, sym2) && ValAndOff(sc).canAdd(off) 719 && (ptr.Op != OpSB || !config.ctxt.Flag_shared) -> 720 (MOVWstoreconst [ValAndOff(sc).add(off)] {mergeSym(sym1, sym2)} ptr mem) 721 (MOVBstoreconst [sc] {sym1} (LEAL [off] {sym2} ptr) mem) && canMergeSym(sym1, sym2) && ValAndOff(sc).canAdd(off) 722 && (ptr.Op != OpSB || !config.ctxt.Flag_shared) -> 723 (MOVBstoreconst [ValAndOff(sc).add(off)] {mergeSym(sym1, sym2)} ptr mem) 724 725 // generating indexed loads and stores 726 (MOVBload [off1] {sym1} (LEAL1 [off2] {sym2} ptr idx) mem) && is32Bit(off1+off2) && canMergeSym(sym1, sym2) -> 727 (MOVBloadidx1 [off1+off2] {mergeSym(sym1,sym2)} ptr idx mem) 728 (MOVWload [off1] {sym1} (LEAL1 [off2] {sym2} ptr idx) mem) && is32Bit(off1+off2) && canMergeSym(sym1, sym2) -> 729 (MOVWloadidx1 [off1+off2] {mergeSym(sym1,sym2)} ptr idx mem) 730 (MOVWload [off1] {sym1} (LEAL2 [off2] {sym2} ptr idx) mem) && is32Bit(off1+off2) && canMergeSym(sym1, sym2) -> 731 (MOVWloadidx2 [off1+off2] {mergeSym(sym1,sym2)} ptr idx mem) 732 (MOVLload [off1] {sym1} (LEAL1 [off2] {sym2} ptr idx) mem) && is32Bit(off1+off2) && canMergeSym(sym1, sym2) -> 733 (MOVLloadidx1 [off1+off2] {mergeSym(sym1,sym2)} ptr idx mem) 734 (MOVLload [off1] {sym1} (LEAL4 [off2] {sym2} ptr idx) mem) && is32Bit(off1+off2) && canMergeSym(sym1, sym2) -> 735 (MOVLloadidx4 [off1+off2] {mergeSym(sym1,sym2)} ptr idx mem) 736 (MOVSSload [off1] {sym1} (LEAL1 [off2] {sym2} ptr idx) mem) && is32Bit(off1+off2) && canMergeSym(sym1, sym2) -> 737 (MOVSSloadidx1 [off1+off2] {mergeSym(sym1,sym2)} ptr idx mem) 738 (MOVSSload [off1] {sym1} (LEAL4 [off2] {sym2} ptr idx) mem) && is32Bit(off1+off2) && canMergeSym(sym1, sym2) -> 739 (MOVSSloadidx4 [off1+off2] {mergeSym(sym1,sym2)} ptr idx mem) 740 (MOVSDload [off1] {sym1} (LEAL1 [off2] {sym2} ptr idx) mem) && is32Bit(off1+off2) && canMergeSym(sym1, sym2) -> 741 (MOVSDloadidx1 [off1+off2] {mergeSym(sym1,sym2)} ptr idx mem) 742 (MOVSDload [off1] {sym1} (LEAL8 [off2] {sym2} ptr idx) mem) && is32Bit(off1+off2) && canMergeSym(sym1, sym2) -> 743 (MOVSDloadidx8 [off1+off2] {mergeSym(sym1,sym2)} ptr idx mem) 744 745 (MOVBstore [off1] {sym1} (LEAL1 [off2] {sym2} ptr idx) val mem) && is32Bit(off1+off2) && canMergeSym(sym1, sym2) -> 746 (MOVBstoreidx1 [off1+off2] {mergeSym(sym1,sym2)} ptr idx val mem) 747 (MOVWstore [off1] {sym1} (LEAL1 [off2] {sym2} ptr idx) val mem) && is32Bit(off1+off2) && canMergeSym(sym1, sym2) -> 748 (MOVWstoreidx1 [off1+off2] {mergeSym(sym1,sym2)} ptr idx val mem) 749 (MOVWstore [off1] {sym1} (LEAL2 [off2] {sym2} ptr idx) val mem) && is32Bit(off1+off2) && canMergeSym(sym1, sym2) -> 750 (MOVWstoreidx2 [off1+off2] {mergeSym(sym1,sym2)} ptr idx val mem) 751 (MOVLstore [off1] {sym1} (LEAL1 [off2] {sym2} ptr idx) val mem) && is32Bit(off1+off2) && canMergeSym(sym1, sym2) -> 752 (MOVLstoreidx1 [off1+off2] {mergeSym(sym1,sym2)} ptr idx val mem) 753 (MOVLstore [off1] {sym1} (LEAL4 [off2] {sym2} ptr idx) val mem) && is32Bit(off1+off2) && canMergeSym(sym1, sym2) -> 754 (MOVLstoreidx4 [off1+off2] {mergeSym(sym1,sym2)} ptr idx val mem) 755 (MOVSSstore [off1] {sym1} (LEAL1 [off2] {sym2} ptr idx) val mem) && is32Bit(off1+off2) && canMergeSym(sym1, sym2) -> 756 (MOVSSstoreidx1 [off1+off2] {mergeSym(sym1,sym2)} ptr idx val mem) 757 (MOVSSstore [off1] {sym1} (LEAL4 [off2] {sym2} ptr idx) val mem) && is32Bit(off1+off2) && canMergeSym(sym1, sym2) -> 758 (MOVSSstoreidx4 [off1+off2] {mergeSym(sym1,sym2)} ptr idx val mem) 759 (MOVSDstore [off1] {sym1} (LEAL1 [off2] {sym2} ptr idx) val mem) && is32Bit(off1+off2) && canMergeSym(sym1, sym2) -> 760 (MOVSDstoreidx1 [off1+off2] {mergeSym(sym1,sym2)} ptr idx val mem) 761 (MOVSDstore [off1] {sym1} (LEAL8 [off2] {sym2} ptr idx) val mem) && is32Bit(off1+off2) && canMergeSym(sym1, sym2) -> 762 (MOVSDstoreidx8 [off1+off2] {mergeSym(sym1,sym2)} ptr idx val mem) 763 764 (MOVBload [off] {sym} (ADDL ptr idx) mem) && ptr.Op != OpSB -> (MOVBloadidx1 [off] {sym} ptr idx mem) 765 (MOVWload [off] {sym} (ADDL ptr idx) mem) && ptr.Op != OpSB -> (MOVWloadidx1 [off] {sym} ptr idx mem) 766 (MOVLload [off] {sym} (ADDL ptr idx) mem) && ptr.Op != OpSB -> (MOVLloadidx1 [off] {sym} ptr idx mem) 767 (MOVSSload [off] {sym} (ADDL ptr idx) mem) && ptr.Op != OpSB -> (MOVSSloadidx1 [off] {sym} ptr idx mem) 768 (MOVSDload [off] {sym} (ADDL ptr idx) mem) && ptr.Op != OpSB -> (MOVSDloadidx1 [off] {sym} ptr idx mem) 769 (MOVBstore [off] {sym} (ADDL ptr idx) val mem) && ptr.Op != OpSB -> (MOVBstoreidx1 [off] {sym} ptr idx val mem) 770 (MOVWstore [off] {sym} (ADDL ptr idx) val mem) && ptr.Op != OpSB -> (MOVWstoreidx1 [off] {sym} ptr idx val mem) 771 (MOVLstore [off] {sym} (ADDL ptr idx) val mem) && ptr.Op != OpSB -> (MOVLstoreidx1 [off] {sym} ptr idx val mem) 772 (MOVSSstore [off] {sym} (ADDL ptr idx) val mem) && ptr.Op != OpSB -> (MOVSSstoreidx1 [off] {sym} ptr idx val mem) 773 (MOVSDstore [off] {sym} (ADDL ptr idx) val mem) && ptr.Op != OpSB -> (MOVSDstoreidx1 [off] {sym} ptr idx val mem) 774 775 (MOVBstoreconst [x] {sym1} (LEAL1 [off] {sym2} ptr idx) mem) && canMergeSym(sym1, sym2) -> 776 (MOVBstoreconstidx1 [ValAndOff(x).add(off)] {mergeSym(sym1,sym2)} ptr idx mem) 777 (MOVWstoreconst [x] {sym1} (LEAL1 [off] {sym2} ptr idx) mem) && canMergeSym(sym1, sym2) -> 778 (MOVWstoreconstidx1 [ValAndOff(x).add(off)] {mergeSym(sym1,sym2)} ptr idx mem) 779 (MOVWstoreconst [x] {sym1} (LEAL2 [off] {sym2} ptr idx) mem) && canMergeSym(sym1, sym2) -> 780 (MOVWstoreconstidx2 [ValAndOff(x).add(off)] {mergeSym(sym1,sym2)} ptr idx mem) 781 (MOVLstoreconst [x] {sym1} (LEAL1 [off] {sym2} ptr idx) mem) && canMergeSym(sym1, sym2) -> 782 (MOVLstoreconstidx1 [ValAndOff(x).add(off)] {mergeSym(sym1,sym2)} ptr idx mem) 783 (MOVLstoreconst [x] {sym1} (LEAL4 [off] {sym2} ptr idx) mem) && canMergeSym(sym1, sym2) -> 784 (MOVLstoreconstidx4 [ValAndOff(x).add(off)] {mergeSym(sym1,sym2)} ptr idx mem) 785 786 (MOVBstoreconst [x] {sym} (ADDL ptr idx) mem) -> (MOVBstoreconstidx1 [x] {sym} ptr idx mem) 787 (MOVWstoreconst [x] {sym} (ADDL ptr idx) mem) -> (MOVWstoreconstidx1 [x] {sym} ptr idx mem) 788 (MOVLstoreconst [x] {sym} (ADDL ptr idx) mem) -> (MOVLstoreconstidx1 [x] {sym} ptr idx mem) 789 790 // combine SHLL into indexed loads and stores 791 (MOVWloadidx1 [c] {sym} ptr (SHLLconst [1] idx) mem) -> (MOVWloadidx2 [c] {sym} ptr idx mem) 792 (MOVLloadidx1 [c] {sym} ptr (SHLLconst [2] idx) mem) -> (MOVLloadidx4 [c] {sym} ptr idx mem) 793 (MOVWstoreidx1 [c] {sym} ptr (SHLLconst [1] idx) val mem) -> (MOVWstoreidx2 [c] {sym} ptr idx val mem) 794 (MOVLstoreidx1 [c] {sym} ptr (SHLLconst [2] idx) val mem) -> (MOVLstoreidx4 [c] {sym} ptr idx val mem) 795 (MOVWstoreconstidx1 [c] {sym} ptr (SHLLconst [1] idx) mem) -> (MOVWstoreconstidx2 [c] {sym} ptr idx mem) 796 (MOVLstoreconstidx1 [c] {sym} ptr (SHLLconst [2] idx) mem) -> (MOVLstoreconstidx4 [c] {sym} ptr idx mem) 797 798 // combine ADDL into indexed loads and stores 799 (MOVBloadidx1 [c] {sym} (ADDLconst [d] ptr) idx mem) -> (MOVBloadidx1 [c+d] {sym} ptr idx mem) 800 (MOVWloadidx1 [c] {sym} (ADDLconst [d] ptr) idx mem) -> (MOVWloadidx1 [c+d] {sym} ptr idx mem) 801 (MOVWloadidx2 [c] {sym} (ADDLconst [d] ptr) idx mem) -> (MOVWloadidx2 [c+d] {sym} ptr idx mem) 802 (MOVLloadidx1 [c] {sym} (ADDLconst [d] ptr) idx mem) -> (MOVLloadidx1 [c+d] {sym} ptr idx mem) 803 (MOVLloadidx4 [c] {sym} (ADDLconst [d] ptr) idx mem) -> (MOVLloadidx4 [c+d] {sym} ptr idx mem) 804 (MOVSSloadidx1 [c] {sym} (ADDLconst [d] ptr) idx mem) -> (MOVSSloadidx1 [c+d] {sym} ptr idx mem) 805 (MOVSSloadidx4 [c] {sym} (ADDLconst [d] ptr) idx mem) -> (MOVSSloadidx4 [c+d] {sym} ptr idx mem) 806 (MOVSDloadidx1 [c] {sym} (ADDLconst [d] ptr) idx mem) -> (MOVSDloadidx1 [c+d] {sym} ptr idx mem) 807 (MOVSDloadidx8 [c] {sym} (ADDLconst [d] ptr) idx mem) -> (MOVSDloadidx8 [c+d] {sym} ptr idx mem) 808 809 (MOVBstoreidx1 [c] {sym} (ADDLconst [d] ptr) idx val mem) -> (MOVBstoreidx1 [c+d] {sym} ptr idx val mem) 810 (MOVWstoreidx1 [c] {sym} (ADDLconst [d] ptr) idx val mem) -> (MOVWstoreidx1 [c+d] {sym} ptr idx val mem) 811 (MOVWstoreidx2 [c] {sym} (ADDLconst [d] ptr) idx val mem) -> (MOVWstoreidx2 [c+d] {sym} ptr idx val mem) 812 (MOVLstoreidx1 [c] {sym} (ADDLconst [d] ptr) idx val mem) -> (MOVLstoreidx1 [c+d] {sym} ptr idx val mem) 813 (MOVLstoreidx4 [c] {sym} (ADDLconst [d] ptr) idx val mem) -> (MOVLstoreidx4 [c+d] {sym} ptr idx val mem) 814 (MOVSSstoreidx1 [c] {sym} (ADDLconst [d] ptr) idx val mem) -> (MOVSSstoreidx1 [c+d] {sym} ptr idx val mem) 815 (MOVSSstoreidx4 [c] {sym} (ADDLconst [d] ptr) idx val mem) -> (MOVSSstoreidx4 [c+d] {sym} ptr idx val mem) 816 (MOVSDstoreidx1 [c] {sym} (ADDLconst [d] ptr) idx val mem) -> (MOVSDstoreidx1 [c+d] {sym} ptr idx val mem) 817 (MOVSDstoreidx8 [c] {sym} (ADDLconst [d] ptr) idx val mem) -> (MOVSDstoreidx8 [c+d] {sym} ptr idx val mem) 818 819 (MOVBloadidx1 [c] {sym} ptr (ADDLconst [d] idx) mem) -> (MOVBloadidx1 [c+d] {sym} ptr idx mem) 820 (MOVWloadidx1 [c] {sym} ptr (ADDLconst [d] idx) mem) -> (MOVWloadidx1 [c+d] {sym} ptr idx mem) 821 (MOVWloadidx2 [c] {sym} ptr (ADDLconst [d] idx) mem) -> (MOVWloadidx2 [c+2*d] {sym} ptr idx mem) 822 (MOVLloadidx1 [c] {sym} ptr (ADDLconst [d] idx) mem) -> (MOVLloadidx1 [c+d] {sym} ptr idx mem) 823 (MOVLloadidx4 [c] {sym} ptr (ADDLconst [d] idx) mem) -> (MOVLloadidx4 [c+4*d] {sym} ptr idx mem) 824 (MOVSSloadidx1 [c] {sym} ptr (ADDLconst [d] idx) mem) -> (MOVSSloadidx1 [c+d] {sym} ptr idx mem) 825 (MOVSSloadidx4 [c] {sym} ptr (ADDLconst [d] idx) mem) -> (MOVSSloadidx4 [c+4*d] {sym} ptr idx mem) 826 (MOVSDloadidx1 [c] {sym} ptr (ADDLconst [d] idx) mem) -> (MOVSDloadidx1 [c+d] {sym} ptr idx mem) 827 (MOVSDloadidx8 [c] {sym} ptr (ADDLconst [d] idx) mem) -> (MOVSDloadidx8 [c+8*d] {sym} ptr idx mem) 828 829 (MOVBstoreidx1 [c] {sym} ptr (ADDLconst [d] idx) val mem) -> (MOVBstoreidx1 [c+d] {sym} ptr idx val mem) 830 (MOVWstoreidx1 [c] {sym} ptr (ADDLconst [d] idx) val mem) -> (MOVWstoreidx1 [c+d] {sym} ptr idx val mem) 831 (MOVWstoreidx2 [c] {sym} ptr (ADDLconst [d] idx) val mem) -> (MOVWstoreidx2 [c+2*d] {sym} ptr idx val mem) 832 (MOVLstoreidx1 [c] {sym} ptr (ADDLconst [d] idx) val mem) -> (MOVLstoreidx1 [c+d] {sym} ptr idx val mem) 833 (MOVLstoreidx4 [c] {sym} ptr (ADDLconst [d] idx) val mem) -> (MOVLstoreidx4 [c+4*d] {sym} ptr idx val mem) 834 (MOVSSstoreidx1 [c] {sym} ptr (ADDLconst [d] idx) val mem) -> (MOVSSstoreidx1 [c+d] {sym} ptr idx val mem) 835 (MOVSSstoreidx4 [c] {sym} ptr (ADDLconst [d] idx) val mem) -> (MOVSSstoreidx4 [c+4*d] {sym} ptr idx val mem) 836 (MOVSDstoreidx1 [c] {sym} ptr (ADDLconst [d] idx) val mem) -> (MOVSDstoreidx1 [c+d] {sym} ptr idx val mem) 837 (MOVSDstoreidx8 [c] {sym} ptr (ADDLconst [d] idx) val mem) -> (MOVSDstoreidx8 [c+8*d] {sym} ptr idx val mem) 838 839 (MOVBstoreconstidx1 [x] {sym} (ADDLconst [c] ptr) idx mem) -> 840 (MOVBstoreconstidx1 [ValAndOff(x).add(c)] {sym} ptr idx mem) 841 (MOVWstoreconstidx1 [x] {sym} (ADDLconst [c] ptr) idx mem) -> 842 (MOVWstoreconstidx1 [ValAndOff(x).add(c)] {sym} ptr idx mem) 843 (MOVWstoreconstidx2 [x] {sym} (ADDLconst [c] ptr) idx mem) -> 844 (MOVWstoreconstidx2 [ValAndOff(x).add(c)] {sym} ptr idx mem) 845 (MOVLstoreconstidx1 [x] {sym} (ADDLconst [c] ptr) idx mem) -> 846 (MOVLstoreconstidx1 [ValAndOff(x).add(c)] {sym} ptr idx mem) 847 (MOVLstoreconstidx4 [x] {sym} (ADDLconst [c] ptr) idx mem) -> 848 (MOVLstoreconstidx4 [ValAndOff(x).add(c)] {sym} ptr idx mem) 849 850 (MOVBstoreconstidx1 [x] {sym} ptr (ADDLconst [c] idx) mem) -> 851 (MOVBstoreconstidx1 [ValAndOff(x).add(c)] {sym} ptr idx mem) 852 (MOVWstoreconstidx1 [x] {sym} ptr (ADDLconst [c] idx) mem) -> 853 (MOVWstoreconstidx1 [ValAndOff(x).add(c)] {sym} ptr idx mem) 854 (MOVWstoreconstidx2 [x] {sym} ptr (ADDLconst [c] idx) mem) -> 855 (MOVWstoreconstidx2 [ValAndOff(x).add(2*c)] {sym} ptr idx mem) 856 (MOVLstoreconstidx1 [x] {sym} ptr (ADDLconst [c] idx) mem) -> 857 (MOVLstoreconstidx1 [ValAndOff(x).add(c)] {sym} ptr idx mem) 858 (MOVLstoreconstidx4 [x] {sym} ptr (ADDLconst [c] idx) mem) -> 859 (MOVLstoreconstidx4 [ValAndOff(x).add(4*c)] {sym} ptr idx mem) 860 861 // fold LEALs together 862 (LEAL [off1] {sym1} (LEAL [off2] {sym2} x)) && is32Bit(off1+off2) && canMergeSym(sym1, sym2) -> 863 (LEAL [off1+off2] {mergeSym(sym1,sym2)} x) 864 865 // LEAL into LEAL1 866 (LEAL1 [off1] {sym1} (LEAL [off2] {sym2} x) y) && is32Bit(off1+off2) && canMergeSym(sym1, sym2) && x.Op != OpSB -> 867 (LEAL1 [off1+off2] {mergeSym(sym1,sym2)} x y) 868 869 // LEAL1 into LEAL 870 (LEAL [off1] {sym1} (LEAL1 [off2] {sym2} x y)) && is32Bit(off1+off2) && canMergeSym(sym1, sym2) -> 871 (LEAL1 [off1+off2] {mergeSym(sym1,sym2)} x y) 872 873 // LEAL into LEAL[248] 874 (LEAL2 [off1] {sym1} (LEAL [off2] {sym2} x) y) && is32Bit(off1+off2) && canMergeSym(sym1, sym2) && x.Op != OpSB -> 875 (LEAL2 [off1+off2] {mergeSym(sym1,sym2)} x y) 876 (LEAL4 [off1] {sym1} (LEAL [off2] {sym2} x) y) && is32Bit(off1+off2) && canMergeSym(sym1, sym2) && x.Op != OpSB -> 877 (LEAL4 [off1+off2] {mergeSym(sym1,sym2)} x y) 878 (LEAL8 [off1] {sym1} (LEAL [off2] {sym2} x) y) && is32Bit(off1+off2) && canMergeSym(sym1, sym2) && x.Op != OpSB -> 879 (LEAL8 [off1+off2] {mergeSym(sym1,sym2)} x y) 880 881 // LEAL[248] into LEAL 882 (LEAL [off1] {sym1} (LEAL2 [off2] {sym2} x y)) && is32Bit(off1+off2) && canMergeSym(sym1, sym2) -> 883 (LEAL2 [off1+off2] {mergeSym(sym1,sym2)} x y) 884 (LEAL [off1] {sym1} (LEAL4 [off2] {sym2} x y)) && is32Bit(off1+off2) && canMergeSym(sym1, sym2) -> 885 (LEAL4 [off1+off2] {mergeSym(sym1,sym2)} x y) 886 (LEAL [off1] {sym1} (LEAL8 [off2] {sym2} x y)) && is32Bit(off1+off2) && canMergeSym(sym1, sym2) -> 887 (LEAL8 [off1+off2] {mergeSym(sym1,sym2)} x y) 888 889 // Absorb InvertFlags into branches. 890 (LT (InvertFlags cmp) yes no) -> (GT cmp yes no) 891 (GT (InvertFlags cmp) yes no) -> (LT cmp yes no) 892 (LE (InvertFlags cmp) yes no) -> (GE cmp yes no) 893 (GE (InvertFlags cmp) yes no) -> (LE cmp yes no) 894 (ULT (InvertFlags cmp) yes no) -> (UGT cmp yes no) 895 (UGT (InvertFlags cmp) yes no) -> (ULT cmp yes no) 896 (ULE (InvertFlags cmp) yes no) -> (UGE cmp yes no) 897 (UGE (InvertFlags cmp) yes no) -> (ULE cmp yes no) 898 (EQ (InvertFlags cmp) yes no) -> (EQ cmp yes no) 899 (NE (InvertFlags cmp) yes no) -> (NE cmp yes no) 900 901 // Constant comparisons. 902 (CMPLconst (MOVLconst [x]) [y]) && int32(x)==int32(y) -> (FlagEQ) 903 (CMPLconst (MOVLconst [x]) [y]) && int32(x)<int32(y) && uint32(x)<uint32(y) -> (FlagLT_ULT) 904 (CMPLconst (MOVLconst [x]) [y]) && int32(x)<int32(y) && uint32(x)>uint32(y) -> (FlagLT_UGT) 905 (CMPLconst (MOVLconst [x]) [y]) && int32(x)>int32(y) && uint32(x)<uint32(y) -> (FlagGT_ULT) 906 (CMPLconst (MOVLconst [x]) [y]) && int32(x)>int32(y) && uint32(x)>uint32(y) -> (FlagGT_UGT) 907 (CMPWconst (MOVLconst [x]) [y]) && int16(x)==int16(y) -> (FlagEQ) 908 (CMPWconst (MOVLconst [x]) [y]) && int16(x)<int16(y) && uint16(x)<uint16(y) -> (FlagLT_ULT) 909 (CMPWconst (MOVLconst [x]) [y]) && int16(x)<int16(y) && uint16(x)>uint16(y) -> (FlagLT_UGT) 910 (CMPWconst (MOVLconst [x]) [y]) && int16(x)>int16(y) && uint16(x)<uint16(y) -> (FlagGT_ULT) 911 (CMPWconst (MOVLconst [x]) [y]) && int16(x)>int16(y) && uint16(x)>uint16(y) -> (FlagGT_UGT) 912 (CMPBconst (MOVLconst [x]) [y]) && int8(x)==int8(y) -> (FlagEQ) 913 (CMPBconst (MOVLconst [x]) [y]) && int8(x)<int8(y) && uint8(x)<uint8(y) -> (FlagLT_ULT) 914 (CMPBconst (MOVLconst [x]) [y]) && int8(x)<int8(y) && uint8(x)>uint8(y) -> (FlagLT_UGT) 915 (CMPBconst (MOVLconst [x]) [y]) && int8(x)>int8(y) && uint8(x)<uint8(y) -> (FlagGT_ULT) 916 (CMPBconst (MOVLconst [x]) [y]) && int8(x)>int8(y) && uint8(x)>uint8(y) -> (FlagGT_UGT) 917 918 // Other known comparisons. 919 (CMPLconst (SHRLconst _ [c]) [n]) && 0 <= n && 0 < c && c <= 32 && (1<<uint64(32-c)) <= uint64(n) -> (FlagLT_ULT) 920 (CMPLconst (ANDLconst _ [m]) [n]) && 0 <= int32(m) && int32(m) < int32(n) -> (FlagLT_ULT) 921 (CMPWconst (ANDLconst _ [m]) [n]) && 0 <= int16(m) && int16(m) < int16(n) -> (FlagLT_ULT) 922 (CMPBconst (ANDLconst _ [m]) [n]) && 0 <= int8(m) && int8(m) < int8(n) -> (FlagLT_ULT) 923 // TODO: DIVxU also. 924 925 // Absorb flag constants into SBB ops. 926 (SBBLcarrymask (FlagEQ)) -> (MOVLconst [0]) 927 (SBBLcarrymask (FlagLT_ULT)) -> (MOVLconst [-1]) 928 (SBBLcarrymask (FlagLT_UGT)) -> (MOVLconst [0]) 929 (SBBLcarrymask (FlagGT_ULT)) -> (MOVLconst [-1]) 930 (SBBLcarrymask (FlagGT_UGT)) -> (MOVLconst [0]) 931 932 // Absorb flag constants into branches. 933 (EQ (FlagEQ) yes no) -> (First nil yes no) 934 (EQ (FlagLT_ULT) yes no) -> (First nil no yes) 935 (EQ (FlagLT_UGT) yes no) -> (First nil no yes) 936 (EQ (FlagGT_ULT) yes no) -> (First nil no yes) 937 (EQ (FlagGT_UGT) yes no) -> (First nil no yes) 938 939 (NE (FlagEQ) yes no) -> (First nil no yes) 940 (NE (FlagLT_ULT) yes no) -> (First nil yes no) 941 (NE (FlagLT_UGT) yes no) -> (First nil yes no) 942 (NE (FlagGT_ULT) yes no) -> (First nil yes no) 943 (NE (FlagGT_UGT) yes no) -> (First nil yes no) 944 945 (LT (FlagEQ) yes no) -> (First nil no yes) 946 (LT (FlagLT_ULT) yes no) -> (First nil yes no) 947 (LT (FlagLT_UGT) yes no) -> (First nil yes no) 948 (LT (FlagGT_ULT) yes no) -> (First nil no yes) 949 (LT (FlagGT_UGT) yes no) -> (First nil no yes) 950 951 (LE (FlagEQ) yes no) -> (First nil yes no) 952 (LE (FlagLT_ULT) yes no) -> (First nil yes no) 953 (LE (FlagLT_UGT) yes no) -> (First nil yes no) 954 (LE (FlagGT_ULT) yes no) -> (First nil no yes) 955 (LE (FlagGT_UGT) yes no) -> (First nil no yes) 956 957 (GT (FlagEQ) yes no) -> (First nil no yes) 958 (GT (FlagLT_ULT) yes no) -> (First nil no yes) 959 (GT (FlagLT_UGT) yes no) -> (First nil no yes) 960 (GT (FlagGT_ULT) yes no) -> (First nil yes no) 961 (GT (FlagGT_UGT) yes no) -> (First nil yes no) 962 963 (GE (FlagEQ) yes no) -> (First nil yes no) 964 (GE (FlagLT_ULT) yes no) -> (First nil no yes) 965 (GE (FlagLT_UGT) yes no) -> (First nil no yes) 966 (GE (FlagGT_ULT) yes no) -> (First nil yes no) 967 (GE (FlagGT_UGT) yes no) -> (First nil yes no) 968 969 (ULT (FlagEQ) yes no) -> (First nil no yes) 970 (ULT (FlagLT_ULT) yes no) -> (First nil yes no) 971 (ULT (FlagLT_UGT) yes no) -> (First nil no yes) 972 (ULT (FlagGT_ULT) yes no) -> (First nil yes no) 973 (ULT (FlagGT_UGT) yes no) -> (First nil no yes) 974 975 (ULE (FlagEQ) yes no) -> (First nil yes no) 976 (ULE (FlagLT_ULT) yes no) -> (First nil yes no) 977 (ULE (FlagLT_UGT) yes no) -> (First nil no yes) 978 (ULE (FlagGT_ULT) yes no) -> (First nil yes no) 979 (ULE (FlagGT_UGT) yes no) -> (First nil no yes) 980 981 (UGT (FlagEQ) yes no) -> (First nil no yes) 982 (UGT (FlagLT_ULT) yes no) -> (First nil no yes) 983 (UGT (FlagLT_UGT) yes no) -> (First nil yes no) 984 (UGT (FlagGT_ULT) yes no) -> (First nil no yes) 985 (UGT (FlagGT_UGT) yes no) -> (First nil yes no) 986 987 (UGE (FlagEQ) yes no) -> (First nil yes no) 988 (UGE (FlagLT_ULT) yes no) -> (First nil no yes) 989 (UGE (FlagLT_UGT) yes no) -> (First nil yes no) 990 (UGE (FlagGT_ULT) yes no) -> (First nil no yes) 991 (UGE (FlagGT_UGT) yes no) -> (First nil yes no) 992 993 // Absorb flag constants into SETxx ops. 994 (SETEQ (FlagEQ)) -> (MOVLconst [1]) 995 (SETEQ (FlagLT_ULT)) -> (MOVLconst [0]) 996 (SETEQ (FlagLT_UGT)) -> (MOVLconst [0]) 997 (SETEQ (FlagGT_ULT)) -> (MOVLconst [0]) 998 (SETEQ (FlagGT_UGT)) -> (MOVLconst [0]) 999 1000 (SETNE (FlagEQ)) -> (MOVLconst [0]) 1001 (SETNE (FlagLT_ULT)) -> (MOVLconst [1]) 1002 (SETNE (FlagLT_UGT)) -> (MOVLconst [1]) 1003 (SETNE (FlagGT_ULT)) -> (MOVLconst [1]) 1004 (SETNE (FlagGT_UGT)) -> (MOVLconst [1]) 1005 1006 (SETL (FlagEQ)) -> (MOVLconst [0]) 1007 (SETL (FlagLT_ULT)) -> (MOVLconst [1]) 1008 (SETL (FlagLT_UGT)) -> (MOVLconst [1]) 1009 (SETL (FlagGT_ULT)) -> (MOVLconst [0]) 1010 (SETL (FlagGT_UGT)) -> (MOVLconst [0]) 1011 1012 (SETLE (FlagEQ)) -> (MOVLconst [1]) 1013 (SETLE (FlagLT_ULT)) -> (MOVLconst [1]) 1014 (SETLE (FlagLT_UGT)) -> (MOVLconst [1]) 1015 (SETLE (FlagGT_ULT)) -> (MOVLconst [0]) 1016 (SETLE (FlagGT_UGT)) -> (MOVLconst [0]) 1017 1018 (SETG (FlagEQ)) -> (MOVLconst [0]) 1019 (SETG (FlagLT_ULT)) -> (MOVLconst [0]) 1020 (SETG (FlagLT_UGT)) -> (MOVLconst [0]) 1021 (SETG (FlagGT_ULT)) -> (MOVLconst [1]) 1022 (SETG (FlagGT_UGT)) -> (MOVLconst [1]) 1023 1024 (SETGE (FlagEQ)) -> (MOVLconst [1]) 1025 (SETGE (FlagLT_ULT)) -> (MOVLconst [0]) 1026 (SETGE (FlagLT_UGT)) -> (MOVLconst [0]) 1027 (SETGE (FlagGT_ULT)) -> (MOVLconst [1]) 1028 (SETGE (FlagGT_UGT)) -> (MOVLconst [1]) 1029 1030 (SETB (FlagEQ)) -> (MOVLconst [0]) 1031 (SETB (FlagLT_ULT)) -> (MOVLconst [1]) 1032 (SETB (FlagLT_UGT)) -> (MOVLconst [0]) 1033 (SETB (FlagGT_ULT)) -> (MOVLconst [1]) 1034 (SETB (FlagGT_UGT)) -> (MOVLconst [0]) 1035 1036 (SETBE (FlagEQ)) -> (MOVLconst [1]) 1037 (SETBE (FlagLT_ULT)) -> (MOVLconst [1]) 1038 (SETBE (FlagLT_UGT)) -> (MOVLconst [0]) 1039 (SETBE (FlagGT_ULT)) -> (MOVLconst [1]) 1040 (SETBE (FlagGT_UGT)) -> (MOVLconst [0]) 1041 1042 (SETA (FlagEQ)) -> (MOVLconst [0]) 1043 (SETA (FlagLT_ULT)) -> (MOVLconst [0]) 1044 (SETA (FlagLT_UGT)) -> (MOVLconst [1]) 1045 (SETA (FlagGT_ULT)) -> (MOVLconst [0]) 1046 (SETA (FlagGT_UGT)) -> (MOVLconst [1]) 1047 1048 (SETAE (FlagEQ)) -> (MOVLconst [1]) 1049 (SETAE (FlagLT_ULT)) -> (MOVLconst [0]) 1050 (SETAE (FlagLT_UGT)) -> (MOVLconst [1]) 1051 (SETAE (FlagGT_ULT)) -> (MOVLconst [0]) 1052 (SETAE (FlagGT_UGT)) -> (MOVLconst [1]) 1053 1054 // Remove redundant *const ops 1055 (ADDLconst [c] x) && int32(c)==0 -> x 1056 (SUBLconst [c] x) && int32(c) == 0 -> x 1057 (ANDLconst [c] _) && int32(c)==0 -> (MOVLconst [0]) 1058 (ANDLconst [c] x) && int32(c)==-1 -> x 1059 (ORLconst [c] x) && int32(c)==0 -> x 1060 (ORLconst [c] _) && int32(c)==-1 -> (MOVLconst [-1]) 1061 (XORLconst [c] x) && int32(c)==0 -> x 1062 // TODO: since we got rid of the W/B versions, we might miss 1063 // things like (ANDLconst [0x100] x) which were formerly 1064 // (ANDBconst [0] x). Probably doesn't happen very often. 1065 // If we cared, we might do: 1066 // (ANDLconst <t> [c] x) && t.Size()==1 && int8(x)==0 -> (MOVLconst [0]) 1067 1068 // Convert constant subtracts to constant adds 1069 (SUBLconst [c] x) -> (ADDLconst [int64(int32(-c))] x) 1070 1071 // generic constant folding 1072 // TODO: more of this 1073 (ADDLconst [c] (MOVLconst [d])) -> (MOVLconst [int64(int32(c+d))]) 1074 (ADDLconst [c] (ADDLconst [d] x)) -> (ADDLconst [int64(int32(c+d))] x) 1075 (SARLconst [c] (MOVLconst [d])) -> (MOVLconst [d>>uint64(c)]) 1076 (SARWconst [c] (MOVLconst [d])) -> (MOVLconst [d>>uint64(c)]) 1077 (SARBconst [c] (MOVLconst [d])) -> (MOVLconst [d>>uint64(c)]) 1078 (NEGL (MOVLconst [c])) -> (MOVLconst [int64(int32(-c))]) 1079 (MULLconst [c] (MOVLconst [d])) -> (MOVLconst [int64(int32(c*d))]) 1080 (ANDLconst [c] (MOVLconst [d])) -> (MOVLconst [c&d]) 1081 (ORLconst [c] (MOVLconst [d])) -> (MOVLconst [c|d]) 1082 (XORLconst [c] (MOVLconst [d])) -> (MOVLconst [c^d]) 1083 (NOTL (MOVLconst [c])) -> (MOVLconst [^c]) 1084 1085 // generic simplifications 1086 // TODO: more of this 1087 (ADDL x (NEGL y)) -> (SUBL x y) 1088 (SUBL x x) -> (MOVLconst [0]) 1089 (ANDL x x) -> x 1090 (ORL x x) -> x 1091 (XORL x x) -> (MOVLconst [0]) 1092 1093 // checking AND against 0. 1094 (CMPLconst (ANDL x y) [0]) -> (TESTL x y) 1095 (CMPWconst (ANDL x y) [0]) -> (TESTW x y) 1096 (CMPBconst (ANDL x y) [0]) -> (TESTB x y) 1097 (CMPLconst (ANDLconst [c] x) [0]) -> (TESTLconst [c] x) 1098 (CMPWconst (ANDLconst [c] x) [0]) -> (TESTWconst [int64(int16(c))] x) 1099 (CMPBconst (ANDLconst [c] x) [0]) -> (TESTBconst [int64(int8(c))] x) 1100 1101 // TEST %reg,%reg is shorter than CMP 1102 (CMPLconst x [0]) -> (TESTL x x) 1103 (CMPWconst x [0]) -> (TESTW x x) 1104 (CMPBconst x [0]) -> (TESTB x x) 1105 1106 // Combining byte loads into larger (unaligned) loads. 1107 // There are many ways these combinations could occur. This is 1108 // designed to match the way encoding/binary.LittleEndian does it. 1109 (ORL x0:(MOVBload [i0] {s} p mem) 1110 s0:(SHLLconst [8] x1:(MOVBload [i1] {s} p mem))) 1111 && i1 == i0+1 1112 && x0.Uses == 1 1113 && x1.Uses == 1 1114 && s0.Uses == 1 1115 && mergePoint(b,x0,x1) != nil 1116 && clobber(x0) 1117 && clobber(x1) 1118 && clobber(s0) 1119 -> @mergePoint(b,x0,x1) (MOVWload [i0] {s} p mem) 1120 1121 (ORL o0:(ORL 1122 x0:(MOVWload [i0] {s} p mem) 1123 s0:(SHLLconst [16] x1:(MOVBload [i2] {s} p mem))) 1124 s1:(SHLLconst [24] x2:(MOVBload [i3] {s} p mem))) 1125 && i2 == i0+2 1126 && i3 == i0+3 1127 && x0.Uses == 1 1128 && x1.Uses == 1 1129 && x2.Uses == 1 1130 && s0.Uses == 1 1131 && s1.Uses == 1 1132 && o0.Uses == 1 1133 && mergePoint(b,x0,x1,x2) != nil 1134 && clobber(x0) 1135 && clobber(x1) 1136 && clobber(x2) 1137 && clobber(s0) 1138 && clobber(s1) 1139 && clobber(o0) 1140 -> @mergePoint(b,x0,x1,x2) (MOVLload [i0] {s} p mem) 1141 1142 (ORL x0:(MOVBloadidx1 [i0] {s} p idx mem) 1143 s0:(SHLLconst [8] x1:(MOVBloadidx1 [i1] {s} p idx mem))) 1144 && i1==i0+1 1145 && x0.Uses == 1 1146 && x1.Uses == 1 1147 && s0.Uses == 1 1148 && mergePoint(b,x0,x1) != nil 1149 && clobber(x0) 1150 && clobber(x1) 1151 && clobber(s0) 1152 -> @mergePoint(b,x0,x1) (MOVWloadidx1 <v.Type> [i0] {s} p idx mem) 1153 1154 (ORL o0:(ORL 1155 x0:(MOVWloadidx1 [i0] {s} p idx mem) 1156 s0:(SHLLconst [16] x1:(MOVBloadidx1 [i2] {s} p idx mem))) 1157 s1:(SHLLconst [24] x2:(MOVBloadidx1 [i3] {s} p idx mem))) 1158 && i2 == i0+2 1159 && i3 == i0+3 1160 && x0.Uses == 1 1161 && x1.Uses == 1 1162 && x2.Uses == 1 1163 && s0.Uses == 1 1164 && s1.Uses == 1 1165 && o0.Uses == 1 1166 && mergePoint(b,x0,x1,x2) != nil 1167 && clobber(x0) 1168 && clobber(x1) 1169 && clobber(x2) 1170 && clobber(s0) 1171 && clobber(s1) 1172 && clobber(o0) 1173 -> @mergePoint(b,x0,x1,x2) (MOVLloadidx1 <v.Type> [i0] {s} p idx mem) 1174 1175 // Combine constant stores into larger (unaligned) stores. 1176 (MOVBstoreconst [c] {s} p x:(MOVBstoreconst [a] {s} p mem)) 1177 && x.Uses == 1 1178 && ValAndOff(a).Off() + 1 == ValAndOff(c).Off() 1179 && clobber(x) 1180 -> (MOVWstoreconst [makeValAndOff(ValAndOff(a).Val()&0xff | ValAndOff(c).Val()<<8, ValAndOff(a).Off())] {s} p mem) 1181 (MOVWstoreconst [c] {s} p x:(MOVWstoreconst [a] {s} p mem)) 1182 && x.Uses == 1 1183 && ValAndOff(a).Off() + 2 == ValAndOff(c).Off() 1184 && clobber(x) 1185 -> (MOVLstoreconst [makeValAndOff(ValAndOff(a).Val()&0xffff | ValAndOff(c).Val()<<16, ValAndOff(a).Off())] {s} p mem) 1186 1187 (MOVBstoreconstidx1 [c] {s} p i x:(MOVBstoreconstidx1 [a] {s} p i mem)) 1188 && x.Uses == 1 1189 && ValAndOff(a).Off() + 1 == ValAndOff(c).Off() 1190 && clobber(x) 1191 -> (MOVWstoreconstidx1 [makeValAndOff(ValAndOff(a).Val()&0xff | ValAndOff(c).Val()<<8, ValAndOff(a).Off())] {s} p i mem) 1192 (MOVWstoreconstidx1 [c] {s} p i x:(MOVWstoreconstidx1 [a] {s} p i mem)) 1193 && x.Uses == 1 1194 && ValAndOff(a).Off() + 2 == ValAndOff(c).Off() 1195 && clobber(x) 1196 -> (MOVLstoreconstidx1 [makeValAndOff(ValAndOff(a).Val()&0xffff | ValAndOff(c).Val()<<16, ValAndOff(a).Off())] {s} p i mem) 1197 1198 (MOVWstoreconstidx2 [c] {s} p i x:(MOVWstoreconstidx2 [a] {s} p i mem)) 1199 && x.Uses == 1 1200 && ValAndOff(a).Off() + 2 == ValAndOff(c).Off() 1201 && clobber(x) 1202 -> (MOVLstoreconstidx1 [makeValAndOff(ValAndOff(a).Val()&0xffff | ValAndOff(c).Val()<<16, ValAndOff(a).Off())] {s} p (SHLLconst <i.Type> [1] i) mem) 1203 1204 // Combine stores into larger (unaligned) stores. 1205 (MOVBstore [i] {s} p (SHRLconst [8] w) x:(MOVBstore [i-1] {s} p w mem)) 1206 && x.Uses == 1 1207 && clobber(x) 1208 -> (MOVWstore [i-1] {s} p w mem) 1209 (MOVBstore [i] {s} p (SHRLconst [j] w) x:(MOVBstore [i-1] {s} p w0:(SHRLconst [j-8] w) mem)) 1210 && x.Uses == 1 1211 && clobber(x) 1212 -> (MOVWstore [i-1] {s} p w0 mem) 1213 (MOVWstore [i] {s} p (SHRLconst [16] w) x:(MOVWstore [i-2] {s} p w mem)) 1214 && x.Uses == 1 1215 && clobber(x) 1216 -> (MOVLstore [i-2] {s} p w mem) 1217 (MOVWstore [i] {s} p (SHRLconst [j] w) x:(MOVWstore [i-2] {s} p w0:(SHRLconst [j-16] w) mem)) 1218 && x.Uses == 1 1219 && clobber(x) 1220 -> (MOVLstore [i-2] {s} p w0 mem) 1221 1222 (MOVBstoreidx1 [i] {s} p idx (SHRLconst [8] w) x:(MOVBstoreidx1 [i-1] {s} p idx w mem)) 1223 && x.Uses == 1 1224 && clobber(x) 1225 -> (MOVWstoreidx1 [i-1] {s} p idx w mem) 1226 (MOVBstoreidx1 [i] {s} p idx (SHRLconst [j] w) x:(MOVBstoreidx1 [i-1] {s} p idx w0:(SHRLconst [j-8] w) mem)) 1227 && x.Uses == 1 1228 && clobber(x) 1229 -> (MOVWstoreidx1 [i-1] {s} p idx w0 mem) 1230 (MOVWstoreidx1 [i] {s} p idx (SHRLconst [16] w) x:(MOVWstoreidx1 [i-2] {s} p idx w mem)) 1231 && x.Uses == 1 1232 && clobber(x) 1233 -> (MOVLstoreidx1 [i-2] {s} p idx w mem) 1234 (MOVWstoreidx1 [i] {s} p idx (SHRLconst [j] w) x:(MOVWstoreidx1 [i-2] {s} p idx w0:(SHRLconst [j-16] w) mem)) 1235 && x.Uses == 1 1236 && clobber(x) 1237 -> (MOVLstoreidx1 [i-2] {s} p idx w0 mem) 1238 1239 (MOVWstoreidx2 [i] {s} p idx (SHRLconst [16] w) x:(MOVWstoreidx2 [i-2] {s} p idx w mem)) 1240 && x.Uses == 1 1241 && clobber(x) 1242 -> (MOVLstoreidx1 [i-2] {s} p (SHLLconst <idx.Type> [1] idx) w mem) 1243 (MOVWstoreidx2 [i] {s} p idx (SHRLconst [j] w) x:(MOVWstoreidx2 [i-2] {s} p idx w0:(SHRLconst [j-16] w) mem)) 1244 && x.Uses == 1 1245 && clobber(x) 1246 -> (MOVLstoreidx1 [i-2] {s} p (SHLLconst <idx.Type> [1] idx) w0 mem) 1247 1248 // For PIC, break floating-point constant loading into two instructions so we have 1249 // a register to use for holding the address of the constant pool entry. 1250 (MOVSSconst [c]) && config.ctxt.Flag_shared -> (MOVSSconst2 (MOVSSconst1 [c])) 1251 (MOVSDconst [c]) && config.ctxt.Flag_shared -> (MOVSDconst2 (MOVSDconst1 [c]))