https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109088
--- Comment #22 from rguenther at suse dot de ---
On Thu, 16 Nov 2023, juzhe.zhong at rivai dot ai wrote:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109088
>
> --- Comment #21 from JuzheZhong ---
> Thanks Richi.
>
> Does re-associating (
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109088
--- Comment #21 from JuzheZhong ---
Thanks Richi.
Does re-associating (with eliminating exceptions) in if-convert is a reasonable
approach ?
If yes, I am gonna to revisit this PR on GCC-15 and refine the codes.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109088
--- Comment #20 from rguenther at suse dot de ---
On Wed, 15 Nov 2023, juzhe.zhong at rivai dot ai wrote:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109088
>
> --- Comment #19 from JuzheZhong ---
> I have added:
>
> + if (!ANY_INTEG
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109088
--- Comment #19 from JuzheZhong ---
I have added:
+ if (!ANY_INTEGRAL_TYPE_P (TREE_TYPE (PHI_RESULT (phi)))
+ && !(FLOAT_TYPE_P (TREE_TYPE (PHI_RESULT (phi)))
+ && !HONOR_SIGNED_ZEROS (TREE_TYPE (PHI_RESULT (phi)))
+
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109088
--- Comment #18 from Richard Biener ---
Ah, so this is for
int foo (int *a, int x)
{
int sum = 0;
for (int i = 0; i < 1024; ++i)
if (a[i] < 10)
sum = sum + a[i] + x;
return sum;
}
transforming it to
int foo (int *a, int x)
{
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109088
--- Comment #17 from JuzheZhong ---
Sorry for confusing and not enough information.
I am trying to transform:
+ reduc_1 = PHI <..., reduc_2>
+ ...
+ if (...)
+ tmp1 = reduc_1 + rhs1;
+ tmp2 = tmp1 +
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109088
--- Comment #16 from Richard Biener ---
it's not exactly clear what the transform is you propose. it looks like a
re-association but SSA names do not match up but the transform only replaces
a single op with 0!?
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109088
--- Comment #15 from JuzheZhong ---
Hi,Richard.
Confirmed Robin's patch doesn't help with this issue.
The root cause of this issue is failed to recognize it as possible
vectorization of conditional reduction which means is_cond_scalar_reduction
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109088
--- Comment #14 from Richard Biener ---
Sorry for the delay - but this looks exactly like Robins transform to COND_ADD,
no? But sure, the current code doesn't handle a reduction path through
multiple stmts but when if-conversion would convert t
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109088
--- Comment #13 from JuzheZhong ---
Hi, Richi. This is my draft approach to enhance the finding more potential
condtional reduction.
diff --git a/gcc/tree-if-conv.cc b/gcc/tree-if-conv.cc
index a8c915913ae..c25d2038f16 100644
--- a/gcc/tree-if-
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109088
--- Comment #12 from JuzheZhong ---
(In reply to Richard Biener from comment #11)
> I don't think strip_nop_cond_scalar_reduction is the place to adjust here,
> maybe it's the caller. I don't have time to dig into the specific issue
> right now
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109088
--- Comment #11 from Richard Biener ---
I don't think strip_nop_cond_scalar_reduction is the place to adjust here,
maybe it's the caller. I don't have time to dig into the specific issue right
now but if we require scalar code adjustments then
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109088
--- Comment #10 from JuzheZhong ---
(In reply to Richard Biener from comment #9)
> (In reply to JuzheZhong from comment #8)
> > It's because the order of the operations we are doing:
> >
> > For code as follows:
> >
> > result += mask ? a[i] +
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109088
Richard Biener changed:
What|Removed |Added
CC||rdapp at gcc dot gnu.org
--- Comment #
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109088
--- Comment #8 from JuzheZhong ---
It's because the order of the operations we are doing:
For code as follows:
result += mask ? a[i] + x : 0;
GCC:
result_ssa_1 = PHI
...
STMT 1. tmp = a[i] + x;
STMT 2. tmp2 = tmp + result_ssa_1;
STMT 3. resu
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109088
--- Comment #7 from JuzheZhong ---
Update the analysis:
We failed to recognize it as reduction because, the PHI result has 2 uses:
# result_20 = PHI
...
_11 = result_20 + 10; > first use
result_17 = _4 + _11;
_23 = _4 > _7;
result_9
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109088
--- Comment #6 from JuzheZhong ---
After investigations:
GCC failed to vectorize reduction with multiple conditional operations:
ifcvt dump:
# result_20 = PHI
...
_11 = result_20 + 10;
result_17 = _4 + _11;
_23 = _4 > _7;
result_9 = _23 ? re
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109088
Andrew Pinski changed:
What|Removed |Added
Last reconfirmed||2023-03-10
Severity|normal
18 matches
Mail list logo