Menu

#3203 3 regtests fail in z80-related ports for --max-allocs-per-node 10

closed-works-for-me
None
Z80
5
2021-04-30
2021-03-26
No

Currently, the following tests fail for some z80-related ports when --max-allocs-per-node 10 is added to SDCCFLAGS in spec.mk:

banked:
fails for ez80-z80

gcc-torture-execute-961213-1:
fails for ucr3ka, ez80-z80 and tlcs90.

rotate2:
fails for ucz80-resiy and ucgbz80.

Discussion

  • Philipp Klaus Krause

    The failure of banked for ez80-z80 is actually a bug in peephole rule 33, which apparently gets confused about 8-bit vs. 16-bit loads:

    ;   genLeftShift
    ;   AOP_STK for _f_ab_sloc0_1_0
    ;   AOP_STK for _f_ab_sloc1_1_0
        ld  a, -2 (ix)
        ld  -1 (ix), a
    ;   genCast
    ;   AOP_STK for _f_ab_sloc1_1_0
    ;   AOP_STK for _f_ab_sloc2_1_0
    ;   genMove_o
    ; common peephole 33 loaded hl from #0x00 instead of going through -2 (ix).
        ld  -2 (ix), #0x00
        ld  hl, #0x00
        ld  -4 (ix), hl
    

    Looks like a zero byte was loaded into one of the bytes of a variable om the stack, then that varaible was loaded into hl. The rule replaced that by a load of a zero word into hl.

     
    • Sergey Belyashov

      banked fixed for eZ80 in [r12174]

       
  • Sergey Belyashov

    genSwap generate invalid swap32 when left is AOP_STK with offset -4. Currently I do not understand how to compare aopu.aop_stk.

     
    • Sergey Belyashov

      Fixed in [r12178].

      But test gcc-torture-execute-961213-1 for tlcs90 and ez80 is failing yet.

       

      Last edit: Sergey Belyashov 2021-04-01
  • Sergey Belyashov

    I have added new fix for gcc-torture-execute-961213-1 in [r12181], but it cause new regressions. For example, z80n:ast_constant_folding, genPlus generates code for bc = hl + fix:

    ;ic:3:  iTemp1 [k4 lr4:5 so:0]{ ia0 a2p0 re0 rm0 nos0 ru0 dp0}{volatile-unsigned-int fixed}[c b ] = iTemp0 [k3 lr3:4 so:0]{ ia
    0 a2p0 re0 rm0 nos0 ru0 dp0}{unsigned-int fixed}[l h ] + _i [k2 lr0:0 so:0]{ ia0 a2p0 re0 rm0 nos0 ru0 dp0}{volatile-unsigned-
    int fixed}
    ;       genPlus
            ld      a, l ;WTF?!?
    ;       Shift into pair hl
    ;fetchLitPair
            ld      hl, #_i
            add     a, (hl)
            ld      c, a
            ld      a, h
            inc     hl
            adc     a, (hl)
            ld      b, a
    
     
  • Philipp Klaus Krause

    • status: open --> closed-works-for-me
    • assigned_to: Philipp Klaus Krause
    • Category: other --> Z80
     
  • Philipp Klaus Krause

    As of [r12258], I do not see any remaining code generation issues when using --max-allocs-per-node 10.
    There is one bug triggered for r3ka when using --max-allocs-per-node 10, but it looks like a peephole issue to me, so I'll open a new bug report.

     

Log in to post a comment.

Auth0 Logo