Bug 92950 - Wrong load instructions emitted for movv1qi
Summary: Wrong load instructions emitted for movv1qi
Status: CLOSED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 7.0
: P2 major
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: wrong-code
Depends on:
Blocks:
 
Reported: 2019-12-16 07:51 UTC by Andreas Krebbel
Modified: 2020-04-24 15:20 UTC (History)
1 user (show)

See Also:
Host: s390x-ibm-linux
Target: s390x-ibm-linux
Build: s390x-ibm-linux
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andreas Krebbel 2019-12-16 07:51:59 UTC
The following testcase abort when being compiled with -O3 -march=z13 on IBM Z:

struct a {
  int b;
  char c;
};
struct a d = {1, 16};
struct a *e = &d;

int f = 0;

int main() {
  struct a g = {0, 0 };
  f = 0;

  for (; f <= 1; f++) {
    g = d;
    *e = g;
  }

  if (d.c != 16)
    __builtin_abort();
}

The movv1qi pattern emits halfword load instructions instead of character loads.
Comment 1 Andreas Krebbel 2019-12-16 08:04:00 UTC
Author: krebbel
Date: Mon Dec 16 08:03:28 2019
New Revision: 279410

URL: https://gcc.gnu.org/viewcvs?rev=279410&root=gcc&view=rev
Log:
Fix PR92950: Wrong code emitted for movv1qi

The backend emits 16 bit memory loads for single element character
vector.  As a result the character will not be right justified in the
GPR.

gcc/ChangeLog:

2019-12-16  Andreas Krebbel  <krebbel@linux.ibm.com>

	PR target/92950
	* config/s390/vector.md ("mov<mode>" for V_8): Replace lh, lhy,
	and lhrl with llc.

gcc/testsuite/ChangeLog:

2019-12-16  Andreas Krebbel  <krebbel@linux.ibm.com>

	PR target/92950
	* gcc.target/s390/vector/pr92950.c: New test.


Added:
    trunk/gcc/testsuite/gcc.target/s390/vector/pr92950.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/s390/vector.md
    trunk/gcc/testsuite/ChangeLog
Comment 2 Andreas Krebbel 2019-12-17 08:38:02 UTC
Author: krebbel
Date: Tue Dec 17 08:37:26 2019
New Revision: 279453

URL: https://gcc.gnu.org/viewcvs?rev=279453&root=gcc&view=rev
Log:
Fix PR92950: Wrong code emitted for movv1qi

The backend emits 16 bit memory loads for single element character
vector.  As a result the character will not be right justified in the
GPR.

gcc/ChangeLog:

2019-12-17  Andreas Krebbel  <krebbel@linux.ibm.com>

	Backport from mainline
	2019-12-16  Andreas Krebbel  <krebbel@linux.ibm.com>

	PR target/92950
	* config/s390/vector.md ("mov<mode>" for V_8): Replace lh, lhy,
	and lhrl with llc.

gcc/testsuite/ChangeLog:

2019-12-17  Andreas Krebbel  <krebbel@linux.ibm.com>

	Backport from mainline
	2019-12-16  Andreas Krebbel  <krebbel@linux.ibm.com>

	PR target/92950
	* gcc.target/s390/vector/pr92950.c: New test.


Added:
    branches/gcc-9-branch/gcc/testsuite/gcc.target/s390/vector/pr92950.c
Modified:
    branches/gcc-9-branch/gcc/ChangeLog
    branches/gcc-9-branch/gcc/config/s390/vector.md
    branches/gcc-9-branch/gcc/testsuite/ChangeLog
Comment 3 Andreas Krebbel 2019-12-17 08:42:26 UTC
Author: krebbel
Date: Tue Dec 17 08:41:54 2019
New Revision: 279454

URL: https://gcc.gnu.org/viewcvs?rev=279454&root=gcc&view=rev
Log:
Fix PR92950: Wrong code emitted for movv1qi

The backend emits 16 bit memory loads for single element character
vector.  As a result the character will not be right justified in the
GPR.

gcc/ChangeLog:

2019-12-17  Andreas Krebbel  <krebbel@linux.ibm.com>

	Backport from mainline
	2019-12-16  Andreas Krebbel  <krebbel@linux.ibm.com>

	PR target/92950
	* config/s390/vector.md ("mov<mode>" for V_8): Replace lh, lhy,
	and lhrl with llc.

gcc/testsuite/ChangeLog:

2019-12-17  Andreas Krebbel  <krebbel@linux.ibm.com>

	Backport from mainline
	2019-12-16  Andreas Krebbel  <krebbel@linux.ibm.com>

	PR target/92950
	* gcc.target/s390/vector/pr92950.c: New test.


Added:
    branches/gcc-8-branch/gcc/testsuite/gcc.target/s390/vector/pr92950.c
Modified:
    branches/gcc-8-branch/gcc/ChangeLog
    branches/gcc-8-branch/gcc/config/s390/vector.md
    branches/gcc-8-branch/gcc/testsuite/ChangeLog
Comment 4 Jakub Jelinek 2020-04-24 15:19:42 UTC
Assuming fixed.
Comment 5 Andreas Krebbel 2020-04-24 15:20:52 UTC
Fixed