/* Table of relaxations for Xtensa assembly.
- Copyright (C) 2003-2017 Free Software Foundation, Inc.
+ Copyright (C) 2003-2020 Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
when the first and second operands are not the same as specified
by the "| %at!=%as" precondition clause.
{"l32i %at,%as,%imm | %at!=%as",
- "LITERAL %imm; l32r %at,%LITERAL; add %at,%at,%as; l32i %at,%at,0"}
-
- There is special case for loop instructions here, but because we do
- not currently have the ability to represent the difference of two
- symbols, the conversion requires special code in the assembler to
- write the operands of the addi/addmi pair representing the
- difference of the old and new loop end label. */
+ "LITERAL %imm; l32r %at,%LITERAL; add %at,%at,%as; l32i %at,%at,0"} */
#include "as.h"
#include "xtensa-isa.h"
{"l32i %at,%as,%imm | %at!=%as ? IsaUseConst16",
"const16 %at,HI16U(%imm); const16 %at,LOW16U(%imm); add %at,%at,%as; l32i %at,%at,0"},
- /* This is only PART of the loop instruction. In addition,
- hardcoded into its use is a modification of the final operand in
- the instruction in bytes 9 and 12. */
- {"loop %as,%label | %as!=1 ? IsaUseLoops",
+ /* Widening loops with literals. */
+ {"loop %as,%label | %as!=1 ? IsaUseLoops ? IsaUseL32R",
"loop %as,%LABEL;"
"rsr.lend %as;" /* LEND */
"wsr.lbeg %as;" /* LBEG */
- "addi %as, %as, 0;" /* lo8(%label-%LABEL1) */
- "addmi %as, %as, 0;" /* mid8(%label-%LABEL1) */
+ "LITERAL %label;"
+ "l32r %as, %LITERAL;"
+ "nop;"
"wsr.lend %as;"
"isync;"
"rsr.lcount %as;" /* LCOUNT */
- "addi %as, %as, 1;" /* density -> addi.n %as, %as, 1 */
+ "addi %as, %as, 1;"
"LABEL"},
- {"loopgtz %as,%label | %as!=1 ? IsaUseLoops",
+ {"loopgtz %as,%label | %as!=1 ? IsaUseLoops ? IsaUseL32R",
"beqz %as,%label;"
"bltz %as,%label;"
"loopgtz %as,%LABEL;"
"rsr.lend %as;" /* LEND */
"wsr.lbeg %as;" /* LBEG */
- "addi %as, %as, 0;" /* lo8(%label-%LABEL1) */
- "addmi %as, %as, 0;" /* mid8(%label-%LABEL1) */
+ "LITERAL %label;"
+ "l32r %as, %LITERAL;"
+ "nop;"
"wsr.lend %as;"
"isync;"
"rsr.lcount %as;" /* LCOUNT */
- "addi %as, %as, 1;" /* density -> addi.n %as, %as, 1 */
+ "addi %as, %as, 1;"
"LABEL"},
- {"loopnez %as,%label | %as!=1 ? IsaUseLoops",
+ {"loopnez %as,%label | %as!=1 ? IsaUseLoops ? IsaUseL32R",
"beqz %as,%label;"
"loopnez %as,%LABEL;"
"rsr.lend %as;" /* LEND */
"wsr.lbeg %as;" /* LBEG */
- "addi %as, %as, 0;" /* lo8(%label-%LABEL1) */
- "addmi %as, %as, 0;" /* mid8(%label-%LABEL1) */
+ "LITERAL %label;"
+ "l32r %as, %LITERAL;"
+ "nop;"
"wsr.lend %as;"
"isync;"
"rsr.lcount %as;" /* LCOUNT */
- "addi %as, %as, 1;" /* density -> addi.n %as, %as, 1 */
+ "addi %as, %as, 1;"
+ "LABEL"},
+
+ /* Widening loops with const16. */
+ {"loop %as,%label | %as!=1 ? IsaUseLoops ? IsaUseConst16",
+ "loop %as,%LABEL;"
+ "rsr.lend %as;" /* LEND */
+ "wsr.lbeg %as;" /* LBEG */
+ "const16 %as,HI16U(%label);"
+ "const16 %as,LOW16U(%label);"
+ "wsr.lend %as;"
+ "isync;"
+ "rsr.lcount %as;" /* LCOUNT */
+ "addi %as, %as, 1;"
+ "LABEL"},
+ {"loopgtz %as,%label | %as!=1 ? IsaUseLoops ? IsaUseConst16",
+ "beqz %as,%label;"
+ "bltz %as,%label;"
+ "loopgtz %as,%LABEL;"
+ "rsr.lend %as;" /* LEND */
+ "wsr.lbeg %as;" /* LBEG */
+ "const16 %as,HI16U(%label);"
+ "const16 %as,LOW16U(%label);"
+ "wsr.lend %as;"
+ "isync;"
+ "rsr.lcount %as;" /* LCOUNT */
+ "addi %as, %as, 1;"
+ "LABEL"},
+ {"loopnez %as,%label | %as!=1 ? IsaUseLoops ? IsaUseConst16",
+ "beqz %as,%label;"
+ "loopnez %as,%LABEL;"
+ "rsr.lend %as;" /* LEND */
+ "wsr.lbeg %as;" /* LBEG */
+ "const16 %as,HI16U(%label);"
+ "const16 %as,LOW16U(%label);"
+ "wsr.lend %as;"
+ "isync;"
+ "rsr.lcount %as;" /* LCOUNT */
+ "addi %as, %as, 1;"
"LABEL"},
/* Relaxing to wide branches. Order is important here. With wide
op2 = get_opmatch (&initial_insn->t.operand_map, precond->opname2);
if (op2 == NULL)
as_fatal (_("opcode '%s': no bound opname '%s' "
- "for precondition in %s"),
+ "for precondition in '%s'"),
xtensa_opcode_name (isa, opcode),
precond->opname2, from_string);
}
/* Check for the right number of ops. */
if (xtensa_opcode_num_operands (isa, bi->opcode)
!= (int) operand_count)
- as_fatal (_("opcode '%s': replacement does not have %d ops"),
+ as_fatal (ngettext ("opcode '%s': replacement does not have %d op",
+ "opcode '%s': replacement does not have %d ops",
+ xtensa_opcode_num_operands (isa, bi->opcode)),
opcode_name,
xtensa_opcode_num_operands (isa, bi->opcode));
}
orig_op = get_opmatch (&initial_insn->t.operand_map,
op->operand_name);
if (orig_op == NULL)
- as_fatal (_("opcode %s: unidentified operand '%s' in '%s'"),
+ as_fatal (_("opcode '%s': unidentified operand '%s' in '%s'"),
opcode_name, op->operand_name, to_string);
append_field_op (bi, op->operand_num, orig_op->operand_num);
}
orig_op = get_opmatch (&initial_insn->t.operand_map,
operand_arg_name);
if (orig_op == NULL)
- as_fatal (_("opcode %s: unidentified operand '%s' in '%s'"),
+ as_fatal (_("opcode '%s': unidentified operand '%s' in '%s'"),
opcode_name, op->operand_name, to_string);
append_user_fn_field_op (bi, op->operand_num,
typ, orig_op->operand_num);
}
else
- as_fatal (_("opcode %s: could not parse operand '%s' in '%s'"),
+ as_fatal (_("opcode '%s': could not parse operand '%s' in '%s'"),
opcode_name, op->operand_name, to_string);
}
}