Hello,

I'm trying to port a private backend from GCC 4.5 to 4.7, and I'm seeing
some performance degradation in HImode benchmarks. The backend has no
HImode insns apart from the mov and SImode extensions. 

I tracked one of the regressions down to the RTL expansion pass. The 4.7
version won't generate smax RTL patterns for COND_EXPR statements
working on HImode operands. 

In GCC 4.5, COND_EXPR was of GIMPLE_SINGLE_RHS rhs_class. At expansion
time, the COND_EXPR would go through:
expand_gimple_stmt -> expand_gimple_stmt_1 ->  expand_assigment 
      -> store_expr -> fold_convert_loc (in the promoted subreg case)
...and the folding converts the COND_EXPR to a MAX_EXPR that generates a
smax RTL pattern.

In 4.7, the COND_EXPR has become a GIMPLE_TERNARY_RHS rhs_class, meaning
that it won't use the expand_assigment path in expand_gimple_stmt_1, but
will use straight expression expansion which will generate control flow
RTL for the COND_EXPR.

Should this be considered a code generation regression, or should the
MAX_EXPR trees be generated at some other point in the middle-end ?

Many thanks,
Fred

Reply via email to