In mips.cc(mips_reorg_process_insns), there is this claim: Also delete cache barriers if the last instruction was an annulled branch. INSN will not be speculatively executed.
And with -O1 on mips64, we can generate binary code like this, which fails this test. gcc/testsuite * gcc.target/mips/r10-cache-barrier-13.c: Add -mno-branch-likely option. --- gcc/testsuite/gcc.target/mips/r10k-cache-barrier-13.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/testsuite/gcc.target/mips/r10k-cache-barrier-13.c b/gcc/testsuite/gcc.target/mips/r10k-cache-barrier-13.c index ee9c84b5988..ac005fb08b3 100644 --- a/gcc/testsuite/gcc.target/mips/r10k-cache-barrier-13.c +++ b/gcc/testsuite/gcc.target/mips/r10k-cache-barrier-13.c @@ -1,4 +1,4 @@ -/* { dg-options "-mr10k-cache-barrier=store" } */ +/* { dg-options "-mr10k-cache-barrier=store -mno-branch-likely" } */ /* Test that indirect calls are protected. */ -- 2.39.3 (Apple Git-146)