public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/112276] New: [14 Regression] wrong code with -O2 -msse4.2
@ 2023-10-29 15:18 zsojka at seznam dot cz
2023-10-29 16:06 ` [Bug target/112276] " pinskia at gcc dot gnu.org
` (9 more replies)
0 siblings, 10 replies; 11+ messages in thread
From: zsojka at seznam dot cz @ 2023-10-29 15:18 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112276
Bug ID: 112276
Summary: [14 Regression] wrong code with -O2 -msse4.2
Product: gcc
Version: 14.0
Status: UNCONFIRMED
Keywords: wrong-code
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: zsojka at seznam dot cz
Target Milestone: ---
Host: x86_64-pc-linux-gnu
Target: x86_64-pc-linux-gnu
Created attachment 56469
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=56469&action=edit
reduced testcase
Output:
$ x86_64-pc-linux-gnu-gcc -O2 -msse4.2 testcase.c
$ ./a.out
Aborted
$ x86_64-pc-linux-gnu-gcc -v
Using built-in specs.
COLLECT_GCC=/repo/gcc-trunk/binary-latest-amd64/bin/x86_64-pc-linux-gnu-gcc
COLLECT_LTO_WRAPPER=/repo/gcc-trunk/binary-trunk-r14-4995-20231029071248-gc6929b08558-checking-yes-rtl-df-extra-nobootstrap-amd64/bin/../libexec/gcc/x86_64-pc-linux-gnu/14.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /repo/gcc-trunk//configure --enable-languages=c,c++
--enable-valgrind-annotations --disable-nls --enable-checking=yes,rtl,df,extra
--disable-bootstrap --with-cloog --with-ppl --with-isl
--build=x86_64-pc-linux-gnu --host=x86_64-pc-linux-gnu
--target=x86_64-pc-linux-gnu --with-ld=/usr/bin/x86_64-pc-linux-gnu-ld
--with-as=/usr/bin/x86_64-pc-linux-gnu-as --disable-libstdcxx-pch
--prefix=/repo/gcc-trunk//binary-trunk-r14-4995-20231029071248-gc6929b08558-checking-yes-rtl-df-extra-nobootstrap-amd64
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 14.0.0 20231029 (experimental) (GCC)
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug target/112276] [14 Regression] wrong code with -O2 -msse4.2
2023-10-29 15:18 [Bug target/112276] New: [14 Regression] wrong code with -O2 -msse4.2 zsojka at seznam dot cz
@ 2023-10-29 16:06 ` pinskia at gcc dot gnu.org
2023-10-29 16:13 ` pinskia at gcc dot gnu.org
` (8 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-10-29 16:06 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112276
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |14.0
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug target/112276] [14 Regression] wrong code with -O2 -msse4.2
2023-10-29 15:18 [Bug target/112276] New: [14 Regression] wrong code with -O2 -msse4.2 zsojka at seznam dot cz
2023-10-29 16:06 ` [Bug target/112276] " pinskia at gcc dot gnu.org
@ 2023-10-29 16:13 ` pinskia at gcc dot gnu.org
2023-10-29 20:05 ` [Bug target/112276] [14 Regression] wrong code with -O2 -msse4.2 since r14-4964-g7eed861e8ca3f5 tkoenig at gcc dot gnu.org
` (7 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-10-29 16:13 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112276
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed| |2023-10-29
Ever confirmed|0 |1
Status|UNCONFIRMED |NEW
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug target/112276] [14 Regression] wrong code with -O2 -msse4.2 since r14-4964-g7eed861e8ca3f5
2023-10-29 15:18 [Bug target/112276] New: [14 Regression] wrong code with -O2 -msse4.2 zsojka at seznam dot cz
2023-10-29 16:06 ` [Bug target/112276] " pinskia at gcc dot gnu.org
2023-10-29 16:13 ` pinskia at gcc dot gnu.org
@ 2023-10-29 20:05 ` tkoenig at gcc dot gnu.org
2023-10-30 2:49 ` crazylht at gmail dot com
` (6 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2023-10-29 20:05 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112276
Thomas Koenig <tkoenig at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |liuhongt at gcc dot gnu.org
Summary|[14 Regression] wrong code |[14 Regression] wrong code
|with -O2 -msse4.2 |with -O2 -msse4.2 since
| |r14-4964-g7eed861e8ca3f5
--- Comment #2 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
Bisected to r14-4964-g7eed861e8ca3f5 .
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug target/112276] [14 Regression] wrong code with -O2 -msse4.2 since r14-4964-g7eed861e8ca3f5
2023-10-29 15:18 [Bug target/112276] New: [14 Regression] wrong code with -O2 -msse4.2 zsojka at seznam dot cz
` (2 preceding siblings ...)
2023-10-29 20:05 ` [Bug target/112276] [14 Regression] wrong code with -O2 -msse4.2 since r14-4964-g7eed861e8ca3f5 tkoenig at gcc dot gnu.org
@ 2023-10-30 2:49 ` crazylht at gmail dot com
2023-10-30 5:49 ` crazylht at gmail dot com
` (5 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: crazylht at gmail dot com @ 2023-10-30 2:49 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112276
Hongtao.liu <crazylht at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |crazylht at gmail dot com
--- Comment #3 from Hongtao.liu <crazylht at gmail dot com> ---
Mine, I'll take a look.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug target/112276] [14 Regression] wrong code with -O2 -msse4.2 since r14-4964-g7eed861e8ca3f5
2023-10-29 15:18 [Bug target/112276] New: [14 Regression] wrong code with -O2 -msse4.2 zsojka at seznam dot cz
` (3 preceding siblings ...)
2023-10-30 2:49 ` crazylht at gmail dot com
@ 2023-10-30 5:49 ` crazylht at gmail dot com
2023-10-30 5:54 ` zsojka at seznam dot cz
` (4 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: crazylht at gmail dot com @ 2023-10-30 5:49 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112276
--- Comment #4 from Hongtao.liu <crazylht at gmail dot com> ---
-(define_split
- [(set (match_operand:V2HI 0 "register_operand")
- (eq:V2HI
- (eq:V2HI
- (us_minus:V2HI
- (match_operand:V2HI 1 "register_operand")
- (match_operand:V2HI 2 "register_operand"))
- (match_operand:V2HI 3 "const0_operand"))
- (match_operand:V2HI 4 "const0_operand")))]
- "TARGET_SSE4_1"
- [(set (match_dup 0)
- (umin:V2HI (match_dup 1) (match_dup 2)))
- (set (match_dup 0)
- (eq:V2HI (match_dup 0) (match_dup 2)))])
the splitter is wrong when op1 == op2.(the original pattern returns 0, after
splitter, it returns 1)
So remove the splitter.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug target/112276] [14 Regression] wrong code with -O2 -msse4.2 since r14-4964-g7eed861e8ca3f5
2023-10-29 15:18 [Bug target/112276] New: [14 Regression] wrong code with -O2 -msse4.2 zsojka at seznam dot cz
` (4 preceding siblings ...)
2023-10-30 5:49 ` crazylht at gmail dot com
@ 2023-10-30 5:54 ` zsojka at seznam dot cz
2023-10-30 18:46 ` zsojka at seznam dot cz
` (3 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: zsojka at seznam dot cz @ 2023-10-30 5:54 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112276
--- Comment #5 from Zdenek Sojka <zsojka at seznam dot cz> ---
(In reply to Hongtao.liu from comment #4)
> -(define_split
> - [(set (match_operand:V2HI 0 "register_operand")
> - (eq:V2HI
> - (eq:V2HI
> - (us_minus:V2HI
> - (match_operand:V2HI 1 "register_operand")
> - (match_operand:V2HI 2 "register_operand"))
> - (match_operand:V2HI 3 "const0_operand"))
> - (match_operand:V2HI 4 "const0_operand")))]
> - "TARGET_SSE4_1"
> - [(set (match_dup 0)
> - (umin:V2HI (match_dup 1) (match_dup 2)))
> - (set (match_dup 0)
> - (eq:V2HI (match_dup 0) (match_dup 2)))])
>
> the splitter is wrong when op1 == op2.(the original pattern returns 0, after
> splitter, it returns 1)
> So remove the splitter.
Thank you for having a look. I have other testcases, possibly related, that are
being reduced now, failing at -O2 only; so -msse4.2 might not be the only
broken target. I will open a new PR if those will still be broken after this is
fixed; alternatively, I can upload the testcases here, once they are reduced.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug target/112276] [14 Regression] wrong code with -O2 -msse4.2 since r14-4964-g7eed861e8ca3f5
2023-10-29 15:18 [Bug target/112276] New: [14 Regression] wrong code with -O2 -msse4.2 zsojka at seznam dot cz
` (5 preceding siblings ...)
2023-10-30 5:54 ` zsojka at seznam dot cz
@ 2023-10-30 18:46 ` zsojka at seznam dot cz
2023-10-31 3:25 ` cvs-commit at gcc dot gnu.org
` (2 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: zsojka at seznam dot cz @ 2023-10-30 18:46 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112276
--- Comment #6 from Zdenek Sojka <zsojka at seznam dot cz> ---
Created attachment 56477
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=56477&action=edit
testcase failing at -O2
$ x86_64-pc-linux-gnu-gcc -O2 testcase.c
$ ./a.out
Aborted
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug target/112276] [14 Regression] wrong code with -O2 -msse4.2 since r14-4964-g7eed861e8ca3f5
2023-10-29 15:18 [Bug target/112276] New: [14 Regression] wrong code with -O2 -msse4.2 zsojka at seznam dot cz
` (6 preceding siblings ...)
2023-10-30 18:46 ` zsojka at seznam dot cz
@ 2023-10-31 3:25 ` cvs-commit at gcc dot gnu.org
2023-10-31 3:25 ` crazylht at gmail dot com
2023-11-14 14:06 ` rguenth at gcc dot gnu.org
9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-10-31 3:25 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112276
--- Comment #7 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by hongtao Liu <liuhongt@gcc.gnu.org>:
https://gcc.gnu.org/g:f5d33d0c790a00cb5240a966dd99df9961bf57a0
commit r14-5025-gf5d33d0c790a00cb5240a966dd99df9961bf57a0
Author: liuhongt <hongtao.liu@intel.com>
Date: Mon Oct 30 14:05:25 2023 +0800
Fix wrong code due to incorrect define_split
-(define_split
- [(set (match_operand:V2HI 0 "register_operand")
- (eq:V2HI
- (eq:V2HI
- (us_minus:V2HI
- (match_operand:V2HI 1 "register_operand")
- (match_operand:V2HI 2 "register_operand"))
- (match_operand:V2HI 3 "const0_operand"))
- (match_operand:V2HI 4 "const0_operand")))]
- "TARGET_SSE4_1"
- [(set (match_dup 0)
- (umin:V2HI (match_dup 1) (match_dup 2)))
- (set (match_dup 0)
- (eq:V2HI (match_dup 0) (match_dup 2)))])
the splitter is wrong when op1 == op2.(the original pattern returns 0,
after split, it returns 1)
So remove the splitter.
Also extend another define_split to define_insn_and_split to handle
below pattern
494(set (reg:V4QI 112)
495 (unspec:V4QI [
496 (subreg:V4QI (reg:V2HF 111 [ bf ]) 0)
497 (subreg:V4QI (reg:V2HF 110 [ af ]) 0)
498 (subreg:V4QI (eq:V2HI (eq:V2HI (reg:V2HI 105)
499 (const_vector:V2HI [
500 (const_int 0 [0]) repeated x2
501 ]))
502 (const_vector:V2HI [
503 (const_int 0 [0]) repeated x2
504 ])) 0)
505 ] UNSPEC_BLENDV))
define_split doesn't work since pass_combine assume it produces at
most 2 insns after split, but here it produces 3 since we need to move
const0_rtx (V2HImode) to reg. The move insn can be eliminated later.
gcc/ChangeLog:
PR target/112276
* config/i386/mmx.md (*mmx_pblendvb_v8qi_1): Change
define_split to define_insn_and_split to handle
immediate_operand for comparison.
(*mmx_pblendvb_v8qi_2): Ditto.
(*mmx_pblendvb_<mode>_1): Ditto.
(*mmx_pblendvb_v4qi_2): Ditto.
(<code><mode>3): Remove define_split after it.
(<code>v8qi3): Ditto.
(<code><mode>3): Ditto.
(<ode>v2hi3): Ditto.
gcc/testsuite/ChangeLog:
* g++.target/i386/part-vect-vcondhf.C: Adjust testcase.
* gcc.target/i386/pr112276.c: New test.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug target/112276] [14 Regression] wrong code with -O2 -msse4.2 since r14-4964-g7eed861e8ca3f5
2023-10-29 15:18 [Bug target/112276] New: [14 Regression] wrong code with -O2 -msse4.2 zsojka at seznam dot cz
` (7 preceding siblings ...)
2023-10-31 3:25 ` cvs-commit at gcc dot gnu.org
@ 2023-10-31 3:25 ` crazylht at gmail dot com
2023-11-14 14:06 ` rguenth at gcc dot gnu.org
9 siblings, 0 replies; 11+ messages in thread
From: crazylht at gmail dot com @ 2023-10-31 3:25 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112276
--- Comment #8 from Hongtao.liu <crazylht at gmail dot com> ---
Fixed.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug target/112276] [14 Regression] wrong code with -O2 -msse4.2 since r14-4964-g7eed861e8ca3f5
2023-10-29 15:18 [Bug target/112276] New: [14 Regression] wrong code with -O2 -msse4.2 zsojka at seznam dot cz
` (8 preceding siblings ...)
2023-10-31 3:25 ` crazylht at gmail dot com
@ 2023-11-14 14:06 ` rguenth at gcc dot gnu.org
9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-11-14 14:06 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112276
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|NEW |RESOLVED
--- Comment #9 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed.
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2023-11-14 14:06 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-29 15:18 [Bug target/112276] New: [14 Regression] wrong code with -O2 -msse4.2 zsojka at seznam dot cz
2023-10-29 16:06 ` [Bug target/112276] " pinskia at gcc dot gnu.org
2023-10-29 16:13 ` pinskia at gcc dot gnu.org
2023-10-29 20:05 ` [Bug target/112276] [14 Regression] wrong code with -O2 -msse4.2 since r14-4964-g7eed861e8ca3f5 tkoenig at gcc dot gnu.org
2023-10-30 2:49 ` crazylht at gmail dot com
2023-10-30 5:49 ` crazylht at gmail dot com
2023-10-30 5:54 ` zsojka at seznam dot cz
2023-10-30 18:46 ` zsojka at seznam dot cz
2023-10-31 3:25 ` cvs-commit at gcc dot gnu.org
2023-10-31 3:25 ` crazylht at gmail dot com
2023-11-14 14:06 ` rguenth at gcc dot gnu.org
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).