public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/113087] New: [14] RISC-V rv64gcv vector: Runtime mismatch with rv64gc
@ 2023-12-19 22:20 patrick at rivosinc dot com
  2023-12-19 22:28 ` [Bug target/113087] " juzhe.zhong at rivai dot ai
                   ` (43 more replies)
  0 siblings, 44 replies; 45+ messages in thread
From: patrick at rivosinc dot com @ 2023-12-19 22:20 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113087

            Bug ID: 113087
           Summary: [14] RISC-V rv64gcv vector: Runtime mismatch with
                    rv64gc
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: patrick at rivosinc dot com
  Target Milestone: ---

Sorry for the non-descriptive issue title - I'm not sure what's going on here.

Testcase:
int(e)(int g, int h) { return h > 0x10 || g > 0xFFFFFFFF >> h ? g : g << h; }
struct i {
  int j;
  int l : 1;
};
struct m {
  char k;
  int n;
};
char o;
char p;
short s;
int q;
struct m r;
int v;
int t;
short z;
long ac;
int ad;
int ae;

static void ai(struct i bf) {
  for (; v; v++)
    r.k = 0;
  do
    ac ^= bf.j;
  while (bf.j < 0);
  s = 0;
  if (bf.l)
    q |= 0x800;
}

int main() {
  struct i aw = {0xE00, 1};
  o = 4;
  s = p;
  ai(aw);
  t = 1;
  ++p;
  for (; t <= 7; t++) {
    ad &= 1;
    (o &= 1 - e(0x40000012, ++ae)) & (z |= 1);
  }
  for (; r.n;)
    ;
  if (o != 4)
    return 1;
}

Analysis:
o = 4;
... Ignore first 7 iterations of loop, only consider last iter (ae = 7)
o &= 1 - e(0x40000012, ++ae)
expanded:
o = 4 & (1 - e(0x40000012, 8))
expanded:
o = 4 & (1 - (8 > 0x10 || 0x40000012 > 0xFFFFFFFF >> 8 ? 0x40000012 :
0x40000012 << 8))
partially evaluated:
o = 4 & (1 - (false || 0x40000012 > 0xFFFFFF ? 0x40000012 : 0x...1200))
partially evaluated:
o = 4 & (1 - (false || true ? 0x40000012 : 0x...1200))
partially evaluated:
o = 4 & (1 - (true ? 0x40000012 : 0x...1200))
partially evaluated:
o = 4 & (1 - (0x40000012))
partially evaluated:
o = 4 & (0xBFFFFFEF)
evaluated:
o = 4

Commands:
> /scratch/tc-testing/tc-dec-19-trunk/build-rv64gcv/bin/riscv64-unknown-linux-gnu-gcc -march=rv64gcv -mabi=lp64d -O3 red.c -o rv64gcv.out
> QEMU_CPU=rv64,vlen=128,v=true,vext_spec=v1.0,Zve32f=true,Zve64f=true timeout --verbose -k 0.1 1 /scratch/tc-testing/tc-dec-19-trunk/build-rv64gcv/bin/qemu-riscv64 rv64gcv.out
> echo $?
1

> /scratch/tc-testing/tc-dec-19-trunk/build-rv64gcv/bin/riscv64-unknown-linux-gnu-gcc -march=rv64gc -mabi=lp64d -O3 red.c -o rv64gc.out
> QEMU_CPU=rv64,vlen=128,v=true,vext_spec=v1.0,Zve32f=true,Zve64f=true timeout --verbose -k 0.1 1 /scratch/tc-testing/tc-dec-19-trunk/build-rv64gcv/bin/qemu-riscv64 rv64gc.out
> echo $?
0

Behavior found using gcc hash: r14-6716-g1502d724df8

^ permalink raw reply	[flat|nested] 45+ messages in thread

end of thread, other threads:[~2024-01-24 22:29 UTC | newest]

Thread overview: 45+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-19 22:20 [Bug target/113087] New: [14] RISC-V rv64gcv vector: Runtime mismatch with rv64gc patrick at rivosinc dot com
2023-12-19 22:28 ` [Bug target/113087] " juzhe.zhong at rivai dot ai
2023-12-19 22:45 ` patrick at rivosinc dot com
2023-12-19 22:51 ` juzhe.zhong at rivai dot ai
2023-12-19 23:42 ` patrick at rivosinc dot com
2023-12-20  2:12 ` juzhe.zhong at rivai dot ai
2023-12-20  2:21 ` patrick at rivosinc dot com
2023-12-20 23:06 ` cvs-commit at gcc dot gnu.org
2023-12-20 23:06 ` cvs-commit at gcc dot gnu.org
2023-12-20 23:25 ` juzhe.zhong at rivai dot ai
2023-12-21  2:55 ` patrick at rivosinc dot com
2023-12-21 19:22 ` patrick at rivosinc dot com
2023-12-21 22:43 ` juzhe.zhong at rivai dot ai
2023-12-22 19:59 ` vineetg at gcc dot gnu.org
2023-12-22 21:04 ` vineetg at gcc dot gnu.org
2023-12-22 22:21 ` juzhe.zhong at rivai dot ai
2023-12-22 23:07 ` vineetg at gcc dot gnu.org
2023-12-22 23:10 ` juzhe.zhong at rivai dot ai
2023-12-22 23:12 ` vineetg at gcc dot gnu.org
2023-12-22 23:14 ` juzhe.zhong at rivai dot ai
2023-12-22 23:20 ` juzhe.zhong at rivai dot ai
2023-12-22 23:21 ` juzhe.zhong at rivai dot ai
2023-12-22 23:33 ` palmer at gcc dot gnu.org
2023-12-22 23:36 ` juzhe.zhong at rivai dot ai
2023-12-22 23:37 ` juzhe.zhong at rivai dot ai
2023-12-23  2:21 ` jiawei at iscas dot ac.cn
2023-12-25  2:39 ` juzhe.zhong at rivai dot ai
2024-01-04 17:12 ` patrick at rivosinc dot com
2024-01-04 22:31 ` juzhe.zhong at rivai dot ai
2024-01-09  1:34 ` pan2.li at intel dot com
2024-01-10 22:16 ` patrick at rivosinc dot com
2024-01-10 23:09 ` juzhe.zhong at rivai dot ai
2024-01-11  0:33 ` patrick at rivosinc dot com
2024-01-11  0:37 ` vineetg at gcc dot gnu.org
2024-01-11  1:13 ` juzhe.zhong at rivai dot ai
2024-01-11  1:14 ` juzhe.zhong at rivai dot ai
2024-01-15 11:11 ` juzhe.zhong at rivai dot ai
2024-01-22 13:42 ` rdapp at gcc dot gnu.org
2024-01-22 14:39 ` rdapp at gcc dot gnu.org
2024-01-24  1:07 ` patrick at rivosinc dot com
2024-01-24  1:08 ` patrick at rivosinc dot com
2024-01-24  7:24 ` juzhe.zhong at rivai dot ai
2024-01-24  7:48 ` patrick at rivosinc dot com
2024-01-24 21:41 ` patrick at rivosinc dot com
2024-01-24 22:29 ` juzhe.zhong at rivai dot ai

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).