aboutsummaryrefslogtreecommitdiff
path: root/gcc/config
diff options
context:
space:
mode:
authorHongyu Wang <hongyu.wang@intel.com>2024-05-09 10:12:16 +0800
committerHongyu Wang <hongyu.wang@intel.com>2024-06-13 15:57:15 +0800
commit99e6cf404e37655be303e71f20df03c284c7989e (patch)
tree3ce5ce00139645bf6e784647e34994a37a68d054 /gcc/config
parent14820327c720dad2ca34eb9fa73c0d9b435b6688 (diff)
downloadgcc-99e6cf404e37655be303e71f20df03c284c7989e.zip
gcc-99e6cf404e37655be303e71f20df03c284c7989e.tar.gz
gcc-99e6cf404e37655be303e71f20df03c284c7989e.tar.bz2
[APX CCMP] Use ctestcc when comparing to const 0
For CTEST, we don't have conditional AND so there's no optimization opportunity to write a new ctest pattern. Emit ctest when ccmp did comparison to const 0 to save bytes. gcc/ChangeLog: * config/i386/i386.md (@ccmp<mode>): Add new alternative <r>,C and adjust output templates. Also adjust UNSPEC mode to CCmode. gcc/testsuite/ChangeLog: * gcc.target/i386/apx-ccmp-1.c: Adjust output to scan ctest. * gcc.target/i386/apx-ccmp-2.c: Adjust some condition to compare with 0.
Diffstat (limited to 'gcc/config')
-rw-r--r--gcc/config/i386/i386.md11
1 files changed, 7 insertions, 4 deletions
diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md
index 5fc2bae..fd48e76 100644
--- a/gcc/config/i386/i386.md
+++ b/gcc/config/i386/i386.md
@@ -1515,14 +1515,17 @@
(match_operator 1 "comparison_operator"
[(reg:CC FLAGS_REG) (const_int 0)])
(compare:CC
- (minus:SWI (match_operand:SWI 2 "nonimmediate_operand" "<r>m,<r>")
- (match_operand:SWI 3 "<general_operand>" "<r><i>,<r><m>"))
+ (minus:SWI (match_operand:SWI 2 "nonimmediate_operand" "<r>,<r>m,<r>")
+ (match_operand:SWI 3 "<general_operand>" "C,<r><i>,<m>"))
(const_int 0))
- (unspec:SI
+ (unspec:CC
[(match_operand:SI 4 "const_0_to_15_operand")]
UNSPEC_APX_DFV)))]
"TARGET_APX_CCMP"
- "ccmp%C1{<imodesuffix>}\t%G4 {%3, %2|%2, %3}"
+ "@
+ ctest%C1{<imodesuffix>}\t%G4 %2, %2
+ ccmp%C1{<imodesuffix>}\t%G4 {%3, %2|%2, %3}
+ ccmp%C1{<imodesuffix>}\t%G4 {%3, %2|%2, %3}"
[(set_attr "type" "icmp")
(set_attr "mode" "<MODE>")
(set_attr "length_immediate" "1")