aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJohn Wehle <john@feith.com>2000-04-09 19:26:31 +0000
committerJohn Wehle <wehle@gcc.gnu.org>2000-04-09 19:26:31 +0000
commit46d21d2c8260c792f9cc5a92bffec3e987c63c2d (patch)
tree5b3f77674ed2d54fd1e8b4082c7c3cc0e3c3e07b /gcc
parente33c685bd65a677c9b4dfde232cb43d6cb55c15a (diff)
downloadgcc-46d21d2c8260c792f9cc5a92bffec3e987c63c2d.zip
gcc-46d21d2c8260c792f9cc5a92bffec3e987c63c2d.tar.gz
gcc-46d21d2c8260c792f9cc5a92bffec3e987c63c2d.tar.bz2
i386.md (fix_truncsfhi2, [...]): New patterns.
* i386.md (fix_truncsfhi2, fix_truncdfhi2, fix_truncxfhi2): New patterns. * i386.c (output_fix_trunc): Handle converting to HImode. From-SVN: r33044
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/config/i386/i386.c6
-rw-r--r--gcc/config/i386/i386.md56
3 files changed, 66 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 775428c..6c8074d 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 9eb13ea..dcab2be 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -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 "";
diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md
index dc24d5f..294493c 100644
--- a/gcc/config/i386/i386.md
+++ b/gcc/config/i386/i386.md
@@ -3113,6 +3113,62 @@
(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")