i386: Fix isa attribute for TI/TF andnot mode

Message ID 20231107022734.368277-1-haochen.jiang@intel.com
State Unresolved
Headers
Series i386: Fix isa attribute for TI/TF andnot mode |

Checks

Context Check Description
snail/gcc-patch-check warning Git am fail log

Commit Message

Jiang, Haochen Nov. 7, 2023, 2:27 a.m. UTC
  Hi all,

This patch aims fo fix the wrong isa attribute which caused regression
on PR111907.

Regtested on x86_64-pc-linux-gnu. Ok for trunk?

Thx,
Haochen

gcc/ChangeLog:

	PR target/111907
	* config/i386/i386.md (avx_noavx512vl): Add missing definition.
	* config/i386/sse.md (*andnot<mode>3): Change isa attribute from
	avx_noavx512f to avx_noavx512vl.

gcc/testsuite/ChangeLog:

	PR target/111907
	* gcc.target/i386/pr111907.c: New test.
---
 gcc/config/i386/i386.md                  | 2 ++
 gcc/config/i386/sse.md                   | 2 +-
 gcc/testsuite/gcc.target/i386/pr111907.c | 8 ++++++++
 3 files changed, 11 insertions(+), 1 deletion(-)
 create mode 100644 gcc/testsuite/gcc.target/i386/pr111907.c
  

Comments

Hongtao Liu Nov. 7, 2023, 2:39 a.m. UTC | #1
On Tue, Nov 7, 2023 at 10:27 AM Haochen Jiang <haochen.jiang@intel.com> wrote:
>
> Hi all,
>
> This patch aims fo fix the wrong isa attribute which caused regression
> on PR111907.
>
> Regtested on x86_64-pc-linux-gnu. Ok for trunk?
>
> Thx,
> Haochen
>
> gcc/ChangeLog:
>
>         PR target/111907
>         * config/i386/i386.md (avx_noavx512vl): Add missing definition.
Add new isa attribute.
Others LGTM.
>         * config/i386/sse.md (*andnot<mode>3): Change isa attribute from
>         avx_noavx512f to avx_noavx512vl.
>
> gcc/testsuite/ChangeLog:
>
>         PR target/111907
>         * gcc.target/i386/pr111907.c: New test.
> ---
>  gcc/config/i386/i386.md                  | 2 ++
>  gcc/config/i386/sse.md                   | 2 +-
>  gcc/testsuite/gcc.target/i386/pr111907.c | 8 ++++++++
>  3 files changed, 11 insertions(+), 1 deletion(-)
>  create mode 100644 gcc/testsuite/gcc.target/i386/pr111907.c
>
> diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md
> index ecc74e9994e..8f2f6e5d908 100644
> --- a/gcc/config/i386/i386.md
> +++ b/gcc/config/i386/i386.md
> @@ -919,6 +919,8 @@
>          (eq_attr "isa" "avx") (symbol_ref "TARGET_AVX")
>          (eq_attr "isa" "avx_noavx512f")
>            (symbol_ref "TARGET_AVX && !TARGET_AVX512F")
> +        (eq_attr "isa" "avx_noavx512vl")
> +          (symbol_ref "TARGET_AVX && !TARGET_AVX512VL")
>          (eq_attr "isa" "noavx") (symbol_ref "!TARGET_AVX")
>          (eq_attr "isa" "avx2") (symbol_ref "TARGET_AVX2")
>          (eq_attr "isa" "noavx2") (symbol_ref "!TARGET_AVX2")
> diff --git a/gcc/config/i386/sse.md b/gcc/config/i386/sse.md
> index e6a5c7911d5..33198756bb0 100644
> --- a/gcc/config/i386/sse.md
> +++ b/gcc/config/i386/sse.md
> @@ -5169,7 +5169,7 @@
>    output_asm_insn (buf, operands);
>    return "";
>  }
> -  [(set_attr "isa" "noavx,avx_noavx512f,avx512vl,avx512f_512")
> +  [(set_attr "isa" "noavx,avx_noavx512vl,avx512vl,avx512f_512")
>     (set_attr "addr" "*,gpr16,*,*")
>     (set_attr "type" "sselog")
>     (set (attr "prefix_data16")
> diff --git a/gcc/testsuite/gcc.target/i386/pr111907.c b/gcc/testsuite/gcc.target/i386/pr111907.c
> new file mode 100644
> index 00000000000..5275e9400ed
> --- /dev/null
> +++ b/gcc/testsuite/gcc.target/i386/pr111907.c
> @@ -0,0 +1,8 @@
> +/* { dg-do compile } */
> +/* { dg-options "-mavx512f -mno-evex512" } */
> +
> +_Float128
> +foo (_Float128 d, _Float128 e)
> +{
> +  return __builtin_copysignf128 (d, e);
> +}
> --
> 2.31.1
>
  

Patch

diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md
index ecc74e9994e..8f2f6e5d908 100644
--- a/gcc/config/i386/i386.md
+++ b/gcc/config/i386/i386.md
@@ -919,6 +919,8 @@ 
 	 (eq_attr "isa" "avx") (symbol_ref "TARGET_AVX")
 	 (eq_attr "isa" "avx_noavx512f")
 	   (symbol_ref "TARGET_AVX && !TARGET_AVX512F")
+	 (eq_attr "isa" "avx_noavx512vl")
+	   (symbol_ref "TARGET_AVX && !TARGET_AVX512VL")
 	 (eq_attr "isa" "noavx") (symbol_ref "!TARGET_AVX")
 	 (eq_attr "isa" "avx2") (symbol_ref "TARGET_AVX2")
 	 (eq_attr "isa" "noavx2") (symbol_ref "!TARGET_AVX2")
diff --git a/gcc/config/i386/sse.md b/gcc/config/i386/sse.md
index e6a5c7911d5..33198756bb0 100644
--- a/gcc/config/i386/sse.md
+++ b/gcc/config/i386/sse.md
@@ -5169,7 +5169,7 @@ 
   output_asm_insn (buf, operands);
   return "";
 }
-  [(set_attr "isa" "noavx,avx_noavx512f,avx512vl,avx512f_512")
+  [(set_attr "isa" "noavx,avx_noavx512vl,avx512vl,avx512f_512")
    (set_attr "addr" "*,gpr16,*,*")
    (set_attr "type" "sselog")
    (set (attr "prefix_data16")
diff --git a/gcc/testsuite/gcc.target/i386/pr111907.c b/gcc/testsuite/gcc.target/i386/pr111907.c
new file mode 100644
index 00000000000..5275e9400ed
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr111907.c
@@ -0,0 +1,8 @@ 
+/* { dg-do compile } */
+/* { dg-options "-mavx512f -mno-evex512" } */
+
+_Float128
+foo (_Float128 d, _Float128 e)
+{
+  return __builtin_copysignf128 (d, e);
+}