diff options
author | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2016-04-25 07:16:49 +0000 |
---|---|---|
committer | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2016-04-25 07:16:49 +0000 |
commit | 3b2ef6864dbb5abe099620f432bb650e84617af3 (patch) | |
tree | cbdab4041baf268d78a8b620a21bed1417a811d7 /gcc/testsuite/gcc.target | |
parent | 523464ff57eea48adea62ae64f3dadc464250513 (diff) | |
download | gcc-3b2ef6864dbb5abe099620f432bb650e84617af3.tar.gz |
2016-04-25 Basile Starynkevitch <basile@starynkevitch.net>
{{merging with even more of GCC 6, using subversion 1.9
svn merge -r234651:235002 ^/trunk
}}
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@235404 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/gcc.target')
43 files changed, 1216 insertions, 29 deletions
diff --git a/gcc/testsuite/gcc.target/aarch64/mgeneral-regs_4.c b/gcc/testsuite/gcc.target/aarch64/mgeneral-regs_4.c index 8eb50aafa2b..49b74d9e265 100644 --- a/gcc/testsuite/gcc.target/aarch64/mgeneral-regs_4.c +++ b/gcc/testsuite/gcc.target/aarch64/mgeneral-regs_4.c @@ -6,4 +6,4 @@ test (void) return 1; } -/* { dg-final { scan-assembler "\.arch.*fp.*simd" } } */ +/* { dg-final { scan-assembler-times "\\.arch armv8-a\n" 1 } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/pr70398.c b/gcc/testsuite/gcc.target/aarch64/pr70398.c new file mode 100644 index 00000000000..dbe5ad1b24f --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/pr70398.c @@ -0,0 +1,26 @@ +/* { dg-do run } */ +/* { dg-options "-O -fno-tree-loop-optimize -fno-tree-ter -static" } */ +unsigned int in[8 * 8] = + { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, + 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63 }; + +unsigned char out[8 * 8]; + +int +main (void) +{ + int i; + for (i = 0; i < 8 * 4; i++) + { + out[i * 2] = (unsigned char) in[i * 2] + 1; + out[i * 2 + 1] = (unsigned char) in[i * 2 + 1] + 2; + } + __asm__("":::"memory"); + for (i = 0; i < 8 * 4; i++) + { + if (out[i * 2] != in[i * 2] + 1 + || out[i * 2 + 1] != in[i * 2 + 1] + 2) + __builtin_abort (); + } + return 0; +} diff --git a/gcc/testsuite/gcc.target/aarch64/target_attr_15.c b/gcc/testsuite/gcc.target/aarch64/target_attr_15.c index f72bec878bf..2d8c7b955ce 100644 --- a/gcc/testsuite/gcc.target/aarch64/target_attr_15.c +++ b/gcc/testsuite/gcc.target/aarch64/target_attr_15.c @@ -10,4 +10,4 @@ foo (int a) return a + 1; } -/* { dg-final { scan-assembler-times "\\.arch armv8-a\n" 1 } } */ +/* { dg-final { scan-assembler-times "\\.arch armv8-a\\+nofp\\+nosimd\n" 1 } } */ diff --git a/gcc/testsuite/gcc.target/arm/pr70496.c b/gcc/testsuite/gcc.target/arm/pr70496.c new file mode 100644 index 00000000000..d3ee0b505a8 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/pr70496.c @@ -0,0 +1,13 @@ +/* { dg-do assemble } */ +/* { dg-options "-mthumb -O2" } */ +/* { dg-require-effective-target arm_arm_ok } */ +/* { dg-require-effective-target arm_thumb2_ok } */ + +int i; +void +main (void) +{ + __asm__ volatile (".arm"); + i = 0; + __asm__ volatile ("\n cbz r0, 2f\n2:"); +} diff --git a/gcc/testsuite/gcc.target/i386/asm-flag-6.c b/gcc/testsuite/gcc.target/i386/asm-flag-6.c new file mode 100644 index 00000000000..458587ec9dc --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/asm-flag-6.c @@ -0,0 +1,276 @@ +/* Executable testcase for 'output flags.' */ +/* { dg-do run } */ + +char TestC () +{ + char r; + + __asm__ ("stc" : "=@ccc"(r)); + if (r) + { + __asm__ ("clc" : "=@ccnc"(r)); + if (r) + return 1; + } + return 0; +} + +char TestE () +{ + char r; + + /* 1 equals 1. */ + __asm__ ("cmp $1, %1" : "=@cce"(r) : "r" (1)); + if (r) + { + /* 1 not equals 2. */ + __asm__ ("cmp $2, %1" : "=@ccne"(r) : "r" (1)); + if (r) + return 1; + } + return 0; +} + +char TestZ () +{ + char r; + + /* 1 equals 1. */ + __asm__ ("cmp $1, %1" : "=@ccz"(r) : "r" (1)); + if (r) + { + /* 1 not equals 2. */ + __asm__ ("cmp $2, %1" : "=@ccnz"(r) : "r" (1)); + if (r) + return 1; + } + return 0; +} + +char TestA () +{ + char r; + + /* 1 a 0. */ + __asm__ ("cmp $0, %1" : "=@cca"(r) : "r" (1)); + if (r) + { + /* 1 na 2. */ + __asm__ ("cmp $2, %1" : "=@ccna"(r) : "r" (1)); + if (r) + { + /* 1 na 1. */ + __asm__ ("cmp $1, %1" : "=@ccna"(r) : "r" (1)); + if (r) + return 1; + } + } + return 0; +} + +char TestAE () +{ + char r; + + /* 1 ae 0. */ + __asm__ ("cmp $0, %1" : "=@ccae"(r) : "r" (1)); + if (r) + { + /* 1 nae 2. */ + __asm__ ("cmp $2, %1" : "=@ccnae"(r) : "r" (1)); + if (r) + { + /* 1 ae 1. */ + __asm__ ("cmp $1, %1" : "=@ccae"(r) : "r" (1)); + if (r) + return 1; + } + } + return 0; +} + +char TestB () +{ + char r; + + /* 1 b 2. */ + __asm__ ("cmp $2, %1" : "=@ccb"(r) : "r" (1)); + if (r) + { + /* 1 nb 0. */ + __asm__ ("cmp $0, %1" : "=@ccnb"(r) : "r" (1)); + if (r) + { + /* 1 nb 1. */ + __asm__ ("cmp $1, %1" : "=@ccnb"(r) : "r" (1)); + if (r) + return 1; + } + } + return 0; +} + +char TestBE () +{ + char r; + + /* 1 be 2. */ + __asm__ ("cmp $2, %1" : "=@ccbe"(r) : "r" (1)); + if (r) + { + /* 1 nbe 0. */ + __asm__ ("cmp $0, %1" : "=@ccnbe"(r) : "r" (1)); + if (r) + { + /* 1 be 1. */ + __asm__ ("cmp $1, %1" : "=@ccbe"(r) : "r" (1)); + if (r) + return 1; + } + } + return 0; +} + +char TestG () +{ + char r; + + /* 1 g 0. */ + __asm__ ("cmp $0, %1" : "=@ccg"(r) : "r" (1)); + if (r) + { + /* 1 ng 2. */ + __asm__ ("cmp $2, %1" : "=@ccng"(r) : "r" (1)); + if (r) + { + /* 1 ng 1. */ + __asm__ ("cmp $1, %1" : "=@ccng"(r) : "r" (1)); + if (r) + return 1; + } + } + return 0; +} + +char TestGE () +{ + char r; + + /* 1 ge 0. */ + __asm__ ("cmp $0, %1" : "=@ccge"(r) : "r" (1)); + if (r) + { + /* 1 nge 2. */ + __asm__ ("cmp $2, %1" : "=@ccnge"(r) : "r" (1)); + if (r) + { + /* 1 ge 1. */ + __asm__ ("cmp $1, %1" : "=@ccge"(r) : "r" (1)); + if (r) + return 1; + } + } + return 0; +} + +char TestL () +{ + char r; + + /* 1 l 2. */ + __asm__ ("cmp $2, %1" : "=@ccl"(r) : "r" (1)); + if (r) + { + /* 1 nl 0. */ + __asm__ ("cmp $0, %1" : "=@ccnl"(r) : "r" (1)); + if (r) + { + /* 1 nl 1. */ + __asm__ ("cmp $1, %1" : "=@ccnl"(r) : "r" (1)); + if (r) + return 1; + } + } + return 0; +} + +char TestLE () +{ + char r; + + /* 1 le 2. */ + __asm__ ("cmp $2, %1" : "=@ccle"(r) : "r" (1)); + if (r) + { + /* 1 nle 0. */ + __asm__ ("cmp $0, %1" : "=@ccnle"(r) : "r" (1)); + if (r) + { + /* 1 le 1. */ + __asm__ ("cmp $1, %1" : "=@ccle"(r) : "r" (1)); + if (r) + return 1; + } + } + return 0; +} + +char TestO () +{ + char r; + unsigned char res = 128; + + /* overflow. */ + __asm__ ("addb $128, %1" : "=@cco"(r), "+r"(res)); + if (r) + { + /* not overflow. */ + __asm__ ("addb $1, %1" : "=@ccno"(r), "+r"(res)); + if (r) + return 1; + } + return 0; +} + +char TestP () +{ + char r, res = 1; + + /* even # bits. */ + __asm__ ("addb $2, %1" : "=@ccp"(r), "+r"(res)); + if (r) + { + /* odd # bits. */ + __asm__ ("addb $1, %1" : "=@ccnp"(r), "+r"(res)); + if (r) + return 1; + } + return 0; +} + +char TestS () +{ + char r, res = 1; + + /* sign bit set. */ + __asm__ ("addb $128, %1" : "=@ccs"(r), "+r"(res)); + if (r) + { + /* sign bit not set. */ + __asm__ ("subb $128, %1" : "=@ccns"(r), "+r"(res)); + if (r) + return 1; + } + return 0; +} + +/* dg-do treats exit code of 0 as success. */ +int main () +{ + if (TestC () && TestE () && TestZ () && TestA () + && TestAE () && TestB () && TestBE () && TestG () + && TestGE () && TestL () && TestLE () && TestO () + && TestP () && TestS ()) + return 0; + __builtin_abort (); +} diff --git a/gcc/testsuite/gcc.target/i386/avx2-pr70542.c b/gcc/testsuite/gcc.target/i386/avx2-pr70542.c new file mode 100644 index 00000000000..2a95c5a027d --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/avx2-pr70542.c @@ -0,0 +1,16 @@ +/* PR tree-optimization/70542 */ +/* { dg-do run } */ +/* { dg-options "-O3 -mavx2" } */ +/* { dg-require-effective-target avx2 } */ + +#include "avx2-check.h" + +#define main() do_main () + +#include "../../gcc.dg/torture/pr70542.c" + +static void +avx2_test (void) +{ + do_main (); +} diff --git a/gcc/testsuite/gcc.target/i386/avx2-pr70574.c b/gcc/testsuite/gcc.target/i386/avx2-pr70574.c new file mode 100644 index 00000000000..c9867ddf9b0 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/avx2-pr70574.c @@ -0,0 +1,26 @@ +/* PR rtl-optimization/70574 */ +/* { dg-do run { target lp64 } } */ +/* { dg-require-effective-target avx2 } */ +/* { dg-options "-O -frerun-cse-after-loop -fno-tree-ccp -mcmodel=medium -mavx2" } */ +/* { dg-additional-options "-fPIC" { target fpic } } */ + +#include "avx2-check.h" + +typedef char A __attribute__((vector_size (32))); +typedef short B __attribute__((vector_size (32))); + +int +foo (int x, __int128 y, __int128 z, A w) +{ + y <<= 64; + w *= (A) { 0, -1, z, 0, ~y }; + return w[0] + ((B) { x, 0, y, 0, -1 } | 1)[4]; +} + +static void +avx2_test () +{ + int x = foo (0, 0, 0, (A) {}); + if (x != -1) + __builtin_abort (); +} diff --git a/gcc/testsuite/gcc.target/i386/avx512bw-kunpckdq-2.c b/gcc/testsuite/gcc.target/i386/avx512bw-kunpckdq-2.c new file mode 100644 index 00000000000..4fe503e42ac --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/avx512bw-kunpckdq-2.c @@ -0,0 +1,24 @@ +/* { dg-do run } */ +/* { dg-options "-O2 -mavx512bw" } */ +/* { dg-require-effective-target avx512bw } */ + +#define AVX512BW + +#include "avx512f-helper.h" + +static __mmask64 __attribute__((noinline,noclone)) +unpack (__mmask64 arg1, __mmask64 arg2) +{ + __mmask64 res; + + res = _mm512_kunpackd (arg1, arg2); + + return res; +} + +void +TEST (void) +{ + if (unpack (0x07UL, 0x70UL) != 0x0700000070UL) + __builtin_abort (); +} diff --git a/gcc/testsuite/gcc.target/i386/avx512bw-kunpckwd-2.c b/gcc/testsuite/gcc.target/i386/avx512bw-kunpckwd-2.c new file mode 100644 index 00000000000..5d7f8955975 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/avx512bw-kunpckwd-2.c @@ -0,0 +1,24 @@ +/* { dg-do run } */ +/* { dg-options "-O2 -mavx512bw" } */ +/* { dg-require-effective-target avx512bw } */ + +#define AVX512BW + +#include "avx512f-helper.h" + +static __mmask32 __attribute__((noinline,noclone)) +unpack (__mmask32 arg1, __mmask32 arg2) +{ + __mmask32 res; + + res = _mm512_kunpackw (arg1, arg2); + + return res; +} + +void +TEST (void) +{ + if (unpack (0x07, 0x70) != 0x070070) + __builtin_abort (); +} diff --git a/gcc/testsuite/gcc.target/i386/avx512bw-pr70509.c b/gcc/testsuite/gcc.target/i386/avx512bw-pr70509.c new file mode 100644 index 00000000000..d7bd659f73a --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/avx512bw-pr70509.c @@ -0,0 +1,26 @@ +/* PR tree-optimization/70509 */ +/* { dg-do run } */ +/* { dg-options "-O1 -mavx512bw" } */ +/* { dg-require-effective-target avx512bw } */ + +#define AVX512BW +#include "avx512f-helper.h" + +typedef char V __attribute__ ((vector_size (64))); + +int __attribute__ ((noinline, noclone)) +foo (V u, V v) +{ + u /= v[0x20]; + return u[0]; +} + +void +TEST (void) +{ + int x = foo ((V) { 9 }, (V) { 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 3 }); + if (x != 3) + abort (); +} diff --git a/gcc/testsuite/gcc.target/i386/avx512f-kunpckbw-2.c b/gcc/testsuite/gcc.target/i386/avx512f-kunpckbw-2.c new file mode 100644 index 00000000000..86580f289aa --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/avx512f-kunpckbw-2.c @@ -0,0 +1,24 @@ +/* { dg-do run } */ +/* { dg-options "-O2 -mavx512f" } */ +/* { dg-require-effective-target avx512f } */ + +#define AVX512F + +#include "avx512f-helper.h" + +static __mmask16 __attribute__((noinline,noclone)) +unpack (__mmask16 arg1, __mmask16 arg2) +{ + __mmask16 res; + + res = _mm512_kunpackb (arg1, arg2); + + return res; +} + +void +TEST (void) +{ + if (unpack (0x07, 0x70) != 0x0770) + __builtin_abort (); +} diff --git a/gcc/testsuite/gcc.target/i386/chkp-strlen-1.c b/gcc/testsuite/gcc.target/i386/chkp-strlen-1.c index de6279f1dfa..38d53900627 100644 --- a/gcc/testsuite/gcc.target/i386/chkp-strlen-1.c +++ b/gcc/testsuite/gcc.target/i386/chkp-strlen-1.c @@ -2,7 +2,7 @@ /* { dg-options "-fcheck-pointer-bounds -mmpx -O2 -fdump-tree-strlen" } */ /* { dg-final { scan-tree-dump "memcpy.chkp" "strlen" } } */ -#include "string.h" +#include "../../gcc.dg/strlenopt.h" char *test (char *str1, char *str2) { diff --git a/gcc/testsuite/gcc.target/i386/chkp-strlen-2.c b/gcc/testsuite/gcc.target/i386/chkp-strlen-2.c index 470ac4715a9..789ebc1f2d8 100644 --- a/gcc/testsuite/gcc.target/i386/chkp-strlen-2.c +++ b/gcc/testsuite/gcc.target/i386/chkp-strlen-2.c @@ -3,8 +3,8 @@ /* { dg-options "-fcheck-pointer-bounds -mmpx -O2 -fdump-tree-strlen" } */ /* { dg-final { scan-tree-dump-not "strlen" "strlen" } } */ -#define _GNU_SOURCE -#include "string.h" +#define USE_GNU +#include "../../gcc.dg/strlenopt.h" char *test (char *str1, char *str2) { diff --git a/gcc/testsuite/gcc.target/i386/chkp-strlen-3.c b/gcc/testsuite/gcc.target/i386/chkp-strlen-3.c index 311c9a042e0..276f4127975 100644 --- a/gcc/testsuite/gcc.target/i386/chkp-strlen-3.c +++ b/gcc/testsuite/gcc.target/i386/chkp-strlen-3.c @@ -2,7 +2,7 @@ /* { dg-options "-fcheck-pointer-bounds -mmpx -O2 -fdump-tree-strlen" } */ /* { dg-final { scan-tree-dump-times "strlen" 1 "strlen" } } */ -#include "string.h" +#include "../../gcc.dg/strlenopt.h" size_t test (char *str1, char *str2) { diff --git a/gcc/testsuite/gcc.target/i386/chkp-strlen-4.c b/gcc/testsuite/gcc.target/i386/chkp-strlen-4.c index dbf568b8418..51ff96028be 100644 --- a/gcc/testsuite/gcc.target/i386/chkp-strlen-4.c +++ b/gcc/testsuite/gcc.target/i386/chkp-strlen-4.c @@ -3,8 +3,8 @@ /* { dg-options "-fcheck-pointer-bounds -mmpx -O2 -fdump-tree-strlen" } */ /* { dg-final { scan-tree-dump-times "strlen" 1 "strlen" } } */ -#define _GNU_SOURCE -#include "string.h" +#define USE_GNU +#include "../../gcc.dg/strlenopt.h" char * test (char *str1, char *str2) { diff --git a/gcc/testsuite/gcc.target/i386/chkp-strlen-5.c b/gcc/testsuite/gcc.target/i386/chkp-strlen-5.c index e44096cd429..bbafecc3063 100644 --- a/gcc/testsuite/gcc.target/i386/chkp-strlen-5.c +++ b/gcc/testsuite/gcc.target/i386/chkp-strlen-5.c @@ -3,7 +3,7 @@ /* { dg-final { scan-tree-dump-times "strlen" 2 "strlen" } } */ /* { dg-final { scan-tree-dump "memcpy" "strlen" } } */ -#include "string.h" +#include "../../gcc.dg/strlenopt.h" size_t test (char *str1, char *str2) { diff --git a/gcc/testsuite/gcc.target/i386/chkp-stropt-1.c b/gcc/testsuite/gcc.target/i386/chkp-stropt-1.c index 18aa2819cdf..d6148a87fd1 100644 --- a/gcc/testsuite/gcc.target/i386/chkp-stropt-1.c +++ b/gcc/testsuite/gcc.target/i386/chkp-stropt-1.c @@ -2,7 +2,7 @@ /* { dg-options "-fcheck-pointer-bounds -mmpx -O2 -fdump-tree-chkpopt -fchkp-use-nochk-string-functions" } */ /* { dg-final { scan-tree-dump "memcpy_nochk" "chkpopt" } } */ -#include "string.h" +#include "../../gcc.dg/strlenopt.h" void test (int *buf1, int *buf2, size_t len) { diff --git a/gcc/testsuite/gcc.target/i386/chkp-stropt-10.c b/gcc/testsuite/gcc.target/i386/chkp-stropt-10.c index 26e9f13a190..18cff739b01 100644 --- a/gcc/testsuite/gcc.target/i386/chkp-stropt-10.c +++ b/gcc/testsuite/gcc.target/i386/chkp-stropt-10.c @@ -2,7 +2,7 @@ /* { dg-options "-fcheck-pointer-bounds -mmpx -O2 -fdump-tree-chkpopt -fchkp-use-fast-string-functions" } */ /* { dg-final { scan-tree-dump-not "memset_nobnd" "chkpopt" } } */ -#include "string.h" +#include "../../gcc.dg/strlenopt.h" void test (void *buf1, int c, size_t len) { diff --git a/gcc/testsuite/gcc.target/i386/chkp-stropt-11.c b/gcc/testsuite/gcc.target/i386/chkp-stropt-11.c index e84963f11f7..c53db6a17e4 100644 --- a/gcc/testsuite/gcc.target/i386/chkp-stropt-11.c +++ b/gcc/testsuite/gcc.target/i386/chkp-stropt-11.c @@ -2,7 +2,7 @@ /* { dg-options "-fcheck-pointer-bounds -mmpx -O2 -fdump-tree-chkpopt -fchkp-use-fast-string-functions" } */ /* { dg-final { scan-tree-dump-not "memmove_nobnd" "chkpopt" } } */ -#include "string.h" +#include "../../gcc.dg/strlenopt.h" void test (void *buf1, void *buf2, size_t len) { diff --git a/gcc/testsuite/gcc.target/i386/chkp-stropt-12.c b/gcc/testsuite/gcc.target/i386/chkp-stropt-12.c index 638810b8be5..a076d17cd9a 100644 --- a/gcc/testsuite/gcc.target/i386/chkp-stropt-12.c +++ b/gcc/testsuite/gcc.target/i386/chkp-stropt-12.c @@ -3,8 +3,8 @@ /* { dg-options "-fcheck-pointer-bounds -mmpx -O2 -fdump-tree-chkpopt -fchkp-use-fast-string-functions" } */ /* { dg-final { scan-tree-dump-not "mempcpy_nobnd" "chkpopt" } } */ -#define _GNU_SOURCE -#include "string.h" +#define USE_GNU +#include "../../gcc.dg/strlenopt.h" void test (void *buf1, void *buf2, size_t len) { diff --git a/gcc/testsuite/gcc.target/i386/chkp-stropt-13.c b/gcc/testsuite/gcc.target/i386/chkp-stropt-13.c index 3b926b11f83..279cae3e5bf 100644 --- a/gcc/testsuite/gcc.target/i386/chkp-stropt-13.c +++ b/gcc/testsuite/gcc.target/i386/chkp-stropt-13.c @@ -2,7 +2,7 @@ /* { dg-options "-fcheck-pointer-bounds -mmpx -O2 -fdump-tree-chkpopt -fchkp-use-nochk-string-functions -fchkp-use-fast-string-functions" } */ /* { dg-final { scan-tree-dump "memcpy_nobnd_nochk" "chkpopt" } } */ -#include "string.h" +#include "../../gcc.dg/strlenopt.h" void test (int *buf1, int *buf2, size_t len) { diff --git a/gcc/testsuite/gcc.target/i386/chkp-stropt-14.c b/gcc/testsuite/gcc.target/i386/chkp-stropt-14.c index a8d000ba1fa..b810c682569 100644 --- a/gcc/testsuite/gcc.target/i386/chkp-stropt-14.c +++ b/gcc/testsuite/gcc.target/i386/chkp-stropt-14.c @@ -2,7 +2,7 @@ /* { dg-options "-fcheck-pointer-bounds -mmpx -O2 -fdump-tree-chkpopt -fchkp-use-nochk-string-functions -fchkp-use-fast-string-functions" } */ /* { dg-final { scan-tree-dump "memset_nobnd_nochk" "chkpopt" } } */ -#include "string.h" +#include "../../gcc.dg/strlenopt.h" void test (int *buf1, int c, size_t len) { diff --git a/gcc/testsuite/gcc.target/i386/chkp-stropt-15.c b/gcc/testsuite/gcc.target/i386/chkp-stropt-15.c index 7c6065657c0..a9a79c1e330 100644 --- a/gcc/testsuite/gcc.target/i386/chkp-stropt-15.c +++ b/gcc/testsuite/gcc.target/i386/chkp-stropt-15.c @@ -2,7 +2,7 @@ /* { dg-options "-fcheck-pointer-bounds -mmpx -O2 -fdump-tree-chkpopt -fchkp-use-nochk-string-functions -fchkp-use-fast-string-functions" } */ /* { dg-final { scan-tree-dump "memmove_nobnd_nochk" "chkpopt" } } */ -#include "string.h" +#include "../../gcc.dg/strlenopt.h" void test (int *buf1, int *buf2, size_t len) { diff --git a/gcc/testsuite/gcc.target/i386/chkp-stropt-16.c b/gcc/testsuite/gcc.target/i386/chkp-stropt-16.c index b0f43a6880d..6ce170c9d68 100644 --- a/gcc/testsuite/gcc.target/i386/chkp-stropt-16.c +++ b/gcc/testsuite/gcc.target/i386/chkp-stropt-16.c @@ -3,8 +3,8 @@ /* { dg-options "-fcheck-pointer-bounds -mmpx -O2 -fdump-tree-chkpopt -fchkp-use-nochk-string-functions -fchkp-use-fast-string-functions" } */ /* { dg-final { scan-tree-dump "mempcpy_nobnd_nochk" "chkpopt" } } */ -#define _GNU_SOURCE -#include "string.h" +#define USE_GNU +#include "../../gcc.dg/strlenopt.h" void test (int *buf1, int *buf2, size_t len) { diff --git a/gcc/testsuite/gcc.target/i386/chkp-stropt-2.c b/gcc/testsuite/gcc.target/i386/chkp-stropt-2.c index cac0feaecbb..6a0c24ee887 100644 --- a/gcc/testsuite/gcc.target/i386/chkp-stropt-2.c +++ b/gcc/testsuite/gcc.target/i386/chkp-stropt-2.c @@ -2,7 +2,7 @@ /* { dg-options "-fcheck-pointer-bounds -mmpx -O2 -fdump-tree-chkpopt -fchkp-use-nochk-string-functions" } */ /* { dg-final { scan-tree-dump "memset_nochk" "chkpopt" } } */ -#include "string.h" +#include "../../gcc.dg/strlenopt.h" void test (int *buf1, int c, size_t len) { diff --git a/gcc/testsuite/gcc.target/i386/chkp-stropt-3.c b/gcc/testsuite/gcc.target/i386/chkp-stropt-3.c index 72ff3869f7b..310dec77456 100644 --- a/gcc/testsuite/gcc.target/i386/chkp-stropt-3.c +++ b/gcc/testsuite/gcc.target/i386/chkp-stropt-3.c @@ -2,7 +2,7 @@ /* { dg-options "-fcheck-pointer-bounds -mmpx -O2 -fdump-tree-chkpopt -fchkp-use-nochk-string-functions" } */ /* { dg-final { scan-tree-dump "memmove_nochk" "chkpopt" } } */ -#include "string.h" +#include "../../gcc.dg/strlenopt.h" void test (int *buf1, int *buf2, size_t len) { diff --git a/gcc/testsuite/gcc.target/i386/chkp-stropt-4.c b/gcc/testsuite/gcc.target/i386/chkp-stropt-4.c index 216ed521edb..7a30d17b8e6 100644 --- a/gcc/testsuite/gcc.target/i386/chkp-stropt-4.c +++ b/gcc/testsuite/gcc.target/i386/chkp-stropt-4.c @@ -3,8 +3,8 @@ /* { dg-options "-fcheck-pointer-bounds -mmpx -O2 -fdump-tree-chkpopt -fchkp-use-nochk-string-functions" } */ /* { dg-final { scan-tree-dump "mempcpy_nochk" "chkpopt" } } */ -#define _GNU_SOURCE -#include "string.h" +#define USE_GNU +#include "../../gcc.dg/strlenopt.h" void test (int *buf1, int *buf2, size_t len) { diff --git a/gcc/testsuite/gcc.target/i386/chkp-stropt-5.c b/gcc/testsuite/gcc.target/i386/chkp-stropt-5.c index 02ad9ccc496..39850d62be8 100644 --- a/gcc/testsuite/gcc.target/i386/chkp-stropt-5.c +++ b/gcc/testsuite/gcc.target/i386/chkp-stropt-5.c @@ -2,7 +2,7 @@ /* { dg-options "-fcheck-pointer-bounds -mmpx -O2 -fdump-tree-chkpopt -fchkp-use-fast-string-functions" } */ /* { dg-final { scan-tree-dump "memcpy_nobnd" "chkpopt" } } */ -#include "string.h" +#include "../../gcc.dg/strlenopt.h" void test (int *buf1, int *buf2, size_t len) { diff --git a/gcc/testsuite/gcc.target/i386/chkp-stropt-6.c b/gcc/testsuite/gcc.target/i386/chkp-stropt-6.c index 6db5d83a0bc..06dcbfb9a25 100644 --- a/gcc/testsuite/gcc.target/i386/chkp-stropt-6.c +++ b/gcc/testsuite/gcc.target/i386/chkp-stropt-6.c @@ -2,7 +2,7 @@ /* { dg-options "-fcheck-pointer-bounds -mmpx -O2 -fdump-tree-chkpopt -fchkp-use-fast-string-functions" } */ /* { dg-final { scan-tree-dump "memset_nobnd" "chkpopt" } } */ -#include "string.h" +#include "../../gcc.dg/strlenopt.h" void test (int *buf1, int c, size_t len) { diff --git a/gcc/testsuite/gcc.target/i386/chkp-stropt-7.c b/gcc/testsuite/gcc.target/i386/chkp-stropt-7.c index 761e6263d86..40ded068f8e 100644 --- a/gcc/testsuite/gcc.target/i386/chkp-stropt-7.c +++ b/gcc/testsuite/gcc.target/i386/chkp-stropt-7.c @@ -2,7 +2,7 @@ /* { dg-options "-fcheck-pointer-bounds -mmpx -O2 -fdump-tree-chkpopt -fchkp-use-fast-string-functions" } */ /* { dg-final { scan-tree-dump "memmove_nobnd" "chkpopt" } } */ -#include "string.h" +#include "../../gcc.dg/strlenopt.h" void test (int *buf1, int *buf2, size_t len) { diff --git a/gcc/testsuite/gcc.target/i386/chkp-stropt-8.c b/gcc/testsuite/gcc.target/i386/chkp-stropt-8.c index afde3c92b9f..7e575bb40bb 100644 --- a/gcc/testsuite/gcc.target/i386/chkp-stropt-8.c +++ b/gcc/testsuite/gcc.target/i386/chkp-stropt-8.c @@ -3,8 +3,8 @@ /* { dg-options "-fcheck-pointer-bounds -mmpx -O2 -fdump-tree-chkpopt -fchkp-use-fast-string-functions" } */ /* { dg-final { scan-tree-dump "mempcpy_nobnd" "chkpopt" } } */ -#define _GNU_SOURCE -#include "string.h" +#define USE_GNU +#include "../../gcc.dg/strlenopt.h" void test (int *buf1, int *buf2, size_t len) { diff --git a/gcc/testsuite/gcc.target/i386/chkp-stropt-9.c b/gcc/testsuite/gcc.target/i386/chkp-stropt-9.c index b79d09633dd..bf26874e5a8 100644 --- a/gcc/testsuite/gcc.target/i386/chkp-stropt-9.c +++ b/gcc/testsuite/gcc.target/i386/chkp-stropt-9.c @@ -2,7 +2,7 @@ /* { dg-options "-fcheck-pointer-bounds -mmpx -O2 -fdump-tree-chkpopt -fchkp-use-fast-string-functions" } */ /* { dg-final { scan-tree-dump-not "memcpy_nobnd" "chkpopt" } } */ -#include "string.h" +#include "../../gcc.dg/strlenopt.h" void test (void *buf1, void *buf2, size_t len) { diff --git a/gcc/testsuite/gcc.target/i386/pr70467-2.c b/gcc/testsuite/gcc.target/i386/pr70467-2.c new file mode 100644 index 00000000000..4c1715c87e5 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr70467-2.c @@ -0,0 +1,20 @@ +/* PR rtl-optimization/70467 */ +/* { dg-do compile { target ia32 } } */ +/* { dg-options "-O2" } */ + +unsigned long long +foo (unsigned long long x) +{ + return x + 0x12345600000000ULL; +} + +unsigned long long +bar (unsigned long long x) +{ + return x - 0x12345600000000ULL; +} + +/* { dg-final { scan-assembler-not "addl\[ \t\]*.0," } } */ +/* { dg-final { scan-assembler-not "subl\[ \t\]*.0," } } */ +/* { dg-final { scan-assembler-not "adcl\[^\n\r\]*%" } } */ +/* { dg-final { scan-assembler-not "sbbl\[^\n\r\]*%" } } */ diff --git a/gcc/testsuite/gcc.target/i386/pr70510.c b/gcc/testsuite/gcc.target/i386/pr70510.c new file mode 100644 index 00000000000..fdad97a16f4 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr70510.c @@ -0,0 +1,14 @@ +/* PR target/70510 */ +/* { dg-do assemble { target avx512bw } } */ +/* { dg-require-effective-target masm_intel } */ +/* { dg-options "-Og -mavx512bw -masm=intel" } */ + +typedef int V __attribute__ ((vector_size (64))); + +V +foo (V u, V v) +{ + v[0] |= v[u[0]]; + u /= ((V)v)[0]; + return u; +} diff --git a/gcc/testsuite/gcc.target/i386/pr70525.c b/gcc/testsuite/gcc.target/i386/pr70525.c new file mode 100644 index 00000000000..78ba752f94b --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr70525.c @@ -0,0 +1,32 @@ +/* PR target/70525 */ +/* { dg-do assemble { target avx512bw } } */ +/* { dg-options "-O2 -mavx512bw -mno-avx512vl" } */ + +typedef char v64qi __attribute__ ((vector_size (64))); +typedef short v32hi __attribute__ ((vector_size (64))); +typedef int v16si __attribute__ ((vector_size (64))); +typedef long long v8di __attribute__ ((vector_size (64))); + +v64qi +f1 (v64qi x, v64qi y) +{ + return x & ~y; +} + +v32hi +f2 (v32hi x, v32hi y) +{ + return x & ~y; +} + +v16si +f3 (v16si x, v16si y) +{ + return x & ~y; +} + +v8di +f4 (v8di x, v8di y) +{ + return x & ~y; +} diff --git a/gcc/testsuite/gcc.target/i386/pr70593.c b/gcc/testsuite/gcc.target/i386/pr70593.c new file mode 100644 index 00000000000..c013683688b --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr70593.c @@ -0,0 +1,19 @@ +/* PR middle-end/70593 */ +/* { dg-do run } */ +/* { dg-options "-O2" } */ + +__attribute__((noinline, noclone)) unsigned long +foo (unsigned x) +{ + unsigned long a, c = x; + asm volatile ("xorl\t%k1, %k1\n\tmovl\t$7, %k0" : "=c" (c), "=a" (a) : "0" (c), "1" (c) : "memory"); + return c; +} + +int +main () +{ + if (foo (3) != 7) + __builtin_abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/pr70596.c b/gcc/testsuite/gcc.target/i386/pr70596.c new file mode 100644 index 00000000000..0c73e838be1 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr70596.c @@ -0,0 +1,13 @@ +/* PR rtl-optimization/70596 */ +/* { dg-do compile { target avx512f } } */ +/* { dg-options "-O2 -fno-dce -fschedule-insns -fno-tree-coalesce-vars -fno-tree-dce -fno-tree-fre -fno-tree-pre -fcompare-debug -mavx512f" } */ + +typedef char V __attribute__((vector_size (64))); + +int +foo (V u, V v) +{ + v /= u | 1; + v[18] = 1 | v[8]; + return v[1] + v[6] + v[0] + v[1] + v[18] + v[2] + v[7]; +} diff --git a/gcc/testsuite/gcc.target/powerpc/float128-1.c b/gcc/testsuite/gcc.target/powerpc/float128-1.c new file mode 100644 index 00000000000..b8e71ceaaae --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/float128-1.c @@ -0,0 +1,147 @@ +/* { dg-do run { target { powerpc*-*-linux* } } } */ +/* { dg-require-effective-target ppc_float128_sw } */ +/* { dg-options "-mcpu=power7 -O2 -mfloat128 -static-libgcc" } */ + +#ifdef DEBUG +#include <stdio.h> +#include <stddef.h> +#include <stdint.h> +#include <inttypes.h> +#endif + +#if !defined(__FLOAT128__) || !defined(_ARCH_PPC) +static __float128 +pass_through (__float128 x) +{ + return x; +} + +__float128 (*no_optimize) (__float128) = pass_through; +#endif + +#ifdef DEBUG +__attribute__((__noinline__)) +static void +print_f128 (__float128 x) +{ + unsigned sign; + unsigned exponent; + uint64_t mantissa1; + uint64_t mantissa2; + uint64_t upper; + uint64_t lower; + +#if defined(_ARCH_PPC) && defined(__BIG_ENDIAN__) + struct ieee128 { + uint64_t upper; + uint64_t lower; + }; + +#elif (defined(_ARCH_PPC) && defined(__LITTLE_ENDIAN__)) || defined(__x86_64__) + struct ieee128 { + uint64_t lower; + uint64_t upper; + }; + +#else +#error "Unknown system" +#endif + + union { + __float128 f128; + struct ieee128 s128; + } u; + + u.f128 = x; + upper = u.s128.upper; + lower = u.s128.lower; + + sign = (unsigned)((upper >> 63) & 1); + exponent = (unsigned)((upper >> 48) & ((((uint64_t)1) << 16) - 1)); + mantissa1 = (upper & ((((uint64_t)1) << 48) - 1)); + mantissa2 = lower; + + printf ("%c 0x%.4x 0x%.12" PRIx64 " 0x%.16" PRIx64, + sign ? '-' : '+', + exponent, + mantissa1, + mantissa2); +} +#endif + +__attribute__((__noinline__)) +static void +do_test (__float128 expected, __float128 got, const char *name) +{ + int equal_p = (expected == got); + +#ifdef DEBUG + printf ("Test %s, expected: ", name); + print_f128 (expected); + printf (" %5g, got: ", (double) expected); + print_f128 (got); + printf (" %5g, result %s\n", + (double) got, + (equal_p) ? "equal" : "not equal"); +#endif + + if (!equal_p) + __builtin_abort (); +} + + +int +main (void) +{ + __float128 one = 1.0q; + __float128 two = 2.0q; + __float128 three = 3.0q; + __float128 four = 4.0q; + __float128 five = 5.0q; + __float128 add_result = (1.0q + 2.0q); + __float128 mul_result = ((1.0q + 2.0q) * 3.0q); + __float128 div_result = (((1.0q + 2.0q) * 3.0q) / 4.0q); + __float128 sub_result = ((((1.0q + 2.0q) * 3.0q) / 4.0q) - 5.0q); + __float128 neg_result = - sub_result; + __float128 add_xresult; + __float128 mul_xresult; + __float128 div_xresult; + __float128 sub_xresult; + __float128 neg_xresult; + +#if defined(__FLOAT128__) && defined(_ARCH_PPC) + __asm__ (" #prevent constant folding, %x0" : "+wa" (one)); + __asm__ (" #prevent constant folding, %x0" : "+wa" (two)); + __asm__ (" #prevent constant folding, %x0" : "+wa" (three)); + __asm__ (" #prevent constant folding, %x0" : "+wa" (four)); + __asm__ (" #prevent constant folding, %x0" : "+wa" (five)); + +#else + one = no_optimize (one); + two = no_optimize (two); + three = no_optimize (three); + four = no_optimize (four); + five = no_optimize (five); +#endif + + add_xresult = (one + two); + do_test (add_result, add_xresult, "add"); + + mul_xresult = add_xresult * three; + do_test (mul_result, mul_xresult, "mul"); + + div_xresult = mul_xresult / four; + do_test (div_result, div_xresult, "div"); + + sub_xresult = div_xresult - five; + do_test (sub_result, sub_xresult, "sub"); + + neg_xresult = - sub_xresult; + do_test (neg_result, neg_xresult, "neg"); + +#ifdef DEBUG + printf ("Passed\n"); +#endif + + return 0; +} diff --git a/gcc/testsuite/gcc.target/powerpc/float128-2.c b/gcc/testsuite/gcc.target/powerpc/float128-2.c new file mode 100644 index 00000000000..f517686bd25 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/float128-2.c @@ -0,0 +1,226 @@ +/* { dg-do run { target { powerpc*-*-linux* } } } */ +/* { dg-require-effective-target ppc_float128_sw } */ +/* { dg-options "-mcpu=power7 -O2 -mfloat128 -static-libgcc" } */ + +/* + * Test program to make sure we are getting more precision than the 53 bits we + * get with IEEE double. + */ + +#include <stdio.h> +#include <math.h> +#include <stdlib.h> +#include <stddef.h> + +#ifndef TYPE +#define TYPE __float128 +#endif + +#ifndef NO_INLINE +#define NO_INLINE __attribute__((__noinline__)) +#endif + +static TYPE power_of_two (ssize_t) NO_INLINE; +static TYPE calc1 (TYPE) NO_INLINE; +static TYPE calc2 (TYPE) NO_INLINE; +static TYPE calc3 (TYPE) NO_INLINE; + +#ifndef POWER2 +#define POWER2 60 +#endif + + +/* + * Print TYPE in hex. + */ + + +#if defined(DEBUG) || defined(DEBUG2) +static void print_hex (const char *prefix, TYPE, const char *suffix) NO_INLINE; + +#if defined (__i386__) || defined (__x86_64__) || defined (__LITTLE_ENDIAN__) +#define ENDIAN_REVERSE(N, MAX) ((MAX) - 1 - (N)) + +#else +#define ENDIAN_REVERSE(N, MAX) (N) +#endif + +static void +print_hex (const char *prefix, TYPE value, const char *suffix) +{ + union { + TYPE f128; + unsigned char uc[sizeof (TYPE)]; + } u; + + size_t i; + + u.f128 = value; + printf ("%s0x", prefix); + for (i = 0; i < sizeof (TYPE); i++) + printf ("%.2x", u.uc[ ENDIAN_REVERSE (i, sizeof (TYPE)) ]); + + printf (", %24.2Lf%s", (long double)value, suffix); +} +#endif + + +/* + * Return a power of two. + */ + +static TYPE +power_of_two (ssize_t num) +{ + TYPE ret = (TYPE) 1.0; + ssize_t i; + + if (num >= 0) + { + for (i = 0; i < num; i++) + ret *= (TYPE) 2.0; + } + else + { + ssize_t num2 = -num; + for (i = 0; i < num2; i++) + ret /= (TYPE) 2.0; + } + +#ifdef DEBUG + printf ("power_of_two (%2ld) = ", (long) num); + print_hex ("", ret, "\n"); +#endif + + return ret; +} + + +#ifdef ADDSUB +static TYPE add (TYPE a, TYPE b) NO_INLINE; +static TYPE sub (TYPE a, TYPE b) NO_INLINE; + +static TYPE +add (TYPE a, TYPE b) +{ + TYPE c; +#ifdef DEBUG + print_hex ("add, arg1 = ", a, "\n"); + print_hex ("add, arg2 = ", b, "\n"); +#endif + c = a + b; +#ifdef DEBUG + print_hex ("add, result = ", c, "\n"); +#endif + return c; +} + +static TYPE +sub (TYPE a, TYPE b) +{ + TYPE c; +#ifdef DEBUG + print_hex ("sub, arg1 = ", a, "\n"); + print_hex ("sub, arg2 = ", b, "\n"); +#endif + c = a - b; +#ifdef DEBUG + print_hex ("sub, result = ", c, "\n"); +#endif + return c; +} + +#else +#define add(x, y) ((x) + (y)) +#define sub(x, y) ((x) - (y)) +#endif + +/* + * Various calculations. Add in 2**POWER2, and subtract 2**(POWER2-1) twice, and we should + * get the original value. + */ + +static TYPE +calc1 (TYPE num) +{ + TYPE num2 = add (power_of_two (POWER2), num); + TYPE ret; + +#ifdef DEBUG + print_hex ("calc1 (before call) = ", num2, "\n"); +#endif + + ret = calc2 (num2); + +#ifdef DEBUG + print_hex ("calc1 (after call) = ", ret, "\n"); +#endif + + return ret; +} + +static TYPE +calc2 (TYPE num) +{ + TYPE num2 = sub (num, power_of_two (POWER2-1)); + TYPE ret; + +#ifdef DEBUG + print_hex ("calc2 (before call) = ", num2, "\n"); +#endif + + ret = calc3 (num2); + +#ifdef DEBUG + print_hex ("calc2 (after call) = ", ret, "\n"); +#endif + + return ret; +} + +static TYPE +calc3 (TYPE num) +{ + TYPE ret = sub (num, (((TYPE) 2.0) * power_of_two (POWER2-2))); + +#ifdef DEBUG + print_hex ("calc3 = ", ret, "\n"); +#endif + + return ret; +} + + +int +main (void) +{ + TYPE input, output; + +#ifdef DEBUG + printf ("Testing, %ld bytes\n", (long) sizeof (TYPE)); +#endif + + input = power_of_two (-1); + if ((double)input != 0.5) + { +#if defined(DEBUG) || defined(DEBUG2) + print_hex ("Input should be 0.5: ", output, "\n"); + return 1; +#else + __builtin_abort (); +#endif + } + + output = calc1 (input); + if ((double)output != 0.5) + { +#if defined(DEBUG) || defined(DEBUG2) + print_hex ("Output should be 0.5: ", output, "\n"); + return 1; +#else + __builtin_abort (); +#endif + } + + return 0; +} diff --git a/gcc/testsuite/gcc.target/powerpc/pr70117.c b/gcc/testsuite/gcc.target/powerpc/pr70117.c new file mode 100644 index 00000000000..f1fdedb6c59 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/pr70117.c @@ -0,0 +1,92 @@ +/* { dg-do run { target { powerpc*-*-linux* powerpc*-*-darwin* powerpc*-*-aix* rs6000-*-* } } } */ +/* { dg-options "-std=c99 -mlong-double-128 -O2" } */ + +#include <float.h> + +union gl_long_double_union +{ + struct { double hi; double lo; } dd; + long double ld; +}; + +/* This is gnulib's LDBL_MAX which, being 107 bits in precision, is + slightly larger than gcc's 106 bit precision LDBL_MAX. */ +volatile union gl_long_double_union gl_LDBL_MAX = + { { DBL_MAX, DBL_MAX / (double)134217728UL / (double)134217728UL } }; + +volatile double min_denorm = 0x1p-1074; +volatile double ld_low = 0x1p-969; +volatile double dinf = 1.0/0.0; +volatile double dnan = 0.0/0.0; + +int +main (void) +{ + long double ld; + + ld = gl_LDBL_MAX.ld; + if (__builtin_isinfl (ld)) + __builtin_abort (); + ld = -gl_LDBL_MAX.ld; + if (__builtin_isinfl (ld)) + __builtin_abort (); + + ld = gl_LDBL_MAX.ld; + if (!__builtin_isfinite (ld)) + __builtin_abort (); + ld = -gl_LDBL_MAX.ld; + if (!__builtin_isfinite (ld)) + __builtin_abort (); + + ld = ld_low; + if (!__builtin_isnormal (ld)) + __builtin_abort (); + ld = -ld_low; + if (!__builtin_isnormal (ld)) + __builtin_abort (); + + ld = -min_denorm; + ld += ld_low; + if (__builtin_isnormal (ld)) + __builtin_abort (); + ld = min_denorm; + ld -= ld_low; + if (__builtin_isnormal (ld)) + __builtin_abort (); + + ld = 0.0; + if (__builtin_isnormal (ld)) + __builtin_abort (); + ld = -0.0; + if (__builtin_isnormal (ld)) + __builtin_abort (); + + ld = LDBL_MAX; + if (!__builtin_isnormal (ld)) + __builtin_abort (); + ld = -LDBL_MAX; + if (!__builtin_isnormal (ld)) + __builtin_abort (); + + ld = gl_LDBL_MAX.ld; + if (!__builtin_isnormal (ld)) + __builtin_abort (); + ld = -gl_LDBL_MAX.ld; + if (!__builtin_isnormal (ld)) + __builtin_abort (); + + ld = dinf; + if (__builtin_isnormal (ld)) + __builtin_abort (); + ld = -dinf; + if (__builtin_isnormal (ld)) + __builtin_abort (); + + ld = dnan; + if (__builtin_isnormal (ld)) + __builtin_abort (); + ld = -dnan; + if (__builtin_isnormal (ld)) + __builtin_abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.target/powerpc/pr70640.c b/gcc/testsuite/gcc.target/powerpc/pr70640.c new file mode 100644 index 00000000000..5d49c6331f3 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/pr70640.c @@ -0,0 +1,11 @@ +/* { dg-do compile { target { powerpc*-*-linux* } } } */ +/* { dg-require-effective-target powerpc_float128_sw_ok } */ +/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power8" } } */ +/* { dg-options "-O2 -mcpu=power8 -mfloat128" } */ + +__float128 foo (__float128 a) { return -a; } + +/* { dg-final { scan-assembler "xxlorc\|vspltisw" } } */ +/* { dg-final { scan-assembler "xxlxor" } } */ +/* { dg-final { scan-assembler "vslb" } } */ +/* { dg-final { scan-assembler "vsldoi" } } */ diff --git a/gcc/testsuite/gcc.target/powerpc/pr70669.c b/gcc/testsuite/gcc.target/powerpc/pr70669.c new file mode 100644 index 00000000000..8054102ee50 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/pr70669.c @@ -0,0 +1,22 @@ +/* { dg-do compile { target { powerpc*-*-linux* && lp64 } } } */ +/* { dg-require-effective-target powerpc_p8vector_ok } */ +/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power8" } } */ +/* { dg-options "-O2 -mcpu=power8 -mfloat128" } */ + +#ifndef TYPE +#define TYPE __float128 +#endif + +void foo (TYPE *p, TYPE *q) +{ + TYPE r = *q; +#ifndef NO_ASM + __asm__ (" # %0" : "+r" (r)); +#endif + *p = r; +} + +/* { dg-final { scan-assembler "mfvsrd" } } */ +/* { dg-final { scan-assembler "mtvsrd" } } */ +/* { dg-final { scan-assembler-times "stxvd2x" 1 } } */ +/* { dg-final { scan-assembler-times "lxvd2x" 1 } } */ diff --git a/gcc/testsuite/gcc.target/sh/torture/pr70416.c b/gcc/testsuite/gcc.target/sh/torture/pr70416.c new file mode 100644 index 00000000000..b1123bee029 --- /dev/null +++ b/gcc/testsuite/gcc.target/sh/torture/pr70416.c @@ -0,0 +1,136 @@ +/* { dg-additional-options "-std=gnu99 -fpic" } */ +/* { dg-do compile } */ + +typedef unsigned long VALUE; +typedef unsigned long ID; + +typedef struct rb_callable_method_entry_struct +{ + ID called_id; + const VALUE owner; +} rb_callable_method_entry_t; + +typedef struct rb_iseq_struct rb_iseq_t; + +struct __jmp_buf_tag { int xx; }; +typedef struct __jmp_buf_tag jmp_buf[1]; + +struct rb_iseq_struct +{ + const struct iseq_catch_table *catch_table; +}; + +typedef struct rb_control_frame_struct +{ + const VALUE *pc; + VALUE *sp; + const rb_iseq_t *iseq; + VALUE flag; + VALUE *ep; +} rb_control_frame_t; + +typedef jmp_buf rb_jmpbuf_t; +struct rb_vm_tag +{ + rb_jmpbuf_t buf; +}rb_ensure_list_t; + +typedef struct rb_thread_struct +{ + rb_control_frame_t *cfp; + struct rb_vm_tag *tag; +} rb_thread_t; + +struct iseq_catch_table_entry +{ + const rb_iseq_t *iseq; +}; + +struct iseq_catch_table +{ + unsigned int size; +}; + +extern unsigned long long __sdt_unsp; +extern unsigned short ruby_cmethod__return_semaphore; + +struct ruby_dtrace_method_hook_args +{ + const char *classname; + const char *methodname; + const char *filename; + int line_no; +}; + +int ruby_th_dtrace_setup(rb_thread_t *th, VALUE klass, ID id, struct ruby_dtrace_method_hook_args *args); +int rb_threadptr_tag_state (rb_thread_t *th); +VALUE vm_exec_core (rb_thread_t *th, VALUE initial); +const rb_callable_method_entry_t *rb_vm_frame_method_entry (const rb_control_frame_t *cfp); + +struct vm_throw_data; +const rb_control_frame_t * THROW_DATA_CATCH_FRAME(const struct vm_throw_data *obj); +rb_control_frame_t * vm_push_frame(rb_thread_t *th, const rb_iseq_t *iseq, VALUE type, VALUE self, VALUE specval, VALUE cref_or_me, const VALUE *pc, VALUE *sp, int local_size, int stack_max); + + +VALUE vm_exec(rb_thread_t *th) +{ + int state; + VALUE result; + VALUE initial = 0; + struct vm_throw_data *err; + rb_thread_t * const _th = (th); + struct rb_vm_tag _tag; + + if ((state = (__builtin_setjmp((_tag.buf)) ? rb_threadptr_tag_state((_th)) : ((void)(_th->tag = &_tag), 0))) == 0) + { + result = vm_exec_core(th, initial); + } + else + { + unsigned int i; + const struct iseq_catch_table_entry *entry; + const struct iseq_catch_table *ct; + unsigned long epc, cont_pc, cont_sp; + const rb_iseq_t *catch_iseq; + rb_control_frame_t *cfp; + const rb_control_frame_t *escape_cfp; + + while (th->cfp->pc == 0 || th->cfp->iseq == 0) + { + if (ruby_cmethod__return_semaphore) + { + struct ruby_dtrace_method_hook_args args; + if (ruby_th_dtrace_setup(th, rb_vm_frame_method_entry(th->cfp)->owner, rb_vm_frame_method_entry(th->cfp)->called_id, &args)) + { + __asm__ __volatile__ ( + ".asciz \"%n[_SDT_S1]@%[_SDT_A1] %n[_SDT_S2]@%[_SDT_A2] %n[_SDT_S3]@%[_SDT_A3] %n[_SDT_S4]@%[_SDT_A4]\"\n" + : + : [_SDT_S1] "n" (((!__extension__ (__builtin_constant_p ((((unsigned long long) (__typeof (__builtin_choose_expr (((__builtin_classify_type ( args.classname ) + 3) & -4) == 4, ( args.classname ), 0U))) __sdt_unsp) & ((unsigned long long)1 << (sizeof (unsigned long long) * 8 - 1))) == 0) || (__typeof (__builtin_choose_expr (((__builtin_classify_type ( args.classname ) + 3) & -4) == 4, ( args.classname ), 0U))) -1 > (__typeof (__builtin_choose_expr (((__builtin_classify_type ( args.classname ) + 3) & -4) == 4, ( args.classname ), 0U))) 0)) ? 1 : -1) * (int) ((__builtin_classify_type ( args.classname ) == 14 || __builtin_classify_type ( args.classname ) == 5) ? sizeof (void *) : sizeof ( args.classname ))), + [_SDT_A1] "nor" (( args.classname )), + [_SDT_S2] "n" (((!__extension__ (__builtin_constant_p ((((unsigned long long) (__typeof (__builtin_choose_expr (((__builtin_classify_type ( args.methodname ) + 3) & -4) == 4, ( args.methodname ), 0U))) __sdt_unsp) & ((unsigned long long)1 << (sizeof (unsigned long long) * 8 - 1))) == 0) || (__typeof (__builtin_choose_expr (((__builtin_classify_type ( args.methodname ) + 3) & -4) == 4, ( args.methodname ), 0U))) -1 > (__typeof (__builtin_choose_expr (((__builtin_classify_type ( args.methodname ) + 3) & -4) == 4, ( args.methodname ), 0U))) 0)) ? 1 : -1) * (int) ((__builtin_classify_type ( args.methodname ) == 14 || __builtin_classify_type ( args.methodname ) == 5) ? sizeof (void *) : sizeof ( args.methodname ))), + [_SDT_A2] "nor" (( args.methodname )), + [_SDT_S3] "n" (((!__extension__ (__builtin_constant_p ((((unsigned long long) (__typeof (__builtin_choose_expr (((__builtin_classify_type ( args.filename ) + 3) & -4) == 4, ( args.filename ), 0U))) __sdt_unsp) & ((unsigned long long)1 << (sizeof (unsigned long long) * 8 - 1))) == 0) || (__typeof (__builtin_choose_expr (((__builtin_classify_type ( args.filename ) + 3) & -4) == 4, ( args.filename ), 0U))) -1 > (__typeof (__builtin_choose_expr (((__builtin_classify_type ( args.filename ) + 3) & -4) == 4, ( args.filename ), 0U))) 0)) ? 1 : -1) * (int) ((__builtin_classify_type ( args.filename ) == 14 || __builtin_classify_type ( args.filename ) == 5) ? sizeof (void *) : sizeof ( args.filename ))), + [_SDT_A3] "nor" (( args.filename )), + [_SDT_S4] "n" (((!__extension__ (__builtin_constant_p ((((unsigned long long) (__typeof (__builtin_choose_expr (((__builtin_classify_type ( args.line_no ) + 3) & -4) == 4, ( args.line_no ), 0U))) __sdt_unsp) & ((unsigned long long)1 << (sizeof (unsigned long long) * 8 - 1))) == 0) || (__typeof (__builtin_choose_expr (((__builtin_classify_type ( args.line_no ) + 3) & -4) == 4, ( args.line_no ), 0U))) -1 > (__typeof (__builtin_choose_expr (((__builtin_classify_type ( args.line_no ) + 3) & -4) == 4, ( args.line_no ), 0U))) 0)) ? 1 : -1) * (int) ((__builtin_classify_type ( args.line_no ) == 14 || __builtin_classify_type ( args.line_no ) == 5) ? sizeof (void *) : sizeof ( args.line_no ))), + [_SDT_A4] "nor" (( args.line_no )) + ); + } + } + } + + if (cfp == escape_cfp && !(((cfp)->flag & 0x0200) != 0)) + catch_iseq = entry->iseq; + + if (state == 6) + { + escape_cfp = THROW_DATA_CATCH_FRAME(err); + + if (ct) + for (i = 0; i < ct->size; i++) { } + } + else + ct = cfp->iseq->catch_table; + + vm_push_frame(th, catch_iseq, 0xb1, 0, 1, 0, 0, 0, 5, 123); + } +} |