x86-64 does not support 64-bit immediates as absolute memory addresses. They have to be stored in a register, which can then be used as [base]. Previously we addressed this at the SubzeroReactor level by emitting a Bitcast from an Ice::Operand to an Ice::Variable, for which Subzero already supported 64-bit constants as input. This change implements X86OperandMem creation from a 64-bit constant operand by letting legalize() move it into a GPR and using it as the memory operand's base register. A Reactor unit test is added to exercise this. Another issue was that doLoadOpt() assumed all load instructions are candidates for fusing into a subsequent instruction which takes the result of the load. This isn't true when for 64-bit constant addresses an instruction to copy it into a register is inserted. For now this case is simply skipped. A future optimization could adjust the iterators properly so the load from [base] can be fused with the next instruction. Lastly, it is possible for a 64-bit constant to fit within a 32-bit immediate, in which case legalize() by default does not perform the copy into a GPR (note this is to allow moves and calls with 64-bit immediates, where they are legal), and simply returns the 64-bit constant. So we must not allow legalization to an immediate in this case. Note that while we could replace it with a 32-bit constant, it's rare for absolute addresses to fit in this range, and it would be non-deterministic which path is taken, so for consistency we don't perform this optimization. Bug: b/148272103 Change-Id: I5fcfa971dc93f2307202ee11619e84c65fe46188 Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/52768Tested-by:Nicolas Capens <nicolascapens@google.com> Presubmit-Ready: Nicolas Capens <nicolascapens@google.com> Reviewed-by:
Antonio Maiorano <amaiorano@google.com>
| Name |
Last commit
|
Last update |
|---|---|---|
| .. | ||
| DartARM32 | Loading commit data... | |
| IceASanInstrumentation.cpp | Loading commit data... | |
| IceASanInstrumentation.h | Loading commit data... | |
| IceAssembler.cpp | Loading commit data... | |
| IceAssembler.h | Loading commit data... | |
| IceAssemblerARM32.cpp | Loading commit data... | |
| IceAssemblerARM32.h | Loading commit data... | |
| IceAssemblerMIPS32.cpp | Loading commit data... | |
| IceAssemblerMIPS32.h | Loading commit data... | |
| IceAssemblerX8632.h | Loading commit data... | |
| IceAssemblerX8664.h | Loading commit data... | |
| IceAssemblerX86Base.h | Loading commit data... | |
| IceAssemblerX86BaseImpl.h | Loading commit data... | |
| IceBitVector.h | Loading commit data... | |
| IceBrowserCompileServer.cpp | Loading commit data... | |
| IceBrowserCompileServer.h | Loading commit data... | |
| IceBuildDefs.h | Loading commit data... | |
| IceCfg.cpp | Loading commit data... | |
| IceCfg.h | Loading commit data... | |
| IceCfgNode.cpp | Loading commit data... | |
| IceCfgNode.h | Loading commit data... | |
| IceClFlags.cpp | Loading commit data... | |
| IceClFlags.def | Loading commit data... | |
| IceClFlags.h | Loading commit data... | |
| IceCompileServer.cpp | Loading commit data... | |
| IceCompileServer.h | Loading commit data... | |
| IceCompiler.cpp | Loading commit data... | |
| IceCompiler.h | Loading commit data... | |
| IceConditionCodesARM32.h | Loading commit data... | |
| IceConditionCodesMIPS32.h | Loading commit data... | |
| IceConditionCodesX8632.h | Loading commit data... | |
| IceConditionCodesX8664.h | Loading commit data... | |
| IceConverter.cpp | Loading commit data... | |
| IceConverter.h | Loading commit data... | |
| IceDefs.h | Loading commit data... | |
| IceELFObjectWriter.cpp | Loading commit data... | |
| IceELFObjectWriter.h | Loading commit data... | |
| IceELFSection.cpp | Loading commit data... | |
| IceELFSection.h | Loading commit data... | |
| IceELFStreamer.h | Loading commit data... | |
| IceFixups.cpp | Loading commit data... | |
| IceFixups.h | Loading commit data... | |
| IceGlobalContext.cpp | Loading commit data... | |
| IceGlobalContext.h | Loading commit data... | |
| IceGlobalInits.cpp | Loading commit data... | |
| IceGlobalInits.h | Loading commit data... | |
| IceInst.cpp | Loading commit data... | |
| IceInst.def | Loading commit data... | |
| IceInst.h | Loading commit data... | |
| IceInstARM32.cpp | Loading commit data... | |
| IceInstARM32.def | Loading commit data... | |
| IceInstARM32.h | Loading commit data... | |
| IceInstMIPS32.cpp | Loading commit data... | |
| IceInstMIPS32.def | Loading commit data... | |
| IceInstMIPS32.h | Loading commit data... | |
| IceInstVarIter.h | Loading commit data... | |
| IceInstX8632.cpp | Loading commit data... | |
| IceInstX8632.def | Loading commit data... | |
| IceInstX8632.h | Loading commit data... | |
| IceInstX8664.cpp | Loading commit data... | |
| IceInstX8664.def | Loading commit data... | |
| IceInstX8664.h | Loading commit data... | |
| IceInstX86Base.h | Loading commit data... | |
| IceInstX86BaseImpl.h | Loading commit data... | |
| IceInstrumentation.cpp | Loading commit data... | |
| IceInstrumentation.h | Loading commit data... | |
| IceIntrinsics.cpp | Loading commit data... | |
| IceIntrinsics.h | Loading commit data... | |
| IceLiveness.cpp | Loading commit data... | |
| IceLiveness.h | Loading commit data... | |
| IceLoopAnalyzer.cpp | Loading commit data... | |
| IceLoopAnalyzer.h | Loading commit data... | |
| IceMangling.cpp | Loading commit data... | |
| IceMangling.h | Loading commit data... | |
| IceMemory.cpp | Loading commit data... | |
| IceMemory.h | Loading commit data... | |
| IceOperand.cpp | Loading commit data... | |
| IceOperand.h | Loading commit data... | |
| IcePhiLoweringImpl.h | Loading commit data... | |
| IceRangeSpec.cpp | Loading commit data... | |
| IceRangeSpec.h | Loading commit data... | |
| IceRegAlloc.cpp | Loading commit data... | |
| IceRegAlloc.h | Loading commit data... | |
| IceRegList.h | Loading commit data... | |
| IceRegistersARM32.def | Loading commit data... | |
| IceRegistersARM32.h | Loading commit data... | |
| IceRegistersMIPS32.h | Loading commit data... | |
| IceRegistersX8632.h | Loading commit data... | |
| IceRegistersX8664.h | Loading commit data... | |
| IceRevision.cpp | Loading commit data... | |
| IceRevision.h | Loading commit data... | |
| IceStringPool.h | Loading commit data... | |
| IceSwitchLowering.cpp | Loading commit data... | |
| IceSwitchLowering.h | Loading commit data... | |
| IceTLS.h | Loading commit data... | |
| IceTargetLowering.cpp | Loading commit data... | |
| IceTargetLowering.def | Loading commit data... | |
| IceTargetLowering.h | Loading commit data... | |
| IceTargetLoweringARM32.cpp | Loading commit data... | |
| IceTargetLoweringARM32.def | Loading commit data... | |
| IceTargetLoweringARM32.h | Loading commit data... | |
| IceTargetLoweringMIPS32.cpp | Loading commit data... | |
| IceTargetLoweringMIPS32.def | Loading commit data... | |
| IceTargetLoweringMIPS32.h | Loading commit data... | |
| IceTargetLoweringX86.cpp | Loading commit data... | |
| IceTargetLoweringX8632.cpp | Loading commit data... | |
| IceTargetLoweringX8632.def | Loading commit data... | |
| IceTargetLoweringX8632.h | Loading commit data... | |
| IceTargetLoweringX8632Traits.h | Loading commit data... | |
| IceTargetLoweringX8664.cpp | Loading commit data... | |
| IceTargetLoweringX8664.def | Loading commit data... | |
| IceTargetLoweringX8664.h | Loading commit data... | |
| IceTargetLoweringX8664Traits.h | Loading commit data... | |
| IceTargetLoweringX86Base.h | Loading commit data... | |
| IceTargetLoweringX86BaseImpl.h | Loading commit data... | |
| IceTargetLoweringX86RegClass.h | Loading commit data... | |
| IceThreading.cpp | Loading commit data... | |
| IceThreading.h | Loading commit data... | |
| IceTimerTree.cpp | Loading commit data... | |
| IceTimerTree.def | Loading commit data... | |
| IceTimerTree.h | Loading commit data... | |
| IceTranslator.cpp | Loading commit data... | |
| IceTranslator.h | Loading commit data... | |
| IceTypeConverter.cpp | Loading commit data... | |
| IceTypeConverter.h | Loading commit data... | |
| IceTypes.cpp | Loading commit data... | |
| IceTypes.def | Loading commit data... | |
| IceTypes.h | Loading commit data... | |
| IceUtils.h | Loading commit data... | |
| IceVariableSplitting.cpp | Loading commit data... | |
| IceVariableSplitting.h | Loading commit data... | |
| LinuxMallocProfiling.cpp | Loading commit data... | |
| LinuxMallocProfiling.h | Loading commit data... | |
| Makefile | Loading commit data... | |
| PNaClTranslator.cpp | Loading commit data... | |
| PNaClTranslator.h | Loading commit data... | |
| README.SIMD.rst | Loading commit data... | |
| SZTargets.def | Loading commit data... | |
| WasmTranslator.cpp | Loading commit data... | |
| WasmTranslator.h | Loading commit data... | |
| main.cpp | Loading commit data... |