From: Uros Bizjak Date: Wed, 1 Mar 2017 19:24:53 +0000 (+0100) Subject: i386.c (print_reg): Warn for values of unsupported size in integer register. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=489909059b8c7dfa3b379be229e7cb1feab9675d;p=gcc.git i386.c (print_reg): Warn for values of unsupported size in integer register. * config/i386/i386.c (print_reg): Warn for values of unsupported size in integer register. testsuite/ChangeLog: * gcc.target/i386/invsize-2.c: New test. * gcc.target/i386/invsize-3.c: Ditto. * gcc.target/i386/invsize-4.c: Ditto. * gcc.target/i386/pr66274.c: Expect "unsuported size" warning. * gcc.target/i386/stackalign/asm-1.c: Ditto. From-SVN: r245815 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c4f879818a4..d791c18247b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2017-03-01 Uros Bizjak + + * config/i386/i386.c (print_reg): Warn for values of + unsupported size in integer register. + 2017-03-01 Michael Meissner PR target/79439 diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 2b11aa1c37d..754c016f139 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -17646,13 +17646,16 @@ print_reg (rtx x, int code, FILE *file) switch (msize) { + case 16: + case 12: case 8: + if (GENERAL_REGNO_P (regno) && msize > GET_MODE_SIZE (word_mode)) + warning (0, "unsupported size for integer register"); + /* FALLTHRU */ case 4: if (LEGACY_INT_REGNO_P (regno)) - putc (msize == 8 && TARGET_64BIT ? 'r' : 'e', file); + putc (msize > 4 && TARGET_64BIT ? 'r' : 'e', file); /* FALLTHRU */ - case 16: - case 12: case 2: normal: reg = hi_reg_name[regno]; @@ -17661,7 +17664,7 @@ print_reg (rtx x, int code, FILE *file) if (regno >= ARRAY_SIZE (qi_reg_name)) goto normal; if (!ANY_QI_REGNO_P (regno)) - error ("unsupported size for integer register in 32-bit mode"); + error ("unsupported size for integer register"); reg = qi_reg_name[regno]; break; case 0: diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b3ba66bc7c9..2b73362781c 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2017-03-01 Uros Bizjak + + * gcc.target/i386/invsize-2.c: New test. + * gcc.target/i386/invsize-3.c: Ditto. + * gcc.target/i386/invsize-4.c: Ditto. + * gcc.target/i386/pr66274.c: Expect "unsuported size" warning. + * gcc.target/i386/stackalign/asm-1.c: Ditto. + 2017-03-01 Michael Meissner PR target/79439 diff --git a/gcc/testsuite/gcc.target/i386/invsize-1.c b/gcc/testsuite/gcc.target/i386/invsize-1.c index f7e59211f65..eefa5fada3d 100644 --- a/gcc/testsuite/gcc.target/i386/invsize-1.c +++ b/gcc/testsuite/gcc.target/i386/invsize-1.c @@ -1,4 +1,5 @@ /* { dg-do compile { target ia32 } } */ +/* { dg-options "" } */ void foo (char x) { diff --git a/gcc/testsuite/gcc.target/i386/invsize-2.c b/gcc/testsuite/gcc.target/i386/invsize-2.c new file mode 100644 index 00000000000..7a9825ab783 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/invsize-2.c @@ -0,0 +1,7 @@ +/* { dg-do compile { target ia32 } } */ +/* { dg-options "" } */ + +void foo (long long x) +{ + __asm__ volatile ("# %0" : : "r" (x)); +} /* { dg-warning "unsupported size" } */ diff --git a/gcc/testsuite/gcc.target/i386/invsize-3.c b/gcc/testsuite/gcc.target/i386/invsize-3.c new file mode 100644 index 00000000000..bd23353fe00 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/invsize-3.c @@ -0,0 +1,7 @@ +/* { dg-do compile } */ +/* { dg-options "" } */ + +void foo (long double x) +{ + __asm__ volatile ("# %0" : : "r" (x)); +} /* { dg-warning "unsupported size" } */ diff --git a/gcc/testsuite/gcc.target/i386/invsize-4.c b/gcc/testsuite/gcc.target/i386/invsize-4.c new file mode 100644 index 00000000000..d4a6d467aee --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/invsize-4.c @@ -0,0 +1,7 @@ +/* { dg-do compile { target int128 } } */ +/* { dg-options "" } */ + +void foo (__int128 x) +{ + __asm__ volatile ("# %0" : : "r" (x)); +} /* { dg-warning "unsupported size" } */ diff --git a/gcc/testsuite/gcc.target/i386/pr66274.c b/gcc/testsuite/gcc.target/i386/pr66274.c index 59969eb9037..caf0d34cd9c 100644 --- a/gcc/testsuite/gcc.target/i386/pr66274.c +++ b/gcc/testsuite/gcc.target/i386/pr66274.c @@ -3,7 +3,7 @@ void f() { - asm ("push %0" : : "r" ((unsigned long long) 456)); -} + asm ("push %0" : : "r" ((unsigned long long) 456 >> 32)); +} /* { dg-warning "unsupported size" } */ -/* { dg-final { scan-assembler-not "push %r" } } */ +/* { dg-final { scan-assembler-not "push\[ \t]+%r" } } */ diff --git a/gcc/testsuite/gcc.target/i386/stackalign/asm-1.c b/gcc/testsuite/gcc.target/i386/stackalign/asm-1.c index 126a2b8a01d..e5ea06df819 100644 --- a/gcc/testsuite/gcc.target/i386/stackalign/asm-1.c +++ b/gcc/testsuite/gcc.target/i386/stackalign/asm-1.c @@ -4,4 +4,4 @@ /* This case is to detect a compile time regression introduced in stack branch development. */ -void f(){asm("%0"::"r"(1.5F));}void g(){asm("%0"::"r"(1.5));} +void f(){asm("%0"::"r"(1.5F));}void g(){asm("%0"::"r"(1.5));} /* { dg-warning "unsupported size" } */