* [RISC-V PATCH] Improve style to work around PR 60994 in host compiler.
@ 2023-12-01 9:22 Roger Sayle
2023-12-01 9:27 ` Robin Dapp
0 siblings, 1 reply; 3+ messages in thread
From: Roger Sayle @ 2023-12-01 9:22 UTC (permalink / raw)
To: gcc-patches; +Cc: 'Robin Dapp'
[-- Attachment #1: Type: text/plain, Size: 946 bytes --]
This simple patch allows me to build a cross-compiler to riscv using
older versions of RedHat's system compiler. The issue is PR c++/60994
where g++ doesn't like the same name (demand_flags) to be used by both
a variable and a (enumeration) type, which is also undesirable from a
(GNU) coding style perspective. One solution is to rename the type
to demand_flags_t, but a less invasive change is to simply use another
identifier for the problematic local variable, renaming demand_flags
to dflags.
This patch has been tested by building cc1 of a cross-compiler to
riscv64-unknown-linux-gnu using g++ 4.8.5 as the host compiler.
Ok for mainline?
2023-12-01 Roger Sayle <roger@nextmovesoftware.com>
gcc/ChangeLog
* config/riscv/riscv-vsetvl.cc (csetvl_info::parse_insn): Rename
local variable from demand_flags to dflags, to avoid conflicting
with (enumeration) type of the same name.
Thanks in advance,
Roger
--
[-- Attachment #2: patchrv.txt --]
[-- Type: text/plain, Size: 2285 bytes --]
diff --git a/gcc/config/riscv/riscv-vsetvl.cc b/gcc/config/riscv/riscv-vsetvl.cc
index b3e07d4..9d11416 100644
--- a/gcc/config/riscv/riscv-vsetvl.cc
+++ b/gcc/config/riscv/riscv-vsetvl.cc
@@ -987,11 +987,11 @@ public:
/* Determine the demand info of the RVV insn. */
m_max_sew = get_max_int_sew ();
- unsigned demand_flags = 0;
+ unsigned dflags = 0;
if (vector_config_insn_p (insn->rtl ()))
{
- demand_flags |= demand_flags::DEMAND_AVL_P;
- demand_flags |= demand_flags::DEMAND_RATIO_P;
+ dflags |= demand_flags::DEMAND_AVL_P;
+ dflags |= demand_flags::DEMAND_RATIO_P;
}
else
{
@@ -1006,39 +1006,39 @@ public:
available.
*/
if (has_non_zero_avl ())
- demand_flags |= demand_flags::DEMAND_NON_ZERO_AVL_P;
+ dflags |= demand_flags::DEMAND_NON_ZERO_AVL_P;
else
- demand_flags |= demand_flags::DEMAND_AVL_P;
+ dflags |= demand_flags::DEMAND_AVL_P;
}
else
- demand_flags |= demand_flags::DEMAND_AVL_P;
+ dflags |= demand_flags::DEMAND_AVL_P;
}
if (get_attr_ratio (insn->rtl ()) != INVALID_ATTRIBUTE)
- demand_flags |= demand_flags::DEMAND_RATIO_P;
+ dflags |= demand_flags::DEMAND_RATIO_P;
else
{
if (scalar_move_insn_p (insn->rtl ()) && m_ta)
{
- demand_flags |= demand_flags::DEMAND_GE_SEW_P;
+ dflags |= demand_flags::DEMAND_GE_SEW_P;
m_max_sew = get_attr_type (insn->rtl ()) == TYPE_VFMOVFV
? get_max_float_sew ()
: get_max_int_sew ();
}
else
- demand_flags |= demand_flags::DEMAND_SEW_P;
+ dflags |= demand_flags::DEMAND_SEW_P;
if (!ignore_vlmul_insn_p (insn->rtl ()))
- demand_flags |= demand_flags::DEMAND_LMUL_P;
+ dflags |= demand_flags::DEMAND_LMUL_P;
}
if (!m_ta)
- demand_flags |= demand_flags::DEMAND_TAIL_POLICY_P;
+ dflags |= demand_flags::DEMAND_TAIL_POLICY_P;
if (!m_ma)
- demand_flags |= demand_flags::DEMAND_MASK_POLICY_P;
+ dflags |= demand_flags::DEMAND_MASK_POLICY_P;
}
- normalize_demand (demand_flags);
+ normalize_demand (dflags);
/* Optimize AVL from the vsetvl instruction. */
insn_info *def_insn = extract_single_source (get_avl_def ());
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [RISC-V PATCH] Improve style to work around PR 60994 in host compiler.
2023-12-01 9:22 [RISC-V PATCH] Improve style to work around PR 60994 in host compiler Roger Sayle
@ 2023-12-01 9:27 ` Robin Dapp
2023-12-01 11:50 ` juzhe.zhong
0 siblings, 1 reply; 3+ messages in thread
From: Robin Dapp @ 2023-12-01 9:27 UTC (permalink / raw)
To: Roger Sayle, gcc-patches; +Cc: rdapp.gcc, juzhe.zhong
Yes, OK, thanks for that. CC'ing Juzhe as this is his pass.
Regards
Robin
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Re: [RISC-V PATCH] Improve style to work around PR 60994 in host compiler.
2023-12-01 9:27 ` Robin Dapp
@ 2023-12-01 11:50 ` juzhe.zhong
0 siblings, 0 replies; 3+ messages in thread
From: juzhe.zhong @ 2023-12-01 11:50 UTC (permalink / raw)
To: Robin Dapp, Roger Sayle, gcc-patches; +Cc: Robin Dapp
[-- Attachment #1: Type: text/plain, Size: 316 bytes --]
LGTM.
juzhe.zhong@rivai.ai
From: Robin Dapp
Date: 2023-12-01 17:27
To: Roger Sayle; gcc-patches
CC: rdapp.gcc; juzhe.zhong@rivai.ai
Subject: Re: [RISC-V PATCH] Improve style to work around PR 60994 in host compiler.
Yes, OK, thanks for that. CC'ing Juzhe as this is his pass.
Regards
Robin
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-12-01 11:50 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-01 9:22 [RISC-V PATCH] Improve style to work around PR 60994 in host compiler Roger Sayle
2023-12-01 9:27 ` Robin Dapp
2023-12-01 11:50 ` juzhe.zhong
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).