Re: Bad linearized output in RC5

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 14 August 2017 at 08:28, Dibyendu Majumdar <mobile@xxxxxxxxxxxxxxx> wrote:
> Hi,
>
> There appears to be a problem handling following:
>
> typedef struct lua_TValue {
>         double value;
>         int tt;
> } TValue;
> typedef TValue *StkId;
> struct lua_State {
>         StkId top;
>         StkId base;
> };
> static void lua_settop(struct lua_State *L, int idx)
> {
>         if (idx >= 0) {
>                 { (void)L; };
>                 while (L->top < L->base + idx)
>                         ((L->top++)->tt = 0);
>                 L->top = L->base + idx;
>         } else {
>                 { (void)L; };
>                 L->top += idx + 1;
>         }
> }
>
> This generates:
>
> lua_settop:
> .L0:
>         <entry-point>
>         setge.32    %r2 <- %arg2, $0
>         cbr         %r2, .L6, .L2
>
> .L6:
>         load.64     %r5 <- 0[VOID]
>         load.64     %r7 <- 8[VOID]
>         scast.64    %r9 <- (32) %arg2
>         muls.64     %r10 <- %r9, $16
>         add.64      %r11 <- %r7, %r10
>         setb.32     %r12 <- %r5, %r11
>         cbr         %r12, .L3, .L5
>
> .L3:
>         add.64      %r15 <- %r5, $16
>         store.64    %r15 -> 0[VOID]
>         store.32    $0 -> 8[%r5]
>         br          .L6
>
> .L5:
>         store.64    %r11 -> 0[VOID]
>         br          .L7
>
> .L2:
>         add.32      %r25 <- %arg2, $1
>         scast.64    %r26 <- (32) %r25
>         muls.64     %r27 <- %r26, $16
>         load.64     %r29 <- 0[%arg1]
>         cast.64     %r30 <- (64) %r29
>         add.64      %r31 <- %r30, %r27
>         ptrcast.64  %r32 <- (64) %r31
>         store.64    %r32 -> 0[%arg1]
>         br          .L7
>
> .L7:
>         ret

Interestingly with single store shortcut enabled the output (from dmrC
this time) is:

lua_settop:
.L0:
        <entry-point>
        setge.32    %r2 <- %arg2, $0
        cbr         %r2, .L6, .L2

.L6:
        load.64*    %r5 <- 0[%arg1]
        load.64*    %r7 <- 8[%arg1]
        scast.64    %r9 <- (32) %arg2
        muls.64     %r10 <- %r9, $16
        add.64*     %r11 <- %r7, %r10
        setb.32     %r12 <- %r5, %r11
        cbr         %r12, .L3, .L5

.L3:
        add.64*     %r15 <- %r5, $16
        store.64*   %r15 -> 0[%arg1]
        store.32    $0 -> 8[%r5]
        br          .L6

.L5:
        store.64*   %r11 -> 0[%arg1]
        br          .L7

.L2:
        add.32      %r25 <- %arg2, $1
        scast.64    %r26 <- (32) %r25
        muls.64     %r27 <- %r26, $16
        load.64*    %r29 <- 0[%arg1]
        cast.64     %r30 <- (64) %r29
        add.64      %r31 <- %r30, %r27
        ptrcast.64* %r32 <- (64) %r31
        store.64*   %r32 -> 0[%arg1]
        br          .L7

.L7:
        ret


What this tells me is that potentially there is a bug in the way
single store shortcut has been removed - i.e. it is having a different
effect here.

Regards
Dibyendu
--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux