From: Jakub Jelinek Date: Mon, 5 Mar 2018 16:01:03 +0000 (+0100) Subject: re PR target/84524 (-O3 causes behavior change) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=8c6b5eb80f51aa685b1d86305399d4dc22300ec2;p=gcc.git re PR target/84524 (-O3 causes behavior change) PR target/84524 * config/i386/sse.md (*3): Replace with orig,vex. (*3): Likewise. Remove uses. * gcc.c-torture/execute/pr84524.c: New test. * gcc.target/i386/avx512bw-pr84524.c: New test. From-SVN: r258252 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 723e718baa1..ef9a8c95f71 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2018-03-05 Jakub Jelinek + + PR target/84524 + * config/i386/sse.md (*3): Replace with + orig,vex. + (*3): Likewise. Remove uses. + 2018-03-05 Peter Bergner PR target/84264 diff --git a/gcc/config/i386/sse.md b/gcc/config/i386/sse.md index 26c4f5227f6..12a594f78bf 100644 --- a/gcc/config/i386/sse.md +++ b/gcc/config/i386/sse.md @@ -10090,11 +10090,11 @@ "TARGET_SSE2 && ix86_binary_operator_ok (, mode, operands)" "@ p\t{%2, %0|%0, %2} - vp\t{%2, %1, %0|%0, %1, %2}" + vp\t{%2, %1, %0|%0, %1, %2}" [(set_attr "isa" "noavx,avx") (set_attr "type" "sseiadd") (set_attr "prefix_data16" "1,*") - (set_attr "prefix" "") + (set_attr "prefix" "orig,vex") (set_attr "mode" "")]) (define_insn "*3_mask" @@ -11899,7 +11899,7 @@ (eq_attr "mode" "TI")) (const_string "1") (const_string "*"))) - (set_attr "prefix" ",evex") + (set_attr "prefix" "orig,vex,evex") (set (attr "mode") (cond [(and (match_test " == 16") (match_test "TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL")) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 70bce764b06..6195e215a9e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2018-03-05 Jakub Jelinek + + PR target/84524 + * gcc.c-torture/execute/pr84524.c: New test. + * gcc.target/i386/avx512bw-pr84524.c: New test. + 2018-03-05 Peter Bergner PR target/84264 diff --git a/gcc/testsuite/gcc.c-torture/execute/pr84524.c b/gcc/testsuite/gcc.c-torture/execute/pr84524.c new file mode 100644 index 00000000000..8ca07153fb4 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr84524.c @@ -0,0 +1,41 @@ +/* PR target/84524 */ + +__attribute__((noipa)) void +foo (unsigned short *x) +{ + unsigned short i, v; + unsigned char j; + for (i = 0; i < 256; i++) + { + v = i << 8; + for (j = 0; j < 8; j++) + if (v & 0x8000) + v = (v << 1) ^ 0x1021; + else + v = v << 1; + x[i] = v; + } +} + +int +main () +{ + unsigned short a[256]; + + foo (a); + for (int i = 0; i < 256; i++) + { + unsigned short v = i << 8; + for (int j = 0; j < 8; j++) + { + asm volatile ("" : "+r" (v)); + if (v & 0x8000) + v = (v << 1) ^ 0x1021; + else + v = v << 1; + } + if (a[i] != v) + __builtin_abort (); + } + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/avx512bw-pr84524.c b/gcc/testsuite/gcc.target/i386/avx512bw-pr84524.c new file mode 100644 index 00000000000..536e81e17db --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/avx512bw-pr84524.c @@ -0,0 +1,14 @@ +/* PR target/84524 */ +/* { dg-do run { target avx512bw } } */ +/* { dg-options "-O3 -mavx512bw" } */ + +#include "avx512bw-check.h" + +#define main() do_main() +#include "../../gcc.c-torture/execute/pr84524.c" + +static void +avx512bw_test (void) +{ + do_main (); +}