diff options
author | Christoph Bumiller <[email protected]> | 2013-06-11 22:57:31 +0200 |
---|---|---|
committer | Ilia Mirkin <[email protected]> | 2014-05-23 12:34:38 -0400 |
commit | 3b0867f35b5b294eb0d40524a6bc4c8de888a96f (patch) | |
tree | 6dddd3218d0ee16d844798a20f01816557f6521a /src/gallium/drivers | |
parent | 2f2d1b3d9b090aeba316d6c425c23e92340b5502 (diff) |
nv50/ir/opt: fix constant folding with saturate modifier
Reviewed-by: Ilia Mirkin <[email protected]>
Cc: "10.2" <[email protected]>
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r-- | src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp index e6f8f69ce91..1a2c2e66df4 100644 --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp @@ -561,7 +561,7 @@ ConstantFolding::expr(Instruction *i, if (i->src(0).getImmediate(src0)) expr(i, src0, *i->getSrc(1)->asImm()); } else { - i->op = OP_MOV; + i->op = i->saturate ? OP_SAT : OP_MOV; /* SAT handled by unary() */ } } @@ -612,6 +612,7 @@ ConstantFolding::unary(Instruction *i, const ImmediateValue &imm) switch (i->op) { case OP_NEG: res.data.f32 = -imm.reg.data.f32; break; case OP_ABS: res.data.f32 = fabsf(imm.reg.data.f32); break; + case OP_SAT: res.data.f32 = CLAMP(imm.reg.data.f32, 0.0f, 1.0f); break; case OP_RCP: res.data.f32 = 1.0f / imm.reg.data.f32; break; case OP_RSQ: res.data.f32 = 1.0f / sqrtf(imm.reg.data.f32); break; case OP_LG2: res.data.f32 = log2f(imm.reg.data.f32); break; @@ -922,6 +923,7 @@ ConstantFolding::opnd(Instruction *i, ImmediateValue &imm0, int s) case OP_ABS: case OP_NEG: + case OP_SAT: case OP_LG2: case OP_RCP: case OP_SQRT: |