@end ifclear
 * 2byte::                       @code{.2byte @var{expressions}}
 * 4byte::                       @code{.4byte @var{expressions}}
-* 8byte::                       @code{.8byte @var{bignums}}
+* 8byte::                       @code{.8byte @var{expressions}}
 * Deprecated::                  Deprecated Directives
 @end menu
 
 @end ifset
 
 @node Quad
-@section @code{.quad @var{bignums}}
+@section @code{.quad @var{expressions}}
 
 @cindex @code{quad} directive
-@code{.quad} expects zero or more bignums, separated by commas.  For
-each bignum, it emits
 @ifclear bignum-16
-an 8-byte integer.  If the bignum won't fit in 8 bytes, it prints a
-warning message; and just takes the lowest order 8 bytes of the bignum.
+For 64-bit architectures, or more generally with any GAS configured to support
+64-bit target virtual addresses, this is like @samp{.int}, but emitting 64-bit
+quantities.  Otherwise @code{.quad} expects zero or more bignums, separated by
+commas.  For each item, it emits an 8-byte integer.  If a bignum won't fit in
+8 bytes, a warning message is printed and just the lowest order 8 bytes of the
+bignum are taken.
 @cindex eight-byte integer
 @cindex integer, 8-byte
 
 hence @emph{quad}-word for 8 bytes.
 @end ifclear
 @ifset bignum-16
-a 16-byte integer.  If the bignum won't fit in 16 bytes, it prints a
-warning message; and just takes the lowest order 16 bytes of the bignum.
+@code{.quad} expects zero or more bignums, separated by commas.  For
+each bignum, it emits a 16-byte integer.  If the bignum won't fit in 16
+bytes, it prints a warning message; and just takes the lowest order 16
+bytes of the bignum.
+@xref{Octa,,@code{.octa @var{bignums}}}.
 @cindex sixteen-byte integer
 @cindex integer, 16-byte
 @end ifset
 @cindex eight-byte integer
 @cindex integer, 8-byte
 
-Like the @option{.2byte} directive, except that it inserts unaligned, eight
-byte long bignum values into the output.
+For 64-bit architectures, or more generally with any GAS configured to support
+64-bit target virtual addresses, this is like the @option{.2byte} directive,
+except that it inserts unaligned, eight byte long values into the output.
+Otherwise, like @ref{Quad,,@code{.quad @var{expressions}}}, it expects zero or
+more bignums, separated by commas.
 
 @node Deprecated
 @section Deprecated Directives
 
              {
                expressionP->X_add_number = ~ expressionP->X_add_number;
                expressionP->X_extrabit ^= 1;
+               expressionP->X_unsigned = 0;
              }
            else if (c == '!')
              {
   while (op_left != O_illegal && op_rank[(int) op_left] > rank)
     {
       segT rightseg;
+      bool is_unsigned;
       offsetT frag_off;
 
       input_line_pointer += op_chars;  /* -> after operator.  */
          right.X_op_symbol = NULL;
        }
 
+      is_unsigned = resultP->X_unsigned && right.X_unsigned;
+
       if (mode == expr_defer
          && ((resultP->X_add_symbol != NULL
               && S_IS_FORWARD_REF (resultP->X_add_symbol))
       if (md_optimize_expr (resultP, op_left, &right))
        {
          /* Skip.  */
-         ;
+         is_unsigned = resultP->X_unsigned;
        }
       else
 #endif
          add_to_result (resultP, symval_diff, symval_diff < 0);
          resultP->X_op = O_constant;
          resultP->X_add_symbol = 0;
+         is_unsigned = false;
        }
       else if (op_left == O_subtract && right.X_op == O_constant
               && (md_register_arithmetic || resultP->X_op != O_register))
        {
          /* X - constant.  */
          subtract_from_result (resultP, right.X_add_number, right.X_extrabit);
+         is_unsigned = false;
        }
       else if (op_left == O_add && resultP->X_op == O_constant
               && (md_register_arithmetic || right.X_op != O_register))
              else
                resultP->X_add_number
                  = (valueT) resultP->X_add_number >> (valueT) v;
+             is_unsigned = resultP->X_unsigned;
              break;
            case O_bit_inclusive_or:    resultP->X_add_number |= v; break;
            case O_bit_or_not:          resultP->X_add_number |= ~v; break;
                 here.  */
            case O_subtract:
              subtract_from_result (resultP, v, 0);
+             is_unsigned = false;
              break;
            case O_eq:
              resultP->X_add_number =
                resultP->X_add_number == v ? ~ (offsetT) 0 : 0;
+             is_unsigned = false;
              break;
            case O_ne:
              resultP->X_add_number =
                resultP->X_add_number != v ? ~ (offsetT) 0 : 0;
+             is_unsigned = false;
              break;
            case O_lt:
              resultP->X_add_number =
                resultP->X_add_number <  v ? ~ (offsetT) 0 : 0;
+             is_unsigned = false;
              break;
            case O_le:
              resultP->X_add_number =
                resultP->X_add_number <= v ? ~ (offsetT) 0 : 0;
+             is_unsigned = false;
              break;
            case O_ge:
              resultP->X_add_number =
                resultP->X_add_number >= v ? ~ (offsetT) 0 : 0;
+             is_unsigned = false;
              break;
            case O_gt:
              resultP->X_add_number =
                resultP->X_add_number >  v ? ~ (offsetT) 0 : 0;
+             is_unsigned = false;
              break;
            case O_logical_and:
              resultP->X_add_number = resultP->X_add_number && v;
+             is_unsigned = true;
              break;
            case O_logical_or:
              resultP->X_add_number = resultP->X_add_number || v;
+             is_unsigned = true;
              break;
            }
        }
          resultP->X_op_symbol = make_expr_symbol (&right);
          resultP->X_op = op_left;
          resultP->X_add_number = 0;
-         resultP->X_unsigned = 1;
          resultP->X_extrabit = 0;
        }
 
+      resultP->X_unsigned = is_unsigned;
+
       if (retval != rightseg)
        {
          if (retval == undefined_section)
 
 
 run_dump_test quad
 
+# ~ isn't an operator on PDP-11
+if { ![istarget "pdp11-*-*"] } {
+    run_dump_test quad2
+}
+
 # poor little PDP-11 can't handle 16-byte values
 if { ![istarget "pdp11-*-*"] } {
     run_dump_test octa
 
 Contents of section .data:
  [^ ]* (ffff3344 55667788 99aabbcc ddeeffff|ffffeedd ccbbaa99 88776655 4433ffff) .*
  [^ ]* (00003444 55667788 99aabbcc ddeeffff|ffffeedd ccbbaa99 88776655 44340000) .*
+ [^ ]* (00000080 00000000 00000000 00000000|00000000 00000000 00000000 80000000) .*
+ [^ ]* (ffffffff 00000000 00000000 00000000|00000000 00000000 00000000 ffffffff) .*
+ [^ ]* (00000080 ffffffff ffffffff ffffffff|ffffffff ffffffff ffffffff 80000000) .*
+ [^ ]* (01000000 ffffffff ffffffff ffffffff|ffffffff ffffffff ffffffff 00000001) .*
+ [^ ]* (ffffff7f ffffffff ffffffff ffffffff|ffffffff ffffffff ffffffff 7fffffff) .*
+ [^ ]* (00000000 ffffffff ffffffff ffffffff|ffffffff ffffffff ffffffff 00000000) .*
+ [^ ]* (00000080 ffffffff ffffffff ffffffff|ffffffff ffffffff ffffffff 80000000) .*
+ [^ ]* (01000000 ffffffff ffffffff ffffffff|ffffffff ffffffff ffffffff 00000001) .*
 
  .data
  .octa ~0x112233445566778899aabbcc0000
  .octa -347510587133311339321256747728896
+ .octa 0x80000000
+ .octa 0xffffffff
+ .octa -0x80000000
+ .octa -0xffffffff
+ .octa ~0x80000000
+ .octa ~0xffffffff
+ .octa 0 - 0x80000000
+ .octa 0 - 0xffffffff
 
  00.. (00000000 87654321 00000000 ffffffff|21436587 00000000 ffffffff 00000000|00000000 65872143 00000000 ffffffff|43218765 00000000 ffffffff 00000000) .*
  00.. (ffffffff 89abcdf0 ffffffff 80000000|f0cdab89 ffffffff 00000080 ffffffff|ffffffff ab89f0cd ffffffff 00800000|cdf089ab ffffffff 00008000 ffffffff) .*
  00.. (ffffffff 789abcdf ffffffff 00000001|dfbc9a78 ffffffff 01000000 ffffffff|ffffffff 9a78dfbc ffffffff 00000100|bcdf789a ffffffff 00010000 ffffffff) .*
+ 00.. (ffffffff 80000000 ffffffff 00000001|00000080 ffffffff 01000000 ffffffff|ffffffff 00800000 ffffffff 00000100|00008000 ffffffff 00010000 ffffffff) .*
  00.. (01234567 89abcdef fedcba98 76543211|efcdab89 67452301 11325476 98badcfe|23016745 ab89efcd dcfe98ba 54761132|cdef89ab 45670123 32117654 ba98fedc) .*
 #pass
 
        .quad   -0x87654321
        .quad   -0xffffffff
 
+       .quad   0 - 0x80000000
+       .quad   0 - 0xffffffff
+
        .quad   0x123456789abcdef
        .quad   -0x123456789abcdef
 
--- /dev/null
+#objdump : -s -j .data -j "\$DATA\$"
+#name : .quad binary-not tests
+
+.*: .*
+
+Contents of section (\.data|\$DATA\$):
+ 0000 (ffffffff 7fffffff ffffffff 00000000|ffffff7f ffffffff 00000000 ffffffff) .*
+#pass
 
--- /dev/null
+       .data
+       .quad   ~0x80000000
+       .quad   ~0xffffffff