public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/96399] New: Arithmetic shift with vector extension becomes logical right shift on s390x
@ 2020-07-31 8:58 yohei at jp dot ibm.com
2020-07-31 9:08 ` [Bug c/96399] " yohei at jp dot ibm.com
2020-07-31 9:16 ` jakub at gcc dot gnu.org
0 siblings, 2 replies; 3+ messages in thread
From: yohei at jp dot ibm.com @ 2020-07-31 8:58 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96399
Bug ID: 96399
Summary: Arithmetic shift with vector extension becomes logical
right shift on s390x
Product: gcc
Version: 10.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: yohei at jp dot ibm.com
Target Milestone: ---
When I applied arithmetic shift (>>) to a 16-element signed char vector
variable, I observed behavior of logical right shift on s390x.
-----
#include <stdio.h>
typedef char vec16char __attribute__ ((vector_size (16)));
void test(vec16char *p, vec16char *q)
{
*q = *p >> 7;
}
int main(int argc, char *argv[])
{
vec16char in = {0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80};
vec16char out;
test(&in, &out);
printf("out[0] = %d\n", out[0]);
}
-----
I compiled the above code with gcc -Wall -march=z14 -O3 -o vectest vectest.c
Then, I got the following output on s390x:
out[0] = 1
I expected the following output:
out[0] = -1
At least on x86_64, I got the expected output.
On s390x, vesrlb is generated, but I think vesrab is appropriate.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-07-31 9:16 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-31 8:58 [Bug c/96399] New: Arithmetic shift with vector extension becomes logical right shift on s390x yohei at jp dot ibm.com
2020-07-31 9:08 ` [Bug c/96399] " yohei at jp dot ibm.com
2020-07-31 9:16 ` jakub 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).