From 0e4e0ca6df52ddecd1bb2fe9a427549d1a82b9f9 Mon Sep 17 00:00:00 2001 From: Christoph Bumiller Date: Mon, 17 Oct 2011 23:02:16 +0200 Subject: [PATCH] nv50/ir: add wrap mode for shift operations D3D1x specifies that only the low 5 bit of the shift are used. --- src/gallium/drivers/nv50/codegen/nv50_ir.h | 1 + src/gallium/drivers/nv50/codegen/nv50_ir_print.cpp | 2 ++ src/gallium/drivers/nvc0/codegen/nv50_ir_emit_nvc0.cpp | 4 ++-- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/nv50/codegen/nv50_ir.h b/src/gallium/drivers/nv50/codegen/nv50_ir.h index e92b152a83b..88306087a98 100644 --- a/src/gallium/drivers/nv50/codegen/nv50_ir.h +++ b/src/gallium/drivers/nv50/codegen/nv50_ir.h @@ -136,6 +136,7 @@ enum operation #define NV50_IR_SUBOP_LDC_IL 1 #define NV50_IR_SUBOP_LDC_IS 2 #define NV50_IR_SUBOP_LDC_ISL 3 +#define NV50_IR_SUBOP_SHIFT_WRAP 1 enum DataType { diff --git a/src/gallium/drivers/nv50/codegen/nv50_ir_print.cpp b/src/gallium/drivers/nv50/codegen/nv50_ir_print.cpp index a730d2c06ab..4040a4d9c0f 100644 --- a/src/gallium/drivers/nv50/codegen/nv50_ir_print.cpp +++ b/src/gallium/drivers/nv50/codegen/nv50_ir_print.cpp @@ -437,6 +437,8 @@ void Instruction::print() const PRINT(" %sBB:%i", colour[TXT_BRA], asFlow()->target.bb->getId()); } else { PRINT("%s ", operationStr[op]); + if (subOp) + PRINT("(SUBOP:%u) ", subOp); if (perPatch) PRINT("patch "); if (asTex()) diff --git a/src/gallium/drivers/nvc0/codegen/nv50_ir_emit_nvc0.cpp b/src/gallium/drivers/nvc0/codegen/nv50_ir_emit_nvc0.cpp index 6bcbd625600..13f5d2f7c72 100644 --- a/src/gallium/drivers/nvc0/codegen/nv50_ir_emit_nvc0.cpp +++ b/src/gallium/drivers/nvc0/codegen/nv50_ir_emit_nvc0.cpp @@ -665,8 +665,8 @@ CodeEmitterNVC0::emitShift(const Instruction *i) emitForm_A(i, HEX64(60000000, 00000003)); } - if (0) - code[0] |= 1 << 9; // clamp shift amount + if (i->subOp == NV50_IR_SUBOP_SHIFT_WRAP) + code[0] |= 1 << 9; } void -- 2.30.2