summaryrefslogtreecommitdiffstats
path: root/src/mesa/shader/slang/slang_codegen.c
diff options
context:
space:
mode:
authorBrian <[email protected]>2006-12-15 17:05:53 -0700
committerBrian <[email protected]>2006-12-15 17:05:53 -0700
commita4be1048870446a45a4a14178b47e2cb1a0d92d6 (patch)
tree81b518dba12010b39ac0629b741651790de89a34 /src/mesa/shader/slang/slang_codegen.c
parentcb7ccc4b144e546239294ae754aa634bbebc4c62 (diff)
start implementing relational operators
Diffstat (limited to 'src/mesa/shader/slang/slang_codegen.c')
-rw-r--r--src/mesa/shader/slang/slang_codegen.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/src/mesa/shader/slang/slang_codegen.c b/src/mesa/shader/slang/slang_codegen.c
index 611b6145f57..f62ff01f2dd 100644
--- a/src/mesa/shader/slang/slang_codegen.c
+++ b/src/mesa/shader/slang/slang_codegen.c
@@ -963,10 +963,32 @@ slang_assemble_operation(slang_assemble_ctx * A, slang_operation *oper)
);
}
break;
+ case slang_oper_equal:
+ return new_node(IR_SEQUAL,
+ slang_assemble_operation(A, &oper->children[0]),
+ slang_assemble_operation(A, &oper->children[1]));
+ case slang_oper_notequal:
+ return new_node(IR_SNEQUAL,
+ slang_assemble_operation(A, &oper->children[0]),
+ slang_assemble_operation(A, &oper->children[1]));
+ case slang_oper_greater:
+ return new_node(IR_SGT,
+ slang_assemble_operation(A, &oper->children[0]),
+ slang_assemble_operation(A, &oper->children[1]));
case slang_oper_less:
- return new_node(IR_LESS,
+ /* child[0] < child[1] ----> child[1] > child[0] */
+ return new_node(IR_SGT,
+ slang_assemble_operation(A, &oper->children[1]),
+ slang_assemble_operation(A, &oper->children[0]));
+ case slang_oper_greaterequal:
+ return new_node(IR_SGE,
slang_assemble_operation(A, &oper->children[0]),
slang_assemble_operation(A, &oper->children[1]));
+ case slang_oper_lessequal:
+ /* child[0] <= child[1] ----> child[1] >= child[0] */
+ return new_node(IR_SGE,
+ slang_assemble_operation(A, &oper->children[1]),
+ slang_assemble_operation(A, &oper->children[0]));
case slang_oper_add:
{
slang_ir_node *n;