diff options
author | liuhongt <hongtao.liu@intel.com> | 2024-03-22 10:09:43 +0800 |
---|---|---|
committer | liuhongt <hongtao.liu@intel.com> | 2024-03-22 10:14:58 +0800 |
commit | 9a6c7aa1b011b77fcd9b19f7b8d7ff0fc823cdb2 (patch) | |
tree | dd78b6c48cddfab335c143c126daf4db27358906 /gcc/testsuite/gcc.c-torture | |
parent | 1542e8a44cc35e63233d3557afbf501c5ff84c55 (diff) | |
download | gcc-9a6c7aa1b011b77fcd9b19f7b8d7ff0fc823cdb2.zip gcc-9a6c7aa1b011b77fcd9b19f7b8d7ff0fc823cdb2.tar.gz gcc-9a6c7aa1b011b77fcd9b19f7b8d7ff0fc823cdb2.tar.bz2 |
Move pr114396.c from gcc.target/i386 to gcc.c-torture/execute.
Also fixed a typo in the testcase.
gcc/testsuite/ChangeLog:
PR tree-optimization/114396
* gcc.target/i386/pr114396.c: Move to...
* gcc.c-torture/execute/pr114396.c: ...here.
Diffstat (limited to 'gcc/testsuite/gcc.c-torture')
-rw-r--r-- | gcc/testsuite/gcc.c-torture/execute/pr114396.c | 105 |
1 files changed, 105 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr114396.c b/gcc/testsuite/gcc.c-torture/execute/pr114396.c new file mode 100644 index 0000000..baf90ea --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr114396.c @@ -0,0 +1,105 @@ +/* PR tree-optimization/114396 */ +/* { dg-additional-options "-fwrapv -fno-vect-cost-model" } */ + +short a = 0xF; +short b[16]; +unsigned short ua = 0xF; +unsigned short ub[16]; + +short +__attribute__((noipa)) +foo (short a) +{ + for (int e = 0; e < 9; e += 1) + b[e] = a *= 5; + return a; +} + +short +__attribute__((noipa)) +foo1 (short a) +{ + for (int e = 0; e < 9; e += 1) + b[e] = a *= -5; + return a; +} + +unsigned short +__attribute__((noipa)) +foou (unsigned short a) +{ + for (int e = 0; e < 9; e += 1) + ub[e] = a *= -5; + return a; +} + +unsigned short +__attribute__((noipa)) +foou1 (unsigned short a) +{ + for (int e = 0; e < 9; e += 1) + ub[e] = a *= 5; + return a; +} + +short +__attribute__((noipa,optimize("O3"))) +foo_o3 (short a) +{ + for (int e = 0; e < 9; e += 1) + b[e] = a *= 5; + return a; +} + +short +__attribute__((noipa,optimize("O3"))) +foo1_o3 (short a) +{ + for (int e = 0; e < 9; e += 1) + b[e] = a *= -5; + return a; +} + +unsigned short +__attribute__((noipa,optimize("O3"))) +foou_o3 (unsigned short a) +{ + for (int e = 0; e < 9; e += 1) + ub[e] = a *= -5; + return a; +} + +unsigned short +__attribute__((noipa,optimize("O3"))) +foou1_o3 (unsigned short a) +{ + for (int e = 0; e < 9; e += 1) + ub[e] = a *= 5; + return a; +} + +int main() { + unsigned short uexp, ures; + short exp, res; + exp = foo (a); + res = foo_o3 (a); + if (exp != res) + __builtin_abort (); + + exp = foo1 (a); + res = foo1_o3 (a); + if (exp != res) + __builtin_abort (); + + uexp = foou (a); + ures = foou_o3 (a); + if (uexp != ures) + __builtin_abort (); + + uexp = foou1 (a); + ures = foou1_o3 (a); + if (uexp != ures) + __builtin_abort (); + + return 0; +} |