Mesa (7.10): i965/fs: Add a helper function for detecting math opcodes.
Ian Romanick
idr at kemper.freedesktop.org
Tue Mar 1 01:37:16 UTC 2011
Module: Mesa
Branch: 7.10
Commit: f13e45d45df78c7af5bb98b523c7efed382fb81d
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=f13e45d45df78c7af5bb98b523c7efed382fb81d
Author: Eric Anholt <eric at anholt.net>
Date: Tue Jan 18 22:48:11 2011 -0800
i965/fs: Add a helper function for detecting math opcodes.
Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
(cherry picked from commit 382c2d99da3f219a5b82f391a81b534b6b44ebce)
---
src/mesa/drivers/dri/i965/brw_fs.cpp | 9 +--------
src/mesa/drivers/dri/i965/brw_fs.h | 12 ++++++++++++
2 files changed, 13 insertions(+), 8 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
index 21f8247..b7425a0 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -3108,14 +3108,7 @@ fs_visitor::compute_to_mrf()
/* gen6 math instructions must have the destination be
* GRF, so no compute-to-MRF for them.
*/
- if (scan_inst->opcode == FS_OPCODE_RCP ||
- scan_inst->opcode == FS_OPCODE_RSQ ||
- scan_inst->opcode == FS_OPCODE_SQRT ||
- scan_inst->opcode == FS_OPCODE_EXP2 ||
- scan_inst->opcode == FS_OPCODE_LOG2 ||
- scan_inst->opcode == FS_OPCODE_SIN ||
- scan_inst->opcode == FS_OPCODE_COS ||
- scan_inst->opcode == FS_OPCODE_POW) {
+ if (scan_inst->is_math()) {
break;
}
}
diff --git a/src/mesa/drivers/dri/i965/brw_fs.h b/src/mesa/drivers/dri/i965/brw_fs.h
index c4d4308..171e615 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.h
+++ b/src/mesa/drivers/dri/i965/brw_fs.h
@@ -305,6 +305,18 @@ public:
offset == inst->offset);
}
+ bool is_math()
+ {
+ return (opcode == FS_OPCODE_RCP ||
+ opcode == FS_OPCODE_RSQ ||
+ opcode == FS_OPCODE_SQRT ||
+ opcode == FS_OPCODE_EXP2 ||
+ opcode == FS_OPCODE_LOG2 ||
+ opcode == FS_OPCODE_SIN ||
+ opcode == FS_OPCODE_COS ||
+ opcode == FS_OPCODE_POW);
+ }
+
int opcode; /* BRW_OPCODE_* or FS_OPCODE_* */
fs_reg dst;
fs_reg src[3];
More information about the mesa-commit
mailing list