public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
* [Bug target/102327] New: gcc/config/i386/i386-expand.c:14678: Suspicious coding ? @ 2021-09-14 15:00 dcb314 at hotmail dot com 2021-09-14 15:01 ` [Bug target/102327] " dcb314 at hotmail dot com ` (6 more replies) 0 siblings, 7 replies; 8+ messages in thread From: dcb314 at hotmail dot com @ 2021-09-14 15:00 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102327 Bug ID: 102327 Summary: gcc/config/i386/i386-expand.c:14678: Suspicious coding ? Product: gcc Version: 12.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: dcb314 at hotmail dot com Target Milestone: --- Static analyser cppcheck says: gcc/config/i386/i386-expand.c:14678:8: style: Variable 'op1' is reassigned a value before the old one has been used. [redundantAssignment] Source code is /* Convert HFmode to HImode. */ op1 = gen_reg_rtx (HImode); op1 = gen_rtx_SUBREG (HImode, force_reg (HFmode, op), 0); I don't know the code, but if the return value from gen_reg_rtx isn't needed, then suggest don't assign it into op1. ^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug target/102327] gcc/config/i386/i386-expand.c:14678: Suspicious coding ? 2021-09-14 15:00 [Bug target/102327] New: gcc/config/i386/i386-expand.c:14678: Suspicious coding ? dcb314 at hotmail dot com @ 2021-09-14 15:01 ` dcb314 at hotmail dot com 2021-09-14 16:05 ` hjl.tools at gmail dot com ` (5 subsequent siblings) 6 siblings, 0 replies; 8+ messages in thread From: dcb314 at hotmail dot com @ 2021-09-14 15:01 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102327 David Binderman <dcb314 at hotmail dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |liuhongt at gcc dot gnu.org --- Comment #1 from David Binderman <dcb314 at hotmail dot com> --- Adding author for clarification. ^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug target/102327] gcc/config/i386/i386-expand.c:14678: Suspicious coding ? 2021-09-14 15:00 [Bug target/102327] New: gcc/config/i386/i386-expand.c:14678: Suspicious coding ? dcb314 at hotmail dot com 2021-09-14 15:01 ` [Bug target/102327] " dcb314 at hotmail dot com @ 2021-09-14 16:05 ` hjl.tools at gmail dot com 2021-09-15 1:10 ` crazylht at gmail dot com ` (4 subsequent siblings) 6 siblings, 0 replies; 8+ messages in thread From: hjl.tools at gmail dot com @ 2021-09-14 16:05 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102327 H.J. Lu <hjl.tools at gmail dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |hjl.tools at gmail dot com Target Milestone|--- |12.0 Status|UNCONFIRMED |NEW Ever confirmed|0 |1 Last reconfirmed| |2021-09-14 ^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug target/102327] gcc/config/i386/i386-expand.c:14678: Suspicious coding ? 2021-09-14 15:00 [Bug target/102327] New: gcc/config/i386/i386-expand.c:14678: Suspicious coding ? dcb314 at hotmail dot com 2021-09-14 15:01 ` [Bug target/102327] " dcb314 at hotmail dot com 2021-09-14 16:05 ` hjl.tools at gmail dot com @ 2021-09-15 1:10 ` crazylht at gmail dot com 2021-09-15 9:26 ` crazylht at gmail dot com ` (3 subsequent siblings) 6 siblings, 0 replies; 8+ messages in thread From: crazylht at gmail dot com @ 2021-09-15 1:10 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102327 --- Comment #2 from Hongtao.liu <crazylht at gmail dot com> --- Yes, it's redundant, Also vector init for v8hf is not optimal , refer to https://godbolt.org/z/M6a4aav48. ^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug target/102327] gcc/config/i386/i386-expand.c:14678: Suspicious coding ? 2021-09-14 15:00 [Bug target/102327] New: gcc/config/i386/i386-expand.c:14678: Suspicious coding ? dcb314 at hotmail dot com ` (2 preceding siblings ...) 2021-09-15 1:10 ` crazylht at gmail dot com @ 2021-09-15 9:26 ` crazylht at gmail dot com 2021-09-15 10:49 ` cvs-commit at gcc dot gnu.org ` (2 subsequent siblings) 6 siblings, 0 replies; 8+ messages in thread From: crazylht at gmail dot com @ 2021-09-15 9:26 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102327 --- Comment #3 from Hongtao.liu <crazylht at gmail dot com> --- Here's optimization i did for v8hf/v16hf/v32hf vec_set/init/extract. diff --git a/origin.s b/after.s index e43e09c..5ea1fb6 100644 --- a/origin.s +++ b/after.s @@ -6,25 +6,13 @@ vec_init_v8hf: .LFB0: .cfi_startproc - vmovw %xmm0, %eax - vmovw %xmm2, %esi - vmovw %xmm4, %edx - vmovw %xmm6, %ecx - vmovd %eax, %xmm0 - vmovw %xmm1, %eax - vmovd %esi, %xmm1 - vmovd %ecx, %xmm2 - vpinsrw $1, %eax, %xmm0, %xmm0 - vmovw %xmm3, %eax - vpinsrw $1, %eax, %xmm1, %xmm3 - vmovw %xmm5, %eax - vmovd %edx, %xmm1 - vpinsrw $1, %eax, %xmm1, %xmm1 - vmovw %xmm7, %eax - vpunpckldq %xmm3, %xmm0, %xmm0 - vpinsrw $1, %eax, %xmm2, %xmm2 - vpunpckldq %xmm2, %xmm1, %xmm1 - vpunpcklqdq %xmm1, %xmm0, %xmm0 + vpunpcklwd %xmm1, %xmm0, %xmm0 + vpunpcklwd %xmm3, %xmm2, %xmm2 + vpunpcklwd %xmm5, %xmm4, %xmm4 + vpunpcklwd %xmm7, %xmm6, %xmm6 + vpunpckldq %xmm2, %xmm0, %xmm0 + vpunpckldq %xmm6, %xmm4, %xmm4 + vpunpcklqdq %xmm4, %xmm0, %xmm0 ret .cfi_endproc .LFE0: @@ -35,8 +23,7 @@ vec_init_v8hf: vec_extract_v8hf_4: .LFB1: .cfi_startproc - vpextrw $4, %xmm0, %eax - vmovw %eax, %xmm0 + vpsrldq $8, %xmm0, %xmm0 ret .cfi_endproc .LFE1: @@ -47,8 +34,7 @@ vec_extract_v8hf_4: vec_extract_v16hf_3: .LFB2: .cfi_startproc - vpextrw $3, %xmm0, %eax - vmovw %eax, %xmm0 + vpsrldq $6, %xmm0, %xmm0 ret .cfi_endproc .LFE2: @@ -71,8 +57,7 @@ vec_extract_v16hf_15: .LFB4: .cfi_startproc vextracti128 $0x1, %ymm0, %xmm0 - vpextrw $7, %xmm0, %eax - vmovw %eax, %xmm0 + vpsrldq $14, %xmm0, %xmm0 ret .cfi_endproc .LFE4: @@ -83,8 +68,7 @@ vec_extract_v16hf_15: vec_extract_v32hf_5: .LFB5: .cfi_startproc - vpextrw $5, %xmm0, %eax - vmovw %eax, %xmm0 + vpsrldq $10, %xmm0, %xmm0 ret .cfi_endproc .LFE5: @@ -107,8 +91,7 @@ vec_extract_v32hf_14: .LFB7: .cfi_startproc vextracti128 $0x1, %ymm0, %xmm0 - vpextrw $6, %xmm0, %eax - vmovw %eax, %xmm0 + vpsrldq $12, %xmm0, %xmm0 ret .cfi_endproc .LFE7: @@ -144,8 +127,7 @@ vec_extract_v32hf_28: .cfi_startproc vextracti64x4 $0x1, %zmm0, %ymm0 vextracti128 $0x1, %ymm0, %xmm0 - vpextrw $4, %xmm0, %eax - vmovw %eax, %xmm0 + vpsrldq $8, %xmm0, %xmm0 ret .cfi_endproc .LFE10: @@ -156,8 +138,8 @@ vec_extract_v32hf_28: vec_set_v8hf_4: .LFB11: .cfi_startproc - vmovw %xmm1, %eax - vpinsrw $4, %eax, %xmm0, %xmm0 + vpbroadcastw %xmm1, %xmm1 + vpblendw $16, %xmm1, %xmm0, %xmm0 ret .cfi_endproc .LFE11: @@ -168,9 +150,9 @@ vec_set_v8hf_4: vec_set_v16hf_3: .LFB12: .cfi_startproc - vmovw %xmm1, %eax - vpinsrw $3, %eax, %xmm0, %xmm2 - vinserti128 $0x0, %xmm2, %ymm0, %ymm0 + vpbroadcastw %xmm1, %ymm1 + vpblendw $8, %ymm1, %ymm0, %ymm1 + vpblendd $15, %ymm1, %ymm0, %ymm0 ret .cfi_endproc .LFE12: @@ -181,9 +163,9 @@ vec_set_v16hf_3: vec_set_v16hf_8: .LFB13: .cfi_startproc - vextracti128 $0x1, %ymm0, %xmm2 - vmovsh %xmm1, %xmm2, %xmm2 - vinserti128 $0x1, %xmm2, %ymm0, %ymm0 + vpbroadcastw %xmm1, %ymm1 + vpblendw $1, %ymm1, %ymm0, %ymm1 + vpblendd $240, %ymm1, %ymm0, %ymm0 ret .cfi_endproc .LFE13: @@ -194,10 +176,9 @@ vec_set_v16hf_8: vec_set_v16hf_15: .LFB14: .cfi_startproc - vextracti128 $0x1, %ymm0, %xmm2 - vmovw %xmm1, %eax - vpinsrw $7, %eax, %xmm2, %xmm2 - vinserti128 $0x1, %xmm2, %ymm0, %ymm0 + vpbroadcastw %xmm1, %ymm1 + vpblendw $128, %ymm1, %ymm0, %ymm1 + vpblendd $240, %ymm1, %ymm0, %ymm0 ret .cfi_endproc .LFE14: @@ -208,7 +189,8 @@ vec_set_v16hf_15: vec_set_v32hf_5: .LFB15: .cfi_startproc - kmovd .LC0(%rip), %k1 + movl $32, %eax + kmovd %eax, %k1 vpbroadcastw %xmm1, %zmm0{%k1} ret .cfi_endproc @@ -220,7 +202,8 @@ vec_set_v32hf_5: vec_set_v32hf_8: .LFB16: .cfi_startproc - kmovd .LC1(%rip), %k1 + movl $256, %eax + kmovd %eax, %k1 vpbroadcastw %xmm1, %zmm0{%k1} ret .cfi_endproc @@ -232,7 +215,8 @@ vec_set_v32hf_8: vec_set_v32hf_14: .LFB17: .cfi_startproc - kmovd .LC2(%rip), %k1 + movl $16384, %eax + kmovd %eax, %k1 vpbroadcastw %xmm1, %zmm0{%k1} ret .cfi_endproc @@ -244,7 +228,8 @@ vec_set_v32hf_14: vec_set_v32hf_16: .LFB18: .cfi_startproc - kmovd .LC3(%rip), %k1 + movl $65536, %eax + kmovd %eax, %k1 vpbroadcastw %xmm1, %zmm0{%k1} ret .cfi_endproc @@ -256,7 +241,8 @@ vec_set_v32hf_16: vec_set_v32hf_24: .LFB19: .cfi_startproc - kmovd .LC4(%rip), %k1 + movl $16777216, %eax + kmovd %eax, %k1 vpbroadcastw %xmm1, %zmm0{%k1} ret .cfi_endproc @@ -268,30 +254,12 @@ vec_set_v32hf_24: vec_set_v32hf_28: .LFB20: .cfi_startproc - kmovd .LC5(%rip), %k1 + movl $268435456, %eax + kmovd %eax, %k1 vpbroadcastw %xmm1, %zmm0{%k1} ret .cfi_endproc .LFE20: .size vec_set_v32hf_28, .-vec_set_v32hf_28 - .section .rodata.cst4,"aM",@progbits,4 - .align 4 -.LC0: - .long 32 - .align 4 -.LC1: - .long 256 - .align 4 -.LC2: - .long 16384 - .align 4 -.LC3: - .long 65536 - .align 4 -.LC4: - .long 16777216 - .align 4 -.LC5: - .long 268435456 .ident "GCC: (GNU) 12.0.0 20210913 (experimental)" .section .note.GNU-stack,"",@progbits ^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug target/102327] gcc/config/i386/i386-expand.c:14678: Suspicious coding ? 2021-09-14 15:00 [Bug target/102327] New: gcc/config/i386/i386-expand.c:14678: Suspicious coding ? dcb314 at hotmail dot com ` (3 preceding siblings ...) 2021-09-15 9:26 ` crazylht at gmail dot com @ 2021-09-15 10:49 ` cvs-commit at gcc dot gnu.org 2021-09-15 10:49 ` crazylht at gmail dot com 2021-09-15 20:39 ` pinskia at gcc dot gnu.org 6 siblings, 0 replies; 8+ messages in thread From: cvs-commit at gcc dot gnu.org @ 2021-09-15 10:49 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102327 --- Comment #4 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:7fc4d6000a0d6c847c4c07373fbd4a17e54c678f commit r12-3547-g7fc4d6000a0d6c847c4c07373fbd4a17e54c678f Author: liuhongt <hongtao.liu@intel.com> Date: Wed Sep 15 15:19:28 2021 +0800 Optimize for V{8,16,32}HFmode vec_set/extract/init. gcc/ChangeLog: PR target/102327 * config/i386/i386-expand.c (ix86_expand_vector_init_interleave): Use puncklwd to pack 2 HFmodes. (ix86_expand_vector_set): Use blendw instead of pinsrw. * config/i386/i386.c (ix86_can_change_mode_class): Adjust for AVX512FP16 which supports 16bit vector load. * config/i386/sse.md (avx512bw_interleave_highv32hi<mask_name>): Rename to .. (avx512bw_interleave_high<mode><mask_name>): .. this, and extend to V32HFmode. (avx2_interleave_highv16hi<mask_name>): Rename to .. (avx2_interleave_high<mode><mask_name>): .. this, and extend to V16HFmode. (vec_interleave_highv8hi<mask_name>): Rename to .. (vec_interleave_high<mode><mask_name>): .. this, and extend to V8HFmode. (<mask_codefor>avx512bw_interleave_lowv32hi<mask_name>): Rename to .. (<mask_codefor>avx512bw_interleave_low<mode><mask_name>): this, and extend to V32HFmode. (avx2_interleave_lowv16hi<mask_name>): Rename to .. (avx2_interleave_low<mode><mask_name>): .. this, and extend to V16HFmode. (vec_interleave_lowv8hi<mask_name>): Rename to .. (vec_interleave_low<mode><mask_name>): .. this, and extend to V8HFmode. (sse4_1_pblendw): Rename to .. (sse4_1_pblend<blendsuf>): .. this, and extend to V8HFmode. (avx2_pblendph): New define_expand. (<sse2p4_1>_pinsr<ssemodesuffix>): Refactor, use sseintmodesuffix instead of ssemodesuffix. (blendsuf): New mode attr. gcc/testsuite/ChangeLog: * gcc.target/i386/pr102327-1.c: New test. * gcc.target/i386/pr102327-2.c: New test. * gcc.target/i386/avx512fp16-1c.c: Adjust testcase. ^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug target/102327] gcc/config/i386/i386-expand.c:14678: Suspicious coding ? 2021-09-14 15:00 [Bug target/102327] New: gcc/config/i386/i386-expand.c:14678: Suspicious coding ? dcb314 at hotmail dot com ` (4 preceding siblings ...) 2021-09-15 10:49 ` cvs-commit at gcc dot gnu.org @ 2021-09-15 10:49 ` crazylht at gmail dot com 2021-09-15 20:39 ` pinskia at gcc dot gnu.org 6 siblings, 0 replies; 8+ messages in thread From: crazylht at gmail dot com @ 2021-09-15 10:49 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102327 --- Comment #5 from Hongtao.liu <crazylht at gmail dot com> --- Fixed in GCC12. ^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug target/102327] gcc/config/i386/i386-expand.c:14678: Suspicious coding ? 2021-09-14 15:00 [Bug target/102327] New: gcc/config/i386/i386-expand.c:14678: Suspicious coding ? dcb314 at hotmail dot com ` (5 preceding siblings ...) 2021-09-15 10:49 ` crazylht at gmail dot com @ 2021-09-15 20:39 ` pinskia at gcc dot gnu.org 6 siblings, 0 replies; 8+ messages in thread From: pinskia at gcc dot gnu.org @ 2021-09-15 20:39 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102327 Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution|--- |FIXED --- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> --- . ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2021-09-15 20:39 UTC | newest] Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2021-09-14 15:00 [Bug target/102327] New: gcc/config/i386/i386-expand.c:14678: Suspicious coding ? dcb314 at hotmail dot com 2021-09-14 15:01 ` [Bug target/102327] " dcb314 at hotmail dot com 2021-09-14 16:05 ` hjl.tools at gmail dot com 2021-09-15 1:10 ` crazylht at gmail dot com 2021-09-15 9:26 ` crazylht at gmail dot com 2021-09-15 10:49 ` cvs-commit at gcc dot gnu.org 2021-09-15 10:49 ` crazylht at gmail dot com 2021-09-15 20:39 ` pinskia 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).