https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65225
Bug ID: 65225 Summary: [AArch64] Various aarch64_rtx_costs improvements Product: gcc Version: 5.0 Status: UNCONFIRMED Keywords: missed-optimization Severity: enhancement Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: ktkachov at gcc dot gnu.org Target: aarch64* The aarch64 rtx costs walker could be improved. Some particular areas: - In the MINUS case, the cost of new_op1 is not included at all - In the PLUS and MINUS case, extends and extended shifts are costed as alu_arith rather than extend_arith - In the PLUS and MINUS case if there is a ASHIFT or MULT after an extend/extended shift, the cost calculated in rtx_mult_cost is as if it was a plain PLUS/MINUS. If the multiply is by a power of 2, it calculates the cost as a arith_shift rather than extend_arith. If it was ASHIFT the cost is wrong as it expects a MULT rather than ASHIFT, so shift immediates which happen to be a power of 2 get a different cost. - In the ASHIFT case, if there is an extend the cost of extend should be used rather than a shift. ASHIFT 1 should use alu cost rather than shift cost (we emit an add if shift cost is higher than alu cost) - In the ASHIFRT/LSHIFTRT case the extend logic is missing. - In the ABS case for integer, speed cost should be 2 ALU instructions rather than 4. - In the and-immediate case look into handling ZERO_EXTRACT. - The NOT case misses logic for shifts (despite the comment, calculating shift cost separately is not correct) - this can be costed as ORN with zero similar to the way NEG works.