From 80c16e39bdf8643184c353e34f146dc8601c2c1e Mon Sep 17 00:00:00 2001
From: Nagaraju Mekala <nmekala@xilix.com>
Date: Tue, 9 Oct 2018 10:07:08 +0530
Subject: [PATCH 34/53] -Added double arith instructions -Fixed prologue stack
 pointer decrement issue

---
 gcc/config/microblaze/microblaze.md | 78 +++++++++++++++++++++++++----
 gcc/config/microblaze/t-microblaze  |  7 +++
 2 files changed, 76 insertions(+), 9 deletions(-)

diff --git a/gcc/config/microblaze/microblaze.md b/gcc/config/microblaze/microblaze.md
index 5a950b49591..5506aee7be5 100644
--- a/gcc/config/microblaze/microblaze.md
+++ b/gcc/config/microblaze/microblaze.md
@@ -527,6 +527,66 @@
   (set_attr "mode"      "SF")
   (set_attr "length"    "4")])
 
+(define_insn "fix_truncsfsi2"
+  [(set (match_operand:SI 0 "register_operand" "=d")
+        (fix:SI (match_operand:SF 1 "register_operand" "d")))]
+  "TARGET_HARD_FLOAT && TARGET_FLOAT_CONVERT"
+  "fint\t%0,%1"
+  [(set_attr "type"     "fint")
+  (set_attr "mode"      "SF")
+  (set_attr "length"    "4")])
+
+
+(define_insn "adddf3"
+  [(set (match_operand:DF 0 "register_operand" "=d")
+        (plus:DF (match_operand:DF 1 "register_operand" "d")
+                 (match_operand:DF 2 "register_operand" "d")))]
+  "TARGET_MB_64"
+  "dadd\t%0,%1,%2"
+  [(set_attr "type"     "fadd")
+  (set_attr "mode"      "DF")
+  (set_attr "length"    "4")])
+
+(define_insn "subdf3"
+  [(set (match_operand:DF 0 "register_operand" "=d")
+        (minus:DF (match_operand:DF 1 "register_operand" "d")
+                  (match_operand:DF 2 "register_operand" "d")))]
+  "TARGET_MB_64"
+  "drsub\t%0,%2,%1"
+  [(set_attr "type"     "frsub")
+  (set_attr "mode"      "DF")
+  (set_attr "length"    "4")])
+
+(define_insn "muldf3"
+  [(set (match_operand:DF 0 "register_operand" "=d")
+        (mult:DF (match_operand:DF 1 "register_operand" "d")
+                 (match_operand:DF 2 "register_operand" "d")))]
+  "TARGET_MB_64"
+  "dmul\t%0,%1,%2"
+  [(set_attr "type"     "fmul")
+  (set_attr "mode"      "DF")
+  (set_attr "length"    "4")])
+
+(define_insn "divdf3"
+  [(set (match_operand:DF 0 "register_operand" "=d")
+        (div:DF (match_operand:DF 1 "register_operand" "d")
+                (match_operand:DF 2 "register_operand" "d")))]
+  "TARGET_MB_64"
+  "ddiv\t%0,%2,%1"
+  [(set_attr "type"     "fdiv")
+  (set_attr "mode"      "DF")
+  (set_attr "length"    "4")])
+
+
+(define_insn "sqrtdf2"
+  [(set (match_operand:DF 0 "register_operand" "=d")
+        (sqrt:DF (match_operand:DF 1 "register_operand" "d")))]
+  "TARGET_MB_64"
+  "dsqrt\t%0,%1"
+  [(set_attr "type"     "fsqrt")
+  (set_attr "mode"      "DF")
+  (set_attr "length"    "4")])
+
 (define_insn "floatdidf2"
   [(set (match_operand:DF 0 "register_operand" "=d")
         (float:DF (match_operand:DI 1 "register_operand" "d")))]
@@ -536,13 +596,13 @@
   (set_attr "mode"      "DF")
   (set_attr "length"    "4")])
 
-(define_insn "fix_truncsfsi2"
-  [(set (match_operand:SI 0 "register_operand" "=d")
-        (fix:SI (match_operand:SF 1 "register_operand" "d")))]
-  "TARGET_HARD_FLOAT && TARGET_FLOAT_CONVERT"
-  "fint\t%0,%1"
-  [(set_attr "type"     "fint")
-  (set_attr "mode"      "SF")
+(define_insn "floatdfdi2"
+  [(set (match_operand:DI 0 "register_operand" "=d")
+        (float:DI (match_operand:DF 1 "register_operand" "d")))]
+  "TARGET_MB_64"
+  "dlong\t%0,%1"
+  [(set_attr "type"     "fcvt")
+  (set_attr "mode"      "DI")
   (set_attr "length"    "4")])
 
 ;;----------------------------------------------------------------
@@ -660,8 +720,8 @@
   "TARGET_MB_64"
   "@
    rsubl\t%0,%2,%1
-   addik\t%0,%z1,-%2
-   addik\t%0,%z1,-%2"
+   addlik\t%0,%z1,-%2
+   addlik\t%0,%z1,-%2"
   [(set_attr "type"	"arith,no_delay_arith,no_delay_arith")
   (set_attr "mode"	"DI")
   (set_attr "length"	"4,4,4")])
diff --git a/gcc/config/microblaze/t-microblaze b/gcc/config/microblaze/t-microblaze
index 47b869b9303..3522afd4831 100644
--- a/gcc/config/microblaze/t-microblaze
+++ b/gcc/config/microblaze/t-microblaze
@@ -1,6 +1,13 @@
 MULTILIB_OPTIONS = m64 mxl-barrel-shift mlittle-endian mno-xl-soft-mul mxl-multiply-high
 MULTILIB_DIRNAMES = m64 bs le m mh
 MULTILIB_EXCEPTIONS = *m64/mxl-multiply-high mxl-multiply-high
+MULTILIB_EXCEPTIONS += *m64
+MULTILIB_EXCEPTIONS += *m64/mxl-barrel-shift
+MULTILIB_EXCEPTIONS += *m64/mno-xl-soft-mul
+MULTILIB_EXCEPTIONS += *m64/mxl-barrel-shift/mno-xl-soft-mul
+MULTILIB_EXCEPTIONS += *m64/mno-xl-soft-mul
+MULTILIB_EXCEPTIONS += *m64/mxl-barrel-shift/mno-xl-soft-mul/mxl-multiply-high
+MULTILIB_EXCEPTIONS += *m64/mno-xl-soft-mul/mxl-multiply-high
 MULTILIB_EXCEPTIONS += *mxl-barrel-shift/mxl-multiply-high mxl-multiply-high
 MULTILIB_EXCEPTIONS += *mlittle-endian/mxl-multiply-high mxl-multiply-high
 MULTILIB_EXCEPTIONS += *m64/mxl-barrel-shift/mlittle-endian/mxl-multiply-high
-- 
2.37.1 (Apple Git-137.1)

