diff --git a/external/gpl3/gcc/dist/gcc/config/vax/vax.c b/external/gpl3/gcc/dist/gcc/config/vax/vax.c
index db18b96fc0f4..1621aa56b57b 100644
--- a/external/gpl3/gcc/dist/gcc/config/vax/vax.c
+++ b/external/gpl3/gcc/dist/gcc/config/vax/vax.c
@@ -582,7 +582,7 @@ print_operand (FILE *file, rtx x, int code)
   else if (code == 'b' && CONST_INT_P (x))
     fprintf (file, "$%d", (int) (0xff & - INTVAL (x)));
   else if (code == 'M' && CONST_INT_P (x))
-    fprintf (file, "$%d", ~((1 << INTVAL (x)) - 1));
+    fprintf (file, "$%d", ((~0) << (INTVAL (x))));
   else if (code == 'x' && CONST_INT_P (x))
     fprintf (file, HOST_WIDE_INT_PRINT_HEX, INTVAL (x));
   else if (REG_P (x))
diff --git a/external/gpl3/gcc/dist/gcc/config/vax/vax.md b/external/gpl3/gcc/dist/gcc/config/vax/vax.md
index a146be6f7cee..5b0bcf9843a1 100644
--- a/external/gpl3/gcc/dist/gcc/config/vax/vax.md
+++ b/external/gpl3/gcc/dist/gcc/config/vax/vax.md
@@ -941,7 +941,14 @@
   if (INTVAL (operands[3]) & 31)
     return \"rotl %R3,%1,%0\;bicl2 %M2,%0\";
   if (rtx_equal_p (operands[0], operands[1]))
+    {
+      if (INTVAL (operands[2]) == 32)
+        return \"\";  /* no-op */
+      else
     return \"bicl2 %M2,%0\";
+    }
+  if (INTVAL (operands[2]) == 32)
+    return \"movl %1,%0\";
   return \"bicl3 %M2,%1,%0\";
 }")