summaryrefslogtreecommitdiffstats
path: root/ir_constant_expression.cpp
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2010-06-11 16:20:43 -0700
committerIan Romanick <[email protected]>2010-06-11 17:11:14 -0700
commit083d75a9428cb5231a26ffbdff856a3a94b49dcc (patch)
tree911fa50f6ba9017ebf1a15d1bf2204cd58b291ca /ir_constant_expression.cpp
parent4daaab6040d2f2b6b366ec1007772e0793177cee (diff)
ir_constant_visitor: Types of ir_binop_{equal,nequal} must match
The types must match exactly, so there is no reason to check the types here.
Diffstat (limited to 'ir_constant_expression.cpp')
-rw-r--r--ir_constant_expression.cpp76
1 files changed, 36 insertions, 40 deletions
diff --git a/ir_constant_expression.cpp b/ir_constant_expression.cpp
index d77921ac895..3a3d994302e 100644
--- a/ir_constant_expression.cpp
+++ b/ir_constant_expression.cpp
@@ -466,50 +466,46 @@ ir_constant_visitor::visit(ir_expression *ir)
break;
case ir_binop_equal:
- if (ir->operands[0]->type == ir->operands[1]->type) {
- type = glsl_type::bool_type;
- data.b[0] = true;
- for (c = 0; c < ir->operands[0]->type->components(); c++) {
- switch (ir->operands[0]->type->base_type) {
- case GLSL_TYPE_UINT:
- data.b[0] = data.b[0] && op[0]->value.u[c] == op[1]->value.u[c];
- break;
- case GLSL_TYPE_INT:
- data.b[0] = data.b[0] && op[0]->value.i[c] == op[1]->value.i[c];
- break;
- case GLSL_TYPE_FLOAT:
- data.b[0] = data.b[0] && op[0]->value.f[c] == op[1]->value.f[c];
- break;
- case GLSL_TYPE_BOOL:
- data.b[0] = data.b[0] && op[0]->value.b[c] == op[1]->value.b[c];
- break;
- default:
- assert(0);
- }
+ type = glsl_type::bool_type;
+ data.b[0] = true;
+ for (c = 0; c < ir->operands[0]->type->components(); c++) {
+ switch (ir->operands[0]->type->base_type) {
+ case GLSL_TYPE_UINT:
+ data.b[0] = data.b[0] && op[0]->value.u[c] == op[1]->value.u[c];
+ break;
+ case GLSL_TYPE_INT:
+ data.b[0] = data.b[0] && op[0]->value.i[c] == op[1]->value.i[c];
+ break;
+ case GLSL_TYPE_FLOAT:
+ data.b[0] = data.b[0] && op[0]->value.f[c] == op[1]->value.f[c];
+ break;
+ case GLSL_TYPE_BOOL:
+ data.b[0] = data.b[0] && op[0]->value.b[c] == op[1]->value.b[c];
+ break;
+ default:
+ assert(0);
}
}
break;
case ir_binop_nequal:
- if (ir->operands[0]->type == ir->operands[1]->type) {
- type = glsl_type::bool_type;
- data.b[0] = false;
- for (c = 0; c < ir->operands[0]->type->components(); c++) {
- switch (ir->operands[0]->type->base_type) {
- case GLSL_TYPE_UINT:
- data.b[0] = data.b[0] || op[0]->value.u[c] != op[1]->value.u[c];
- break;
- case GLSL_TYPE_INT:
- data.b[0] = data.b[0] || op[0]->value.i[c] != op[1]->value.i[c];
- break;
- case GLSL_TYPE_FLOAT:
- data.b[0] = data.b[0] || op[0]->value.f[c] != op[1]->value.f[c];
- break;
- case GLSL_TYPE_BOOL:
- data.b[0] = data.b[0] || op[0]->value.b[c] != op[1]->value.b[c];
- break;
- default:
- assert(0);
- }
+ type = glsl_type::bool_type;
+ data.b[0] = false;
+ for (c = 0; c < ir->operands[0]->type->components(); c++) {
+ switch (ir->operands[0]->type->base_type) {
+ case GLSL_TYPE_UINT:
+ data.b[0] = data.b[0] || op[0]->value.u[c] != op[1]->value.u[c];
+ break;
+ case GLSL_TYPE_INT:
+ data.b[0] = data.b[0] || op[0]->value.i[c] != op[1]->value.i[c];
+ break;
+ case GLSL_TYPE_FLOAT:
+ data.b[0] = data.b[0] || op[0]->value.f[c] != op[1]->value.f[c];
+ break;
+ case GLSL_TYPE_BOOL:
+ data.b[0] = data.b[0] || op[0]->value.b[c] != op[1]->value.b[c];
+ break;
+ default:
+ assert(0);
}
}
break;