代码拉取完成,页面将自动刷新
From b817cad361eac1754101114b9beb7abc1aab3435 Mon Sep 17 00:00:00 2001
From: liuhongt <hongtao.liu@intel.com>
Date: Tue, 29 Oct 2024 02:09:39 -0700
Subject: [PATCH 11/14] Fix ICE due to subreg:us_truncate.
Force_operand issues an ICE when input
is (subreg:DI (us_truncate:V8QI)), it's probably because it's an
invalid rtx, So refine backend patterns for that.
gcc/ChangeLog:
PR target/117318
* config/i386/sse.md (*avx512vl_<code>v2div2qi2_mask_store_1):
Rename to ..
(avx512vl_<code>v2div2qi2_mask_store_1): .. this.
(avx512vl_<code>v2div2qi2_mask_store_2): Change to
define_expand.
(*avx512vl_<code><mode>v4qi2_mask_store_1): Rename to ..
(avx512vl_<code><mode>v4qi2_mask_store_1): .. this.
(avx512vl_<code><mode>v4qi2_mask_store_2): Change to
define_expand.
(*avx512vl_<code><mode>v8qi2_mask_store_1): Rename to ..
(avx512vl_<code><mode>v8qi2_mask_store_1): .. this.
(avx512vl_<code><mode>v8qi2_mask_store_2): Change to
define_expand.
(*avx512vl_<code><mode>v4hi2_mask_store_1): Rename to ..
(avx512vl_<code><mode>v4hi2_mask_store_1): .. this.
(avx512vl_<code><mode>v4hi2_mask_store_2): Change to
define_expand.
(*avx512vl_<code>v2div2hi2_mask_store_1): Rename to ..
(avx512vl_<code>v2div2hi2_mask_store_1): .. this.
(avx512vl_<code>v2div2hi2_mask_store_2): Change to
define_expand.
(*avx512vl_<code>v2div2si2_mask_store_1): Rename to ..
(avx512vl_<code>v2div2si2_mask_store_1): .. this.
(avx512vl_<code>v2div2si2_mask_store_2): Change to
define_expand.
(*avx512f_<code>v8div16qi2_mask_store_1): Rename to ..
(avx512f_<code>v8div16qi2_mask_store_1): .. this.
(avx512f_<code>v8div16qi2_mask_store_2): Change to
define_expand.
gcc/testsuite/ChangeLog:
* gcc.target/i386/pr117318.c: New test.
(cherry picked from commit bc0eeccf27a084461a2d5661e23468350acb43da)
---
gcc/config/i386/sse.md | 268 +++++++++--------------
gcc/testsuite/gcc.target/i386/pr117318.c | 12 +
2 files changed, 110 insertions(+), 170 deletions(-)
create mode 100644 gcc/testsuite/gcc.target/i386/pr117318.c
diff --git a/gcc/config/i386/sse.md b/gcc/config/i386/sse.md
index 7d01c00a848..a7d61bf0044 100644
--- a/gcc/config/i386/sse.md
+++ b/gcc/config/i386/sse.md
@@ -13850,7 +13850,7 @@
(set_attr "prefix" "evex")
(set_attr "mode" "TI")])
-(define_insn "*avx512vl_<code>v2div2qi2_mask_store_1"
+(define_insn "avx512vl_<code>v2div2qi2_mask_store_1"
[(set (match_operand:V2QI 0 "memory_operand" "=m")
(vec_merge:V2QI
(any_truncate:V2QI
@@ -13864,28 +13864,19 @@
(set_attr "prefix" "evex")
(set_attr "mode" "TI")])
-(define_insn_and_split "avx512vl_<code>v2div2qi2_mask_store_2"
- [(set (match_operand:HI 0 "memory_operand")
- (subreg:HI
- (vec_merge:V2QI
- (any_truncate:V2QI
- (match_operand:V2DI 1 "register_operand"))
- (vec_select:V2QI
- (subreg:V4QI
- (vec_concat:V2HI
- (match_dup 0)
- (const_int 0)) 0)
- (parallel [(const_int 0) (const_int 1)]))
- (match_operand:QI 2 "register_operand")) 0))]
- "TARGET_AVX512VL && ix86_pre_reload_split ()"
- "#"
- "&& 1"
- [(set (match_dup 0)
- (vec_merge:V2QI
- (any_truncate:V2QI (match_dup 1))
- (match_dup 0)
- (match_dup 2)))]
- "operands[0] = adjust_address_nv (operands[0], V2QImode, 0);")
+(define_expand "avx512vl_<code>v2div2qi2_mask_store_2"
+ [(match_operand:HI 0 "memory_operand")
+ (any_truncate:V2QI
+ (match_operand:V2DI 1 "register_operand"))
+ (match_operand:QI 2 "register_operand")]
+ "TARGET_AVX512VL"
+{
+ operands[0] = adjust_address_nv (operands[0], V2QImode, 0);
+ emit_insn (gen_avx512vl_<code>v2div2qi2_mask_store_1 (operands[0],
+ operands[1],
+ operands[2]));
+ DONE;
+})
(define_insn "*avx512vl_<code><mode>v4qi2_store_1"
[(set (match_operand:V4QI 0 "memory_operand" "=m")
@@ -13954,7 +13945,7 @@
(set_attr "prefix" "evex")
(set_attr "mode" "TI")])
-(define_insn "*avx512vl_<code><mode>v4qi2_mask_store_1"
+(define_insn "avx512vl_<code><mode>v4qi2_mask_store_1"
[(set (match_operand:V4QI 0 "memory_operand" "=m")
(vec_merge:V4QI
(any_truncate:V4QI
@@ -13968,29 +13959,19 @@
(set_attr "prefix" "evex")
(set_attr "mode" "TI")])
-(define_insn_and_split "avx512vl_<code><mode>v4qi2_mask_store_2"
- [(set (match_operand:SI 0 "memory_operand")
- (subreg:SI
- (vec_merge:V4QI
- (any_truncate:V4QI
- (match_operand:VI4_128_8_256 1 "register_operand"))
- (vec_select:V4QI
- (subreg:V8QI
- (vec_concat:V2SI
- (match_dup 0)
- (const_int 0)) 0)
- (parallel [(const_int 0) (const_int 1)
- (const_int 2) (const_int 3)]))
- (match_operand:QI 2 "register_operand")) 0))]
- "TARGET_AVX512VL && ix86_pre_reload_split ()"
- "#"
- "&& 1"
- [(set (match_dup 0)
- (vec_merge:V4QI
- (any_truncate:V4QI (match_dup 1))
- (match_dup 0)
- (match_dup 2)))]
- "operands[0] = adjust_address_nv (operands[0], V4QImode, 0);")
+(define_expand "avx512vl_<code><mode>v4qi2_mask_store_2"
+ [(match_operand:SI 0 "memory_operand")
+ (any_truncate:V4QI
+ (match_operand:VI4_128_8_256 1 "register_operand"))
+ (match_operand:QI 2 "register_operand")]
+ "TARGET_AVX512VL"
+{
+ operands[0] = adjust_address_nv (operands[0], V4QImode, 0);
+ emit_insn (gen_avx512vl_<code><mode>v4qi2_mask_store_1 (operands[0],
+ operands[1],
+ operands[2]));
+ DONE;
+})
(define_mode_iterator VI2_128_BW_4_256
[(V8HI "TARGET_AVX512BW") V8SI])
@@ -14062,7 +14043,7 @@
(set_attr "prefix" "evex")
(set_attr "mode" "TI")])
-(define_insn "*avx512vl_<code><mode>v8qi2_mask_store_1"
+(define_insn "avx512vl_<code><mode>v8qi2_mask_store_1"
[(set (match_operand:V8QI 0 "memory_operand" "=m")
(vec_merge:V8QI
(any_truncate:V8QI
@@ -14076,31 +14057,19 @@
(set_attr "prefix" "evex")
(set_attr "mode" "TI")])
-(define_insn_and_split "avx512vl_<code><mode>v8qi2_mask_store_2"
- [(set (match_operand:DI 0 "memory_operand")
- (subreg:DI
- (vec_merge:V8QI
- (any_truncate:V8QI
- (match_operand:VI2_128_BW_4_256 1 "register_operand"))
- (vec_select:V8QI
- (subreg:V16QI
- (vec_concat:V2DI
- (match_dup 0)
- (const_int 0)) 0)
- (parallel [(const_int 0) (const_int 1)
- (const_int 2) (const_int 3)
- (const_int 4) (const_int 5)
- (const_int 6) (const_int 7)]))
- (match_operand:QI 2 "register_operand")) 0))]
- "TARGET_AVX512VL && ix86_pre_reload_split ()"
- "#"
- "&& 1"
- [(set (match_dup 0)
- (vec_merge:V8QI
- (any_truncate:V8QI (match_dup 1))
- (match_dup 0)
- (match_dup 2)))]
- "operands[0] = adjust_address_nv (operands[0], V8QImode, 0);")
+(define_expand "avx512vl_<code><mode>v8qi2_mask_store_2"
+ [(match_operand:DI 0 "memory_operand")
+ (any_truncate:V8QI
+ (match_operand:VI2_128_BW_4_256 1 "register_operand"))
+ (match_operand:QI 2 "register_operand")]
+ "TARGET_AVX512VL"
+{
+ operands[0] = adjust_address_nv (operands[0], V8QImode, 0);
+ emit_insn (gen_avx512vl_<code><mode>v8qi2_mask_store_1 (operands[0],
+ operands[1],
+ operands[2]));
+ DONE;
+})
(define_mode_iterator PMOV_SRC_MODE_4 [V4DI V2DI V4SI])
(define_mode_attr pmov_dst_4
@@ -14222,7 +14191,7 @@
(set_attr "prefix" "evex")
(set_attr "mode" "TI")])
-(define_insn "*avx512vl_<code><mode>v4hi2_mask_store_1"
+(define_insn "avx512vl_<code><mode>v4hi2_mask_store_1"
[(set (match_operand:V4HI 0 "memory_operand" "=m")
(vec_merge:V4HI
(any_truncate:V4HI
@@ -14240,30 +14209,19 @@
(set_attr "prefix" "evex")
(set_attr "mode" "TI")])
-(define_insn_and_split "avx512vl_<code><mode>v4hi2_mask_store_2"
- [(set (match_operand:DI 0 "memory_operand")
- (subreg:DI
- (vec_merge:V4HI
- (any_truncate:V4HI
- (match_operand:VI4_128_8_256 1 "register_operand"))
- (vec_select:V4HI
- (subreg:V8HI
- (vec_concat:V2DI
- (match_dup 0)
- (const_int 0)) 0)
- (parallel [(const_int 0) (const_int 1)
- (const_int 2) (const_int 3)]))
- (match_operand:QI 2 "register_operand")) 0))]
- "TARGET_AVX512VL && ix86_pre_reload_split ()"
- "#"
- "&& 1"
- [(set (match_dup 0)
- (vec_merge:V4HI
- (any_truncate:V4HI (match_dup 1))
- (match_dup 0)
- (match_dup 2)))]
- "operands[0] = adjust_address_nv (operands[0], V4HImode, 0);")
-
+(define_expand "avx512vl_<code><mode>v4hi2_mask_store_2"
+ [(match_operand:DI 0 "memory_operand")
+ (any_truncate:V4HI
+ (match_operand:VI4_128_8_256 1 "register_operand"))
+ (match_operand:QI 2 "register_operand")]
+ "TARGET_AVX512VL"
+{
+ operands[0] = adjust_address_nv (operands[0], V4HImode, 0);
+ emit_insn (gen_avx512vl_<code><mode>v4hi2_mask_store_1 (operands[0],
+ operands[1],
+ operands[2]));
+ DONE;
+})
(define_insn "*avx512vl_<code>v2div2hi2_store_1"
[(set (match_operand:V2HI 0 "memory_operand" "=m")
@@ -14324,7 +14282,7 @@
(set_attr "prefix" "evex")
(set_attr "mode" "TI")])
-(define_insn "*avx512vl_<code>v2div2hi2_mask_store_1"
+(define_insn "avx512vl_<code>v2div2hi2_mask_store_1"
[(set (match_operand:V2HI 0 "memory_operand" "=m")
(vec_merge:V2HI
(any_truncate:V2HI
@@ -14338,28 +14296,19 @@
(set_attr "prefix" "evex")
(set_attr "mode" "TI")])
-(define_insn_and_split "avx512vl_<code>v2div2hi2_mask_store_2"
- [(set (match_operand:SI 0 "memory_operand")
- (subreg:SI
- (vec_merge:V2HI
- (any_truncate:V2HI
- (match_operand:V2DI 1 "register_operand"))
- (vec_select:V2HI
- (subreg:V4HI
- (vec_concat:V2SI
- (match_dup 0)
- (const_int 0)) 0)
- (parallel [(const_int 0) (const_int 1)]))
- (match_operand:QI 2 "register_operand")) 0))]
- "TARGET_AVX512VL && ix86_pre_reload_split ()"
- "#"
- "&& 1"
- [(set (match_dup 0)
- (vec_merge:V2HI
- (any_truncate:V2HI (match_dup 1))
- (match_dup 0)
- (match_dup 2)))]
- "operands[0] = adjust_address_nv (operands[0], V2HImode, 0);")
+(define_expand "avx512vl_<code>v2div2hi2_mask_store_2"
+ [(match_operand:SI 0 "memory_operand")
+ (any_truncate:V2HI
+ (match_operand:V2DI 1 "register_operand"))
+ (match_operand:QI 2 "register_operand")]
+ "TARGET_AVX512VL"
+{
+ operands[0] = adjust_address_nv (operands[0], V2HImode, 0);
+ emit_insn (gen_avx512vl_<code>v2div2hi2_mask_store_1 (operands[0],
+ operands[1],
+ operands[2]));
+ DONE;
+})
(define_expand "truncv2div2si2"
[(set (match_operand:V2SI 0 "register_operand")
@@ -14467,7 +14416,7 @@
(set_attr "prefix" "evex")
(set_attr "mode" "TI")])
-(define_insn "*avx512vl_<code>v2div2si2_mask_store_1"
+(define_insn "avx512vl_<code>v2div2si2_mask_store_1"
[(set (match_operand:V2SI 0 "memory_operand" "=m")
(vec_merge:V2SI
(any_truncate:V2SI
@@ -14481,28 +14430,19 @@
(set_attr "prefix" "evex")
(set_attr "mode" "TI")])
-(define_insn_and_split "avx512vl_<code>v2div2si2_mask_store_2"
- [(set (match_operand:DI 0 "memory_operand")
- (subreg:DI
- (vec_merge:V2SI
- (any_truncate:V2SI
- (match_operand:V2DI 1 "register_operand"))
- (vec_select:V2SI
- (subreg:V4SI
- (vec_concat:V2DI
- (match_dup 0)
- (const_int 0)) 0)
- (parallel [(const_int 0) (const_int 1)]))
- (match_operand:QI 2 "register_operand")) 0))]
- "TARGET_AVX512VL && ix86_pre_reload_split ()"
- "#"
- "&& 1"
- [(set (match_dup 0)
- (vec_merge:V2SI
- (any_truncate:V2SI (match_dup 1))
- (match_dup 0)
- (match_dup 2)))]
- "operands[0] = adjust_address_nv (operands[0], V2SImode, 0);")
+(define_expand "avx512vl_<code>v2div2si2_mask_store_2"
+ [(match_operand:DI 0 "memory_operand")
+ (any_truncate:V2SI
+ (match_operand:V2DI 1 "register_operand"))
+ (match_operand:QI 2 "register_operand")]
+ "TARGET_AVX512VL"
+{
+ operands[0] = adjust_address_nv (operands[0], V2SImode, 0);
+ emit_insn (gen_avx512vl_<code>v2div2si2_mask_store_1 (operands[0],
+ operands[1],
+ operands[2]));
+ DONE;
+})
(define_expand "truncv8div8qi2"
[(set (match_operand:V8QI 0 "register_operand")
@@ -14601,7 +14541,7 @@
(set_attr "prefix" "evex")
(set_attr "mode" "TI")])
-(define_insn "*avx512f_<code>v8div16qi2_mask_store_1"
+(define_insn "avx512f_<code>v8div16qi2_mask_store_1"
[(set (match_operand:V8QI 0 "memory_operand" "=m")
(vec_merge:V8QI
(any_truncate:V8QI
@@ -14615,31 +14555,19 @@
(set_attr "prefix" "evex")
(set_attr "mode" "TI")])
-(define_insn_and_split "avx512f_<code>v8div16qi2_mask_store_2"
- [(set (match_operand:DI 0 "memory_operand")
- (subreg:DI
- (vec_merge:V8QI
- (any_truncate:V8QI
- (match_operand:V8DI 1 "register_operand"))
- (vec_select:V8QI
- (subreg:V16QI
- (vec_concat:V2DI
- (match_dup 0)
- (const_int 0)) 0)
- (parallel [(const_int 0) (const_int 1)
- (const_int 2) (const_int 3)
- (const_int 4) (const_int 5)
- (const_int 6) (const_int 7)]))
- (match_operand:QI 2 "register_operand")) 0))]
- "TARGET_AVX512F && ix86_pre_reload_split ()"
- "#"
- "&& 1"
- [(set (match_dup 0)
- (vec_merge:V8QI
- (any_truncate:V8QI (match_dup 1))
- (match_dup 0)
- (match_dup 2)))]
- "operands[0] = adjust_address_nv (operands[0], V8QImode, 0);")
+(define_expand "avx512f_<code>v8div16qi2_mask_store_2"
+ [(match_operand:DI 0 "memory_operand")
+ (any_truncate:V8QI
+ (match_operand:V8DI 1 "register_operand"))
+ (match_operand:QI 2 "register_operand")]
+ "TARGET_AVX512F"
+{
+ operands[0] = adjust_address_nv (operands[0], V8QImode, 0);
+ emit_insn (gen_avx512f_<code>v8div16qi2_mask_store_1 (operands[0],
+ operands[1],
+ operands[2]));
+ DONE;
+})
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
diff --git a/gcc/testsuite/gcc.target/i386/pr117318.c b/gcc/testsuite/gcc.target/i386/pr117318.c
new file mode 100644
index 00000000000..3d316ad04cf
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr117318.c
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-options "-mavx512f -O" } */
+
+typedef __attribute__((__vector_size__ (64))) long long V;
+unsigned long long x;
+
+unsigned long long
+foo()
+{
+ __builtin_ia32_pmovusqb512mem_mask (&x, (V){8000000000000000}, 255);
+ return x;
+}
--
2.31.1
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。