OSDN Git Service

nv50/ir: add wrap mode for shift operations
authorChristoph Bumiller <e0425955@student.tuwien.ac.at>
Mon, 17 Oct 2011 21:02:16 +0000 (23:02 +0200)
committerChristoph Bumiller <e0425955@student.tuwien.ac.at>
Fri, 21 Oct 2011 21:00:39 +0000 (23:00 +0200)
D3D1x specifies that only the low 5 bit of the shift are used.

src/gallium/drivers/nv50/codegen/nv50_ir.h
src/gallium/drivers/nv50/codegen/nv50_ir_print.cpp
src/gallium/drivers/nvc0/codegen/nv50_ir_emit_nvc0.cpp

index e92b152..8830608 100644 (file)
@@ -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
 {
index a730d2c..4040a4d 100644 (file)
@@ -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())
index 6bcbd62..13f5d2f 100644 (file)
@@ -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