diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md index 090dbcf..b8aada32 100644 --- a/gcc/config/rs6000/rs6000.md +++ b/gcc/config/rs6000/rs6000.md @@ -4209,13 +4209,19 @@ (define_code_iterator plus_ior_xor [plus ior xor]) -(define_split - [(set (match_operand:GPR 0 "gpc_reg_operand") - (plus_ior_xor:GPR (ashift:GPR (match_operand:GPR 1 "gpc_reg_operand") - (match_operand:SI 2 "const_int_operand")) - (match_operand:GPR 3 "gpc_reg_operand")))] - "nonzero_bits (operands[3], mode) - < HOST_WIDE_INT_1U << INTVAL (operands[2])" +(define_insn_and_split "*rotl3_insert_3b_" + [(set (match_operand:GPR 0 "gpc_reg_operand" "=r") + (plus_ior_xor:GPR + (ashift:GPR (match_operand:GPR 1 "gpc_reg_operand" "r") + (match_operand:SI 2 "const_int_operand" "n")) + (match_operand:GPR 3 "gpc_reg_operand" "0")))] + "INTVAL (operands[2]) > 0 + && INTVAL (operands[2]) < 64 + && ((nonzero_bits (operands[3], mode) + < HOST_WIDE_INT_1U << INTVAL (operands[2])) + || reload_completed)" + "#" + "&& 1" [(set (match_dup 0) (ior:GPR (and:GPR (match_dup 3) (match_dup 4)) diff --git a/gcc/testsuite/gcc.target/powerpc/rldimi-3.c b/gcc/testsuite/gcc.target/powerpc/rldimi-3.c new file mode 100644 index 0000000..80ff86e --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/rldimi-3.c @@ -0,0 +1,9 @@ +/* { dg-do compile { target lp64 } } */ +/* { dg-options "-O2" } */ + +int foo(int x) +{ + int t = x & 42; + return t * 0x2001; +} +/* { dg-final { scan-assembler {\mrldimi\M} } } */