[gcc r16-6426] [APX] i386: Use setzucc by default when APX-ZU enabled
Hongyu Wang
hongyuw@gcc.gnu.org
Mon Dec 29 01:20:22 GMT 2025
https://gcc.gnu.org/g:cac032367da5a7df020eaebf7e701d6a82b4e8d6
commit r16-6426-gcac032367da5a7df020eaebf7e701d6a82b4e8d6
Author: Hongyu Wang <hongyu.wang@intel.com>
Date: Wed May 21 09:45:03 2025 +0800
[APX] i386: Use setzucc by default when APX-ZU enabled
When APX-ZU enabled, all legacy setcc can directly use zu sematic to
avoid potential partial-dependency.
gcc/ChangeLog:
* config/i386/i386.md (*setcc_qi): Force output setzucc for
reg operand[0].
(*setcc_qi_slp): Likewise.
gcc/testsuite/ChangeLog:
* gcc.target/i386/apx-zu-3.c: New test.
Diff:
---
gcc/config/i386/i386.md | 15 +++++++++++++--
gcc/testsuite/gcc.target/i386/apx-zu-3.c | 8 ++++++++
2 files changed, 21 insertions(+), 2 deletions(-)
diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md
index cae1e1016e05..ccc927ca5ec0 100644
--- a/gcc/config/i386/i386.md
+++ b/gcc/config/i386/i386.md
@@ -19880,7 +19880,13 @@
(match_operator:QI 1 "ix86_comparison_operator"
[(reg FLAGS_REG) (const_int 0)]))]
""
- "set%C1\t%0"
+{
+ if (REG_P (operands[0])
+ && TARGET_APX_ZU)
+ return "setzu%C1\t%0";
+ else
+ return "set%C1\t%0";
+}
[(set_attr "type" "setcc")
(set_attr "mode" "QI")])
@@ -19889,7 +19895,12 @@
(match_operator:QI 1 "ix86_comparison_operator"
[(reg FLAGS_REG) (const_int 0)]))]
""
- "set%C1\t%0"
+{
+ if (TARGET_APX_ZU)
+ return "setzu%C1\t%0";
+ else
+ return "set%C1\t%0";
+}
[(set_attr "type" "setcc")
(set_attr "mode" "QI")])
diff --git a/gcc/testsuite/gcc.target/i386/apx-zu-3.c b/gcc/testsuite/gcc.target/i386/apx-zu-3.c
new file mode 100644
index 000000000000..3028c939c9d0
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/apx-zu-3.c
@@ -0,0 +1,8 @@
+/* { dg-do compile { target { ! ia32 } } } */
+/* { dg-options "-mapxf -march=x86-64 -O2" } */
+/* { dg-final { scan-assembler-times "setzune" 1} } */
+
+char foo0 (int a)
+{
+ return a == 0 ? 0 : 1;
+}
More information about the Gcc-cvs
mailing list