diff options
author | Hans de Goede <hdegoede@redhat.com> | 2015-11-05 14:32:36 +0100 |
---|---|---|
committer | Ilia Mirkin <imirkin@alum.mit.edu> | 2015-11-06 18:13:31 -0500 |
commit | 428506ece2c7627392d0f02c7f83021caa46bb4f (patch) | |
tree | 1a6d01b788d4a2c05932baea267921c766cf5b46 /src | |
parent | 2437f0085372355980864454964749ac8231ca44 (diff) | |
download | external_mesa3d-428506ece2c7627392d0f02c7f83021caa46bb4f.zip external_mesa3d-428506ece2c7627392d0f02c7f83021caa46bb4f.tar.gz external_mesa3d-428506ece2c7627392d0f02c7f83021caa46bb4f.tar.bz2 |
nv50/ir: Add support for merge-s to the ConstantFolding pass
This allows later passes like LoadPropagation to properly deal with 64
bit immediates.
If the new 64 bit load this introduces does not get optimized away then
split64BitOpPostRA() will split this into 2 instructions again.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Diffstat (limited to 'src')
-rw-r--r-- | src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp index 44f74c6..8e241f1 100644 --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp @@ -447,6 +447,7 @@ ConstantFolding::expr(Instruction *i, { struct Storage *const a = &imm0.reg, *const b = &imm1.reg; struct Storage res; + uint8_t fixSrc0Size = 0; memset(&res.data, 0, sizeof(res.data)); @@ -589,6 +590,18 @@ ConstantFolding::expr(Instruction *i, // the second argument will not be constant, but that can happen. res.data.u32 = a->data.u32 + b->data.u32; break; + case OP_MERGE: + switch (i->dType) { + case TYPE_U64: + case TYPE_S64: + case TYPE_F64: + res.data.u64 = (((uint64_t)b->data.u32) << 32) | a->data.u32; + fixSrc0Size = 8; + break; + default: + return; + } + break; default: return; } @@ -602,6 +615,8 @@ ConstantFolding::expr(Instruction *i, i->setSrc(1, NULL); i->getSrc(0)->reg.data = res.data; + if (fixSrc0Size) + i->getSrc(0)->reg.size = fixSrc0Size; switch (i->op) { case OP_MAD: |