Commit 5e291fe1 authored by Richard Henderson's avatar Richard Henderson Committed by Peter Maydell
Browse files

target/arm: Convert load/store (register, immediate, literal)



Reviewed-by: default avatarPeter Maydell <peter.maydell@linaro.org>
Signed-off-by: default avatarRichard Henderson <richard.henderson@linaro.org>
Message-id: 20190904193059.26202-21-richard.henderson@linaro.org
Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
parent 145952e8
Loading
Loading
Loading
Loading
+120 −0
Original line number Diff line number Diff line
@@ -37,6 +37,8 @@
&mrs_reg         rd r
&msr_bank        rn r sysm
&mrs_bank        rd r sysm
&ldst_rr         p w u rn rt rm shimm shtype
&ldst_ri         p w u rn rt imm

# Data-processing (register)

@@ -222,3 +224,121 @@ HLT .... 0001 0000 .... .... .... 0111 .... @i16
BKPT             .... 0001 0010 .... .... .... 0111 ....      @i16
HVC              .... 0001 0100 .... .... .... 0111 ....      @i16
SMC              ---- 0001 0110 0000 0000 0000 0111 imm:4     &i

# Load/Store Dual, Half, Signed Byte (register)

@ldst_rr_p1w     ---- ...1 u:1 . w:1 . rn:4 rt:4 .... .... rm:4 \
                 &ldst_rr p=1 shimm=0 shtype=0
@ldst_rr_pw0     ---- ...0 u:1 . 0   . rn:4 rt:4 .... .... rm:4 \
                 &ldst_rr p=0 w=0 shimm=0 shtype=0

STRH_rr          .... 000. .0.0 .... .... 0000 1011 ....      @ldst_rr_pw0
STRH_rr          .... 000. .0.0 .... .... 0000 1011 ....      @ldst_rr_p1w

LDRD_rr          .... 000. .0.0 .... .... 0000 1101 ....      @ldst_rr_pw0
LDRD_rr          .... 000. .0.0 .... .... 0000 1101 ....      @ldst_rr_p1w

STRD_rr          .... 000. .0.0 .... .... 0000 1111 ....      @ldst_rr_pw0
STRD_rr          .... 000. .0.0 .... .... 0000 1111 ....      @ldst_rr_p1w

LDRH_rr          .... 000. .0.1 .... .... 0000 1011 ....      @ldst_rr_pw0
LDRH_rr          .... 000. .0.1 .... .... 0000 1011 ....      @ldst_rr_p1w

LDRSB_rr         .... 000. .0.1 .... .... 0000 1101 ....      @ldst_rr_pw0
LDRSB_rr         .... 000. .0.1 .... .... 0000 1101 ....      @ldst_rr_p1w

LDRSH_rr         .... 000. .0.1 .... .... 0000 1111 ....      @ldst_rr_pw0
LDRSH_rr         .... 000. .0.1 .... .... 0000 1111 ....      @ldst_rr_p1w

# Note the unpriv load/stores use the previously invalid P=0, W=1 encoding,
# and act as normal post-indexed (P=0, W=0).
@ldst_rr_p0w1    ---- ...0 u:1 . 1   . rn:4 rt:4 .... .... rm:4 \
                 &ldst_rr p=0 w=0 shimm=0 shtype=0

STRHT_rr         .... 000. .0.0 .... .... 0000 1011 ....      @ldst_rr_p0w1
LDRHT_rr         .... 000. .0.1 .... .... 0000 1011 ....      @ldst_rr_p0w1
LDRSBT_rr        .... 000. .0.1 .... .... 0000 1101 ....      @ldst_rr_p0w1
LDRSHT_rr        .... 000. .0.1 .... .... 0000 1111 ....      @ldst_rr_p0w1

# Load/Store word and unsigned byte (register)

@ldst_rs_p1w     ---- ...1 u:1 . w:1 . rn:4 rt:4 shimm:5 shtype:2 . rm:4 \
                 &ldst_rr p=1
@ldst_rs_pw0     ---- ...0 u:1 . 0   . rn:4 rt:4 shimm:5 shtype:2 . rm:4 \
                 &ldst_rr p=0 w=0

STR_rr           .... 011. .0.0 .... .... .... ...0 ....      @ldst_rs_pw0
STR_rr           .... 011. .0.0 .... .... .... ...0 ....      @ldst_rs_p1w
STRB_rr          .... 011. .1.0 .... .... .... ...0 ....      @ldst_rs_pw0
STRB_rr          .... 011. .1.0 .... .... .... ...0 ....      @ldst_rs_p1w

LDR_rr           .... 011. .0.1 .... .... .... ...0 ....      @ldst_rs_pw0
LDR_rr           .... 011. .0.1 .... .... .... ...0 ....      @ldst_rs_p1w
LDRB_rr          .... 011. .1.1 .... .... .... ...0 ....      @ldst_rs_pw0
LDRB_rr          .... 011. .1.1 .... .... .... ...0 ....      @ldst_rs_p1w

@ldst_rs_p0w1    ---- ...0 u:1 . 1   . rn:4 rt:4 shimm:5 shtype:2 . rm:4 \
                 &ldst_rr p=0 w=0

STRT_rr          .... 011. .0.0 .... .... .... ...0 ....      @ldst_rs_p0w1
STRBT_rr         .... 011. .1.0 .... .... .... ...0 ....      @ldst_rs_p0w1
LDRT_rr          .... 011. .0.1 .... .... .... ...0 ....      @ldst_rs_p0w1
LDRBT_rr         .... 011. .1.1 .... .... .... ...0 ....      @ldst_rs_p0w1

# Load/Store Dual, Half, Signed Byte (immediate)

%imm8s_8_0       8:4 0:4
@ldst_ri8_p1w    ---- ...1 u:1 . w:1 . rn:4 rt:4 .... .... .... \
                 &ldst_ri imm=%imm8s_8_0 p=1
@ldst_ri8_pw0    ---- ...0 u:1 . 0   . rn:4 rt:4 .... .... .... \
                 &ldst_ri imm=%imm8s_8_0 p=0 w=0

STRH_ri          .... 000. .1.0 .... .... .... 1011 ....      @ldst_ri8_pw0
STRH_ri          .... 000. .1.0 .... .... .... 1011 ....      @ldst_ri8_p1w

LDRD_ri_a32      .... 000. .1.0 .... .... .... 1101 ....      @ldst_ri8_pw0
LDRD_ri_a32      .... 000. .1.0 .... .... .... 1101 ....      @ldst_ri8_p1w

STRD_ri_a32      .... 000. .1.0 .... .... .... 1111 ....      @ldst_ri8_pw0
STRD_ri_a32      .... 000. .1.0 .... .... .... 1111 ....      @ldst_ri8_p1w

LDRH_ri          .... 000. .1.1 .... .... .... 1011 ....      @ldst_ri8_pw0
LDRH_ri          .... 000. .1.1 .... .... .... 1011 ....      @ldst_ri8_p1w

LDRSB_ri         .... 000. .1.1 .... .... .... 1101 ....      @ldst_ri8_pw0
LDRSB_ri         .... 000. .1.1 .... .... .... 1101 ....      @ldst_ri8_p1w

LDRSH_ri         .... 000. .1.1 .... .... .... 1111 ....      @ldst_ri8_pw0
LDRSH_ri         .... 000. .1.1 .... .... .... 1111 ....      @ldst_ri8_p1w

# Note the unpriv load/stores use the previously invalid P=0, W=1 encoding,
# and act as normal post-indexed (P=0, W=0).
@ldst_ri8_p0w1   ---- ...0 u:1 . 1   . rn:4 rt:4 .... .... .... \
                 &ldst_ri imm=%imm8s_8_0 p=0 w=0

STRHT_ri         .... 000. .1.0 .... .... .... 1011 ....      @ldst_ri8_p0w1
LDRHT_ri         .... 000. .1.1 .... .... .... 1011 ....      @ldst_ri8_p0w1
LDRSBT_ri        .... 000. .1.1 .... .... .... 1101 ....      @ldst_ri8_p0w1
LDRSHT_ri        .... 000. .1.1 .... .... .... 1111 ....      @ldst_ri8_p0w1

# Load/Store word and unsigned byte (immediate)

@ldst_ri12_p1w   ---- ...1 u:1 . w:1 . rn:4 rt:4 imm:12       &ldst_ri p=1
@ldst_ri12_pw0   ---- ...0 u:1 . 0   . rn:4 rt:4 imm:12       &ldst_ri p=0 w=0

STR_ri           .... 010. .0.0 .... .... ............        @ldst_ri12_p1w
STR_ri           .... 010. .0.0 .... .... ............        @ldst_ri12_pw0
STRB_ri          .... 010. .1.0 .... .... ............        @ldst_ri12_p1w
STRB_ri          .... 010. .1.0 .... .... ............        @ldst_ri12_pw0

LDR_ri           .... 010. .0.1 .... .... ............        @ldst_ri12_p1w
LDR_ri           .... 010. .0.1 .... .... ............        @ldst_ri12_pw0
LDRB_ri          .... 010. .1.1 .... .... ............        @ldst_ri12_p1w
LDRB_ri          .... 010. .1.1 .... .... ............        @ldst_ri12_pw0

@ldst_ri12_p0w1  ---- ...0 u:1 . 1 . rn:4 rt:4 imm:12         &ldst_ri p=0 w=0

STRT_ri          .... 010. .0.0 .... .... ............        @ldst_ri12_p0w1
STRBT_ri         .... 010. .1.0 .... .... ............        @ldst_ri12_p0w1
LDRT_ri          .... 010. .0.1 .... .... ............        @ldst_ri12_p0w1
LDRBT_ri         .... 010. .1.1 .... .... ............        @ldst_ri12_p0w1
+141 −0
Original line number Diff line number Diff line
@@ -34,6 +34,8 @@
&mrs_reg         !extern rd r
&msr_bank        !extern rn r sysm
&mrs_bank        !extern rd r sysm
&ldst_rr         !extern p w u rn rt rm shimm shtype
&ldst_ri         !extern p w u rn rt imm

# Data-processing (register)

@@ -251,3 +253,142 @@ CLZ 1111 1010 1011 ---- 1111 .... 1000 .... @rdm
  HVC            1111 0111 1110 ....  1000 .... .... ....     \
                 &i imm=%imm16_16_0
}

# Load/store (register, immediate, literal)

@ldst_rr         .... .... .... rn:4 rt:4 ...... shimm:2 rm:4 \
                 &ldst_rr p=1 w=0 u=1 shtype=0
@ldst_ri_idx     .... .... .... rn:4 rt:4 . p:1 u:1 . imm:8 \
                 &ldst_ri w=1
@ldst_ri_neg     .... .... .... rn:4 rt:4 .... imm:8 \
                 &ldst_ri p=1 w=0 u=0
@ldst_ri_unp     .... .... .... rn:4 rt:4 .... imm:8 \
                 &ldst_ri p=1 w=0 u=1
@ldst_ri_pos     .... .... .... rn:4 rt:4 imm:12 \
                 &ldst_ri p=1 w=0 u=1
@ldst_ri_lit     .... .... u:1 ... .... rt:4 imm:12 \
                 &ldst_ri p=1 w=0 rn=15

STRB_rr          1111 1000 0000 .... .... 000000 .. ....      @ldst_rr
STRB_ri          1111 1000 0000 .... .... 1..1 ........       @ldst_ri_idx
STRB_ri          1111 1000 0000 .... .... 1100 ........       @ldst_ri_neg
STRBT_ri         1111 1000 0000 .... .... 1110 ........       @ldst_ri_unp
STRB_ri          1111 1000 1000 .... .... ............        @ldst_ri_pos

STRH_rr          1111 1000 0010 .... .... 000000 .. ....      @ldst_rr
STRH_ri          1111 1000 0010 .... .... 1..1 ........       @ldst_ri_idx
STRH_ri          1111 1000 0010 .... .... 1100 ........       @ldst_ri_neg
STRHT_ri         1111 1000 0010 .... .... 1110 ........       @ldst_ri_unp
STRH_ri          1111 1000 1010 .... .... ............        @ldst_ri_pos

STR_rr           1111 1000 0100 .... .... 000000 .. ....      @ldst_rr
STR_ri           1111 1000 0100 .... .... 1..1 ........       @ldst_ri_idx
STR_ri           1111 1000 0100 .... .... 1100 ........       @ldst_ri_neg
STRT_ri          1111 1000 0100 .... .... 1110 ........       @ldst_ri_unp
STR_ri           1111 1000 1100 .... .... ............        @ldst_ri_pos

# Note that Load, unsigned (literal) overlaps all other load encodings.
{
  {
    NOP          1111 1000 -001 1111 1111 ------------        # PLD
    LDRB_ri      1111 1000 .001 1111 .... ............        @ldst_ri_lit
  }
  {
    NOP          1111 1000 1001 ---- 1111 ------------        # PLD
    LDRB_ri      1111 1000 1001 .... .... ............        @ldst_ri_pos
  }
  LDRB_ri        1111 1000 0001 .... .... 1..1 ........       @ldst_ri_idx
  {
    NOP          1111 1000 0001 ---- 1111 1100 --------       # PLD
    LDRB_ri      1111 1000 0001 .... .... 1100 ........       @ldst_ri_neg
  }
  LDRBT_ri       1111 1000 0001 .... .... 1110 ........       @ldst_ri_unp
  {
    NOP          1111 1000 0001 ---- 1111 000000 -- ----      # PLD
    LDRB_rr      1111 1000 0001 .... .... 000000 .. ....      @ldst_rr
  }
}
{
  {
    NOP          1111 1000 -011 1111 1111 ------------        # PLD
    LDRH_ri      1111 1000 .011 1111 .... ............        @ldst_ri_lit
  }
  {
    NOP          1111 1000 1011 ---- 1111 ------------        # PLDW
    LDRH_ri      1111 1000 1011 .... .... ............        @ldst_ri_pos
  }
  LDRH_ri        1111 1000 0011 .... .... 1..1 ........       @ldst_ri_idx
  {
    NOP          1111 1000 0011 ---- 1111 1100 --------       # PLDW
    LDRH_ri      1111 1000 0011 .... .... 1100 ........       @ldst_ri_neg
  }
  LDRHT_ri       1111 1000 0011 .... .... 1110 ........       @ldst_ri_unp
  {
    NOP          1111 1000 0011 ---- 1111 000000 -- ----      # PLDW
    LDRH_rr      1111 1000 0011 .... .... 000000 .. ....      @ldst_rr
  }
}
{
  LDR_ri         1111 1000 .101 1111 .... ............        @ldst_ri_lit
  LDR_ri         1111 1000 1101 .... .... ............        @ldst_ri_pos
  LDR_ri         1111 1000 0101 .... .... 1..1 ........       @ldst_ri_idx
  LDR_ri         1111 1000 0101 .... .... 1100 ........       @ldst_ri_neg
  LDRT_ri        1111 1000 0101 .... .... 1110 ........       @ldst_ri_unp
  LDR_rr         1111 1000 0101 .... .... 000000 .. ....      @ldst_rr
}
# NOPs here are PLI.
{
  {
    NOP          1111 1001 -001 1111 1111 ------------
    LDRSB_ri     1111 1001 .001 1111 .... ............        @ldst_ri_lit
  }
  {
    NOP          1111 1001 1001 ---- 1111 ------------
    LDRSB_ri     1111 1001 1001 .... .... ............        @ldst_ri_pos
  }
  LDRSB_ri       1111 1001 0001 .... .... 1..1 ........       @ldst_ri_idx
  {
    NOP          1111 1001 0001 ---- 1111 1100 --------
    LDRSB_ri     1111 1001 0001 .... .... 1100 ........       @ldst_ri_neg
  }
  LDRSBT_ri      1111 1001 0001 .... .... 1110 ........       @ldst_ri_unp
  {
    NOP          1111 1001 0001 ---- 1111 000000 -- ----
    LDRSB_rr     1111 1001 0001 .... .... 000000 .. ....      @ldst_rr
  }
}
# NOPs here are unallocated memory hints, treated as NOP.
{
  {
    NOP          1111 1001 -011 1111 1111 ------------
    LDRSH_ri     1111 1001 .011 1111 .... ............        @ldst_ri_lit
  }
  {
    NOP          1111 1001 1011 ---- 1111 ------------
    LDRSH_ri     1111 1001 1011 .... .... ............        @ldst_ri_pos
  }
  LDRSH_ri       1111 1001 0011 .... .... 1..1 ........       @ldst_ri_idx
  {
    NOP          1111 1001 0011 ---- 1111 1100 --------
    LDRSH_ri     1111 1001 0011 .... .... 1100 ........       @ldst_ri_neg
  }
  LDRSHT_ri      1111 1001 0011 .... .... 1110 ........       @ldst_ri_unp
  {
    NOP          1111 1001 0011 ---- 1111 000000 -- ----
    LDRSH_rr     1111 1001 0011 .... .... 000000 .. ....      @ldst_rr
  }
}

%imm8x4          0:8 !function=times_4
&ldst_ri2        p w u rn rt rt2 imm
@ldstd_ri8       .... .... u:1 ... rn:4 rt:4 rt2:4 ........   \
                 &ldst_ri2 imm=%imm8x4

STRD_ri_t32      1110 1000 .110 .... .... .... ........    @ldstd_ri8 w=1 p=0
LDRD_ri_t32      1110 1000 .111 .... .... .... ........    @ldstd_ri8 w=1 p=0

STRD_ri_t32      1110 1001 .100 .... .... .... ........    @ldstd_ri8 w=0 p=1
LDRD_ri_t32      1110 1001 .101 .... .... .... ........    @ldstd_ri8 w=0 p=1

STRD_ri_t32      1110 1001 .110 .... .... .... ........    @ldstd_ri8 w=1 p=1
LDRD_ri_t32      1110 1001 .111 .... .... .... ........    @ldstd_ri8 w=1 p=1
+362 −443

File changed.

Preview size limit exceeded, changes collapsed.