* [Bug target/98648] Failure to optimize out no-op vector operation using andnot
2021-01-13 1:02 [Bug target/98648] New: Failure to optimize out no-op vector operation using andnot gabravier at gmail dot com
@ 2021-01-13 1:09 ` pinskia at gcc dot gnu.org
2021-01-14 10:58 ` crazylht at gmail dot com
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-01-13 1:09 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98648
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |ABI
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
I think this is an ABI issue. What does the ABI say about the other bits of
the SSE register for float passing?
This might be a clang/LLVM issue if the ABI says the other bits are not defined
to be 0.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug target/98648] Failure to optimize out no-op vector operation using andnot
2021-01-13 1:02 [Bug target/98648] New: Failure to optimize out no-op vector operation using andnot gabravier at gmail dot com
2021-01-13 1:09 ` [Bug target/98648] " pinskia at gcc dot gnu.org
@ 2021-01-14 10:58 ` crazylht at gmail dot com
2021-01-14 11:16 ` jakub at gcc dot gnu.org
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: crazylht at gmail dot com @ 2021-01-14 10:58 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98648
Hongtao.liu <crazylht at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |crazylht at gmail dot com
--- Comment #2 from Hongtao.liu <crazylht at gmail dot com> ---
It looks like not an ABI issue, but gcc didn't simplify for vector all one bits
for floating point.
.277r.combine
Trying 6 -> 7:
6: r85:V4SF=const_vector
7: r84:V4SF=~r85:V4SF&r87:V4SF
REG_DEAD r87:V4SF
REG_DEAD r85:V4SF
Failed to match this instruction:
(set (reg:V4SF 84)
(and:V4SF (reg:V4SF 87)
(const_vector:V4SF [
(const_double:SF -QNaN [-QNaN]) repeated x4
])))
When NAN is all ones(which is situation here), it should be simplified to (set
(reg:V4SF 84) (reg: V4SF 87))
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug target/98648] Failure to optimize out no-op vector operation using andnot
2021-01-13 1:02 [Bug target/98648] New: Failure to optimize out no-op vector operation using andnot gabravier at gmail dot com
2021-01-13 1:09 ` [Bug target/98648] " pinskia at gcc dot gnu.org
2021-01-14 10:58 ` crazylht at gmail dot com
@ 2021-01-14 11:16 ` jakub at gcc dot gnu.org
2021-01-14 15:32 ` gabravier at gmail dot com
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-01-14 11:16 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98648
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at gcc dot gnu.org
--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
I guess the reason why simplify-rtx.c doesn't optimize it is that these
patterns really don't have valid RTL, bitwise and/or/xor/andnot are expected to
have integral or integral vector arguments, not floating point vector.
Don't know if we couldn't e.g. represent these as
(set (match_operand:V4SF 0)
(subreg:V4SF
(and:V4SI (subreg:V4SI (match_operand:V4SF 1) 0)
(subreg:V4SI (match_operand:V4SF 2) 0)) 0))
etc.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug target/98648] Failure to optimize out no-op vector operation using andnot
2021-01-13 1:02 [Bug target/98648] New: Failure to optimize out no-op vector operation using andnot gabravier at gmail dot com
` (2 preceding siblings ...)
2021-01-14 11:16 ` jakub at gcc dot gnu.org
@ 2021-01-14 15:32 ` gabravier at gmail dot com
2021-12-15 1:16 ` pinskia at gcc dot gnu.org
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: gabravier at gmail dot com @ 2021-01-14 15:32 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98648
--- Comment #4 from Gabriel Ravier <gabravier at gmail dot com> ---
This code :
typedef int64_t v2di __attribute__((vector_size(16)));
v2di f(__m128 val)
{
return (~(v2di)_mm_set_ps1(0.0f) & (v2di)val);
}
is optimized better (and is equivalent, if I understand the semantics of andnps
right). Maybe the builtin for andnot should be thrown out as soon as possible
(i.e. transformed into ~a & b`) ? From what I can see, `~a & b` for vectors in
general is optimized to an andnot operation too.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug target/98648] Failure to optimize out no-op vector operation using andnot
2021-01-13 1:02 [Bug target/98648] New: Failure to optimize out no-op vector operation using andnot gabravier at gmail dot com
` (3 preceding siblings ...)
2021-01-14 15:32 ` gabravier at gmail dot com
@ 2021-12-15 1:16 ` pinskia at gcc dot gnu.org
2021-12-15 1:16 ` pinskia at gcc dot gnu.org
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-12-15 1:16 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98648
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Ever confirmed|0 |1
Last reconfirmed| |2021-12-15
Status|UNCONFIRMED |NEW
--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(set (reg:V4SF 84)
(and:V4SF (reg:V4SF 87)
(const_vector:V4SF [
(const_double:SF -QNaN [-QNaN]) repeated x4
])))
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug target/98648] Failure to optimize out no-op vector operation using andnot
2021-01-13 1:02 [Bug target/98648] New: Failure to optimize out no-op vector operation using andnot gabravier at gmail dot com
` (4 preceding siblings ...)
2021-12-15 1:16 ` pinskia at gcc dot gnu.org
@ 2021-12-15 1:16 ` pinskia at gcc dot gnu.org
2021-12-20 2:33 ` crazylht at gmail dot com
2021-12-20 2:35 ` pinskia at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-12-15 1:16 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98648
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Severity|normal |enhancement
Keywords|ABI |
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug target/98648] Failure to optimize out no-op vector operation using andnot
2021-01-13 1:02 [Bug target/98648] New: Failure to optimize out no-op vector operation using andnot gabravier at gmail dot com
` (5 preceding siblings ...)
2021-12-15 1:16 ` pinskia at gcc dot gnu.org
@ 2021-12-20 2:33 ` crazylht at gmail dot com
2021-12-20 2:35 ` pinskia at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: crazylht at gmail dot com @ 2021-12-20 2:33 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98648
--- Comment #6 from Hongtao.liu <crazylht at gmail dot com> ---
Fixed by r12-6071-g19dcecd963295b02b96c8cac57933657dbe3234a
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug target/98648] Failure to optimize out no-op vector operation using andnot
2021-01-13 1:02 [Bug target/98648] New: Failure to optimize out no-op vector operation using andnot gabravier at gmail dot com
` (6 preceding siblings ...)
2021-12-20 2:33 ` crazylht at gmail dot com
@ 2021-12-20 2:35 ` pinskia at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-12-20 2:35 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98648
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |FIXED
Target Milestone|--- |12.0
--- Comment #7 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
.
^ permalink raw reply [flat|nested] 9+ messages in thread