public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
* [Bug target/64358] New: Wrong code for __int128 operations in powerpc64le @ 2014-12-19 11:35 roger.ferrer at bsc dot es 2014-12-19 15:13 ` [Bug target/64358] " pthaugen at gcc dot gnu.org ` (4 more replies) 0 siblings, 5 replies; 6+ messages in thread From: roger.ferrer at bsc dot es @ 2014-12-19 11:35 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64358 Bug ID: 64358 Summary: Wrong code for __int128 operations in powerpc64le Product: gcc Version: 4.9.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: roger.ferrer at bsc dot es Hi, I'm observing a weird behaviour in PowerPC64 Little Endian that does not seem to occur on other architectures supporting __int128. The following code, when compiled with -O1 generates wrong output in gcc 4.9.1. -- test.c #include <stdio.h> typedef unsigned __int128 uint128_t; #define PRINT(value) \ { union u { uint128_t i; unsigned long long l[2]; } _t = { .i = value }; \ fprintf(stderr, "%s => <%016llx, %016llx>\n", #value, _t.l[1], _t.l[0]); } __attribute__((noinline)) uint128_t get_int(uint128_t value, unsigned int num_bytes) { uint128_t mask = ~(uint128_t)0; mask <<= (uint128_t)(8 * num_bytes); /* assuming 1 byte = 8 bits */ mask = ~mask; value &= mask; return value; } int main(int argc, char* argv[]) { uint128_t x = 0; x = get_int(10, /* num_bytes */ 1); PRINT(x); return 0; } -- end of test.c The problem is still present in a recent version from the svn: $ gcc -v Using built-in specs. COLLECT_GCC=/home/Computational/rferrer/gcc/install/bin/gcc COLLECT_LTO_WRAPPER=/home/Computational/rferrer/gcc/install/libexec/gcc/powerpc64le-unknown-linux-gnu/5.0.0/lto-wrapper Target: powerpc64le-unknown-linux-gnu Configured with: ../gcc-src/configure --prefix=/home/Computational/rferrer/gcc/install --enable-languages=c,c++,fortran --with-gmp=/home/Computational/rferrer/gcc/install --with-mpfr=/home/Computational/rferrer/gcc/install --with-mpc=/home/Computational/rferrer/gcc/install --enable-multiarch --disable-multilib Thread model: posix gcc version 5.0.0 20141218 (experimental) (GCC) $ make gcc -O0 -o test.O0 test.c ./test.O0 x => <0000000000000000, 000000000000000a> gcc -O1 -o test.O1 test.c ./test.O1 x => <ffffffffffffffff, ffffffffffffff00> Kind regards, ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug target/64358] Wrong code for __int128 operations in powerpc64le 2014-12-19 11:35 [Bug target/64358] New: Wrong code for __int128 operations in powerpc64le roger.ferrer at bsc dot es @ 2014-12-19 15:13 ` pthaugen at gcc dot gnu.org 2014-12-19 16:01 ` roger.ferrer at bsc dot es ` (3 subsequent siblings) 4 siblings, 0 replies; 6+ messages in thread From: pthaugen at gcc dot gnu.org @ 2014-12-19 15:13 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64358 Pat Haugen <pthaugen at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Target|powerpc64le |powerpc64le, powerpc64 Status|UNCONFIRMED |ASSIGNED Last reconfirmed| |2014-12-19 CC| |dje at gcc dot gnu.org Assignee|unassigned at gcc dot gnu.org |pthaugen at gcc dot gnu.org Ever confirmed|0 |1 --- Comment #1 from Pat Haugen <pthaugen at gcc dot gnu.org> --- This occurs on powerpc64 Big Endian too and is fixed by a patch I just submitted yesterday. Talk about timing... https://gcc.gnu.org/ml/gcc-patches/2014-12/msg01585.html ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug target/64358] Wrong code for __int128 operations in powerpc64le 2014-12-19 11:35 [Bug target/64358] New: Wrong code for __int128 operations in powerpc64le roger.ferrer at bsc dot es 2014-12-19 15:13 ` [Bug target/64358] " pthaugen at gcc dot gnu.org @ 2014-12-19 16:01 ` roger.ferrer at bsc dot es 2014-12-20 15:37 ` segher at gcc dot gnu.org ` (2 subsequent siblings) 4 siblings, 0 replies; 6+ messages in thread From: roger.ferrer at bsc dot es @ 2014-12-19 16:01 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64358 --- Comment #2 from Roger Ferrer Ibanez <roger.ferrer at bsc dot es> --- (In reply to Pat Haugen from comment #1) > This occurs on powerpc64 Big Endian too and is fixed by a patch I just > submitted yesterday. Talk about timing... Fantastic > > https://gcc.gnu.org/ml/gcc-patches/2014-12/msg01585.html I applied the patch in my tree and it fixes this issue. Thanks a lot! ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug target/64358] Wrong code for __int128 operations in powerpc64le 2014-12-19 11:35 [Bug target/64358] New: Wrong code for __int128 operations in powerpc64le roger.ferrer at bsc dot es 2014-12-19 15:13 ` [Bug target/64358] " pthaugen at gcc dot gnu.org 2014-12-19 16:01 ` roger.ferrer at bsc dot es @ 2014-12-20 15:37 ` segher at gcc dot gnu.org 2015-01-13 19:09 ` pthaugen at gcc dot gnu.org 2015-01-13 19:18 ` pthaugen at gcc dot gnu.org 4 siblings, 0 replies; 6+ messages in thread From: segher at gcc dot gnu.org @ 2014-12-20 15:37 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64358 --- Comment #3 from Segher Boessenkool <segher at gcc dot gnu.org> --- Author: segher Date: Sat Dec 20 15:37:06 2014 New Revision: 218989 URL: https://gcc.gnu.org/viewcvs?rev=218989&root=gcc&view=rev Log: PR target/64358 * config/rs6000/rs6000.c (rs6000_split_logical_inner): Swap the input operands if only the second is inverted. * config/rs6000/rs6000.md (*boolc<mode>3_internal1 for BOOL_128): Swap BOOL_REGS_OP1 and BOOL_REGS_OP2. Correct arguments to rs6000_split_logical. (*boolc<mode>3_internal2 for TI2): Swap operands[1] and operands[2]. Modified: trunk/gcc/ChangeLog trunk/gcc/config/rs6000/rs6000.c trunk/gcc/config/rs6000/rs6000.md ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug target/64358] Wrong code for __int128 operations in powerpc64le 2014-12-19 11:35 [Bug target/64358] New: Wrong code for __int128 operations in powerpc64le roger.ferrer at bsc dot es ` (2 preceding siblings ...) 2014-12-20 15:37 ` segher at gcc dot gnu.org @ 2015-01-13 19:09 ` pthaugen at gcc dot gnu.org 2015-01-13 19:18 ` pthaugen at gcc dot gnu.org 4 siblings, 0 replies; 6+ messages in thread From: pthaugen at gcc dot gnu.org @ 2015-01-13 19:09 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64358 --- Comment #4 from Pat Haugen <pthaugen at gcc dot gnu.org> --- Author: pthaugen Date: Tue Jan 13 19:08:49 2015 New Revision: 219548 URL: https://gcc.gnu.org/viewcvs?rev=219548&root=gcc&view=rev Log: Backport from mainline 2014-12-20 Segher Boessenkool <segher@kernel.crashing.org> PR target/64358 * config/rs6000/rs6000.c (rs6000_split_logical_inner): Swap the input operands if only the second is inverted. * config/rs6000/rs6000.md (*boolc<mode>3_internal1 for BOOL_128): Swap BOOL_REGS_OP1 and BOOL_REGS_OP2. Correct arguments to rs6000_split_logical. (*boolc<mode>3_internal2 for TI2): Swap operands[1] and operands[2]. Modified: branches/gcc-4_8-branch/gcc/ChangeLog branches/gcc-4_8-branch/gcc/config/rs6000/rs6000.c branches/gcc-4_8-branch/gcc/config/rs6000/rs6000.md ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug target/64358] Wrong code for __int128 operations in powerpc64le 2014-12-19 11:35 [Bug target/64358] New: Wrong code for __int128 operations in powerpc64le roger.ferrer at bsc dot es ` (3 preceding siblings ...) 2015-01-13 19:09 ` pthaugen at gcc dot gnu.org @ 2015-01-13 19:18 ` pthaugen at gcc dot gnu.org 4 siblings, 0 replies; 6+ messages in thread From: pthaugen at gcc dot gnu.org @ 2015-01-13 19:18 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64358 --- Comment #5 from Pat Haugen <pthaugen at gcc dot gnu.org> --- Author: pthaugen Date: Tue Jan 13 19:17:42 2015 New Revision: 219551 URL: https://gcc.gnu.org/viewcvs?rev=219551&root=gcc&view=rev Log: Backport from mainline 2014-12-20 Segher Boessenkool <segher@kernel.crashing.org> PR target/64358 * config/rs6000/rs6000.c (rs6000_split_logical_inner): Swap the input operands if only the second is inverted. * config/rs6000/rs6000.md (*boolc<mode>3_internal1 for BOOL_128): Swap BOOL_REGS_OP1 and BOOL_REGS_OP2. Correct arguments to rs6000_split_logical. (*boolc<mode>3_internal2 for TI2): Swap operands[1] and operands[2]. Modified: branches/gcc-4_9-branch/gcc/ChangeLog branches/gcc-4_9-branch/gcc/config/rs6000/rs6000.c branches/gcc-4_9-branch/gcc/config/rs6000/rs6000.md ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2015-01-13 19:18 UTC | newest] Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2014-12-19 11:35 [Bug target/64358] New: Wrong code for __int128 operations in powerpc64le roger.ferrer at bsc dot es 2014-12-19 15:13 ` [Bug target/64358] " pthaugen at gcc dot gnu.org 2014-12-19 16:01 ` roger.ferrer at bsc dot es 2014-12-20 15:37 ` segher at gcc dot gnu.org 2015-01-13 19:09 ` pthaugen at gcc dot gnu.org 2015-01-13 19:18 ` pthaugen at gcc dot gnu.org
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).