From 033b98c34ebf7820ad14bc8b8311cc9761c0b903 Mon Sep 17 00:00:00 2001 From: Yvan Roux Date: Mon, 30 Nov 2015 13:13:39 +0100 Subject: gcc/ Backport from trunk r229875. 2015-11-06 Ramana Radhakrishnan * config/arm/arm-ldmstm.ml: Rewrite to generate unified asm templates. * config/arm/arm.c (arm_asm_trampoline_template): Make unified asm safe. (arm_output_multireg_pop): Likewise. (output_move_double): Likewise. (output_move_quad): Likewise. (output_return_instruction): Likewise. (arm_print_operand): Remove support for %( and %. print modifiers. (arm_output_shift): Make unified asm. (arm_declare_function_name): Likewise. * config/arm/arm.h (TARGET_UNIFIED_ASM): Delete. (ASM_APP_OFF): Adjust. (ASM_OUTPUT_REG_PUSH): Undo special casing for TARGET_ARM. (ASM_OUTPUT_REG_POP): Likewise. * config/arm/arm.md: Adjust uses of %., %(, %) * config/arm/sync.md: Likewise. * config/arm/thumb2.md: Likewise. * config/arm/ldmstm.md: Regenerate. * config/arm/arm.opt (masm-unified-syntax): Do not special case Thumb. * doc/invoke.texi (masm-unified-syntax): Update documentation. gcc/testsuite/ Backport from trunk r229875. 2015-11-06 Ramana Radhakrishnan * gcc.target/arm/combine-movs.c: Adjust for unified asm. * gcc.target/arm/interrupt-1.c: Likewise. * gcc.target/arm/interrupt-2.c: Likewise. * gcc.target/arm/unaligned-memcpy-4.c: Likewise. gcc/testsuite/ Backport from trunk r230223. 2015-11-12 Christian Bruel * gcc.target/arm/mmx-1.c: Adjust for unified asm. Change-Id: Ia3f67cdabaaea2e9294bf35e6b7db2159c481891 --- gcc/config/arm/arm.c | 157 ++++++++++++++++++++------------------------------- 1 file changed, 60 insertions(+), 97 deletions(-) (limited to 'gcc/config/arm/arm.c') diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c index 6c6ce4ab28b..e31c2b7bdc0 100644 --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -941,7 +941,7 @@ int arm_regs_in_sequence[] = 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }; -#define ARM_LSL_NAME (TARGET_UNIFIED_ASM ? "lsl" : "asl") +#define ARM_LSL_NAME "lsl" #define streq(string1, string2) (strcmp (string1, string2) == 0) #define THUMB2_WORK_REGS (0xff & ~( (1 << THUMB_HARD_FRAME_POINTER_REGNUM) \ @@ -3576,10 +3576,7 @@ arm_warn_func_return (tree decl) static void arm_asm_trampoline_template (FILE *f) { - if (TARGET_UNIFIED_ASM) - fprintf (f, "\t.syntax unified\n"); - else - fprintf (f, "\t.syntax divided\n"); + fprintf (f, "\t.syntax unified\n"); if (TARGET_ARM) { @@ -17644,10 +17641,8 @@ arm_output_multireg_pop (rtx *operands, bool return_pc, rtx cond, bool reverse, } conditional = reverse ? "%?%D0" : "%?%d0"; - if ((regno_base == SP_REGNUM) && TARGET_THUMB) + if ((regno_base == SP_REGNUM) && update) { - /* Output pop (not stmfd) because it has a shorter encoding. */ - gcc_assert (update); sprintf (pattern, "pop%s\t{", conditional); } else @@ -17655,11 +17650,14 @@ arm_output_multireg_pop (rtx *operands, bool return_pc, rtx cond, bool reverse, /* Output ldmfd when the base register is SP, otherwise output ldmia. It's just a convention, their semantics are identical. */ if (regno_base == SP_REGNUM) - sprintf (pattern, "ldm%sfd\t", conditional); - else if (TARGET_UNIFIED_ASM) - sprintf (pattern, "ldmia%s\t", conditional); + /* update is never true here, hence there is no need to handle + pop here. */ + sprintf (pattern, "ldmfd%s", conditional); + + if (update) + sprintf (pattern, "ldmia%s\t", conditional); else - sprintf (pattern, "ldm%sia\t", conditional); + sprintf (pattern, "ldm%s\t", conditional); strcat (pattern, reg_names[regno_base]); if (update) @@ -18003,25 +18001,25 @@ output_move_double (rtx *operands, bool emit, int *count) { if (TARGET_LDRD && !(fix_cm3_ldrd && reg0 == REGNO(XEXP (operands[1], 0)))) - output_asm_insn ("ldr%(d%)\t%0, [%m1]", operands); + output_asm_insn ("ldrd%?\t%0, [%m1]", operands); else - output_asm_insn ("ldm%(ia%)\t%m1, %M0", operands); + output_asm_insn ("ldmia%?\t%m1, %M0", operands); } break; case PRE_INC: gcc_assert (TARGET_LDRD); if (emit) - output_asm_insn ("ldr%(d%)\t%0, [%m1, #8]!", operands); + output_asm_insn ("ldrd%?\t%0, [%m1, #8]!", operands); break; case PRE_DEC: if (emit) { if (TARGET_LDRD) - output_asm_insn ("ldr%(d%)\t%0, [%m1, #-8]!", operands); + output_asm_insn ("ldrd%?\t%0, [%m1, #-8]!", operands); else - output_asm_insn ("ldm%(db%)\t%m1!, %M0", operands); + output_asm_insn ("ldmdb%?\t%m1!, %M0", operands); } break; @@ -18029,16 +18027,16 @@ output_move_double (rtx *operands, bool emit, int *count) if (emit) { if (TARGET_LDRD) - output_asm_insn ("ldr%(d%)\t%0, [%m1], #8", operands); + output_asm_insn ("ldrd%?\t%0, [%m1], #8", operands); else - output_asm_insn ("ldm%(ia%)\t%m1!, %M0", operands); + output_asm_insn ("ldmia%?\t%m1!, %M0", operands); } break; case POST_DEC: gcc_assert (TARGET_LDRD); if (emit) - output_asm_insn ("ldr%(d%)\t%0, [%m1], #-8", operands); + output_asm_insn ("ldrd%?\t%0, [%m1], #-8", operands); break; case PRE_MODIFY: @@ -18059,7 +18057,7 @@ output_move_double (rtx *operands, bool emit, int *count) if (emit) { output_asm_insn ("add%?\t%1, %1, %2", otherops); - output_asm_insn ("ldr%(d%)\t%0, [%1] @split", otherops); + output_asm_insn ("ldrd%?\t%0, [%1] @split", otherops); } if (count) *count = 2; @@ -18075,7 +18073,7 @@ output_move_double (rtx *operands, bool emit, int *count) && INTVAL (otherops[2]) < 256)) { if (emit) - output_asm_insn ("ldr%(d%)\t%0, [%1, %2]!", otherops); + output_asm_insn ("ldrd%?\t%0, [%1, %2]!", otherops); } else { @@ -18101,7 +18099,7 @@ output_move_double (rtx *operands, bool emit, int *count) && INTVAL (otherops[2]) < 256)) { if (emit) - output_asm_insn ("ldr%(d%)\t%0, [%1], %2", otherops); + output_asm_insn ("ldrd%?\t%0, [%1], %2", otherops); } else { @@ -18130,9 +18128,9 @@ output_move_double (rtx *operands, bool emit, int *count) if (emit) { if (TARGET_LDRD) - output_asm_insn ("ldr%(d%)\t%0, [%1]", operands); + output_asm_insn ("ldrd%?\t%0, [%1]", operands); else - output_asm_insn ("ldm%(ia%)\t%1, %M0", operands); + output_asm_insn ("ldmia%?\t%1, %M0", operands); } if (count) @@ -18156,19 +18154,19 @@ output_move_double (rtx *operands, bool emit, int *count) { case -8: if (emit) - output_asm_insn ("ldm%(db%)\t%1, %M0", otherops); + output_asm_insn ("ldmdb%?\t%1, %M0", otherops); return ""; case -4: if (TARGET_THUMB2) break; if (emit) - output_asm_insn ("ldm%(da%)\t%1, %M0", otherops); + output_asm_insn ("ldmda%?\t%1, %M0", otherops); return ""; case 4: if (TARGET_THUMB2) break; if (emit) - output_asm_insn ("ldm%(ib%)\t%1, %M0", otherops); + output_asm_insn ("ldmib%?\t%1, %M0", otherops); return ""; } } @@ -18196,7 +18194,7 @@ output_move_double (rtx *operands, bool emit, int *count) if (emit) { output_asm_insn ("add%?\t%0, %1, %2", otherops); - output_asm_insn ("ldr%(d%)\t%0, [%1]", operands); + output_asm_insn ("ldrd%?\t%0, [%1]", operands); } if (count) *count = 2; @@ -18205,7 +18203,7 @@ output_move_double (rtx *operands, bool emit, int *count) { otherops[0] = operands[0]; if (emit) - output_asm_insn ("ldr%(d%)\t%0, [%1, %2]", otherops); + output_asm_insn ("ldrd%?\t%0, [%1, %2]", otherops); } return ""; } @@ -18236,9 +18234,9 @@ output_move_double (rtx *operands, bool emit, int *count) *count = 2; if (TARGET_LDRD) - return "ldr%(d%)\t%0, [%1]"; + return "ldrd%?\t%0, [%1]"; - return "ldm%(ia%)\t%1, %M0"; + return "ldmia%?\t%1, %M0"; } else { @@ -18281,25 +18279,25 @@ output_move_double (rtx *operands, bool emit, int *count) if (emit) { if (TARGET_LDRD) - output_asm_insn ("str%(d%)\t%1, [%m0]", operands); + output_asm_insn ("strd%?\t%1, [%m0]", operands); else - output_asm_insn ("stm%(ia%)\t%m0, %M1", operands); + output_asm_insn ("stm%?\t%m0, %M1", operands); } break; case PRE_INC: gcc_assert (TARGET_LDRD); if (emit) - output_asm_insn ("str%(d%)\t%1, [%m0, #8]!", operands); + output_asm_insn ("strd%?\t%1, [%m0, #8]!", operands); break; case PRE_DEC: if (emit) { if (TARGET_LDRD) - output_asm_insn ("str%(d%)\t%1, [%m0, #-8]!", operands); + output_asm_insn ("strd%?\t%1, [%m0, #-8]!", operands); else - output_asm_insn ("stm%(db%)\t%m0!, %M1", operands); + output_asm_insn ("stmdb%?\t%m0!, %M1", operands); } break; @@ -18307,16 +18305,16 @@ output_move_double (rtx *operands, bool emit, int *count) if (emit) { if (TARGET_LDRD) - output_asm_insn ("str%(d%)\t%1, [%m0], #8", operands); + output_asm_insn ("strd%?\t%1, [%m0], #8", operands); else - output_asm_insn ("stm%(ia%)\t%m0!, %M1", operands); + output_asm_insn ("stm%?\t%m0!, %M1", operands); } break; case POST_DEC: gcc_assert (TARGET_LDRD); if (emit) - output_asm_insn ("str%(d%)\t%1, [%m0], #-8", operands); + output_asm_insn ("strd%?\t%1, [%m0], #-8", operands); break; case PRE_MODIFY: @@ -18356,12 +18354,12 @@ output_move_double (rtx *operands, bool emit, int *count) else if (GET_CODE (XEXP (operands[0], 0)) == PRE_MODIFY) { if (emit) - output_asm_insn ("str%(d%)\t%0, [%1, %2]!", otherops); + output_asm_insn ("strd%?\t%0, [%1, %2]!", otherops); } else { if (emit) - output_asm_insn ("str%(d%)\t%0, [%1], %2", otherops); + output_asm_insn ("strd%?\t%0, [%1], %2", otherops); } break; @@ -18373,21 +18371,21 @@ output_move_double (rtx *operands, bool emit, int *count) { case -8: if (emit) - output_asm_insn ("stm%(db%)\t%m0, %M1", operands); + output_asm_insn ("stmdb%?\t%m0, %M1", operands); return ""; case -4: if (TARGET_THUMB2) break; if (emit) - output_asm_insn ("stm%(da%)\t%m0, %M1", operands); + output_asm_insn ("stmda%?\t%m0, %M1", operands); return ""; case 4: if (TARGET_THUMB2) break; if (emit) - output_asm_insn ("stm%(ib%)\t%m0, %M1", operands); + output_asm_insn ("stmib%?\t%m0, %M1", operands); return ""; } } @@ -18401,7 +18399,7 @@ output_move_double (rtx *operands, bool emit, int *count) otherops[0] = operands[1]; otherops[1] = XEXP (XEXP (operands[0], 0), 0); if (emit) - output_asm_insn ("str%(d%)\t%0, [%1, %2]", otherops); + output_asm_insn ("strd%?\t%0, [%1, %2]", otherops); return ""; } /* Fall through */ @@ -18437,13 +18435,13 @@ output_move_quad (rtx *operands) switch (GET_CODE (XEXP (operands[1], 0))) { case REG: - output_asm_insn ("ldm%(ia%)\t%m1, %M0", operands); + output_asm_insn ("ldmia%?\t%m1, %M0", operands); break; case LABEL_REF: case CONST: output_asm_insn ("adr%?\t%0, %1", operands); - output_asm_insn ("ldm%(ia%)\t%0, %M0", operands); + output_asm_insn ("ldmia%?\t%0, %M0", operands); break; default: @@ -18487,7 +18485,7 @@ output_move_quad (rtx *operands) switch (GET_CODE (XEXP (operands[0], 0))) { case REG: - output_asm_insn ("stm%(ia%)\t%m0, %M1", operands); + output_asm_insn ("stm%?\t%m0, %M1", operands); break; default: @@ -19520,10 +19518,7 @@ output_return_instruction (rtx operand, bool really_return, bool reverse, gcc_assert (stack_adjust == 0 || stack_adjust == 4); if (stack_adjust && arm_arch5 && TARGET_ARM) - if (TARGET_UNIFIED_ASM) sprintf (instr, "ldmib%s\t%%|sp, {", conditional); - else - sprintf (instr, "ldm%sib\t%%|sp, {", conditional); else { /* If we can't use ldmib (SA110 bug), @@ -19531,17 +19526,11 @@ output_return_instruction (rtx operand, bool really_return, bool reverse, if (stack_adjust) live_regs_mask |= 1 << 3; - if (TARGET_UNIFIED_ASM) - sprintf (instr, "ldmfd%s\t%%|sp, {", conditional); - else - sprintf (instr, "ldm%sfd\t%%|sp, {", conditional); + sprintf (instr, "ldmfd%s\t%%|sp, {", conditional); } } else - if (TARGET_UNIFIED_ASM) sprintf (instr, "pop%s\t{", conditional); - else - sprintf (instr, "ldm%sfd\t%%|sp!, {", conditional); p = instr + strlen (instr); @@ -21570,37 +21559,17 @@ arm_print_operand (FILE *stream, rtx x, int code) arm_print_condition (stream); return; - case '(': - /* Nothing in unified syntax, otherwise the current condition code. */ - if (!TARGET_UNIFIED_ASM) - arm_print_condition (stream); - break; - - case ')': - /* The current condition code in unified syntax, otherwise nothing. */ - if (TARGET_UNIFIED_ASM) - arm_print_condition (stream); - break; - case '.': /* The current condition code for a condition code setting instruction. Preceded by 's' in unified syntax, otherwise followed by 's'. */ - if (TARGET_UNIFIED_ASM) - { - fputc('s', stream); - arm_print_condition (stream); - } - else - { - arm_print_condition (stream); - fputc('s', stream); - } + fputc('s', stream); + arm_print_condition (stream); return; case '!': /* If the instruction is conditionally executed then print the current condition code, otherwise print 's'. */ - gcc_assert (TARGET_THUMB2 && TARGET_UNIFIED_ASM); + gcc_assert (TARGET_THUMB2); if (current_insn_predicate) arm_print_condition (stream); else @@ -27014,20 +26983,16 @@ arm_output_shift(rtx * operands, int set_flags) char c; c = flag_chars[set_flags]; - if (TARGET_UNIFIED_ASM) + shift = shift_op(operands[3], &val); + if (shift) { - shift = shift_op(operands[3], &val); - if (shift) - { - if (val != -1) - operands[2] = GEN_INT(val); - sprintf (pattern, "%s%%%c\t%%0, %%1, %%2", shift, c); - } - else - sprintf (pattern, "mov%%%c\t%%0, %%1", c); + if (val != -1) + operands[2] = GEN_INT(val); + sprintf (pattern, "%s%%%c\t%%0, %%1, %%2", shift, c); } else - sprintf (pattern, "mov%%%c\t%%0, %%1%%S3", c); + sprintf (pattern, "mov%%%c\t%%0, %%1", c); + output_asm_insn (pattern, operands); return ""; } @@ -29725,10 +29690,8 @@ arm_valid_target_attribute_p (tree fndecl, tree ARG_UNUSED (name), void arm_declare_function_name (FILE *stream, const char *name, tree decl) { - if (TARGET_UNIFIED_ASM) - fprintf (stream, "\t.syntax unified\n"); - else - fprintf (stream, "\t.syntax divided\n"); + + fprintf (stream, "\t.syntax unified\n"); if (TARGET_THUMB) { -- cgit v1.2.1