aboutsummaryrefslogtreecommitdiff
path: root/gcc/config
diff options
context:
space:
mode:
authorJeff Law <jlaw@ventanamicro.com>2024-05-12 07:05:43 -0600
committerJeff Law <jlaw@ventanamicro.com>2024-05-12 07:09:02 -0600
commit77a28ed91b2a527b9006ee1a220b468756b43eca (patch)
treeb35f4f5fabfff0bd45649b9a18cde6207e78de55 /gcc/config
parenta18c83b45c64ac7870f6e2acb0f23ae6090ed9cd (diff)
downloadgcc-77a28ed91b2a527b9006ee1a220b468756b43eca.zip
gcc-77a28ed91b2a527b9006ee1a220b468756b43eca.tar.gz
gcc-77a28ed91b2a527b9006ee1a220b468756b43eca.tar.bz2
[to-be-committed] RISC-V Fix minor regression in synthesis WRT bseti usage
Overnight testing showed a small number of cases where constant synthesis was doing something dumb. Specifically generating more instructions than the number of bits set in the constant. It was a minor goof in the recent bseti code. In the code to first figure out what bits LUI could set, I included one bit outside the space LUI operates. For some dumb reason I kept thinking in terms of 11 low bits belonging to addi, but it's actually 12 bits. The net is what we thought should be a single LUI for costing turned into LUI+ADDI. I didn't let the test run to completion, but over the course of 12 hours it found 9 cases. Given we know that the triggers all have 0x800 set, I bet we could likely find more, but I doubt it's that critical to cover every possible constant that regressed. gcc/ * config/riscv/riscv.cc (riscv_build_integer_1): Fix thinko in testing when lui can be used to set several bits in bseti path. gcc/testsuite * gcc.target/riscv/synthesis-4.c: New test
Diffstat (limited to 'gcc/config')
-rw-r--r--gcc/config/riscv/riscv.cc6
1 files changed, 3 insertions, 3 deletions
diff --git a/gcc/config/riscv/riscv.cc b/gcc/config/riscv/riscv.cc
index 9c98b1d..049f8f8 100644
--- a/gcc/config/riscv/riscv.cc
+++ b/gcc/config/riscv/riscv.cc
@@ -921,12 +921,12 @@ riscv_build_integer_1 (struct riscv_integer_op codes[RISCV_MAX_INTEGER_OPS],
/* First handle any bits set by LUI. Be careful of the
SImode sign bit!. */
- if (value & 0x7ffff800)
+ if (value & 0x7ffff000)
{
alt_codes[i].code = (i == 0 ? UNKNOWN : IOR);
- alt_codes[i].value = value & 0x7ffff800;
+ alt_codes[i].value = value & 0x7ffff000;
alt_codes[i].use_uw = false;
- value &= ~0x7ffff800;
+ value &= ~0x7ffff000;
i++;
}