From 91ae8fbc5aa02bd889492d3c04a7fcb95026a77e Mon Sep 17 00:00:00 2001 From: "Maciej W. Rozycki" Date: Sat, 5 Dec 2020 18:26:24 +0000 Subject: [PATCH] VAX: Remove `c' operand format specifier overload The `c' operand format specifier is handled directly by the middle end in `output_asm_insn': %cN means require operand N to be a constant and print the constant expression with no punctuation. however it resorts to the target for constants that are not valid addresses: else if (letter == 'c') { if (CONSTANT_ADDRESS_P (operands[opnum])) output_addr_const (asm_out_file, operands[opnum]); else output_operand (operands[opnum], 'c'); } The VAX backend expects the fallback never to happen and overloads `c' with the branch condition code. This is confusing however and it is not like we are short of letters, so instead make the branch condition code use `k', and then for consistency make `K' the reverse branch condition code format specifier. This is safe to do as we provide no means to use a computed branch condition code in user `asm'. gcc/ * config/vax/vax.c (print_operand): Replace `c' and `C' with `k' and `K' respectively. * config/vax/vax.md (*branch, *branch_reversed): Update accordingly. --- gcc/config/vax/vax.c | 4 ++-- gcc/config/vax/vax.md | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/gcc/config/vax/vax.c b/gcc/config/vax/vax.c index da4e6cb1745..0b3b76ed6da 100644 --- a/gcc/config/vax/vax.c +++ b/gcc/config/vax/vax.c @@ -509,9 +509,9 @@ print_operand (FILE *file, rtx x, int code) fputc (ASM_DOUBLE_CHAR, file); else if (code == '|') fputs (REGISTER_PREFIX, file); - else if (code == 'c') + else if (code == 'k') fputs (cond_name (x), file); - else if (code == 'C') + else if (code == 'K') fputs (rev_cond_name (x), file); else if (code == 'D' && CONST_INT_P (x) && INTVAL (x) < 0) fprintf (file, "$" NEG_HWI_PRINT_HEX16, INTVAL (x)); diff --git a/gcc/config/vax/vax.md b/gcc/config/vax/vax.md index 4897ce44505..e3018a0ee06 100644 --- a/gcc/config/vax/vax.md +++ b/gcc/config/vax/vax.md @@ -1111,7 +1111,7 @@ (label_ref (match_operand 1 "" "")) (pc)))] "" - "j%c0 %l1") + "j%k0 %l1") ;; Recognize reversed jumps. (define_insn "*branch_reversed" @@ -1122,7 +1122,7 @@ (pc) (label_ref (match_operand 1 "" ""))))] "" - "j%C0 %l1") ; %C0 negates condition + "j%K0 %l1") ; %K0 negates condition ;; Recognize jbs, jlbs, jbc and jlbc instructions. Note that the operand ;; of jlbs and jlbc insns are SImode in the hardware. However, if it is -- 2.30.2