Message ID | 5cc8e70b-f118-4245-8701-6fbc96df29eb@ventanamicro.com |
---|---|
State | New |
Headers | show |
Series | [to-be-committed,RISC-V,PR,target/115142] Do not create invalidate shift-add insn | expand |
diff --git a/gcc/config/riscv/riscv.cc b/gcc/config/riscv/riscv.cc index 7a34b4be873..d0c22058b8c 100644 --- a/gcc/config/riscv/riscv.cc +++ b/gcc/config/riscv/riscv.cc @@ -2465,6 +2465,7 @@ mem_shadd_or_shadd_rtx_p (rtx x) { return ((GET_CODE (x) == ASHIFT || GET_CODE (x) == MULT) + && register_operand (XEXP (x, 0), GET_MODE (x)) && CONST_INT_P (XEXP (x, 1)) && ((GET_CODE (x) == ASHIFT && IN_RANGE (INTVAL (XEXP (x, 1)), 1, 3)) || (GET_CODE (x) == MULT diff --git a/gcc/testsuite/gcc.target/riscv/pr115142.c b/gcc/testsuite/gcc.target/riscv/pr115142.c new file mode 100644 index 00000000000..40ba49dfa20 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/pr115142.c @@ -0,0 +1,10 @@ +/* { dg-do compile } */ +/* { dg-options "-O0 -ftree-ter" } */ + +long a; +char b; +void e() { + char f[8][1]; + b = f[a][a]; +} +