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.