On Mon, Jul 4, 2011 at 4:29 PM, Andrew Stubbs <a...@codesourcery.com> wrote: > On 28/06/11 16:08, Andrew Stubbs wrote: >> >> On 23/06/11 15:41, Andrew Stubbs wrote: >>> >>> This patch removes the restriction that the inputs to a widening >>> multiply must be of the same mode. >>> >>> It does this by extending the smaller of the two inputs to match the >>> larger; therefore, it remains the case that subsequent code (in the >>> expand pass, for example) can rely on the type of rhs1 being the input >>> type of the operation, and the gimple verification code is still valid. >>> >>> OK? >> >> This update fixes the testcase issue Janis highlighted. > > And this one updates the context changed by my update to patch 3. > > The content of the patch has not changed.
Similar to the previous patch + if (TYPE_MODE (type2) != from_mode) + { + type2 = lang_hooks.types.type_for_mode (from_mode, + TYPE_UNSIGNED (type2)); use build_nonstandard_integer_type. + if (cast1) + rhs1 = build_and_insert_cast (gsi, gimple_location (stmt), + create_tmp_var (type1, NULL), rhs1, type1); + if (cast2) + rhs2 = build_and_insert_cast (gsi, gimple_location (stmt), + create_tmp_var (type2, NULL), rhs2, type2); and CSE create_tmp_var - at this point type1 and type2 should be the same, right? So I guess it would be a good place to assert types_compatible_p (type1, type2). gimple_assign_set_rhs1 (stmt, fold_convert (type1, rhs1)); gimple_assign_set_rhs2 (stmt, fold_convert (type2, rhs2)); and that's now seemingly redundant ... it should probably be gimple_assign_set_rhs1 (stmt, rhs1);, no? A conversion isn't a valid rhs1/2. Similar oddity in convert_plusminus_to_widen. + if (TYPE_MODE (type2) != TYPE_MODE (type1)) + { + type2 = lang_hooks.types.type_for_mode (TYPE_MODE (type1), + TYPE_UNSIGNED (type2)); + cast2 = true; + } + + if (cast1) + mult_rhs1 = build_and_insert_cast (gsi, gimple_location (stmt), + create_tmp_var (type1, NULL), + mult_rhs1, type1); + if (cast2) + mult_rhs2 = build_and_insert_cast (gsi, gimple_location (stmt), + create_tmp_var (type2, NULL), + mult_rhs2, type2); see above. Thanks, Richard. > Andrew >