aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite
diff options
context:
space:
mode:
authorKong Lingling <lingling.kong@intel.com>2023-05-19 17:15:52 +0800
committerHongyu Wang <hongyu.wang@intel.com>2023-12-07 09:31:14 +0800
commit042519b61772c3fd7aa1bb9b492e1df75df23eb5 (patch)
tree74d26cf677951e282e1476f90d50ca83493bfcdf /gcc/testsuite
parent57fdb5c2440a8b9d8d0b2dd8be866b6ae012a788 (diff)
downloadgcc-042519b61772c3fd7aa1bb9b492e1df75df23eb5.zip
gcc-042519b61772c3fd7aa1bb9b492e1df75df23eb5.tar.gz
gcc-042519b61772c3fd7aa1bb9b492e1df75df23eb5.tar.bz2
[APX NDD] Support APX NDD for neg insn
gcc/ChangeLog: * config/i386/i386-expand.cc (ix86_expand_unary_operator): Add use_ndd parameter and adjust for NDD. * config/i386/i386-protos.h: Add use_ndd parameter for ix86_unary_operator_ok and ix86_expand_unary_operator. * config/i386/i386.cc (ix86_unary_operator_ok): Add use_ndd parameter and adjust for NDD. * config/i386/i386.md (neg<mode>2): Add new constraint for NDD and adjust output template. (*neg<mode>_1): Likewise. (*neg<dwi>2_doubleword): Likewise and adopt '&' to NDD dest. (*neg<mode>_2): Likewise. (*neg<mode>_ccc_1): Likewise. (*neg<mode>_ccc_2): Likewise. (*negsi_1_zext): Likewise, and use nonimmediate_operand for operands[1] to accept memory input for NDD alternatives. (*negsi_2_zext): Likewise. gcc/testsuite/ChangeLog: * gcc.target/i386/apx-ndd.c: Add neg test.
Diffstat (limited to 'gcc/testsuite')
-rw-r--r--gcc/testsuite/gcc.target/i386/apx-ndd.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.target/i386/apx-ndd.c b/gcc/testsuite/gcc.target/i386/apx-ndd.c
index 0c7952e..c351f71 100644
--- a/gcc/testsuite/gcc.target/i386/apx-ndd.c
+++ b/gcc/testsuite/gcc.target/i386/apx-ndd.c
@@ -27,8 +27,25 @@ foo2_##OP_NAME##_##TYPE (TYPE *a, TYPE b) \
{ \
TYPE c = *a OP b; \
return c; \
+}
+
+#define F(TYPE, OP_NAME, OP) \
+TYPE \
+__attribute__ ((noipa)) \
+f_##OP_NAME##_##TYPE (TYPE *a) \
+{ \
+ TYPE b = OP*a; \
+ return b; \
}
+#define F1(TYPE, OP_NAME, OP) \
+TYPE \
+__attribute__ ((noipa)) \
+f1_##OP_NAME##_##TYPE (TYPE a) \
+{ \
+ TYPE b = OP a; \
+ return b; \
+}
FOO (char, add, +)
FOO1 (char, add, +)
FOO2 (char, add, +)
@@ -50,8 +67,20 @@ FOO (int, sub, -)
FOO1 (int, sub, -)
FOO (long, sub, -)
FOO1 (long, sub, -)
+
+F (char, neg, -)
+F1 (char, neg, -)
+F (short, neg, -)
+F1 (short, neg, -)
+F (int, neg, -)
+F1 (int, neg, -)
+F (long, neg, -)
+F1 (long, neg, -)
/* { dg-final { scan-assembler-times "add(?:b|l|w|q)\[^\n\r]*1, \\(%rdi\\), %(?:|r|e)a(?:x|l)" 4 } } */
/* { dg-final { scan-assembler-times "lea(?:l|q)\[^\n\r]\\(%r(?:d|s)i,%r(?:d|s)i\\), %(?:|r|e)ax" 4 } } */
/* { dg-final { scan-assembler-times "add(?:b|l|w|q)\[^\n\r]%(?:|r|e)si(?:|l), \\(%rdi\\), %(?:|r|e)a(?:x|l)" 4 } } */
/* { dg-final { scan-assembler-times "sub(?:b|l|w|q)\[^\n\r]*1, \\(%rdi\\), %(?:|r|e)a(?:x|l)" 4 } } */
/* { dg-final { scan-assembler-times "sub(?:b|l|w|q)\[^\n\r]%(?:|r|e)si(?:|l), %(?:|r|e)di, %(?:|r|e)a(?:x|l)" 4 } } */
+/* { dg-final { scan-assembler-times "negb\[^\n\r]\\(%rdi\\), %(?:|r|e)al" 1 } } */
+/* { dg-final { scan-assembler-times "neg(?:l|w|q)\[^\n\r]\\(%rdi\\), %(?:|r|e)ax" 3 } } */
+/* { dg-final { scan-assembler-times "neg(?:l|w|q)\[^\n\r]%(?:|r|e)di, %(?:|r|e)ax" 4 } } */