OSDN Git Service

* i386.md (fix_truncsfhi2, fix_truncdfhi2,
authorwehle <wehle@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 9 Apr 2000 19:26:31 +0000 (19:26 +0000)
committerwehle <wehle@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 9 Apr 2000 19:26:31 +0000 (19:26 +0000)
fix_truncxfhi2): New patterns.
* i386.c (output_fix_trunc): Handle converting to HImode.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@33044 138bc75d-0d04-0410-961f-82ee72b054a4

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

index 775428c..6c8074d 100644 (file)
@@ -1,3 +1,9 @@
+Sun Apr  9 15:16:14 EDT 2000  John Wehle  (john@feith.com)
+
+       * i386.md (fix_truncsfhi2, fix_truncdfhi2,
+       fix_truncxfhi2): New patterns.
+       * i386.c (output_fix_trunc): Handle converting to HImode.
+
 2000-04-08  Alex Samuel  <samuel@codesourcery.com>
 
        * ssa.c (convert_to_ssa): Eliminate dead code when calling
index 9eb13ea..dcab2be 100644 (file)
@@ -3643,7 +3643,7 @@ output_387_binary_op (insn, operands)
 }
 
 /* Output code for INSN to convert a float to a signed int.  OPERANDS
-   are the insn operands.  The output may be [SD]Imode and the input
+   are the insn operands.  The output may be [HSD]Imode and the input
    operand may be [SDX]Fmode.  */
 
 const char *
@@ -3694,8 +3694,10 @@ output_fix_trunc (insn, operands)
          output_asm_insn ("mov{l}\t{%2, %0|%0, %2}", xops);
          output_asm_insn ("mov{l}\t{%3, %1|%1, %3}", xops);
        }
-      else
+      else if (GET_MODE (operands[0]) == SImode)
        output_asm_insn ("mov{l}\t{%3, %0|%0, %3}", operands);
+      else
+       output_asm_insn ("mov{w}\t{%3, %0|%0, %3}", operands);
     }
 
   return "";
index dc24d5f..294493c 100644 (file)
    (set (match_dup 0) (match_dup 3))]
   "")
 
+;; Signed conversion to HImode.
+
+(define_expand "fix_truncxfhi2"
+  [(parallel [(set (match_operand:HI 0 "nonimmediate_operand" "")
+                  (fix:HI (match_operand:XF 1 "register_operand" "")))
+             (clobber (match_dup 2))
+             (clobber (match_dup 3))
+             (clobber (match_scratch:SI 4 ""))])]
+  "TARGET_80387"
+  "operands[2] = assign_386_stack_local (SImode, 0);
+   operands[3] = assign_386_stack_local (HImode, 1);")
+
+(define_expand "fix_truncdfhi2"
+  [(parallel [(set (match_operand:HI 0 "nonimmediate_operand" "")
+                  (fix:HI (match_operand:DF 1 "register_operand" "")))
+             (clobber (match_dup 2))
+             (clobber (match_dup 3))
+             (clobber (match_scratch:SI 4 ""))])]
+  "TARGET_80387"
+  "operands[2] = assign_386_stack_local (SImode, 0);
+   operands[3] = assign_386_stack_local (HImode, 1);")
+
+(define_expand "fix_truncsfhi2"
+  [(parallel [(set (match_operand:HI 0 "nonimmediate_operand" "")
+                  (fix:HI (match_operand:SF 1 "register_operand" "")))
+             (clobber (match_dup 2))
+             (clobber (match_dup 3))
+             (clobber (match_scratch:SI 4 ""))])]
+  "TARGET_80387"
+  "operands[2] = assign_386_stack_local (SImode, 0);
+   operands[3] = assign_386_stack_local (HImode, 1);")
+
+(define_insn "*fix_trunchi_1"
+  [(set (match_operand:HI 0 "nonimmediate_operand" "=m,?r")
+       (fix:HI (match_operand 1 "register_operand" "f,f")))
+   (clobber (match_operand:SI 2 "memory_operand" "=o,o"))
+   (clobber (match_operand:HI 3 "memory_operand" "=m,m"))
+   (clobber (match_scratch:SI 4 "=&r,r"))]
+  "TARGET_80387 && FLOAT_MODE_P (GET_MODE (operands[1]))"
+  "* return output_fix_trunc (insn, operands);"
+  [(set_attr "type" "multi")])
+
+(define_split 
+  [(set (match_operand:HI 0 "register_operand" "")
+       (fix:HI (match_operand 1 "register_operand" "")))
+   (clobber (match_operand:SI 2 "memory_operand" ""))
+   (clobber (match_operand:HI 3 "memory_operand" ""))
+   (clobber (match_scratch:SI 4 ""))]
+  "reload_completed"
+  [(parallel [(set (match_dup 3) (fix:HI (match_dup 1)))
+             (clobber (match_dup 2))
+             (clobber (match_dup 3))
+             (clobber (match_dup 4))])
+   (set (match_dup 0) (match_dup 3))]
+  "")
+
 ;; %% Not used yet.
 (define_insn "x86_fnstcw_1"
   [(set (match_operand:HI 0 "memory_operand" "=m")