[Mesa-dev] [PATCH 03/12] glsl: Don't explicitly store "__intrinsic_"
Ian Romanick
idr at freedesktop.org
Tue Jul 19 20:13:05 UTC 2016
From: Ian Romanick <ian.d.romanick at intel.com>
Every valid intrinsic function name starts with "__intrinsic_". Compare
and store the string once instead of 41 times.
text data bss dec hex filename
7529283 273096 28584 7830963 777db3 /tmp/i965_dri-64bit-before.so
7529067 273096 28584 7830747 777cdb /tmp/i965_dri-64bit-after.so
Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
Reviewed-by: Iago Toral Quiroga <itoral at igalia.com>
---
src/compiler/glsl/nir_intrinsic_map.py | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/compiler/glsl/nir_intrinsic_map.py b/src/compiler/glsl/nir_intrinsic_map.py
index c14438b..4d999c1 100644
--- a/src/compiler/glsl/nir_intrinsic_map.py
+++ b/src/compiler/glsl/nir_intrinsic_map.py
@@ -73,8 +73,13 @@ namespace _glsl_to_nir {
nir_intrinsic_op
get_intrinsic_opcode(const char *name, const ir_dereference *return_deref)
{
+ if (strncmp(name, "__intrinsic_", 12) == 0)
+ name += 12;
+ else
+ unreachable("Intrinsic name does not begin with '__intrinsic_'");
+
% for (name, ops) in intrinsics:
- if (strcmp(name, "${name}") == 0) {
+ if (strcmp(name, "${name[12:]}") == 0) {
% if ops[1] is None:
return ${ops[0]};
% else:
--
2.5.5
More information about the mesa-dev
mailing list