public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-2259] i386: Fix vec_set<mode> expanders [PR101424]
@ 2021-07-12 19:09 Uros Bizjak
0 siblings, 0 replies; only message in thread
From: Uros Bizjak @ 2021-07-12 19:09 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:8d980e84240c82502661758fbecd5f456018ea89
commit r12-2259-g8d980e84240c82502661758fbecd5f456018ea89
Author: Uros Bizjak <ubizjak@gmail.com>
Date: Mon Jul 12 21:06:32 2021 +0200
i386: Fix vec_set<mode> expanders [PR101424]
AVX does not support 32-byte integer compares, required by
ix86_expand_vector_set_var. The following patch fixes vec_set<mode>
expanders by introducing new vec_setm_avx2_operand predicate for AVX
vector modes.
gcc/
2021-07-12 Uroš Bizjak <ubizjak@gmail.com>
PR target/101424
* config/i386/predicates.md (vec_setm_sse41_operand):
Rename from vec_setm_operand.
(vec_setm_avx2_operand): New predicate.
* config/i386/sse.md (vec_set<V_128:mode>): Use V_128 mode iterator.
Use vec_setm_sse41_operand as operand 2 predicate.
(vec_set<V_256_512:mode): New expander.
* config/i386/mmx.md (vec_setv2hi): Use vec_setm_sse41_operand
as operand 2 predicate.
gcc/testsuite/
2021-07-12 Uroš Bizjak <ubizjak@gmail.com>
PR target/101424
* gcc.target/i386/pr101424.c: New test.
Diff:
---
gcc/config/i386/mmx.md | 2 +-
gcc/config/i386/predicates.md | 7 ++++++-
gcc/config/i386/sse.md | 18 ++++++++++++++++--
gcc/testsuite/gcc.target/i386/pr101424.c | 15 +++++++++++++++
4 files changed, 38 insertions(+), 4 deletions(-)
diff --git a/gcc/config/i386/mmx.md b/gcc/config/i386/mmx.md
index 986b758396a..0984f7cc44d 100644
--- a/gcc/config/i386/mmx.md
+++ b/gcc/config/i386/mmx.md
@@ -3604,7 +3604,7 @@
(define_expand "vec_setv2hi"
[(match_operand:V2HI 0 "register_operand")
(match_operand:HI 1 "register_operand")
- (match_operand 2 "vec_setm_operand")]
+ (match_operand 2 "vec_setm_sse41_operand")]
"TARGET_SSE2"
{
if (CONST_INT_P (operands[2]))
diff --git a/gcc/config/i386/predicates.md b/gcc/config/i386/predicates.md
index 9488632ce24..6aa1ea32627 100644
--- a/gcc/config/i386/predicates.md
+++ b/gcc/config/i386/predicates.md
@@ -1021,11 +1021,16 @@
})
;; True for registers, or const_int_operand, used to vec_setm expander.
-(define_predicate "vec_setm_operand"
+(define_predicate "vec_setm_sse41_operand"
(ior (and (match_operand 0 "register_operand")
(match_test "TARGET_SSE4_1"))
(match_code "const_int")))
+(define_predicate "vec_setm_avx2_operand"
+ (ior (and (match_operand 0 "register_operand")
+ (match_test "TARGET_AVX2"))
+ (match_code "const_int")))
+
(define_predicate "vec_setm_mmx_operand"
(ior (and (match_operand 0 "register_operand")
(match_test "TARGET_SSE4_1")
diff --git a/gcc/config/i386/sse.md b/gcc/config/i386/sse.md
index 17c9e571d5d..ab29999023d 100644
--- a/gcc/config/i386/sse.md
+++ b/gcc/config/i386/sse.md
@@ -8486,9 +8486,9 @@
(set_attr "mode" "DF")])
(define_expand "vec_set<mode>"
- [(match_operand:V 0 "register_operand")
+ [(match_operand:V_128 0 "register_operand")
(match_operand:<ssescalarmode> 1 "register_operand")
- (match_operand 2 "vec_setm_operand")]
+ (match_operand 2 "vec_setm_sse41_operand")]
"TARGET_SSE"
{
if (CONST_INT_P (operands[2]))
@@ -8499,6 +8499,20 @@
DONE;
})
+(define_expand "vec_set<mode>"
+ [(match_operand:V_256_512 0 "register_operand")
+ (match_operand:<ssescalarmode> 1 "register_operand")
+ (match_operand 2 "vec_setm_avx2_operand")]
+ "TARGET_AVX"
+{
+ if (CONST_INT_P (operands[2]))
+ ix86_expand_vector_set (false, operands[0], operands[1],
+ INTVAL (operands[2]));
+ else
+ ix86_expand_vector_set_var (operands[0], operands[1], operands[2]);
+ DONE;
+})
+
(define_insn_and_split "*vec_extractv4sf_0"
[(set (match_operand:SF 0 "nonimmediate_operand" "=v,m,f,r")
(vec_select:SF
diff --git a/gcc/testsuite/gcc.target/i386/pr101424.c b/gcc/testsuite/gcc.target/i386/pr101424.c
new file mode 100644
index 00000000000..28bb7230e47
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr101424.c
@@ -0,0 +1,15 @@
+/* PR target/101424 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -mavx" } */
+
+typedef int v4df __attribute__((vector_size(32)));
+
+int foo_v4df_b, foo_v4df_c;
+
+v4df
+__attribute__foo_v4df ()
+{
+ v4df a;
+ a[foo_v4df_c] = foo_v4df_b;
+ return a;
+}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-07-12 19:09 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-12 19:09 [gcc r12-2259] i386: Fix vec_set<mode> expanders [PR101424] Uros Bizjak
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).