https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120362

            Bug ID: 120362
           Summary: [GCC-15.1] Illegal Insn when run spec2017 511 ref size
           Product: gcc
           Version: 15.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pan2.li at intel dot com
  Target Milestone: ---

There will be an illegal insn when run spec17 511 with below command:

runcpu -c gcc-15-rvv_fix.cfg --action=validate --size=ref --noreportable 
--iterations=1 --tune=base --copies=1 511 

compile option are: "-O3 -march=rv64gcvb_zvl256b -mrvv-vector-bits=zvl"


[89405.212442] CPU: 0 PID: 5724 Comm: povray_r_base.g Not tainted 6.6.36
#2.0~rc7.2
[89405.219881] CPU: 7 PID: 5725 Comm: povray_r_base.g Not tainted 6.6.36
#2.0~rc7.2
[89405.225214] Hardware name: spacemit k1-x deb1 board (DT)
[89405.232480] Hardware name: spacemit k1-x deb1 board (DT)
[89405.239748] epc : 00000000000b29e8 ra : 00000000000b2a30 sp :
0000003fda481eb0
[89405.247023] epc : 00000000000b29e8 ra : 00000000000b2a30 sp :
0000003fdb576eb0
[89405.254308]  gp : 0000000000101240 tp : 0000003fbce47dc0 t0 :
0000003fbd2302a0
[89405.261574]  gp : 0000000000101240 tp : 0000003fb85d6dc0 t0 :
0000003fb89bf2a0
[89405.268840]  t1 : 0000003fbce6f4ac t2 : 0000000000000006 s0 :
0000000000101788
[89405.276088]  t1 : 0000003fb85fe4ac t2 : 0000000000000006 s0 :
0000000000101788
[89405.283354]  s1 : 0000003fda482218 a0 : 0000000000101788 a1 :
0000003fda482218
[89405.290602]  s1 : 0000003fdb577218 a0 : 0000000000101788 a1 :
0000003fdb577218
[89405.297867]  a2 : 0000003fda482230 a3 : 0000000000000000 a4 :
0000003fda4820b0
[89405.303223]  a2 : 0000003fdb577230 a3 : 0000000000000000 a4 :
0000003fdb5770b0
[89405.311183]  a5 : 00000000000dd388 a6 : 0000000000000000 a7 :
0000003fbcf85040
[89405.322831]  a5 : 00000000000dd388 a6 : 0000000000000000 a7 :
0000003fb8714040
[89405.330280]  s2 : 0000000000000002 s3 : 00000000000f8d10 s4 :
0000000000012c2e
[89405.335636]  s2 : 0000000000000002 s3 : 00000000000f8d10 s4 :
0000000000012c2e
[89405.342911]  s5 : 0000003fda482230 s6 : 00000000000f8d10 s7 :
0000003fbd22ed68
[89405.350200]  s5 : 0000003fdb577230 s6 : 00000000000f8d10 s7 :
0000003fb89bdd68
[89405.357485]  s8 : 0000003fbd22f030 s9 : 0000000000000000 s10:
0000002ab7befed8
[89405.364754]  s8 : 0000003fb89be030 s9 : 0000000000000000 s10:
0000002ae6fc0ed8
[89405.372029]  s11: 0000002ab7befee4 t3 : 0000003fbd21e922 t4 :
000000000003642e
[89405.379298]  s11: 0000002ae6fc0ee4 t3 : 0000003fb89ad922 t4 :
000000000003642e
[89405.386574]  t5 : 000000002b43e9ed t6 : 0000000000ad0fa7
[89405.393843]  t5 : 000000002b43e9ed t6 : 0000000000ad0fa7
[89405.401108] status: 8000000200006020 badaddr: 000000000287e087 cause:
0000000000000002
[89405.408377] status: 8000000200006020 badaddr: 000000000287e087 cause:
0000000000000002

The illegal insn comes from POVMSStream_Init @ 0xb29e8 with below asm, take
simple vsetvel still have this issue but disable zvl will not have vl1re32 insn
and can fix this illegal insn.


00000000000b29e0 <_Z16POVMSStream_Initv>:
   b29e0:       000dd7b7                lui     a5,0xdd
   b29e4:       38878793                add     a5,a5,904 # dd388
<_ZTVN8pov_base7OStreamE+0x30>

   b29e8:       0287e087                vl1re32.v       v1,(a5)

   b29ec:       cd047057                vsetivli        zero,8,e32,m1,ta,ma
   b29f0:       0012f7b7                lui     a5,0x12f
   b29f4:       0d078793                add     a5,a5,208 # 12f0d0
<POVMSStreamOrderTables>
   b29f8:       5208a157                vid.v   v2

One simple inline asm can also reproduce this issue too.

nt
main() {
  asm volatile ("lui a5, 0xdd\n\t"
                "add a5, a5, 904\n\t"
                "vl1re32.v v1,(a5)\n\t"
                :
                :
                :);

  return 0;
}

I am trying to narrow down the POVMSStream_Init for easy debugging, and will
keep posted.

Reply via email to