------- Comment #1 from bonzini at gnu dot org  2006-12-06 10:10 -------
You might have to add a post-reload splitter for something like

(set (match_operand:SI 0 "register_operand" "+r")
     (plus (match_dup 0)
           (lt:SI (match_operand:SF 1 "register_operand" "x")
                  (match_operand:SF 2 "register_operand" "xm")))

to

[(set (reg:CCFP FLAGS_REG)
      (compare:CCFPU (match_dup 1) (match_dup 2)))
 (parallel [(set (match_dup 0)
                 (plus (match_dup 0)
                       (ltu:SI (reg:CC FLAGS_REG) (const_int 0))))
            (clobber (reg:CC FLAGS_REG))])]

and likewise

(set (match_operand:SI 0 "register_operand" "+r")
     (minus (match_dup 0)
            (lt:SI (match_operand:SF 1 "register_operand" "x")
                   (match_operand:SF 2 "register_operand" "xm")))

to

[(set (reg:CCFP FLAGS_REG)
      (compare:CCFPU (match_dup 2) (match_dup 1)))
 (parallel [(set (match_dup 0)
                 (minus:SI (match_dup 0)
                           (ltu:SI (reg:CC FLAGS_REG) (const_int 0))))
            (clobber (reg:CC FLAGS_REG))])]



The pattern for the adc and sbb are already there, but they don't match if the
immediate is zero because it gets simplified, so you need also something like
this:

(define_insn "adc_carry_si"
  [(set (match_operand:SI 0 "nonimmediate_operand" "=rm")
        (plus:SI (match_operand:SI 1 "nonimmediate_operand" "0")
                 (match_operand:SI 2 "ix86_carry_flag_operator" "")))
   (clobber (reg:CC FLAGS_REG))]
  "ix86_binary_operator_ok (PLUS, SImode, operands)"
  "adc{l}\t{$0, %0|%0, 0}"
  [(set_attr "type" "alu")
   (set_attr "pent_pair" "pu")
   (set_attr "mode" "SI")])

(define_insn "sub_carry_si"
  [(set (match_operand:SI 0 "nonimmediate_operand" "=rm")
        (minus:SI (match_operand:SI 1 "nonimmediate_operand" "0")
                  (match_operand:SI 2 "ix86_carry_flag_operator" "")))
   (clobber (reg:CC FLAGS_REG))]
  "ix86_binary_operator_ok (MINUS, SImode, operands)"
  "sbb{l}\t{$0, %0|%0, 0}"
  [(set_attr "type" "alu")
   (set_attr "pent_pair" "pu")
   (set_attr "mode" "SI")])

Of course in both 32-bit and 64-bit modes.  Which explains why I only did the
theory, and stopped before the practice.


-- 

bonzini at gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bonzini at gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30082

Reply via email to