From 7f827e73dff27c764e5f475613e3e06ae546103f Mon Sep 17 00:00:00 2001
From: Mahesh Bodapati <mbodapat@xilinx.com>
Date: Tue, 13 Sep 2022 15:24:25 +0530
Subject: [PATCH 32/53] [Patch,MicroBlaze]: Fixed issues like:     1 Interrupt
 alignment issue     2 Sign extension issue

---
 gcc/config/microblaze/microblaze.cc | 16 ++++++++++------
 gcc/config/microblaze/microblaze.md |  2 +-
 2 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/gcc/config/microblaze/microblaze.cc b/gcc/config/microblaze/microblaze.cc
index 4792e3ba370..f1da145232a 100644
--- a/gcc/config/microblaze/microblaze.cc
+++ b/gcc/config/microblaze/microblaze.cc
@@ -2178,9 +2178,14 @@ compute_frame_size (HOST_WIDE_INT size)
 
   total_size += gp_reg_size;
 
-  /* Add 4 bytes for MSR.  */
+  /* Add 4/8 bytes for MSR.  */
   if (microblaze_is_interrupt_variant ())
-    total_size += 4;
+    {
+      if (TARGET_MB_64)
+        total_size += 8;
+      else
+        total_size += 4;
+    }
 
   /* No space to be allocated for link register in leaf functions with no other
      stack requirements.  */
@@ -2465,7 +2470,6 @@ print_operand (FILE * file, rtx op, int letter)
   else if (letter == 'h' || letter == 'j')
     {
       long val[2];
-      int val1[2];
       long l[2];
       if (code == CONST_DOUBLE)
 	{
@@ -2480,10 +2484,10 @@ print_operand (FILE * file, rtx op, int letter)
 	}
       else if (code == CONST_INT || code == CONST)// || code == SYMBOL_REF ||code == LABEL_REF)
         {
-	  val1[0] = (INTVAL (op) & 0xffffffff00000000LL) >> 32;
-	  val1[1] = INTVAL (op) & 0x00000000ffffffffLL;
+	  val[0] = (INTVAL (op) & 0xffffffff00000000LL) >> 32;
+	  val[1] = INTVAL (op) & 0x00000000ffffffffLL;
         }
-      fprintf (file, "0x%8.8lx", (letter == 'h') ? val1[0] : val1[1]);
+      fprintf (file, "0x%8.8lx", (letter == 'h') ? val[0] : val[1]);
     }
   else if (code == CONST_DOUBLE)
     {
diff --git a/gcc/config/microblaze/microblaze.md b/gcc/config/microblaze/microblaze.md
index e54888550f6..4e5d21a1f4c 100644
--- a/gcc/config/microblaze/microblaze.md
+++ b/gcc/config/microblaze/microblaze.md
@@ -1096,7 +1096,7 @@
       case 1:
       case 2:
         {
-          output_asm_insn ("ll%i1\t%0,%1", operands);
+          output_asm_insn ("lw%i1\t%0,%1", operands);
           return "sextl32\t%0,%0";
         }
     } 
-- 
2.37.1 (Apple Git-137.1)

