aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorKyrylo Tkachov <kyrylo.tkachov@arm.com>2016-02-17 13:42:35 +0000
committerKyrylo Tkachov <ktkachov@gcc.gnu.org>2016-02-17 13:42:35 +0000
commita44e0ebb89e453c6663104be721622949f0a885e (patch)
treee0af4443979d7f6854a77a72f719f39a9d8f7c8b /gcc
parentac4bf40708c5e2f97e5b9e0b066e458c9fe443e8 (diff)
downloadgcc-a44e0ebb89e453c6663104be721622949f0a885e.zip
gcc-a44e0ebb89e453c6663104be721622949f0a885e.tar.gz
gcc-a44e0ebb89e453c6663104be721622949f0a885e.tar.bz2
[AArch64] PR target/69161: Don't use special predicate for CCmode comparisons in expressions that require matching modes
PR target/69161 * config/aarch64/predicates.md (aarch64_comparison_operator_mode): New predicate. (aarch64_comparison_operator): Break overly long line into two. (aarch64_comparison_operation): Likewise. * config/aarch64/aarch64.md (cstorecc4): Use aarch64_comparison_operator_mode instead of aarch64_comparison_operator. (cstore<mode>4): Likewise. (aarch64_cstore<mode>): Likewise. (*cstoresi_insn_uxtw): Likewise. (cstore<mode>_neg): Likewise. (*cstoresi_neg_uxtw): Likewise. * gcc.c-torture/compile/pr69161.c: New test. From-SVN: r233496
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog16
-rw-r--r--gcc/config/aarch64/aarch64.md12
-rw-r--r--gcc/config/aarch64/predicates.md13
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr69161.c19
5 files changed, 57 insertions, 8 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 5f4bd78..6d2a4bd 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,6 +1,22 @@
2016-02-17 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
PR target/69161
+ * config/aarch64/predicates.md (aarch64_comparison_operator_mode):
+ New predicate.
+ (aarch64_comparison_operator): Break overly long line into two.
+ (aarch64_comparison_operation): Likewise.
+ * config/aarch64/aarch64.md (cstorecc4): Use
+ aarch64_comparison_operator_mode instead of
+ aarch64_comparison_operator.
+ (cstore<mode>4): Likewise.
+ (aarch64_cstore<mode>): Likewise.
+ (*cstoresi_insn_uxtw): Likewise.
+ (cstore<mode>_neg): Likewise.
+ (*cstoresi_neg_uxtw): Likewise.
+
+2016-02-17 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
+
+ PR target/69161
* config/arm/predicates.md (arm_comparison_operator_mode):
New predicate.
* config/arm/arm.md (*mov_scc): Use arm_comparison_operator_mode
diff --git a/gcc/config/aarch64/aarch64.md b/gcc/config/aarch64/aarch64.md
index 77bd191..68676c9 100644
--- a/gcc/config/aarch64/aarch64.md
+++ b/gcc/config/aarch64/aarch64.md
@@ -3039,7 +3039,7 @@
(define_expand "cstorecc4"
[(set (match_operand:SI 0 "register_operand")
- (match_operator 1 "aarch64_comparison_operator"
+ (match_operator 1 "aarch64_comparison_operator_mode"
[(match_operand 2 "cc_register")
(match_operand 3 "const0_operand")]))]
""
@@ -3051,7 +3051,7 @@
(define_expand "cstore<mode>4"
[(set (match_operand:SI 0 "register_operand" "")
- (match_operator:SI 1 "aarch64_comparison_operator"
+ (match_operator:SI 1 "aarch64_comparison_operator_mode"
[(match_operand:GPF 2 "register_operand" "")
(match_operand:GPF 3 "aarch64_fp_compare_operand" "")]))]
""
@@ -3064,7 +3064,7 @@
(define_insn "aarch64_cstore<mode>"
[(set (match_operand:ALLI 0 "register_operand" "=r")
- (match_operator:ALLI 1 "aarch64_comparison_operator"
+ (match_operator:ALLI 1 "aarch64_comparison_operator_mode"
[(match_operand 2 "cc_register" "") (const_int 0)]))]
""
"cset\\t%<w>0, %m1"
@@ -3109,7 +3109,7 @@
(define_insn "*cstoresi_insn_uxtw"
[(set (match_operand:DI 0 "register_operand" "=r")
(zero_extend:DI
- (match_operator:SI 1 "aarch64_comparison_operator"
+ (match_operator:SI 1 "aarch64_comparison_operator_mode"
[(match_operand 2 "cc_register" "") (const_int 0)])))]
""
"cset\\t%w0, %m1"
@@ -3118,7 +3118,7 @@
(define_insn "cstore<mode>_neg"
[(set (match_operand:ALLI 0 "register_operand" "=r")
- (neg:ALLI (match_operator:ALLI 1 "aarch64_comparison_operator"
+ (neg:ALLI (match_operator:ALLI 1 "aarch64_comparison_operator_mode"
[(match_operand 2 "cc_register" "") (const_int 0)])))]
""
"csetm\\t%<w>0, %m1"
@@ -3129,7 +3129,7 @@
(define_insn "*cstoresi_neg_uxtw"
[(set (match_operand:DI 0 "register_operand" "=r")
(zero_extend:DI
- (neg:SI (match_operator:SI 1 "aarch64_comparison_operator"
+ (neg:SI (match_operator:SI 1 "aarch64_comparison_operator_mode"
[(match_operand 2 "cc_register" "") (const_int 0)]))))]
""
"csetm\\t%w0, %m1"
diff --git a/gcc/config/aarch64/predicates.md b/gcc/config/aarch64/predicates.md
index e80e406..1186827 100644
--- a/gcc/config/aarch64/predicates.md
+++ b/gcc/config/aarch64/predicates.md
@@ -229,10 +229,19 @@
;; True for integer comparisons and for FP comparisons other than LTGT or UNEQ.
(define_special_predicate "aarch64_comparison_operator"
- (match_code "eq,ne,le,lt,ge,gt,geu,gtu,leu,ltu,unordered,ordered,unlt,unle,unge,ungt"))
+ (match_code "eq,ne,le,lt,ge,gt,geu,gtu,leu,ltu,unordered,
+ ordered,unlt,unle,unge,ungt"))
+
+;; Same as aarch64_comparison_operator but don't ignore the mode.
+;; RTL SET operations require their operands source and destination have
+;; the same modes, so we can't ignore the modes there. See PR target/69161.
+(define_predicate "aarch64_comparison_operator_mode"
+ (match_code "eq,ne,le,lt,ge,gt,geu,gtu,leu,ltu,unordered,
+ ordered,unlt,unle,unge,ungt"))
(define_special_predicate "aarch64_comparison_operation"
- (match_code "eq,ne,le,lt,ge,gt,geu,gtu,leu,ltu,unordered,ordered,unlt,unle,unge,ungt")
+ (match_code "eq,ne,le,lt,ge,gt,geu,gtu,leu,ltu,unordered,
+ ordered,unlt,unle,unge,ungt")
{
if (XEXP (op, 1) != const0_rtx)
return false;
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index ffe84ee..660d471 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2016-02-17 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
+
+ PR target/69161
+ * gcc.c-torture/compile/pr69161.c: New test.
+
2016-02-17 David Sherwood <david.sherwood@arm.com>
PR target/69532
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr69161.c b/gcc/testsuite/gcc.c-torture/compile/pr69161.c
new file mode 100644
index 0000000..fdbb63f
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr69161.c
@@ -0,0 +1,19 @@
+/* PR target/69161. */
+
+char a;
+int b, c, d, e;
+
+void
+foo (void)
+{
+ int f;
+ for (f = 0; f <= 4; f++)
+ {
+ for (d = 0; d < 20; d++)
+ {
+ __INTPTR_TYPE__ g = (__INTPTR_TYPE__) & c;
+ b &= (0 != g) > e;
+ }
+ e &= a;
+ }
+}