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 |
|---|---|---|
| .. | ||
| PowerVR_Examples @ 409c9d54 | ||
| SPIRV-Headers | Loading commit data... | |
| SPIRV-Tools | Loading commit data... | |
| angle | Loading commit data... | |
| astc-encoder | Loading commit data... | |
| benchmark @ e5ea03ce | ||
| boost | Loading commit data... | |
| cppdap @ 1fd23dda | ||
| glslang @ 81112685 | ||
| googletest @ 8ffb7e5c | ||
| json @ ed554144 | ||
| libbacktrace | Loading commit data... | |
| llvm-10.0 | Loading commit data... | |
| llvm-subzero | Loading commit data... | |
| marl | Loading commit data... | |
| subzero | Loading commit data... | |
| .clang-format | Loading commit data... | |
| update-llvm-10.sh | Loading commit data... | |
| update-marl.sh | Loading commit data... | |
| update-spirvheaders.sh | Loading commit data... | |
| update-spirvtools.sh | Loading commit data... |