  
  	  XEXP (x, 0) = temp;
  	  return x;
-@@ -11437,9 +11618,23 @@
+@@ -11437,9 +11616,23 @@
        break;
      case SEG_FS:
      case SEG_GS:

 
 	  XEXP (x, 1) = temp;
 	  return x;
@@ -10177,7 +10344,21 @@
 	  rtx temp = gen_reg_rtx (Pmode);
 	  rtx val  = force_operand (XEXP (x, 0), temp);
 	  if (val != temp)

 		  if (reload_in_progress)
 		    df_set_regs_ever_live (PIC_OFFSET_TABLE_REGNUM, true);
-		  new_rtx = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, op0),
+		  new_rtx = gen_rtx_UNSPEC (orig_mode, gen_rtvec (1, op0),
 					    UNSPEC_GOTOFF);
-		  new_rtx = gen_rtx_PLUS (Pmode, new_rtx, op1);
-		  new_rtx = gen_rtx_CONST (Pmode, new_rtx);
-		  new_rtx = gen_rtx_PLUS (Pmode, pic_offset_table_rtx, new_rtx);
+		  new_rtx = gen_rtx_PLUS (orig_mode, new_rtx, op1);
+		  new_rtx = gen_rtx_CONST (orig_mode, new_rtx);
+		  new_rtx = gen_rtx_PLUS (orig_mode, pic_offset_table_rtx, new_rtx);
 
 		  if (reg != 0)
 		    {
@@ -9698,9 +9849,9 @@
 		  if (INTVAL (op1) < -16*1024*1024
 		      || INTVAL (op1) >= 16*1024*1024)
 		    {
-		      if (!x86_64_immediate_operand (op1, Pmode))
-			op1 = force_reg (Pmode, op1);
-		      new_rtx = gen_rtx_PLUS (Pmode, force_reg (Pmode, op0), op1);
+		      if (!x86_64_immediate_operand (op1, orig_mode))
+			op1 = force_reg (orig_mode, op1);
+		      new_rtx = gen_rtx_PLUS (orig_mode, force_reg (orig_mode, op0), op1);
 		    }
 		}
 	    }
@@ -9716,10 +9867,10 @@
 		{
 		  if (GET_CODE (new_rtx) == PLUS && CONSTANT_P (XEXP (new_rtx, 1)))
 		    {
-		      base = gen_rtx_PLUS (Pmode, base, XEXP (new_rtx, 0));
+		      base = gen_rtx_PLUS (orig_mode, base, XEXP (new_rtx, 0));
 		      new_rtx = XEXP (new_rtx, 1);
 		    }
-		  new_rtx = gen_rtx_PLUS (Pmode, base, new_rtx);
+		  new_rtx = gen_rtx_PLUS (orig_mode, base, new_rtx);
 		}
 	    }
 	}
@@ -10166,7 +10317,21 @@
 	  rtx temp = gen_reg_rtx (Pmode);
 	  rtx val  = force_operand (XEXP (x, 1), temp);
 	  if (val != temp)
