diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index b5addb81dec2f60cc67085cea39623791410258e..7e785b63d200839c40675ccd37750149f10e2abe 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2007-01-14  Uros Bizjak  <ubizjak@gmail.com>
+
+	PR target/30413
+	* config/i386/i386.c (print_operand) ['z']: Output 'b' for
+	operands of size 1.
+
 2007-01-14  Jan Hubicka  <jh@suse.cz>
 
 	* tree-dfa.c (remove_referenced_var): New function.
@@ -619,7 +625,6 @@
 
 	* config/i386/i386.md (*sinxf2): Rename to *sinxf2_i387.
 	(*cosxf2): Rename to cosxf2_i387.
-
 	(*sindf2, *sinsf2): Extend operand 1 to XFmode.  Macroize patterns
 	using X87MODEF12 mode macro. Rename patterns to
 	*sin_extend<mode>xf2_i387.  Use SSE_FLOAT_MODE_P to disable patterns
@@ -627,9 +632,7 @@
 	(*cosdf2, *cossf2): Ditto.
 	(sincosdf3, sincossf3): Ditto.  Rewrite corresponding splitters
 	to match extended input operands.
-
 	(sincos<mode>3): New expander.
-
 	(*sinextendsfdf2, *cosextendsfdf2, *sincosextendsfdf3): Remove
 	insn patterns and corresponding splitters.
 
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 579b4a32f9480a7b5c8e1b71c180b32909b10828..a2ec4d8a2e5af2e8ad8648eb3e9fa8f634f3d9ba 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -7918,6 +7918,10 @@ print_operand (FILE *file, rtx x, int code)
 	  /* This is the size of op from size of operand.  */
 	  switch (GET_MODE_SIZE (GET_MODE (x)))
 	    {
+	    case 1:
+	      putc ('b', file);
+	      return;
+
 	    case 2:
 #ifdef HAVE_GAS_FILDS_FISTS
 	      putc ('s', file);
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index ce42aaa2f5bf0af8ccf79d60e4397f294bdbc51e..e6fa28dc5ed4498b321b06facfb823f1894fff70 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2007-01-14  Uros Bizjak  <ubizjak@gmail.com>
+
+	PR target/30413
+	* gcc.target/i386/pr30413.c: New test.
+
 2007-01-14  Thomas Koenig  <Thomas.Koenig@online.de>
 
 	PR fortran/30452
diff --git a/gcc/testsuite/gcc.target/i386/pr30413.c b/gcc/testsuite/gcc.target/i386/pr30413.c
new file mode 100644
index 0000000000000000000000000000000000000000..cd52d8bd92e303caf051d9bc6bccebbdb2ac1684
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr30413.c
@@ -0,0 +1,18 @@
+/* { dg-do run { target i?86-*-* x86_64-*-* } } */
+/* { dg-options "-O2" } */
+
+extern void abort (void);
+
+int test() {
+  char a, b = -1;
+  asm volatile ("mov%z0 %1, %0" : "=q"(a) : "m"(b));
+  return a;
+}
+
+int main()
+{
+  if (test() != -1)
+    abort();
+
+  return 0;
+}