Skip to content

Commit

Permalink
remove fprintf(stderr, ...)
Browse files Browse the repository at this point in the history
  • Loading branch information
jjsuwa-sys3175 committed Dec 24, 2021
1 parent 6643898 commit c915ad2
Showing 1 changed file with 264 additions and 0 deletions.
264 changes: 264 additions & 0 deletions patches/gcc10.3/gcc-xtensa-0021-remove-fprintf-stderr.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,264 @@
From d6457b4f63cfed77282c43d2180fde9873f5d8c1 Mon Sep 17 00:00:00 2001
From: Takayuki 'January June' Suwa <[email protected]>
Date: Fri, 24 Dec 2021 08:38:15 +0900
Subject: [PATCH 15/15] remove `fprintf(stderr, ...)`

---
gcc/config/xtensa/xtensa.c | 51 ++++---------------------------------
gcc/config/xtensa/xtensa.md | 47 +---------------------------------
2 files changed, 6 insertions(+), 92 deletions(-)

diff --git a/gcc/config/xtensa/xtensa.c b/gcc/config/xtensa/xtensa.c
index 43ff2d76a..4b315ba8d 100644
--- a/gcc/config/xtensa/xtensa.c
+++ b/gcc/config/xtensa/xtensa.c
@@ -1110,13 +1110,7 @@ xtensa_emit_move_sequence (rtx *operands, machine_mode mode)
lo = srcval - hi;
if (xtensa_emit_const_synth_sequence (dst, gen_addsi3,
hi, lo))
- {
- fprintf (stderr, "[xtensa_const_synth @ %s(), line %d] '" HOST_WIDE_INT_PRINT_DEC "' = '" HOST_WIDE_INT_PRINT_DEC " + " HOST_WIDE_INT_PRINT_DEC "'\n",
- current_function_name (), LOCATION_LINE (curr_insn_location ()),
- srcval, hi, lo);
-
- return 1;
- }
+ return 1;
}

/* Synthesize a constant by "MOVI imm12" + "ADDMI imm8"
@@ -1132,13 +1126,7 @@ xtensa_emit_move_sequence (rtx *operands, machine_mode mode)
lo = srcval - hi;
if (xtensa_emit_const_synth_sequence (dst, gen_addsi3,
lo, hi))
- {
- fprintf (stderr, "[xtensa_const_synth @ %s(), line %d] '" HOST_WIDE_INT_PRINT_DEC "' = '" HOST_WIDE_INT_PRINT_DEC " + " HOST_WIDE_INT_PRINT_DEC "'\n",
- current_function_name (), LOCATION_LINE (curr_insn_location ()),
- srcval, lo, hi);
-
- return 1;
- }
+ return 1;
}

/* Synthesize a constant by "MOVI -1" + "SRLI/EXTUI"
@@ -1147,13 +1135,7 @@ xtensa_emit_move_sequence (rtx *operands, machine_mode mode)
if (IN_RANGE (shift, 1, 31)
&& xtensa_emit_const_synth_sequence (dst, gen_lshrsi3,
-1, 32 - shift))
- {
- fprintf (stderr, "[xtensa_const_synth @ %s(), line %d] '" HOST_WIDE_INT_PRINT_DEC "' = '-1U >> %d'\n",
- current_function_name (), LOCATION_LINE (curr_insn_location ()),
- srcval, 32 - shift);
-
- return 1;
- }
+ return 1;

/* Synthesize a constant by "MOVI imm12" + "SLLI" sequence
(5 or 6 bytes). */
@@ -1161,13 +1143,7 @@ xtensa_emit_move_sequence (rtx *operands, machine_mode mode)
if (xtensa_simm12b (srcval >> shift)
&& xtensa_emit_const_synth_sequence (dst, gen_ashlsi3_internal,
srcval >> shift, shift))
- {
- fprintf (stderr, "[xtensa_const_synth @ %s(), line %d] '" HOST_WIDE_INT_PRINT_DEC "' = '" HOST_WIDE_INT_PRINT_DEC " << %d'\n",
- current_function_name (), LOCATION_LINE (curr_insn_location ()),
- srcval, srcval >> shift, shift);
-
- return 1;
- }
+ return 1;
}
}

@@ -1476,7 +1452,6 @@ xtensa_expand_block_set (rtx *operands)
HOST_WIDE_INT bytes, value, align;
int insns_len, insns_len_threshold;
rtx x, reg;
- int insns;
int offset;

/* If this is not a fixed size set, just call memset. */
@@ -1514,13 +1489,7 @@ xtensa_expand_block_set (rtx *operands)
+ (TARGET_LONGCALLS ? 4 + 3 + 3 : 3);
/* call subroutine (CALLn / litpool + L32R + CALLXn). */
if (insns_len > insns_len_threshold)
- {
- fprintf (stderr, "[xtensa_expand_block_set @ %s(), line %d] insns_len=%d, threshold=%d; not expanded\n",
- current_function_name (), LOCATION_LINE (curr_insn_location ()),
- insns_len, insns_len_threshold);
-
- return 0;
- }
+ return 0;

x = XEXP (dst_mem, 0);
if (!REG_P (x))
@@ -1528,7 +1497,6 @@ xtensa_expand_block_set (rtx *operands)

reg = gen_reg_rtx (SImode);
emit_move_insn (reg, GEN_INT ((int32_t)(value * 0x01010101)));
- insns = 1;
offset = 0;
do
{
@@ -1544,16 +1512,11 @@ xtensa_expand_block_set (rtx *operands)
emit_insn (gen_rtx_SET (adjust_address (dst_mem, unit_mode, offset),
x));

- insns += 1;
offset += unit_size;
bytes -= unit_size;
}
while (bytes > 0);

- fprintf (stderr, "[xtensa_expand_block_set @ %s(), line %d] insns_len=%d, threshold=%d; expanded to %d insns\n",
- current_function_name (), LOCATION_LINE (curr_insn_location ()),
- insns_len, insns_len_threshold, insns);
-
return 1;
}

@@ -2014,10 +1977,6 @@ xtensa_emit_mask_alt_branch (bool inverted, rtx *operands)
default: gcc_unreachable ();
}

- fprintf (stderr, "[xtensa_emit_mask_alt_branch @ %s()] 'if ((x & " HOST_WIDE_INT_PRINT_DEC ") %s 0)' => 'if (extzv(x, %d, %d) %s 0)'\n",
- current_function_name (),
- mask, *op == 'n' ? "!=" : "==", mask_size, shifted, *op == 'n' ? "!=" : "==");
-
operands[1] = GEN_INT (shifted);
operands[3] = GEN_INT (mask_size);

diff --git a/gcc/config/xtensa/xtensa.md b/gcc/config/xtensa/xtensa.md
index c20a96e4d..1ba5698af 100644
--- a/gcc/config/xtensa/xtensa.md
+++ b/gcc/config/xtensa/xtensa.md
@@ -559,10 +559,6 @@
int shifted = ctz_hwi (mask);
int mask_size = floor_log2 (((uint32_t)mask >> shifted) + 1);

- fprintf (stderr, "[*xtensa_andsi3_alt @ %s()] 'x & " HOST_WIDE_INT_PRINT_DEC "' = 'extzv(x, %d, %d) << %d'\n",
- current_function_name (),
- mask, mask_size, shifted, shifted);
-
operands[2] = GEN_INT (shifted);
operands[3] = GEN_INT (mask_size);

@@ -586,11 +582,6 @@
int mask_size = (helper >> 5) & 0x1f;
int mask_pos = (helper >> 10) & 0x1f;

- fprintf (stderr, "[*xtensa_paired_shift_and @ %s()] '(x %s " HOST_WIDE_INT_PRINT_DEC ") & " HOST_WIDE_INT_PRINT_DEC "' = 'extzv(x, %d, %d) << %d'\n",
- current_function_name (),
- GET_CODE (operands[4]) == ASHIFT ? "<<" : ">>", INTVAL (operands[2]) & 0x1f, INTVAL (operands[3]),
- mask_size, mask_pos, shifted);
-
operands[2] = GEN_INT (mask_pos);
operands[3] = GEN_INT (mask_size);
operands[4] = GEN_INT (shifted);
@@ -612,11 +603,7 @@
[(set (match_dup 3)
(and:SI (match_dup 2) (match_dup 1)))
(set (match_dup 0)
- (xor:SI (match_dup 2) (match_dup 3)))]
-{
- fprintf (stderr, "[split @ %s()] 'x & ~y' = '(x & y) ^ x'\n",
- current_function_name ());
-})
+ (xor:SI (match_dup 2) (match_dup 3)))])

(define_insn "iorsi3"
[(set (match_operand:SI 0 "register_operand" "=a")
@@ -1244,10 +1231,6 @@
(const_int 3))]))]
""
{
- fprintf (stderr, "[*xtensa_shift_x3 @ %s()] 'a %s b*8'\n",
- current_function_name (),
- GET_CODE (operands[1]) == ASHIFT ? "<<" : ">>");
-
switch (GET_CODE (operands[1]))
{
case ASHIFT: return "ssa8b\t%3\;sll\t%0, %2";
@@ -1268,10 +1251,6 @@
(match_operand:SI 4 "const_int_operand" "i"))]))]
"(INTVAL (operands[4]) & 0x1f) == 0x18"
{
- fprintf (stderr, "[*xtensa_shift_x3_alt @ %s()] 'a %s (b*8&" HOST_WIDE_INT_PRINT_DEC ")'\n",
- current_function_name (),
- GET_CODE (operands[1]) == ASHIFT ? "<<" : ">>", INTVAL (operands[4]));
-
switch (GET_CODE (operands[1]))
{
case ASHIFT: return "ssa8b\t%3\;sll\t%0, %2";
@@ -1292,10 +1271,6 @@
(neg:SI (match_dup 2))])))]
"xtensa_shlrd_helper (operands) != UNKNOWN"
{
- fprintf (stderr, "[*xtensa_shlrd_<code> @ %s()] 'a %s c | b %s 32-c'\n",
- current_function_name (),
- GET_CODE (operands[4]) == ASHIFT ? "<<" : ">>", GET_CODE (operands[5]) == ASHIFT ? "<<" : ">>");
-
switch (xtensa_shlrd_helper (operands))
{
case ASHIFT: return "ssl\t%2\;src\t%0, %1, %3";
@@ -1316,11 +1291,6 @@
"xtensa_shlrd_helper (operands) != UNKNOWN
&& INTVAL (operands[2]) + INTVAL (operands[6]) == 32"
{
- fprintf (stderr, "[*xtensa_shlrd_const_<code> @ %s()] 'a %s " HOST_WIDE_INT_PRINT_DEC " | b %s " HOST_WIDE_INT_PRINT_DEC "'\n",
- current_function_name (),
- GET_CODE (operands[4]) == ASHIFT ? "<<" : ">>", INTVAL (operands[2]),
- GET_CODE (operands[5]) == ASHIFT ? "<<" : ">>", INTVAL (operands[6]));
-
switch (xtensa_shlrd_helper (operands))
{
case ASHIFT: return "ssai\t%L2\;src\t%0, %1, %3";
@@ -1342,10 +1312,6 @@
(const_int 3)))])))]
"xtensa_shlrd_helper (operands) != UNKNOWN"
{
- fprintf (stderr, "[*xtensa_shlrd_x3_<code> @ %s()] 'a %s (c*8) | b %s 32-(c*8)'\n",
- current_function_name (),
- GET_CODE (operands[4]) == ASHIFT ? "<<" : ">>", GET_CODE (operands[5]) == ASHIFT ? "<<" : ">>");
-
switch (xtensa_shlrd_helper (operands))
{
case ASHIFT: return "ssa8b\t%2\;src\t%0, %1, %3";
@@ -1370,11 +1336,6 @@
"xtensa_shlrd_helper (operands) != UNKNOWN
&& (INTVAL (operands[6]) & 0x1f) == 0x18"
{
- fprintf (stderr, "[*xtensa_shlrd_x3_alt_<code> @ %s()] 'a %s (c*8&" HOST_WIDE_INT_PRINT_DEC ") | b %s 32-(c*8&" HOST_WIDE_INT_PRINT_DEC ")'\n",
- current_function_name (),
- GET_CODE (operands[4]) == ASHIFT ? "<<" : ">>", INTVAL (operands[6]),
- GET_CODE (operands[5]) == ASHIFT ? "<<" : ">>", INTVAL (operands[6]));
-
switch (xtensa_shlrd_helper (operands))
{
case ASHIFT: return "ssa8b\t%2\;src\t%0, %1, %3";
@@ -1580,9 +1541,6 @@
(pc)))]
""
{
- fprintf (stderr, "[*masktrue_bitcmpl @ %s()]\n",
- current_function_name ());
-
return xtensa_emit_mask_branch (false, true, operands);
}
[(set_attr "type" "jump")
@@ -1632,9 +1590,6 @@
(label_ref (match_operand 2 "" ""))))]
""
{
- fprintf (stderr, "[*maskfalse_bitcmpl @ %s()]\n",
- current_function_name ());
-
return xtensa_emit_mask_branch (true, true, operands);
}
[(set_attr "type" "jump")
--
2.20.1

0 comments on commit c915ad2

Please sign in to comment.