Skip to content

Commit cac0323

Browse files
committed
[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.
1 parent c93e74a commit cac0323

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

gcc/config/i386/i386.md

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19880,7 +19880,13 @@
1988019880
(match_operator:QI 1 "ix86_comparison_operator"
1988119881
[(reg FLAGS_REG) (const_int 0)]))]
1988219882
""
19883-
"set%C1\t%0"
19883+
{
19884+
if (REG_P (operands[0])
19885+
&& TARGET_APX_ZU)
19886+
return "setzu%C1\t%0";
19887+
else
19888+
return "set%C1\t%0";
19889+
}
1988419890
[(set_attr "type" "setcc")
1988519891
(set_attr "mode" "QI")])
1988619892

@@ -19889,7 +19895,12 @@
1988919895
(match_operator:QI 1 "ix86_comparison_operator"
1989019896
[(reg FLAGS_REG) (const_int 0)]))]
1989119897
""
19892-
"set%C1\t%0"
19898+
{
19899+
if (TARGET_APX_ZU)
19900+
return "setzu%C1\t%0";
19901+
else
19902+
return "set%C1\t%0";
19903+
}
1989319904
[(set_attr "type" "setcc")
1989419905
(set_attr "mode" "QI")])
1989519906

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/* { dg-do compile { target { ! ia32 } } } */
2+
/* { dg-options "-mapxf -march=x86-64 -O2" } */
3+
/* { dg-final { scan-assembler-times "setzune" 1} } */
4+
5+
char foo0 (int a)
6+
{
7+
return a == 0 ? 0 : 1;
8+
}

0 commit comments

Comments
 (0)