"Fossies" - the Fresh Open Source Software Archive

Member "go/src/cmd/asm/internal/asm/testdata/386.s" (9 Sep 2020, 2068 Bytes) of package /windows/misc/go1.14.9.windows-386.zip:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) PowerPC Assembler source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 // This input was created by taking the instruction productions in
    2 // the old assembler's (8a's) grammar and hand-writing complete
    3 // instructions for each rule, to guarantee we cover the same space.
    4 
    5 #include "../../../../../runtime/textflag.h"
    6 
    7 TEXT foo(SB), DUPOK|NOSPLIT, $0
    8 
    9 // LTYPE1 nonrem    { outcode(int($1), &$2); }
   10     SETCC   AX
   11     SETCC   foo+4(SB)
   12 
   13 // LTYPE2 rimnon    { outcode(int($1), &$2); }
   14     DIVB    AX
   15     DIVB    foo+4(SB)
   16     PUSHL   $foo+4(SB)
   17     POPL        AX
   18 
   19 // LTYPE3 rimrem    { outcode(int($1), &$2); }
   20     SUBB    $1, AX
   21     SUBB    $1, foo+4(SB)
   22     SUBB    BX, AX
   23     SUBB    BX, foo+4(SB)
   24 
   25 // LTYPE4 remrim    { outcode(int($1), &$2); }
   26     CMPB    AX, $1
   27     CMPB    foo+4(SB), $4
   28     CMPB    BX, AX
   29     CMPB    foo+4(SB), BX
   30 
   31 // LTYPER nonrel    { outcode(int($1), &$2); }
   32 label:
   33     JC  label // JCS
   34     JC  -1(PC) // JCS -1(PC)
   35 
   36 // LTYPEC spec3 { outcode(int($1), &$2); }
   37     CALL    AX
   38     JCS 2(PC)
   39     JMP *AX // JMP AX
   40     CALL    *foo(SB)
   41     JCS 2(PC)
   42     JMP $4
   43     JCS 2(PC)
   44     JMP label // JMP 16
   45     CALL    foo(SB)
   46 //  CALL    (AX*4) // TODO: This line is silently dropped on the floor!
   47     CALL    foo+4(SB)(AX*4)
   48     CALL    *4(SP) // CALL 4(SP)
   49     CALL    *(AX) // CALL (AX)
   50     CALL    *(SP) // CALL (SP)
   51 //  CALL    *(AX*4) // TODO: This line is silently dropped on the floor!
   52     CALL    *(AX)(AX*4) // CALL (AX)(AX*4)
   53     CALL    4(SP)
   54     CALL    (AX)
   55     CALL    (SP)
   56 //  CALL    (AX*4) // TODO: This line is silently dropped on the floor!
   57     JCS 2(PC)
   58     JMP (AX)(AX*4)
   59 
   60 // LTYPEN spec4 { outcode(int($1), &$2); }
   61     NOP
   62     NOP AX
   63     NOP foo+4(SB)
   64 
   65 // LTYPES spec5 { outcode(int($1), &$2); }
   66     SHLL    $4, BX
   67     SHLL    $4, foo+4(SB)
   68     SHLL    $4, foo+4(SB):AX // SHLL $4, AX, foo+4(SB)
   69 
   70 // LTYPEM spec6 { outcode(int($1), &$2); }
   71     MOVL    AX, BX
   72     MOVL    $4, BX
   73 
   74 // LTYPEI spec7 { outcode(int($1), &$2); }
   75     IMULL   AX
   76     IMULL   $4, CX
   77     IMULL   AX, BX
   78 
   79 // LTYPEXC spec9    { outcode(int($1), &$2); }
   80     CMPPD   X0, X1, 4
   81     CMPPD   foo+4(SB), X1, 4
   82 
   83 // LTYPEX spec10    { outcode(int($1), &$2); }
   84     PINSRD  $1, (AX), X0
   85     PINSRD  $2, foo+4(FP), X0
   86 
   87 // Was bug: LOOP is a branch instruction.
   88     JCS 2(PC)
   89 loop:
   90     LOOP    loop // LOOP
   91 
   92 // Tests for TLS reference.
   93     MOVL    (TLS), AX
   94     MOVL    8(TLS), DX
   95 
   96 // LTYPE0 nonnon    { outcode(int($1), &$2); }
   97     RET
   98     RET foo(SB)