summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>2010-11-12 17:53:36 +0000
committerrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>2010-11-12 17:53:36 +0000
commit041cf4137dfc4392f94b5de8386c65ea4f4718ca (patch)
treeb52955f1bbf013daa3c5d5060ab58cc99ba73847 /gcc
parente53bb4014e2fca967a755d42f5065d6b85383250 (diff)
downloadgcc-041cf4137dfc4392f94b5de8386c65ea4f4718ca.tar.gz
xtensa: Convert to fma.
* config.gcc [xtensa] (extra_options): Add fused-madd.opt. * config/xtensa/xtensa.opt (mfused-madd): Remove. * config/xtensa/xtensa.c (TARGET_DEFAULT_TARGET_FLAGS): Remove MASK_FUSED_MADD. * config/xtensa/xtensa.md (fmasf4): Rename from muladdsf3; use * fma. (fnmasf4): Rename from mulsubsf3; use fma. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@166666 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog9
-rw-r--r--gcc/config.gcc3
-rw-r--r--gcc/config/xtensa/xtensa.c2
-rw-r--r--gcc/config/xtensa/xtensa.md23
-rw-r--r--gcc/config/xtensa/xtensa.opt4
5 files changed, 25 insertions, 16 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 399fe7a348f..923a1204426 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,12 @@
+2010-11-12 Richard Henderson <rth@redhat.com>
+
+ * config.gcc [xtensa] (extra_options): Add fused-madd.opt.
+ * config/xtensa/xtensa.opt (mfused-madd): Remove.
+ * config/xtensa/xtensa.c (TARGET_DEFAULT_TARGET_FLAGS): Remove
+ MASK_FUSED_MADD.
+ * config/xtensa/xtensa.md (fmasf4): Rename from muladdsf3; use fma.
+ (fnmasf4): Rename from mulsubsf3; use fma.
+
2010-11-12 Joern Rennecke <amylaar@spamcop.net>
Richard Henderson <rth@redhat.com>
diff --git a/gcc/config.gcc b/gcc/config.gcc
index f92483de52a..cb718b4b2f6 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -399,6 +399,9 @@ sh[123456789lbe]*-*-* | sh-*-*)
cpu_type=sh
need_64bit_hwint=yes
;;
+xtensa*-*-*)
+ extra_options="${extra_options} fused-madd.opt"
+ ;;
esac
tm_file=${cpu_type}/${cpu_type}.h
diff --git a/gcc/config/xtensa/xtensa.c b/gcc/config/xtensa/xtensa.c
index a01fb0b3019..033779c3d58 100644
--- a/gcc/config/xtensa/xtensa.c
+++ b/gcc/config/xtensa/xtensa.c
@@ -193,7 +193,7 @@ static const struct default_options xtensa_option_optimization_table[] =
#define TARGET_ASM_SELECT_RTX_SECTION xtensa_select_rtx_section
#undef TARGET_DEFAULT_TARGET_FLAGS
-#define TARGET_DEFAULT_TARGET_FLAGS (TARGET_DEFAULT | MASK_FUSED_MADD)
+#define TARGET_DEFAULT_TARGET_FLAGS (TARGET_DEFAULT)
#undef TARGET_LEGITIMIZE_ADDRESS
#define TARGET_LEGITIMIZE_ADDRESS xtensa_legitimize_address
diff --git a/gcc/config/xtensa/xtensa.md b/gcc/config/xtensa/xtensa.md
index 13883f1d5ca..9d9bf9c246d 100644
--- a/gcc/config/xtensa/xtensa.md
+++ b/gcc/config/xtensa/xtensa.md
@@ -315,24 +315,25 @@
(set_attr "mode" "SF")
(set_attr "length" "3")])
-(define_insn "muladdsf3"
+(define_insn "fmasf4"
[(set (match_operand:SF 0 "register_operand" "=f")
- (plus:SF (mult:SF (match_operand:SF 1 "register_operand" "%f")
- (match_operand:SF 2 "register_operand" "f"))
- (match_operand:SF 3 "register_operand" "0")))]
- "TARGET_HARD_FLOAT && TARGET_FUSED_MADD"
+ (fma:SF (match_operand:SF 1 "register_operand" "f")
+ (match_operand:SF 2 "register_operand" "f")
+ (match_operand:SF 3 "register_operand" "0")))]
+ "TARGET_HARD_FLOAT"
"madd.s\t%0, %1, %2"
[(set_attr "type" "fmadd")
(set_attr "mode" "SF")
(set_attr "length" "3")])
-(define_insn "mulsubsf3"
+;; Note that (C - A*B) = (-A*B + C)
+(define_insn "fnmasf4"
[(set (match_operand:SF 0 "register_operand" "=f")
- (minus:SF (match_operand:SF 1 "register_operand" "0")
- (mult:SF (match_operand:SF 2 "register_operand" "%f")
- (match_operand:SF 3 "register_operand" "f"))))]
- "TARGET_HARD_FLOAT && TARGET_FUSED_MADD"
- "msub.s\t%0, %2, %3"
+ (fma:SF (neg:SF (match_operand:SF 1 "register_operand" "f"))
+ (match_operand:SF 2 "register_operand" "f")
+ (match_operand:SF 3 "register_operand" "0")))]
+ "TARGET_HARD_FLOAT"
+ "msub.s\t%0, %1, %2"
[(set_attr "type" "fmadd")
(set_attr "mode" "SF")
(set_attr "length" "3")])
diff --git a/gcc/config/xtensa/xtensa.opt b/gcc/config/xtensa/xtensa.opt
index 18f8bf3aae1..9ae8b392eff 100644
--- a/gcc/config/xtensa/xtensa.opt
+++ b/gcc/config/xtensa/xtensa.opt
@@ -22,10 +22,6 @@ mconst16
Target Report Mask(CONST16)
Use CONST16 instruction to load constants
-mfused-madd
-Target Report Mask(FUSED_MADD)
-Enable fused multiply/add and multiply/subtract FP instructions
-
mforce-no-pic
Target Report Mask(FORCE_NO_PIC)
Disable position-independent code (PIC) for use in OS kernel code