Public bug reported:

Vector shift miscompilation
 
---Steps to Reproduce---
   t.c:
__vector int
foo (__vector int a, int s)
{
  return a << (s + 3);
}

gcc -O3 -march=z13 t.c -S -mzvector

foo:
        veslf   %v24,%v24,0(%r2)   <---- +3 is omitted
        br      %r14
 
Contact Information = andreas.kreb...@de.ibm.com 
 
Userspace tool common name: GCC 
 
The userspace tool has the following bit modes: 64 

Backported fix has been applied to GCC 8 branch as r273493:

https://gcc.gnu.org/viewcvs?rev=273493&root=gcc&view=rev

S/390: Fix vector shift count operand

We currently use subst definitions to handle the different variants of shift
count operands. Unfortunately, in the vector shift pattern the shift count
operand is used directly. Without it being adjusted for the 'subst' variants the
displacement value is omitted resulting in a wrong shift count being applied.

This patch needs to be applied to older branches as well.

gcc/ChangeLog:

2019-07-15  Andreas Krebbel  <kreb...@linux.ibm.com>

Backport from mainline
2019-07-01  Andreas Krebbel  <kreb...@linux.ibm.com>

* config/s390/vector.md: Fix shift count operand printing.

gcc/testsuite/ChangeLog:

2019-07-15  Andreas Krebbel  <kreb...@linux.ibm.com>

Backport from mainline
2019-07-01  Andreas Krebbel  <kreb...@linux.ibm.com>

* gcc.target/s390/vector/vec-shift-2.c: New test.

Added:
branches/gcc-8-branch/gcc/testsuite/gcc.target/s390/vector/vec-shift-2.c
Modified:
branches/gcc-8-branch/gcc/ChangeLog
branches/gcc-8-branch/gcc/config/s390/vector.md
branches/gcc-8-branch/gcc/testsuite/ChangeLog

** Affects: ubuntu-z-systems
     Importance: High
     Assignee: Matthias Klose (doko)
         Status: Triaged

** Affects: gcc-8 (Ubuntu)
     Importance: Undecided
     Assignee: Skipper Bug Screeners (skipper-screen-team)
         Status: New


** Tags: architecture-s39064 bugnameltc-179280 severity-high 
targetmilestone-inin---

** Tags added: architecture-s39064 bugnameltc-179280 severity-high
targetmilestone-inin---

** Changed in: ubuntu
     Assignee: (unassigned) => Skipper Bug Screeners (skipper-screen-team)

** Package changed: ubuntu => linux (Ubuntu)

-- 
You received this bug notification because you are a member of Kernel
Packages, which is subscribed to linux in Ubuntu.
https://bugs.launchpad.net/bugs/1837522

Title:
  GCC Miscompilation of vector shift

Status in Ubuntu on IBM z Systems:
  Triaged
Status in gcc-8 package in Ubuntu:
  New

Bug description:
  Vector shift miscompilation
   
  ---Steps to Reproduce---
     t.c:
  __vector int
  foo (__vector int a, int s)
  {
    return a << (s + 3);
  }

  gcc -O3 -march=z13 t.c -S -mzvector

  foo:
          veslf   %v24,%v24,0(%r2)   <---- +3 is omitted
          br      %r14
   
  Contact Information = andreas.kreb...@de.ibm.com 
   
  Userspace tool common name: GCC 
   
  The userspace tool has the following bit modes: 64 

  Backported fix has been applied to GCC 8 branch as r273493:

  https://gcc.gnu.org/viewcvs?rev=273493&root=gcc&view=rev

  S/390: Fix vector shift count operand

  We currently use subst definitions to handle the different variants of shift
  count operands. Unfortunately, in the vector shift pattern the shift count
  operand is used directly. Without it being adjusted for the 'subst' variants 
the
  displacement value is omitted resulting in a wrong shift count being applied.

  This patch needs to be applied to older branches as well.

  gcc/ChangeLog:

  2019-07-15  Andreas Krebbel  <kreb...@linux.ibm.com>

  Backport from mainline
  2019-07-01  Andreas Krebbel  <kreb...@linux.ibm.com>

  * config/s390/vector.md: Fix shift count operand printing.

  gcc/testsuite/ChangeLog:

  2019-07-15  Andreas Krebbel  <kreb...@linux.ibm.com>

  Backport from mainline
  2019-07-01  Andreas Krebbel  <kreb...@linux.ibm.com>

  * gcc.target/s390/vector/vec-shift-2.c: New test.

  Added:
  branches/gcc-8-branch/gcc/testsuite/gcc.target/s390/vector/vec-shift-2.c
  Modified:
  branches/gcc-8-branch/gcc/ChangeLog
  branches/gcc-8-branch/gcc/config/s390/vector.md
  branches/gcc-8-branch/gcc/testsuite/ChangeLog

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu-z-systems/+bug/1837522/+subscriptions

-- 
Mailing list: https://launchpad.net/~kernel-packages
Post to     : kernel-packages@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kernel-packages
More help   : https://help.launchpad.net/ListHelp

Reply via email to