diff options
author | Christoph Bumiller <[email protected]> | 2012-04-09 20:34:24 +0200 |
---|---|---|
committer | Christoph Bumiller <[email protected]> | 2012-04-14 21:54:00 +0200 |
commit | 55f9bdb64e1f88c74754c8e090cd2cdbe62bba05 (patch) | |
tree | f47dece859a6c932a0b4d37e5250d5db4c32bf65 /src/gallium/drivers/nvc0/codegen | |
parent | 56cf2da02226aee6b7476675c0e05ac7c218756e (diff) |
nv50/ir/opt: improve post-multiply and check target for support
Diffstat (limited to 'src/gallium/drivers/nvc0/codegen')
-rw-r--r-- | src/gallium/drivers/nvc0/codegen/nv50_ir_target_nvc0.cpp | 12 | ||||
-rw-r--r-- | src/gallium/drivers/nvc0/codegen/nv50_ir_target_nvc0.h | 1 |
2 files changed, 13 insertions, 0 deletions
diff --git a/src/gallium/drivers/nvc0/codegen/nv50_ir_target_nvc0.cpp b/src/gallium/drivers/nvc0/codegen/nv50_ir_target_nvc0.cpp index bcc2c43a55f..6fe95c6693f 100644 --- a/src/gallium/drivers/nvc0/codegen/nv50_ir_target_nvc0.cpp +++ b/src/gallium/drivers/nvc0/codegen/nv50_ir_target_nvc0.cpp @@ -516,6 +516,18 @@ TargetNVC0::isSatSupported(const Instruction *insn) const return insn->dType == TYPE_F32; } +bool +TargetNVC0::isPostMultiplySupported(operation op, float f, int& e) const +{ + if (op != OP_MUL) + return false; + f = fabsf(f); + e = static_cast<int>(log2f(f)); + if (e < -3 || e > 3) + return false; + return f == exp2f(static_cast<float>(e)); +} + // TODO: better values int TargetNVC0::getLatency(const Instruction *i) const { diff --git a/src/gallium/drivers/nvc0/codegen/nv50_ir_target_nvc0.h b/src/gallium/drivers/nvc0/codegen/nv50_ir_target_nvc0.h index 1a49f369920..e4efe476de0 100644 --- a/src/gallium/drivers/nvc0/codegen/nv50_ir_target_nvc0.h +++ b/src/gallium/drivers/nvc0/codegen/nv50_ir_target_nvc0.h @@ -48,6 +48,7 @@ public: virtual bool isAccessSupported(DataFile, DataType) const; virtual bool isModSupported(const Instruction *, int s, Modifier) const; virtual bool isSatSupported(const Instruction *) const; + virtual bool isPostMultiplySupported(operation, float, int& e) const; virtual bool mayPredicate(const Instruction *, const Value *) const; virtual int getLatency(const Instruction *) const; |