--- gcc/config/mips/mips.c.jj	2015-06-08 23:06:50.000000000 +0200
+++ gcc/config/mips/mips.c	2015-07-03 13:16:02.637293167 +0200
@@ -9902,8 +9902,11 @@ mips_cfun_has_inflexible_gp_ref_p (void)
 static bool
 mips_insn_has_flexible_gp_ref_p (rtx_insn *insn)
 {
-  return (get_attr_got (insn) != GOT_UNSET
-	  || mips_small_data_pattern_p (PATTERN (insn))
+  rtx_insn *subinsn;
+  FOR_EACH_SUBINSN (subinsn, insn)
+    if (get_attr_got (subinsn) != GOT_UNSET)
+      return true;
+  return (mips_small_data_pattern_p (PATTERN (insn))
 	  || reg_overlap_mentioned_p (pic_offset_table_rtx, PATTERN (insn)));
 }
 
