More LLM discovered issues. First in andes.md we're trying to emit a
conditional branch around a long branch sequence. That's usually done
by using a forward label like 0f or 1f. The output template used %1f,
so it's going to append 'f' to whatever the output string is for
operand1. Opps. That output template should just use 1f. There's other
problems with the long branch sequences, but I need to read the Andes
manual to make sure I don't muck up the fix.
Second was a case where we're using REGNO on an object that could be a
SUBREG. It's a pretty low impact peephole, so I've just adjusted the
condition to ensure the operands are REGs.
Tested on riscv64-elf and riscv32-elf. However, I doubt that really
exercises either of these two paths at all.
Jeff
* config/riscv/andes.md (branch-on-bit pattern): Reference the forward
label correctly in the long branch sequence.
* config/riscv/peephole.md: Require operands to be a REG before asking
for the REGNO.
diff --git a/gcc/config/riscv/andes.md b/gcc/config/riscv/andes.md
index 82563176b40..4b19fba5aa2 100644
--- a/gcc/config/riscv/andes.md
+++ b/gcc/config/riscv/andes.md
@@ -61,7 +61,7 @@
"TARGET_XANDESPERF"
{
if (get_attr_length (insn) == 12)
- return "nds.bb<any_eq:cs>\t%1,%2,%1f; jump\t%l0,ra; 1:";
+ return "nds.bb<any_eq:cs>\t%1,%2,1f; jump\t%l0,ra; 1:";
return "nds.bb<any_eq:cs>\t%1,%2,%l0";
}
diff --git a/gcc/config/riscv/peephole.md b/gcc/config/riscv/peephole.md
index e49bc042665..9191064c012 100644
--- a/gcc/config/riscv/peephole.md
+++ b/gcc/config/riscv/peephole.md
@@ -29,6 +29,7 @@
(ashift:DI (match_dup 3) (match_operand 5 "const_int_operand")))]
"TARGET_64BIT
&& INTVAL (operands[5]) < INTVAL (operands[2])
+ && REG_P (operands[3]) && REG_P (operands[4])
&& (REGNO (operands[3]) == REGNO (operands[4])
|| peep2_reg_dead_p (3, operands[3]))"
[(set (match_dup 0)