* config/i386/i386.md: Use FLAGS_REG everywhere.
authorRichard Henderson <rth@redhat.com>
Thu, 9 Dec 2004 07:21:19 +0000 (23:21 -0800)
committerRichard Henderson <rth@gcc.gnu.org>
Thu, 9 Dec 2004 07:21:19 +0000 (23:21 -0800)
From-SVN: r91927

gcc/ChangeLog
gcc/config/i386/i386.md

index f9fa30f99a57a10f2394e55e83d8eed8bcdc717e..666b76c4ffdf66e58f493f83c3c303426f161d0e 100644 (file)
@@ -1,3 +1,7 @@
+2004-12-08  Richard Henderson  <rth@redhat.com>
+
+       * config/i386/i386.md: Use FLAGS_REG everywhere.
+
 2004-12-08  Eric Christopher  <echristo@redhat.com>
 
        * config/mips/mips.c (mips_scalar_mode_supported_p): Rewrite
index 84b97e86805ec8976c0499e359ab833d717d6174..0d2ccb2bbb42265a4dc822c800934c3616e58c52 100644 (file)
 })
 
 (define_insn "cmpdi_ccno_1_rex64"
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
        (compare (match_operand:DI 0 "nonimmediate_operand" "r,?mr")
                 (match_operand:DI 1 "const0_operand" "n,n")))]
   "TARGET_64BIT && ix86_match_ccmode (insn, CCNOmode)"
    (set_attr "mode" "DI")])
 
 (define_insn "*cmpdi_minus_1_rex64"
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
        (compare (minus:DI (match_operand:DI 0 "nonimmediate_operand" "rm,r")
                           (match_operand:DI 1 "x86_64_general_operand" "re,mr"))
                 (const_int 0)))]
   "")
 
 (define_insn "cmpdi_1_insn_rex64"
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
        (compare (match_operand:DI 0 "nonimmediate_operand" "mr,r")
                 (match_operand:DI 1 "x86_64_general_operand" "re,mr")))]
   "TARGET_64BIT && ix86_match_ccmode (insn, CCmode)"
 
 
 (define_insn "*cmpsi_ccno_1"
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
        (compare (match_operand:SI 0 "nonimmediate_operand" "r,?mr")
                 (match_operand:SI 1 "const0_operand" "n,n")))]
   "ix86_match_ccmode (insn, CCNOmode)"
    (set_attr "mode" "SI")])
 
 (define_insn "*cmpsi_minus_1"
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
        (compare (minus:SI (match_operand:SI 0 "nonimmediate_operand" "rm,r")
                           (match_operand:SI 1 "general_operand" "ri,mr"))
                 (const_int 0)))]
   "")
 
 (define_insn "*cmpsi_1_insn"
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
        (compare (match_operand:SI 0 "nonimmediate_operand" "rm,r")
                 (match_operand:SI 1 "general_operand" "ri,mr")))]
   "(GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)
    (set_attr "mode" "SI")])
 
 (define_insn "*cmphi_ccno_1"
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
        (compare (match_operand:HI 0 "nonimmediate_operand" "r,?mr")
                 (match_operand:HI 1 "const0_operand" "n,n")))]
   "ix86_match_ccmode (insn, CCNOmode)"
    (set_attr "mode" "HI")])
 
 (define_insn "*cmphi_minus_1"
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
        (compare (minus:HI (match_operand:HI 0 "nonimmediate_operand" "rm,r")
                           (match_operand:HI 1 "general_operand" "ri,mr"))
                 (const_int 0)))]
    (set_attr "mode" "HI")])
 
 (define_insn "*cmphi_1"
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
        (compare (match_operand:HI 0 "nonimmediate_operand" "rm,r")
                 (match_operand:HI 1 "general_operand" "ri,mr")))]
   "(GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)
    (set_attr "mode" "HI")])
 
 (define_insn "*cmpqi_ccno_1"
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
        (compare (match_operand:QI 0 "nonimmediate_operand" "q,?mq")
                 (match_operand:QI 1 "const0_operand" "n,n")))]
   "ix86_match_ccmode (insn, CCNOmode)"
    (set_attr "mode" "QI")])
 
 (define_insn "*cmpqi_1"
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
        (compare (match_operand:QI 0 "nonimmediate_operand" "qm,q")
                 (match_operand:QI 1 "general_operand" "qi,mq")))]
   "(GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)
    (set_attr "mode" "QI")])
 
 (define_insn "*cmpqi_minus_1"
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
        (compare (minus:QI (match_operand:QI 0 "nonimmediate_operand" "qm,q")
                           (match_operand:QI 1 "general_operand" "qi,mq"))
                 (const_int 0)))]
    (set_attr "mode" "QI")])
 
 (define_insn "*cmpqi_ext_1"
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
        (compare
          (match_operand:QI 0 "general_operand" "Qm")
          (subreg:QI
    (set_attr "mode" "QI")])
 
 (define_insn "*cmpqi_ext_1_rex64"
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
        (compare
          (match_operand:QI 0 "register_operand" "Q")
          (subreg:QI
    (set_attr "mode" "QI")])
 
 (define_insn "*cmpqi_ext_2"
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
        (compare
          (subreg:QI
            (zero_extract:SI
   "")
 
 (define_insn "cmpqi_ext_3_insn"
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
        (compare
          (subreg:QI
            (zero_extract:SI
    (set_attr "mode" "QI")])
 
 (define_insn "cmpqi_ext_3_insn_rex64"
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
        (compare
          (subreg:QI
            (zero_extract:SI
    (set_attr "mode" "QI")])
 
 (define_insn "*cmpqi_ext_4"
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
        (compare
          (subreg:QI
            (zero_extract:SI
   "")
 
 (define_insn "*adddi_2_rex64"
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
        (compare
          (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
                   (match_operand:DI 2 "x86_64_general_operand" "rme,re"))
    (set_attr "mode" "DI")])
 
 (define_insn "*adddi_3_rex64"
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
        (compare (neg:DI (match_operand:DI 2 "x86_64_general_operand" "rme"))
                 (match_operand:DI 1 "x86_64_general_operand" "%0")))
    (clobber (match_scratch:DI 0 "=r"))]
 ; Also carry flag is reversed compared to cmp, so this conversion is valid
 ; only for comparisons not depending on it.
 (define_insn "*adddi_4_rex64"
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
        (compare (match_operand:DI 1 "nonimmediate_operand" "0")
                 (match_operand:DI 2 "x86_64_immediate_operand" "e")))
    (clobber (match_scratch:DI 0 "=rm"))]
    (set_attr "mode" "DI")])
 
 (define_insn "*adddi_5_rex64"
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
        (compare
          (plus:DI (match_operand:DI 1 "nonimmediate_operand" "%0")
                   (match_operand:DI 2 "x86_64_general_operand" "rme"))
 })
 
 (define_insn "*addsi_2"
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
        (compare
          (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0")
                   (match_operand:SI 2 "general_operand" "rmni,rni"))
 
 ;; See comment for addsi_1_zext why we do use nonimmediate_operand
 (define_insn "*addsi_2_zext"
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
        (compare
          (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0")
                   (match_operand:SI 2 "general_operand" "rmni"))
    (set_attr "mode" "SI")])
 
 (define_insn "*addsi_3"
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
        (compare (neg:SI (match_operand:SI 2 "general_operand" "rmni"))
                 (match_operand:SI 1 "nonimmediate_operand" "%0")))
    (clobber (match_scratch:SI 0 "=r"))]
 
 ;; See comment for addsi_1_zext why we do use nonimmediate_operand
 (define_insn "*addsi_3_zext"
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
        (compare (neg:SI (match_operand:SI 2 "general_operand" "rmni"))
                 (match_operand:SI 1 "nonimmediate_operand" "%0")))
    (set (match_operand:DI 0 "register_operand" "=r")
 ; Also carry flag is reversed compared to cmp, so this conversion is valid
 ; only for comparisons not depending on it.
 (define_insn "*addsi_4"
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
        (compare (match_operand:SI 1 "nonimmediate_operand" "0")
                 (match_operand:SI 2 "const_int_operand" "n")))
    (clobber (match_scratch:SI 0 "=rm"))]
    (set_attr "mode" "SI")])
 
 (define_insn "*addsi_5"
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
        (compare
          (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0")
                   (match_operand:SI 2 "general_operand" "rmni"))
    (set_attr "mode" "HI")])
 
 (define_insn "*addhi_2"
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
        (compare
          (plus:HI (match_operand:HI 1 "nonimmediate_operand" "%0,0")
                   (match_operand:HI 2 "general_operand" "rmni,rni"))
    (set_attr "mode" "HI")])
 
 (define_insn "*addhi_3"
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
        (compare (neg:HI (match_operand:HI 2 "general_operand" "rmni"))
                 (match_operand:HI 1 "nonimmediate_operand" "%0")))
    (clobber (match_scratch:HI 0 "=r"))]
 
 ; See comments above addsi_3_imm for details.
 (define_insn "*addhi_4"
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
        (compare (match_operand:HI 1 "nonimmediate_operand" "0")
                 (match_operand:HI 2 "const_int_operand" "n")))
    (clobber (match_scratch:HI 0 "=rm"))]
 
 
 (define_insn "*addhi_5"
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
        (compare
          (plus:HI (match_operand:HI 1 "nonimmediate_operand" "%0")
                   (match_operand:HI 2 "general_operand" "rmni"))
    (set_attr "mode" "QI")])
 
 (define_insn "*addqi_2"
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
        (compare
          (plus:QI (match_operand:QI 1 "nonimmediate_operand" "%0,0")
                   (match_operand:QI 2 "general_operand" "qmni,qni"))
    (set_attr "mode" "QI")])
 
 (define_insn "*addqi_3"
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
        (compare (neg:QI (match_operand:QI 2 "general_operand" "qmni"))
                 (match_operand:QI 1 "nonimmediate_operand" "%0")))
    (clobber (match_scratch:QI 0 "=q"))]
 
 ; See comments above addsi_3_imm for details.
 (define_insn "*addqi_4"
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
        (compare (match_operand:QI 1 "nonimmediate_operand" "0")
                 (match_operand:QI 2 "const_int_operand" "n")))
    (clobber (match_scratch:QI 0 "=qm"))]
 
 
 (define_insn "*addqi_5"
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
        (compare
          (plus:QI (match_operand:QI 1 "nonimmediate_operand" "%0")
                   (match_operand:QI 2 "general_operand" "qmni"))
    (set_attr "mode" "DI")])
 
 (define_insn "*subdi_2_rex64"
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
        (compare
          (minus:DI (match_operand:DI 1 "nonimmediate_operand" "0,0")
                    (match_operand:DI 2 "x86_64_general_operand" "re,rm"))
    (set_attr "mode" "DI")])
 
 (define_insn "*subdi_3_rex63"
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
        (compare (match_operand:DI 1 "nonimmediate_operand" "0,0")
                 (match_operand:DI 2 "x86_64_general_operand" "re,rm")))
    (set (match_operand:DI 0 "nonimmediate_operand" "=rm,r")
    (set_attr "mode" "SI")])
 
 (define_insn "*subsi_2"
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
        (compare
          (minus:SI (match_operand:SI 1 "nonimmediate_operand" "0,0")
                    (match_operand:SI 2 "general_operand" "ri,rm"))
    (set_attr "mode" "SI")])
 
 (define_insn "*subsi_2_zext"
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
        (compare
          (minus:SI (match_operand:SI 1 "register_operand" "0")
                    (match_operand:SI 2 "general_operand" "rim"))
    (set_attr "mode" "SI")])
 
 (define_insn "*subsi_3"
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
        (compare (match_operand:SI 1 "nonimmediate_operand" "0,0")
                 (match_operand:SI 2 "general_operand" "ri,rm")))
    (set (match_operand:SI 0 "nonimmediate_operand" "=rm,r")
    (set_attr "mode" "SI")])
 
 (define_insn "*subsi_3_zext"
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
        (compare (match_operand:SI 1 "register_operand" "0")
                 (match_operand:SI 2 "general_operand" "rim")))
    (set (match_operand:DI 0 "register_operand" "=r")
    (set_attr "mode" "HI")])
 
 (define_insn "*subhi_2"
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
        (compare
          (minus:HI (match_operand:HI 1 "nonimmediate_operand" "0,0")
                    (match_operand:HI 2 "general_operand" "ri,rm"))
    (set_attr "mode" "HI")])
 
 (define_insn "*subhi_3"
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
        (compare (match_operand:HI 1 "nonimmediate_operand" "0,0")
                 (match_operand:HI 2 "general_operand" "ri,rm")))
    (set (match_operand:HI 0 "nonimmediate_operand" "=rm,r")
    (set_attr "mode" "QI")])
 
 (define_insn "*subqi_2"
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
        (compare
          (minus:QI (match_operand:QI 1 "nonimmediate_operand" "0,0")
                    (match_operand:QI 2 "general_operand" "qi,qm"))
    (set_attr "mode" "QI")])
 
 (define_insn "*subqi_3"
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
        (compare (match_operand:QI 1 "nonimmediate_operand" "0,0")
                 (match_operand:QI 2 "general_operand" "qi,qm")))
    (set (match_operand:HI 0 "nonimmediate_operand" "=qm,q")
 ;; Note that this excludes ah.
 
 (define_insn "*testdi_1_rex64"
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
        (compare
          (and:DI (match_operand:DI 0 "nonimmediate_operand" "%!*a,r,!*a,r,rm")
                  (match_operand:DI 1 "x86_64_szext_general_operand" "Z,Z,e,e,re"))
    (set_attr "pent_pair" "uv,np,uv,np,uv")])
 
 (define_insn "testsi_1"
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
        (compare
          (and:SI (match_operand:SI 0 "nonimmediate_operand" "%!*a,r,rm")
                  (match_operand:SI 1 "general_operand" "in,in,rin"))
   "")
 
 (define_insn "*testhi_1"
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
         (compare (and:HI (match_operand:HI 0 "nonimmediate_operand" "%!*a,r,rm")
                         (match_operand:HI 1 "general_operand" "n,n,rn"))
                 (const_int 0)))]
   "")
 
 (define_insn "*testqi_ext_0"
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
        (compare
          (and:SI
            (zero_extract:SI
    (set_attr "pent_pair" "np")])
 
 (define_insn "*testqi_ext_1"
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
        (compare
          (and:SI
            (zero_extract:SI
    (set_attr "mode" "QI")])
 
 (define_insn "*testqi_ext_1_rex64"
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
        (compare
          (and:SI
            (zero_extract:SI
    (set_attr "mode" "QI")])
 
 (define_insn "*testqi_ext_2"
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
        (compare
          (and:SI
            (zero_extract:SI
 
 ;; Combine likes to form bit extractions for some tests.  Humor it.
 (define_insn "*testqi_ext_3"
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
         (compare (zero_extract:SI
                   (match_operand 0 "nonimmediate_operand" "rm")
                   (match_operand:SI 1 "const_int_operand" "")
   "#")
 
 (define_insn "*testqi_ext_3_rex64"
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
         (compare (zero_extract:DI
                   (match_operand 0 "nonimmediate_operand" "rm")
                   (match_operand:DI 1 "const_int_operand" "")
   "#")
 
 (define_split
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
         (compare (zero_extract
                   (match_operand 0 "nonimmediate_operand" "")
                   (match_operand 1 "const_int_operand" "")
 ;; Do the conversion only post-reload to avoid limiting of the register class
 ;; to QI regs.
 (define_split
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
        (compare
          (and (match_operand 0 "register_operand" "")
               (match_operand 1 "const_int_operand" ""))
    operands[1] = gen_int_mode (INTVAL (operands[1]) >> 8, SImode);")
 
 (define_split
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
        (compare
          (and (match_operand 0 "nonimmediate_operand" "")
               (match_operand 1 "const_int_operand" ""))
    (set_attr "mode" "SI,DI,DI,DI")])
 
 (define_insn "*anddi_2"
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
        (compare (and:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0,0")
                         (match_operand:DI 2 "x86_64_szext_general_operand" "Z,rem,re"))
                 (const_int 0)))
    (set_attr "mode" "SI")])
 
 (define_insn "*andsi_2"
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
        (compare (and:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0")
                         (match_operand:SI 2 "general_operand" "rim,ri"))
                 (const_int 0)))
 
 ;; See comment for addsi_1_zext why we do use nonimmediate_operand
 (define_insn "*andsi_2_zext"
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
        (compare (and:SI (match_operand:SI 1 "nonimmediate_operand" "%0")
                         (match_operand:SI 2 "general_operand" "rim"))
                 (const_int 0)))
    (set_attr "mode" "HI,HI,SI")])
 
 (define_insn "*andhi_2"
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
        (compare (and:HI (match_operand:HI 1 "nonimmediate_operand" "%0,0")
                         (match_operand:HI 2 "general_operand" "rim,ri"))
                 (const_int 0)))
    (set_attr "mode" "QI")])
 
 (define_insn "*andqi_2"
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
        (compare (and:QI
                   (match_operand:QI 1 "nonimmediate_operand" "%0,0,0")
                   (match_operand:QI 2 "general_operand" "qim,qi,i"))
    (set_attr "mode" "QI,QI,SI")])
 
 (define_insn "*andqi_2_slp"
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
        (compare (and:QI
                   (match_operand:QI 0 "nonimmediate_operand" "+q,qm")
                   (match_operand:QI 1 "nonimmediate_operand" "qmi,qi"))
 ;; often in fp comparisons.
 
 (define_insn "*andqi_ext_0_cc"
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
        (compare
          (and:SI
            (zero_extract:SI
    (set_attr "mode" "DI")])
 
 (define_insn "*iordi_2_rex64"
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
        (compare (ior:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
                         (match_operand:DI 2 "x86_64_general_operand" "rem,re"))
                 (const_int 0)))
    (set_attr "mode" "DI")])
 
 (define_insn "*iordi_3_rex64"
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
        (compare (ior:DI (match_operand:DI 1 "nonimmediate_operand" "%0")
                         (match_operand:DI 2 "x86_64_general_operand" "rem"))
                 (const_int 0)))
    (set_attr "mode" "SI")])
 
 (define_insn "*iorsi_2"
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
        (compare (ior:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0")
                         (match_operand:SI 2 "general_operand" "rim,ri"))
                 (const_int 0)))
 ;; See comment for addsi_1_zext why we do use nonimmediate_operand
 ;; ??? Special case for immediate operand is missing - it is tricky.
 (define_insn "*iorsi_2_zext"
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
        (compare (ior:SI (match_operand:SI 1 "nonimmediate_operand" "%0")
                         (match_operand:SI 2 "general_operand" "rim"))
                 (const_int 0)))
    (set_attr "mode" "SI")])
 
 (define_insn "*iorsi_2_zext_imm"
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
        (compare (ior:SI (match_operand:SI 1 "nonimmediate_operand" "%0")
                         (match_operand 2 "x86_64_zext_immediate_operand" "Z"))
                 (const_int 0)))
    (set_attr "mode" "SI")])
 
 (define_insn "*iorsi_3"
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
        (compare (ior:SI (match_operand:SI 1 "nonimmediate_operand" "%0")
                         (match_operand:SI 2 "general_operand" "rim"))
                 (const_int 0)))
    (set_attr "mode" "HI")])
 
 (define_insn "*iorhi_2"
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
        (compare (ior:HI (match_operand:HI 1 "nonimmediate_operand" "%0,0")
                         (match_operand:HI 2 "general_operand" "rim,ri"))
                 (const_int 0)))
    (set_attr "mode" "HI")])
 
 (define_insn "*iorhi_3"
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
        (compare (ior:HI (match_operand:HI 1 "nonimmediate_operand" "%0")
                         (match_operand:HI 2 "general_operand" "rim"))
                 (const_int 0)))
    (set_attr "mode" "QI")])
 
 (define_insn "*iorqi_2"
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
        (compare (ior:QI (match_operand:QI 1 "nonimmediate_operand" "%0,0")
                         (match_operand:QI 2 "general_operand" "qim,qi"))
                 (const_int 0)))
    (set_attr "mode" "QI")])
 
 (define_insn "*iorqi_2_slp"
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
        (compare (ior:QI (match_operand:QI 0 "nonimmediate_operand" "+q,qm")
                         (match_operand:QI 1 "general_operand" "qim,qi"))
                 (const_int 0)))
    (set_attr "mode" "QI")])
 
 (define_insn "*iorqi_3"
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
        (compare (ior:QI (match_operand:QI 1 "nonimmediate_operand" "%0")
                         (match_operand:QI 2 "general_operand" "qim"))
                 (const_int 0)))
    (set_attr "mode" "DI,DI")])
 
 (define_insn "*xordi_2_rex64"
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
        (compare (xor:DI (match_operand:DI 1 "nonimmediate_operand" "%0,0")
                         (match_operand:DI 2 "x86_64_general_operand" "rem,re"))
                 (const_int 0)))
    (set_attr "mode" "DI,DI")])
 
 (define_insn "*xordi_3_rex64"
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
        (compare (xor:DI (match_operand:DI 1 "nonimmediate_operand" "%0")
                         (match_operand:DI 2 "x86_64_general_operand" "rem"))
                 (const_int 0)))
    (set_attr "mode" "SI")])
 
 (define_insn "*xorsi_2"
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
        (compare (xor:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0")
                         (match_operand:SI 2 "general_operand" "rim,ri"))
                 (const_int 0)))
 ;; See comment for addsi_1_zext why we do use nonimmediate_operand
 ;; ??? Special case for immediate operand is missing - it is tricky.
 (define_insn "*xorsi_2_zext"
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
        (compare (xor:SI (match_operand:SI 1 "nonimmediate_operand" "%0")
                         (match_operand:SI 2 "general_operand" "rim"))
                 (const_int 0)))
    (set_attr "mode" "SI")])
 
 (define_insn "*xorsi_2_zext_imm"
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
        (compare (xor:SI (match_operand:SI 1 "nonimmediate_operand" "%0")
                         (match_operand 2 "x86_64_zext_immediate_operand" "Z"))
                 (const_int 0)))
    (set_attr "mode" "SI")])
 
 (define_insn "*xorsi_3"
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
        (compare (xor:SI (match_operand:SI 1 "nonimmediate_operand" "%0")
                         (match_operand:SI 2 "general_operand" "rim"))
                 (const_int 0)))
    (set_attr "mode" "HI")])
 
 (define_insn "*xorhi_2"
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
        (compare (xor:HI (match_operand:HI 1 "nonimmediate_operand" "%0,0")
                         (match_operand:HI 2 "general_operand" "rim,ri"))
                 (const_int 0)))
    (set_attr "mode" "HI")])
 
 (define_insn "*xorhi_3"
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
        (compare (xor:HI (match_operand:HI 1 "nonimmediate_operand" "%0")
                         (match_operand:HI 2 "general_operand" "rim"))
                 (const_int 0)))
    (set_attr "mode" "QI")])
 
 (define_insn "*xorqi_cc_1"
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
        (compare
          (xor:QI (match_operand:QI 1 "nonimmediate_operand" "%0,0")
                  (match_operand:QI 2 "general_operand" "qim,qi"))
    (set_attr "mode" "QI")])
 
 (define_insn "*xorqi_2_slp"
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
        (compare (xor:QI (match_operand:QI 0 "nonimmediate_operand" "+q,qm")
                         (match_operand:QI 1 "general_operand" "qim,qi"))
                 (const_int 0)))
    (set_attr "mode" "QI")])
 
 (define_insn "*xorqi_cc_2"
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
        (compare
          (xor:QI (match_operand:QI 1 "nonimmediate_operand" "%0")
                  (match_operand:QI 2 "general_operand" "qim"))
    (set_attr "mode" "QI")])
 
 (define_insn "*xorqi_cc_ext_1"
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
        (compare
          (xor:SI
            (zero_extract:SI
    (set_attr "mode" "QI")])
 
 (define_insn "*xorqi_cc_ext_1_rex64"
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
        (compare
          (xor:SI
            (zero_extract:SI
    (set_attr "mode" "DI")])
 
 (define_insn "*one_cmpldi2_2_rex64"
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
        (compare (not:DI (match_operand:DI 1 "nonimmediate_operand" "0"))
                 (const_int 0)))
    (set (match_operand:DI 0 "nonimmediate_operand" "=rm")
    (set_attr "mode" "DI")])
 
 (define_split
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
        (compare (not:DI (match_operand:DI 1 "nonimmediate_operand" ""))
                 (const_int 0)))
    (set (match_operand:DI 0 "nonimmediate_operand" "")
    (set_attr "mode" "SI")])
 
 (define_insn "*one_cmplsi2_2"
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
        (compare (not:SI (match_operand:SI 1 "nonimmediate_operand" "0"))
                 (const_int 0)))
    (set (match_operand:SI 0 "nonimmediate_operand" "=rm")
    (set_attr "mode" "SI")])
 
 (define_split
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
        (compare (not:SI (match_operand:SI 1 "nonimmediate_operand" ""))
                 (const_int 0)))
    (set (match_operand:SI 0 "nonimmediate_operand" "")
 
 ;; ??? Currently never generated - xor is used instead.
 (define_insn "*one_cmplsi2_2_zext"
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
        (compare (not:SI (match_operand:SI 1 "register_operand" "0"))
                 (const_int 0)))
    (set (match_operand:DI 0 "register_operand" "=r")
    (set_attr "mode" "SI")])
 
 (define_split
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
        (compare (not:SI (match_operand:SI 1 "register_operand" ""))
                 (const_int 0)))
    (set (match_operand:DI 0 "register_operand" "")
    (set_attr "mode" "HI")])
 
 (define_insn "*one_cmplhi2_2"
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
        (compare (not:HI (match_operand:HI 1 "nonimmediate_operand" "0"))
                 (const_int 0)))
    (set (match_operand:HI 0 "nonimmediate_operand" "=rm")
    (set_attr "mode" "HI")])
 
 (define_split
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
        (compare (not:HI (match_operand:HI 1 "nonimmediate_operand" ""))
                 (const_int 0)))
    (set (match_operand:HI 0 "nonimmediate_operand" "")
    (set_attr "mode" "QI,SI")])
 
 (define_insn "*one_cmplqi2_2"
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
        (compare (not:QI (match_operand:QI 1 "nonimmediate_operand" "0"))
                 (const_int 0)))
    (set (match_operand:QI 0 "nonimmediate_operand" "=qm")
    (set_attr "mode" "QI")])
 
 (define_split
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
        (compare (not:QI (match_operand:QI 1 "nonimmediate_operand" ""))
                 (const_int 0)))
    (set (match_operand:QI 0 "nonimmediate_operand" "")
 ;; zero don't affect the flags.  We assume that shifts by constant
 ;; zero are optimized away.
 (define_insn "*ashldi3_cmp_rex64"
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
        (compare
          (ashift:DI (match_operand:DI 1 "nonimmediate_operand" "0")
                     (match_operand:QI 2 "immediate_operand" "e"))
 ;; zero don't affect the flags.  We assume that shifts by constant
 ;; zero are optimized away.
 (define_insn "*ashlsi3_cmp"
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
        (compare
          (ashift:SI (match_operand:SI 1 "nonimmediate_operand" "0")
                     (match_operand:QI 2 "const_int_1_31_operand" "I"))
    (set_attr "mode" "SI")])
 
 (define_insn "*ashlsi3_cmp_zext"
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
        (compare
          (ashift:SI (match_operand:SI 1 "register_operand" "0")
                     (match_operand:QI 2 "const_int_1_31_operand" "I"))
 ;; zero don't affect the flags.  We assume that shifts by constant
 ;; zero are optimized away.
 (define_insn "*ashlhi3_cmp"
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
        (compare
          (ashift:HI (match_operand:HI 1 "nonimmediate_operand" "0")
                     (match_operand:QI 2 "const_int_1_31_operand" "I"))
 ;; zero don't affect the flags.  We assume that shifts by constant
 ;; zero are optimized away.
 (define_insn "*ashlqi3_cmp"
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
        (compare
          (ashift:QI (match_operand:QI 1 "nonimmediate_operand" "0")
                     (match_operand:QI 2 "const_int_1_31_operand" "I"))
 ;; zero don't affect the flags.  We assume that shifts by constant
 ;; zero are optimized away.
 (define_insn "*ashrdi3_one_bit_cmp_rex64"
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
        (compare
          (ashiftrt:DI (match_operand:DI 1 "nonimmediate_operand" "0")
                       (match_operand:QI 2 "const1_operand" ""))
 ;; zero don't affect the flags.  We assume that shifts by constant
 ;; zero are optimized away.
 (define_insn "*ashrdi3_cmp_rex64"
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
        (compare
          (ashiftrt:DI (match_operand:DI 1 "nonimmediate_operand" "0")
                       (match_operand:QI 2 "const_int_operand" "n"))
 ;; zero don't affect the flags.  We assume that shifts by constant
 ;; zero are optimized away.
 (define_insn "*ashrsi3_one_bit_cmp"
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
        (compare
          (ashiftrt:SI (match_operand:SI 1 "nonimmediate_operand" "0")
                       (match_operand:QI 2 "const1_operand" ""))
        (const_string "*")))])
 
 (define_insn "*ashrsi3_one_bit_cmp_zext"
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
        (compare
          (ashiftrt:SI (match_operand:SI 1 "register_operand" "0")
                       (match_operand:QI 2 "const1_operand" ""))
 ;; zero don't affect the flags.  We assume that shifts by constant
 ;; zero are optimized away.
 (define_insn "*ashrsi3_cmp"
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
        (compare
          (ashiftrt:SI (match_operand:SI 1 "nonimmediate_operand" "0")
                       (match_operand:QI 2 "const_int_1_31_operand" "I"))
    (set_attr "mode" "SI")])
 
 (define_insn "*ashrsi3_cmp_zext"
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
        (compare
          (ashiftrt:SI (match_operand:SI 1 "register_operand" "0")
                       (match_operand:QI 2 "const_int_1_31_operand" "I"))
 ;; zero don't affect the flags.  We assume that shifts by constant
 ;; zero are optimized away.
 (define_insn "*ashrhi3_one_bit_cmp"
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
        (compare
          (ashiftrt:HI (match_operand:HI 1 "nonimmediate_operand" "0")
                       (match_operand:QI 2 "const1_operand" ""))
 ;; zero don't affect the flags.  We assume that shifts by constant
 ;; zero are optimized away.
 (define_insn "*ashrhi3_cmp"
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
        (compare
          (ashiftrt:HI (match_operand:HI 1 "nonimmediate_operand" "0")
                       (match_operand:QI 2 "const_int_1_31_operand" "I"))
 ;; zero don't affect the flags.  We assume that shifts by constant
 ;; zero are optimized away.
 (define_insn "*ashrqi3_one_bit_cmp"
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
        (compare
          (ashiftrt:QI (match_operand:QI 1 "nonimmediate_operand" "0")
                       (match_operand:QI 2 "const1_operand" "I"))
 ;; zero don't affect the flags.  We assume that shifts by constant
 ;; zero are optimized away.
 (define_insn "*ashrqi3_cmp"
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
        (compare
          (ashiftrt:QI (match_operand:QI 1 "nonimmediate_operand" "0")
                       (match_operand:QI 2 "const_int_1_31_operand" "I"))
 ;; zero don't affect the flags.  We assume that shifts by constant
 ;; zero are optimized away.
 (define_insn "*lshrdi3_cmp_one_bit_rex64"
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
        (compare
          (lshiftrt:DI (match_operand:DI 1 "nonimmediate_operand" "0")
                       (match_operand:QI 2 "const1_operand" ""))
 ;; zero don't affect the flags.  We assume that shifts by constant
 ;; zero are optimized away.
 (define_insn "*lshrdi3_cmp_rex64"
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
        (compare
          (lshiftrt:DI (match_operand:DI 1 "nonimmediate_operand" "0")
                       (match_operand:QI 2 "const_int_operand" "e"))
 ;; zero don't affect the flags.  We assume that shifts by constant
 ;; zero are optimized away.
 (define_insn "*lshrsi3_one_bit_cmp"
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
        (compare
          (lshiftrt:SI (match_operand:SI 1 "nonimmediate_operand" "0")
                       (match_operand:QI 2 "const1_operand" ""))
        (const_string "*")))])
 
 (define_insn "*lshrsi3_cmp_one_bit_zext"
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
        (compare
          (lshiftrt:SI (match_operand:SI 1 "register_operand" "0")
                       (match_operand:QI 2 "const1_operand" ""))
 ;; zero don't affect the flags.  We assume that shifts by constant
 ;; zero are optimized away.
 (define_insn "*lshrsi3_cmp"
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
        (compare
          (lshiftrt:SI (match_operand:SI 1 "nonimmediate_operand" "0")
                       (match_operand:QI 2 "const_int_1_31_operand" "I"))
    (set_attr "mode" "SI")])
 
 (define_insn "*lshrsi3_cmp_zext"
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
        (compare
          (lshiftrt:SI (match_operand:SI 1 "register_operand" "0")
                       (match_operand:QI 2 "const_int_1_31_operand" "I"))
 ;; zero don't affect the flags.  We assume that shifts by constant
 ;; zero are optimized away.
 (define_insn "*lshrhi3_one_bit_cmp"
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
        (compare
          (lshiftrt:HI (match_operand:HI 1 "nonimmediate_operand" "0")
                       (match_operand:QI 2 "const1_operand" ""))
 ;; zero don't affect the flags.  We assume that shifts by constant
 ;; zero are optimized away.
 (define_insn "*lshrhi3_cmp"
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
        (compare
          (lshiftrt:HI (match_operand:HI 1 "nonimmediate_operand" "0")
                       (match_operand:QI 2 "const_int_1_31_operand" "I"))
 ;; zero don't affect the flags.  We assume that shifts by constant
 ;; zero are optimized away.
 (define_insn "*lshrqi2_one_bit_cmp"
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
        (compare
          (lshiftrt:QI (match_operand:QI 1 "nonimmediate_operand" "0")
                       (match_operand:QI 2 "const1_operand" ""))
 ;; zero don't affect the flags.  We assume that shifts by constant
 ;; zero are optimized away.
 (define_insn "*lshrqi2_cmp"
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
        (compare
          (lshiftrt:QI (match_operand:QI 1 "nonimmediate_operand" "0")
                       (match_operand:QI 2 "const_int_1_31_operand" "I"))
 (define_insn "*setcc_1"
   [(set (match_operand:QI 0 "nonimmediate_operand" "=qm")
        (match_operator:QI 1 "ix86_comparison_operator"
-         [(reg 17) (const_int 0)]))]
+         [(reg FLAGS_REG) (const_int 0)]))]
   ""
   "set%C1\t%0"
   [(set_attr "type" "setcc")
 (define_insn "*setcc_2"
   [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+qm"))
        (match_operator:QI 1 "ix86_comparison_operator"
-         [(reg 17) (const_int 0)]))]
+         [(reg FLAGS_REG) (const_int 0)]))]
   ""
   "set%C1\t%0"
   [(set_attr "type" "setcc")
 (define_split 
   [(set (match_operand:QI 0 "nonimmediate_operand" "")
        (ne:QI (match_operator 1 "ix86_comparison_operator"
-                [(reg 17) (const_int 0)])
+                [(reg FLAGS_REG) (const_int 0)])
            (const_int 0)))]
   ""
   [(set (match_dup 0) (match_dup 1))]
 (define_split 
   [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" ""))
        (ne:QI (match_operator 1 "ix86_comparison_operator"
-                [(reg 17) (const_int 0)])
+                [(reg FLAGS_REG) (const_int 0)])
            (const_int 0)))]
   ""
   [(set (match_dup 0) (match_dup 1))]
 (define_split 
   [(set (match_operand:QI 0 "nonimmediate_operand" "")
        (eq:QI (match_operator 1 "ix86_comparison_operator"
-                [(reg 17) (const_int 0)])
+                [(reg FLAGS_REG) (const_int 0)])
            (const_int 0)))]
   ""
   [(set (match_dup 0) (match_dup 1))]
 (define_split 
   [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" ""))
        (eq:QI (match_operator 1 "ix86_comparison_operator"
-                [(reg 17) (const_int 0)])
+                [(reg FLAGS_REG) (const_int 0)])
            (const_int 0)))]
   ""
   [(set (match_dup 0) (match_dup 1))]
 ;; We ignore the overflow flag for signed branch instructions.
 
 ;; For all bCOND expanders, also expand the compare or test insn that
-;; generates reg 17.  Generate an equality comparison if `beq' or `bne'.
+;; generates reg FLAGS_REG.  Generate an equality comparison if `beq' or `bne'.
 
 (define_expand "beq"
   [(set (pc)
 (define_insn "*jcc_1"
   [(set (pc)
        (if_then_else (match_operator 1 "ix86_comparison_operator"
-                                     [(reg 17) (const_int 0)])
+                                     [(reg FLAGS_REG) (const_int 0)])
                      (label_ref (match_operand 0 "" ""))
                      (pc)))]
   ""
 (define_insn "*jcc_2"
   [(set (pc)
        (if_then_else (match_operator 1 "ix86_comparison_operator"
-                                     [(reg 17) (const_int 0)])
+                                     [(reg FLAGS_REG) (const_int 0)])
                      (pc)
                      (label_ref (match_operand 0 "" ""))))]
   ""
 (define_split 
   [(set (pc)
        (if_then_else (ne (match_operator 0 "ix86_comparison_operator"
-                                     [(reg 17) (const_int 0)])
+                                     [(reg FLAGS_REG) (const_int 0)])
                          (const_int 0))
                      (label_ref (match_operand 1 "" ""))
                      (pc)))]
 (define_split 
   [(set (pc)
        (if_then_else (eq (match_operator 0 "ix86_comparison_operator"
-                                     [(reg 17) (const_int 0)])
+                                     [(reg FLAGS_REG) (const_int 0)])
                          (const_int 0))
                      (label_ref (match_operand 1 "" ""))
                      (pc)))]
 ;; Convert setcc + movzbl to xor + setcc if operands don't overlap.
 
 (define_peephole2
-  [(set (reg 17) (match_operand 0 "" ""))
+  [(set (reg FLAGS_REG) (match_operand 0 "" ""))
    (set (match_operand:QI 1 "register_operand" "")
        (match_operator:QI 2 "ix86_comparison_operator"
-         [(reg 17) (const_int 0)]))
+         [(reg FLAGS_REG) (const_int 0)]))
    (set (match_operand 3 "q_regs_operand" "")
        (zero_extend (match_dup 1)))]
   "(peep2_reg_dead_p (3, operands[1])
 ;; Similar, but match zero_extendhisi2_and, which adds a clobber.
 
 (define_peephole2
-  [(set (reg 17) (match_operand 0 "" ""))
+  [(set (reg FLAGS_REG) (match_operand 0 "" ""))
    (set (match_operand:QI 1 "register_operand" "")
        (match_operator:QI 2 "ix86_comparison_operator"
-         [(reg 17) (const_int 0)]))
+         [(reg FLAGS_REG) (const_int 0)]))
    (parallel [(set (match_operand 3 "q_regs_operand" "")
                   (zero_extend (match_dup 1)))
              (clobber (reg:CC FLAGS_REG))])]
      [(set (match_operand:DI 0 "register_operand" "") 
           (ffs:DI (match_operand:DI 1 "nonimmediate_operand" "")))
       (clobber (match_scratch:DI 2 ""))
-      (clobber (reg:CC 17))])]
+      (clobber (reg:CC FLAGS_REG))])]
   "TARGET_64BIT && TARGET_CMOVE"
   "")
 
   [(set (match_operand:DI 0 "register_operand" "=r") 
        (ffs:DI (match_operand:DI 1 "nonimmediate_operand" "rm")))
    (clobber (match_scratch:DI 2 "=&r"))
-   (clobber (reg:CC 17))]
+   (clobber (reg:CC FLAGS_REG))]
   "TARGET_64BIT && TARGET_CMOVE"
   "#"
   "&& reload_completed"
   [(set (match_dup 2) (const_int -1))
-   (parallel [(set (reg:CCZ 17) (compare:CCZ (match_dup 1) (const_int 0)))
+   (parallel [(set (reg:CCZ FLAGS_REG)
+                  (compare:CCZ (match_dup 1) (const_int 0)))
              (set (match_dup 0) (ctz:DI (match_dup 1)))])
    (set (match_dup 0) (if_then_else:DI
-                       (eq (reg:CCZ 17) (const_int 0))
+                       (eq (reg:CCZ FLAGS_REG) (const_int 0))
                        (match_dup 2)
                        (match_dup 0)))
    (parallel [(set (match_dup 0) (plus:DI (match_dup 0) (const_int 1)))
-             (clobber (reg:CC 17))])]
+             (clobber (reg:CC FLAGS_REG))])]
   "")
 
 (define_insn "*ffsdi_1"
-  [(set (reg:CCZ 17)
+  [(set (reg:CCZ FLAGS_REG)
        (compare:CCZ (match_operand:DI 1 "nonimmediate_operand" "rm")
                     (const_int 0)))
    (set (match_operand:DI 0 "register_operand" "=r")
 (define_insn "ctzdi2"
   [(set (match_operand:DI 0 "register_operand" "=r")
        (ctz:DI (match_operand:DI 1 "nonimmediate_operand" "rm")))
-   (clobber (reg:CC 17))]
+   (clobber (reg:CC FLAGS_REG))]
   "TARGET_64BIT"
   "bsf{q}\t{%1, %0|%0, %1}"
   [(set_attr "prefix_0f" "1")])
      [(set (match_operand:DI 0 "register_operand" "")
           (minus:DI (const_int 63)
                     (clz:DI (match_operand:DI 1 "nonimmediate_operand" ""))))
-      (clobber (reg:CC 17))])
+      (clobber (reg:CC FLAGS_REG))])
    (parallel
      [(set (match_dup 0) (xor:DI (match_dup 0) (const_int 63)))
-      (clobber (reg:CC 17))])]
+      (clobber (reg:CC FLAGS_REG))])]
   "TARGET_64BIT"
   "")
 
   [(set (match_operand:DI 0 "register_operand" "=r")
        (minus:DI (const_int 63)
                  (clz:DI (match_operand:DI 1 "nonimmediate_operand" "rm"))))
-   (clobber (reg:CC 17))]
+   (clobber (reg:CC FLAGS_REG))]
   "TARGET_64BIT"
   "bsr{q}\t{%1, %0|%0, %1}"
   [(set_attr "prefix_0f" "1")])
        (gtu:QI (reg:CC FLAGS_REG) (const_int 0)))
    (set (match_operand:QI 8 "register_operand" "")
        (ltu:QI (reg:CC FLAGS_REG) (const_int 0)))
-   (set (reg 17)
+   (set (reg FLAGS_REG)
        (compare (match_dup 7) (match_dup 8)))
   ]
   "peep2_reg_dead_p (4, operands[7]) && peep2_reg_dead_p (4, operands[8])"
        (gtu:QI (reg:CC FLAGS_REG) (const_int 0)))
    (set (match_operand:QI 8 "register_operand" "")
        (ltu:QI (reg:CC FLAGS_REG) (const_int 0)))
-   (set (reg 17)
+   (set (reg FLAGS_REG)
        (compare (match_dup 7) (match_dup 8)))
   ]
   "peep2_reg_dead_p (4, operands[7]) && peep2_reg_dead_p (4, operands[8])"
 (define_insn "movdicc_c_rex64"
   [(set (match_operand:DI 0 "register_operand" "=r,r")
        (if_then_else:DI (match_operator 1 "ix86_comparison_operator" 
-                               [(reg 17) (const_int 0)])
+                               [(reg FLAGS_REG) (const_int 0)])
                      (match_operand:DI 2 "nonimmediate_operand" "rm,0")
                      (match_operand:DI 3 "nonimmediate_operand" "0,rm")))]
   "TARGET_64BIT && TARGET_CMOVE
 (define_insn "*movsicc_noc"
   [(set (match_operand:SI 0 "register_operand" "=r,r")
        (if_then_else:SI (match_operator 1 "ix86_comparison_operator" 
-                               [(reg 17) (const_int 0)])
+                               [(reg FLAGS_REG) (const_int 0)])
                      (match_operand:SI 2 "nonimmediate_operand" "rm,0")
                      (match_operand:SI 3 "nonimmediate_operand" "0,rm")))]
   "TARGET_CMOVE
 (define_insn "*movhicc_noc"
   [(set (match_operand:HI 0 "register_operand" "=r,r")
        (if_then_else:HI (match_operator 1 "ix86_comparison_operator" 
-                               [(reg 17) (const_int 0)])
+                               [(reg FLAGS_REG) (const_int 0)])
                      (match_operand:HI 2 "nonimmediate_operand" "rm,0")
                      (match_operand:HI 3 "nonimmediate_operand" "0,rm")))]
   "TARGET_CMOVE
 (define_insn "*movsfcc_1"
   [(set (match_operand:SF 0 "register_operand" "=f#r,f#r,r#f,r#f")
        (if_then_else:SF (match_operator 1 "fcmov_comparison_operator" 
-                               [(reg 17) (const_int 0)])
+                               [(reg FLAGS_REG) (const_int 0)])
                      (match_operand:SF 2 "nonimmediate_operand" "f#r,0,rm#f,0")
                      (match_operand:SF 3 "nonimmediate_operand" "0,f#r,0,rm#f")))]
   "TARGET_CMOVE
 (define_insn "*movdfcc_1"
   [(set (match_operand:DF 0 "register_operand" "=f#r,f#r,&r#f,&r#f")
        (if_then_else:DF (match_operator 1 "fcmov_comparison_operator" 
-                               [(reg 17) (const_int 0)])
+                               [(reg FLAGS_REG) (const_int 0)])
                      (match_operand:DF 2 "nonimmediate_operand" "f#r,0,rm#f,0")
                      (match_operand:DF 3 "nonimmediate_operand" "0,f#r,0,rm#f")))]
   "!TARGET_64BIT && TARGET_CMOVE
 (define_insn "*movdfcc_1_rex64"
   [(set (match_operand:DF 0 "register_operand" "=f#r,f#r,r#f,r#f")
        (if_then_else:DF (match_operator 1 "fcmov_comparison_operator" 
-                               [(reg 17) (const_int 0)])
+                               [(reg FLAGS_REG) (const_int 0)])
                      (match_operand:DF 2 "nonimmediate_operand" "f#r,0#r,rm#f,0#f")
                      (match_operand:DF 3 "nonimmediate_operand" "0#r,f#r,0#f,rm#f")))]
   "TARGET_64BIT && TARGET_CMOVE
 (define_insn "*movxfcc_1"
   [(set (match_operand:XF 0 "register_operand" "=f,f")
        (if_then_else:XF (match_operator 1 "fcmov_comparison_operator" 
-                               [(reg 17) (const_int 0)])
+                               [(reg FLAGS_REG) (const_int 0)])
                      (match_operand:XF 2 "register_operand" "f,0")
                      (match_operand:XF 3 "register_operand" "0,f")))]
   "TARGET_CMOVE"
 ; instruction size is unchanged, except in the %eax case for
 ; which it is increased by one byte, hence the ! optimize_size.
 (define_split
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
        (compare (and (match_operand 1 "aligned_operand" "")
                      (match_operand 2 "const_int_operand" ""))
                 (const_int 0)))
 ; the instruction size would at least double, which is not what we
 ; want even with ! optimize_size.
 (define_split
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
        (compare (and (match_operand:HI 0 "aligned_operand" "")
                      (match_operand:HI 1 "const_int_operand" ""))
                 (const_int 0)))]
 (define_split 
   [(set (match_operand 0 "register_operand" "")
        (if_then_else (match_operator 1 "comparison_operator" 
-                               [(reg 17) (const_int 0)])
+                               [(reg FLAGS_REG) (const_int 0)])
                      (match_operand 2 "register_operand" "")
                      (match_operand 3 "register_operand" "")))]
   "! TARGET_PARTIAL_REG_STALL && TARGET_CMOVE
 
 ;; Don't compare memory with zero, load and use a test instead.
 (define_peephole2
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
        (compare (match_operand:SI 0 "memory_operand" "")
                 (const_int 0)))
    (match_scratch:SI 3 "r")]
 ;; versions if we're concerned about partial register stalls.
 
 (define_peephole2
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
        (compare (and:SI (match_operand:SI 0 "register_operand" "")
                         (match_operand:SI 1 "immediate_operand" ""))
                 (const_int 0)))]
 ;; on ! TARGET_PARTIAL_REG_STALL
 
 (define_peephole2
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
        (compare (and:QI (match_operand:QI 0 "register_operand" "")
                         (match_operand:QI 1 "immediate_operand" ""))
                 (const_int 0)))]
   "")
 
 (define_peephole2
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
        (compare
          (and:SI
            (zero_extract:SI
 ;; Convert compares with 1 to shorter inc/dec operations when CF is not
 ;; required and register dies.
 (define_peephole2
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
        (compare (match_operand:SI 0 "register_operand" "")
                 (match_operand:SI 1 "incdec_operand" "")))]
   "ix86_match_ccmode (insn, CCGCmode)
   "")
 
 (define_peephole2
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
        (compare (match_operand:HI 0 "register_operand" "")
                 (match_operand:HI 1 "incdec_operand" "")))]
   "ix86_match_ccmode (insn, CCGCmode)
   "")
 
 (define_peephole2
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
        (compare (match_operand:QI 0 "register_operand" "")
                 (match_operand:QI 1 "incdec_operand" "")))]
   "ix86_match_ccmode (insn, CCGCmode)
 
 ;; Convert compares with 128 to shorter add -128
 (define_peephole2
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
        (compare (match_operand:SI 0 "register_operand" "")
                 (const_int 128)))]
   "ix86_match_ccmode (insn, CCGCmode)
   "")
 
 (define_peephole2
-  [(set (reg 17)
+  [(set (reg FLAGS_REG)
        (compare (match_operand:HI 0 "register_operand" "")
                 (const_int 128)))]
   "ix86_match_ccmode (insn, CCGCmode)
 
 (define_insn "*conditional_trap_1"
   [(trap_if (match_operator 0 "comparison_operator"
-            [(reg 17) (const_int 0)])
+            [(reg FLAGS_REG) (const_int 0)])
            (match_operand 1 "const_int_operand" ""))]
   ""
 {