5a, 5l: add LDREX/STREX/CLREX instructions

front
cinap_lenrek 2014-08-07 20:22:00 +02:00
parent ca4f815cfc
commit d304dc8119
6 changed files with 27 additions and 109 deletions

View File

@ -380,6 +380,7 @@ struct
"RET", LTYPEA, ARET,
"RFE", LTYPEA, ARFE,
"CLREX", LTYPEA, ACLREX,
"TEXT", LTYPEB, ATEXT,
"GLOBL", LTYPEB, AGLOBL,

View File

@ -156,6 +156,8 @@ enum as
ALDREXD,
ASTREXD,
ACLREX,
ALAST,
};

View File

@ -1,104 +0,0 @@
char* anames[] =
{
"XXX",
"AND",
"EOR",
"SUB",
"RSB",
"ADD",
"ADC",
"SBC",
"RSC",
"TST",
"TEQ",
"CMP",
"CMN",
"ORR",
"BIC",
"MVN",
"B",
"BL",
"BEQ",
"BNE",
"BCS",
"BHS",
"BCC",
"BLO",
"BMI",
"BPL",
"BVS",
"BVC",
"BHI",
"BLS",
"BGE",
"BLT",
"BGT",
"BLE",
"MOVWD",
"MOVWF",
"MOVDW",
"MOVFW",
"MOVFD",
"MOVDF",
"MOVF",
"MOVD",
"CMPF",
"CMPD",
"ADDF",
"ADDD",
"SUBF",
"SUBD",
"MULF",
"MULD",
"DIVF",
"DIVD",
"SRL",
"SRA",
"SLL",
"MULU",
"DIVU",
"MUL",
"DIV",
"MOD",
"MODU",
"MOVB",
"MOVBU",
"MOVH",
"MOVHU",
"MOVW",
"MOVM",
"SWPBU",
"SWPW",
"NOP",
"RFE",
"SWI",
"MULA",
"DATA",
"GLOBL",
"GOK",
"HISTORY",
"NAME",
"RET",
"TEXT",
"WORD",
"DYNT",
"INIT",
"BCASE",
"CASE",
"END",
"MULL",
"MULAL",
"MULLU",
"MULALU",
"BX",
"BXRET",
"DWORD",
"SIGNAME",
"SQRTF",
"SQRTD",
"LDREX",
"STREX",
"LDREXD",
"STREXD",
"LAST",
};

View File

@ -1094,12 +1094,19 @@ PP = p;
break;
case 40: /* swp oreg,reg,reg */
aclass(&p->from);
if(instoffset != 0)
diag("offset must be zero in SWP");
if(p->as != ASTREX){
aclass(&p->from);
if(instoffset != 0)
diag("offset must be zero in SWP");
}
o1 = (0x2<<23) | (0x9<<4);
if(p->as != ASWPW)
o1 |= 1 << 22;
if(p->as == ASWPBU)
o1 |= (1 << 22);
else if(p->as == ALDREX || p->as == ASTREX){
o1 |= (1 << 23) | 0xf00;
if(p->as == ALDREX)
o1 |= (1 << 20) | 0xf;
}
o1 |= p->from.reg << 16;
o1 |= p->reg << 0;
o1 |= p->to.reg << 12;
@ -1110,6 +1117,10 @@ PP = p;
o1 = 0xe8fd8000;
break;
case 42: /* clrex */
o1 = 0xf57ff01f;
break;
case 50: /* floating point store */
v = regoff(&p->to);
r = p->to.reg;

View File

@ -161,8 +161,11 @@ Optab optab[] =
{ AMOVM, C_SOREG,C_NONE, C_LCON, 39, 4, 0 },
{ ASWPW, C_SOREG,C_REG, C_REG, 40, 4, 0 },
{ ALDREX, C_SOREG,C_NONE, C_REG, 40, 4, 0 },
{ ASTREX, C_SOREG,C_REG, C_REG, 40, 4, 0 },
{ ARFE, C_NONE, C_NONE, C_NONE, 41, 4, 0 },
{ ACLREX, C_NONE, C_NONE, C_NONE, 42, 4, 0 },
{ AMOVF, C_FREG, C_NONE, C_FEXT, 50, 4, REGSB },
{ AMOVF, C_FREG, C_NONE, C_FAUTO, 50, 4, REGSP },

View File

@ -743,7 +743,11 @@ buildop(void)
break;
case ASWPW:
oprange[ASWPBU] = oprange[r];
oprange[ALDREX] = oprange[r];
oprange[ASTREX] = oprange[r];
break;
case ALDREX:
case ASTREX:
case AB:
case ABL:
case ABX:
@ -752,6 +756,7 @@ buildop(void)
case AWORD:
case AMOVM:
case ARFE:
case ACLREX:
case ATEXT:
case ACASE:
case ABCASE: