[AArch64] Fix possible wrong code generation when comparing DImode values.
authorJames Greenhalgh <james.greenhalgh@arm.com>
Thu, 23 May 2013 10:18:19 +0000 (10:18 +0000)
committerJames Greenhalgh <jgreenhalgh@gcc.gnu.org>
Thu, 23 May 2013 10:18:19 +0000 (10:18 +0000)
gcc/
* config/aarch64/aarch64-simd.md
(aarch64_cm<optab>di): Add clobber of CC_REGNUM to unsplit pattern.

From-SVN: r199241

gcc/ChangeLog
gcc/config/aarch64/aarch64-simd.md

index b9c78a81c86991ebf945ef3a571da721bc326ba7..fdfa20c0ddc2811bd3ed1eae9a5f4393edefff4a 100644 (file)
@@ -1,3 +1,8 @@
+2013-05-23  James Greenhalgh  <james.greenhalgh@arm.com>
+
+       * config/aarch64/aarch64-simd.md
+       (aarch64_cm<optab>di): Add clobber of CC_REGNUM to unsplit pattern.
+
 2013-05-23  Richard Biener  <rguenther@suse.de>
 
        PR middle-end/57381
index 9069a73c46c9cdc5f75f00c7d0c0d1dc015bae79..f91cf814accdd681f09a7c06ed4e2242425f979c 100644 (file)
          (COMPARISONS:DI
            (match_operand:DI 1 "register_operand" "w,w,r")
            (match_operand:DI 2 "aarch64_simd_reg_or_zero" "w,ZDz,r")
-         )))]
+         )))
+     (clobber (reg:CC CC_REGNUM))]
   "TARGET_SIMD"
   "@
   cm<n_optab>\t%d0, %d<cmp_1>, %d<cmp_2>
       happening in the 'w' constraint cases.  */
    && GP_REGNUM_P (REGNO (operands[0]))
    && GP_REGNUM_P (REGNO (operands[1]))"
-  [(set (reg:CC CC_REGNUM)
-    (compare:CC
-      (match_dup 1)
-      (match_dup 2)))
-  (set (match_dup 0)
-    (neg:DI
-      (COMPARISONS:DI
-       (match_operand 3 "cc_register" "")
-       (const_int 0))))]
+  [(const_int 0)]
   {
     enum machine_mode mode = SELECT_CC_MODE (<CMP>, operands[1], operands[2]);
     rtx cc_reg = aarch64_gen_compare_reg (<CMP>, operands[1], operands[2]);
          (UCOMPARISONS:DI
            (match_operand:DI 1 "register_operand" "w,r")
            (match_operand:DI 2 "aarch64_simd_reg_or_zero" "w,r")
-         )))]
+         )))
+    (clobber (reg:CC CC_REGNUM))]
   "TARGET_SIMD"
   "@
   cm<n_optab>\t%d0, %d<cmp_1>, %d<cmp_2>
       happening in the 'w' constraint cases.  */
    && GP_REGNUM_P (REGNO (operands[0]))
    && GP_REGNUM_P (REGNO (operands[1]))"
-  [(set (reg:CC CC_REGNUM)
-    (compare:CC
-      (match_dup 1)
-      (match_dup 2)))
-  (set (match_dup 0)
-    (neg:DI
-      (UCOMPARISONS:DI
-       (match_operand 3 "cc_register" "")
-       (const_int 0))))]
+  [(const_int 0)]
   {
-    enum machine_mode mode = SELECT_CC_MODE (<CMP>, operands[1], operands[2]);
+    enum machine_mode mode = CCmode;
     rtx cc_reg = aarch64_gen_compare_reg (<CMP>, operands[1], operands[2]);
     rtx comparison = gen_rtx_<CMP> (mode, operands[1], operands[2]);
     emit_insn (gen_cstoredi_neg (operands[0], comparison, cc_reg));
            (and:DI
              (match_operand:DI 1 "register_operand" "w,r")
              (match_operand:DI 2 "register_operand" "w,r"))
-           (const_int 0))))]
+           (const_int 0))))
+    (clobber (reg:CC CC_REGNUM))]
   "TARGET_SIMD"
   "@
   cmtst\t%d0, %d1, %d2
       happening in the 'w' constraint cases.  */
    && GP_REGNUM_P (REGNO (operands[0]))
    && GP_REGNUM_P (REGNO (operands[1]))"
-   [(set (reg:CC_NZ CC_REGNUM)
-       (compare:CC_NZ
-        (and:DI (match_dup 1)
-                 (match_dup 2))
-        (const_int 0)))
-  (set (match_dup 0)
-    (neg:DI
-      (ne:DI
-       (match_operand 3 "cc_register" "")
-       (const_int 0))))]
+  [(const_int 0)]
   {
     rtx and_tree = gen_rtx_AND (DImode, operands[1], operands[2]);
     enum machine_mode mode = SELECT_CC_MODE (NE, and_tree, const0_rtx);