summaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorChristoph Bumiller <[email protected]>2011-08-27 21:00:39 +0200
committerChristoph Bumiller <[email protected]>2011-08-30 13:55:07 +0200
commiteabb9b0fd9d3a8b757c54465618b0d050ae0852f (patch)
tree0488aead090bf595aa8b6ab54f0e9b9a7c8e795e /src/gallium
parent222b3ea653e5525a4afa57e6a2353335953012d4 (diff)
nv50: handle TGSI_OPCODE_ROUND
Will round to nearest-even.
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/drivers/nv50/nv50_pc.c1
-rw-r--r--src/gallium/drivers/nv50/nv50_pc.h3
-rw-r--r--src/gallium/drivers/nv50/nv50_pc_emit.c6
-rw-r--r--src/gallium/drivers/nv50/nv50_pc_print.c1
-rw-r--r--src/gallium/drivers/nv50/nv50_tgsi_to_nc.c2
5 files changed, 10 insertions, 3 deletions
diff --git a/src/gallium/drivers/nv50/nv50_pc.c b/src/gallium/drivers/nv50/nv50_pc.c
index 7900bf811df..9137f871f5a 100644
--- a/src/gallium/drivers/nv50/nv50_pc.c
+++ b/src/gallium/drivers/nv50/nv50_pc.c
@@ -102,6 +102,7 @@ nv50_nvi_can_load(struct nv_instruction *nvi, int s, struct nv_value *value)
case NV_OP_FLOOR:
case NV_OP_TRUNC:
case NV_OP_CVT:
+ case NV_OP_ROUND:
case NV_OP_NEG:
case NV_OP_MAD:
case NV_OP_MUL:
diff --git a/src/gallium/drivers/nv50/nv50_pc.h b/src/gallium/drivers/nv50/nv50_pc.h
index 5bb0e1296bb..45804d3a913 100644
--- a/src/gallium/drivers/nv50/nv50_pc.h
+++ b/src/gallium/drivers/nv50/nv50_pc.h
@@ -86,7 +86,8 @@
#define NV_OP_SELECT 54
#define NV_OP_EXPORT 55
#define NV_OP_JOIN 56
-#define NV_OP_COUNT 57
+#define NV_OP_ROUND 57
+#define NV_OP_COUNT 58
#define NV_FILE_GPR 0
#define NV_FILE_OUT 1
diff --git a/src/gallium/drivers/nv50/nv50_pc_emit.c b/src/gallium/drivers/nv50/nv50_pc_emit.c
index 600850da011..2b177c6cb2f 100644
--- a/src/gallium/drivers/nv50/nv50_pc_emit.c
+++ b/src/gallium/drivers/nv50/nv50_pc_emit.c
@@ -94,7 +94,7 @@ const ubyte nv50_inst_min_size_tab[NV_OP_COUNT] =
0, 0, 0, 8, 8, 4, 4, 4, 8, 4, 4, 8, 8, 8, 8, 8, /* 15 */
8, 8, 8, 4, 0, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 4, /* 31 */
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 4, /* 47 */
- 4, 8, 8, 8, 8, 8, 0, 0, 8
+ 4, 8, 8, 8, 8, 8, 0, 0, 8, 8
};
unsigned
@@ -1009,13 +1009,14 @@ emit_cvt(struct nv_pc *pc, struct nv_instruction *nvi)
}
if (pc->emit[1] == CVT_F32_F32 &&
(nvi->opcode == NV_OP_CEIL || nvi->opcode == NV_OP_FLOOR ||
- nvi->opcode == NV_OP_TRUNC))
+ nvi->opcode == NV_OP_TRUNC || nvi->opcode == NV_OP_ROUND))
pc->emit[1] |= CVT_RI;
switch (nvi->opcode) {
case NV_OP_CEIL: pc->emit[1] |= CVT_CEIL; break;
case NV_OP_FLOOR: pc->emit[1] |= CVT_FLOOR; break;
case NV_OP_TRUNC: pc->emit[1] |= CVT_TRUNC; break;
+ case NV_OP_ROUND: pc->emit[1] |= CVT_RN; break;
case NV_OP_ABS: pc->emit[1] |= CVT_ABS; break;
case NV_OP_SAT: pc->emit[1] |= CVT_SAT; break;
@@ -1163,6 +1164,7 @@ nv50_emit_instruction(struct nv_pc *pc, struct nv_instruction *i)
case NV_OP_CEIL:
case NV_OP_FLOOR:
case NV_OP_TRUNC:
+ case NV_OP_ROUND:
emit_cvt(pc, i);
break;
case NV_OP_DFDX:
diff --git a/src/gallium/drivers/nv50/nv50_pc_print.c b/src/gallium/drivers/nv50/nv50_pc_print.c
index 984f6cbe172..dabbb836aa4 100644
--- a/src/gallium/drivers/nv50/nv50_pc_print.c
+++ b/src/gallium/drivers/nv50/nv50_pc_print.c
@@ -96,6 +96,7 @@ static const char *nv_opcode_names[NV_OP_COUNT + 1] = {
"select",
"export",
"join",
+ "round",
"BAD_OP"
};
diff --git a/src/gallium/drivers/nv50/nv50_tgsi_to_nc.c b/src/gallium/drivers/nv50/nv50_tgsi_to_nc.c
index 15aa40cddd1..4b11ae1e626 100644
--- a/src/gallium/drivers/nv50/nv50_tgsi_to_nc.c
+++ b/src/gallium/drivers/nv50/nv50_tgsi_to_nc.c
@@ -803,6 +803,7 @@ translate_opcode(uint opcode)
case TGSI_OPCODE_CEIL: return NV_OP_CEIL;
case TGSI_OPCODE_FLR: return NV_OP_FLOOR;
case TGSI_OPCODE_TRUNC: return NV_OP_TRUNC;
+ case TGSI_OPCODE_ROUND: return NV_OP_ROUND;
case TGSI_OPCODE_COS: return NV_OP_COS;
case TGSI_OPCODE_SIN: return NV_OP_SIN;
case TGSI_OPCODE_DDX: return NV_OP_DFDX;
@@ -1819,6 +1820,7 @@ bld_instruction(struct bld_context *bld,
case TGSI_OPCODE_CEIL:
case TGSI_OPCODE_FLR:
case TGSI_OPCODE_TRUNC:
+ case TGSI_OPCODE_ROUND:
case TGSI_OPCODE_DDX:
case TGSI_OPCODE_DDY:
FOR_EACH_DST0_ENABLED_CHANNEL(c, insn) {