charfi asma <charfiasma@xxxxxxxx> writes: > I try to generate the GIMPLE form corresponding to > > if (var == 1 || var == 5) > goto L1; > else > goto L2; > > I satarted by generating GIMPLE for this code > > if (var == 1) > goto L1; > else > goto L2; > > this is my GENERIC tree codes used to generate this gimple : > > //GENERIC: > > .... > > tree VAR = build_decl(BUILTINS_LOCATION, VAR_DECL, get_identifier("var"), > integer_type_node); > > tree __if_cond = build2(EQ_EXPR, TREE_TYPE(VAR), VAR, > build_int_cst(integer_type_node, 1)); > > tree __if_stmt = build3(COND_EXPR, void_type_node, __if_cond, goto_L1, goto_L2); > > .... > > //GIMPLE: > > <unnamed-signed:32> var; > .... > gimple_cond <eq_expr, var, 1, L1, L2> > ... > > to use the || operand, I tried to use the TRUTH_OR_IF_EXPR like this > > tree __if_cond_1 = build2(TRUTH_ORIF_EXPR, TREE_TYPE(VAR), > build_int_cst(integer_type_node, 1), build_int_cst(integer_type_node, 5)); > > tree __if_stmt1 = build3(COND_EXPR, void_type_node, __if_cond_1, goto_L1, > goto_L12); > > but this did not work, cause I do not specify the variable to test (VAR): > TRUTH_ORIF_EXPR has only 2 operands that represent the values (1 and 5). > > did so use before this TREE CODE or has an idea how we should use it ? The operands of TRUTH_ORIF_EXPR in this case would be, approximately, build2(EQ_EXPR, boolean_type_node, var, 1) build2(EQ_EXPR, boolean_type_node, var, 5) That is, TRUTH_ORIF_EXPR corresponds directly to the || operator. By the way, there is no reason to TRUTH_ORIF_EXPR in this case. You might as well just use TRUTH_OR_EXPR. Ian