Commit c8cc6ed6 authored by Manuel Mohr's avatar Manuel Mohr
Browse files

Use correct CAS ASI on LEON.

According to Gaisler's GRIP documentation, section 77.2.7, the LEON
requires the ASI 0x0A for CAS usage in user mode.
parent aef6a579
......@@ -334,10 +334,15 @@ static void sparc_setup_cg_config(void)
switch ((sparc_cpu_t)cpu) {
case cpu_v8plus:
sparc_cg_config.use_cas = true;
sparc_cg_config.cas_asi = 0x80;
has_fpu = false;
break;
case cpu_leon:
sparc_cg_config.use_cas = true;
/* According to Gaisler's GRIP documentation, section 77.2.7,
* the LEON requires the ASI 0x0A for CAS usage in user mode.
*/
sparc_cg_config.cas_asi = 0x0A;
has_fpu = true;
break;
case cpu_hypersparc:
......
......@@ -25,8 +25,9 @@ typedef struct sparc_irg_data_t {
} sparc_irg_data_t;
typedef struct sparc_codegen_config_t {
bool use_fpu;
bool use_cas;
bool use_fpu;
bool use_cas;
unsigned cas_asi : 8;
} sparc_codegen_config_t;
extern sparc_codegen_config_t sparc_cg_config;
......
......@@ -772,8 +772,9 @@ static void emit_sparc_Cas(const ir_node *node)
= arch_get_irn_register_in(node, n_sparc_Cas_ptr);
const arch_register_t *reg_old
= arch_get_irn_register_in(node, n_sparc_Cas_old);
uint32_t cas_asi = sparc_cg_config.cas_asi;
uint32_t encoding = 3u<<30 | (reg_new->encoding<<25) | (0x3C << 19)
| (reg_ptr->encoding<<14) | (0x80<<5) | (reg_old->encoding);
| (reg_ptr->encoding<<14) | (cas_asi<<5) | (reg_old->encoding);
sparc_emitf(node, ".long 0x%X /* cas [%S0], %S1, %S2", encoding);
#endif
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment