Note: This is a public test instance of Red Hat Bugzilla. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback at bugzilla.redhat.com.
Bug 1429961 - vec_vmul{e,o}u{b,h} AltiVec built-in functions broken on ppc64 and ppc64le
Summary: vec_vmul{e,o}u{b,h} AltiVec built-in functions broken on ppc64 and ppc64le
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: gcc
Version: 26
Hardware: ppc64
OS: Linux
unspecified
unspecified
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-03-07 15:14 UTC by Nikola Forró
Modified: 2017-05-23 13:22 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-05-23 13:22:07 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
GNU Compiler Collection 79941 0 None None None 2017-03-07 16:03:46 UTC

Description Nikola Forró 2017-03-07 15:14:54 UTC
Description of problem:
vec_vmul{e,o}u{b,h} functions return incorrect results, because they compile down to instructions that differ in signedness, e.g. vec_vmuleub function compiles down to the vmulesb instruction. This also applies to generic vec_mule and vec_mulo functions when they are used with a pair of unsigned char or unsigned short arguments.


Version-Release number of selected component (if applicable):
gcc-7.0.1-0.10.fc26


How reproducible:
always


Steps to Reproduce:
1. $ cat reproducer.c
#include <limits.h>
#include <assert.h>
#include <altivec.h>

int main(void)
{
    vector unsigned char v0 = {1, 0, 0, 0, 0, 0, 0, 0};
    vector unsigned char v1 = {UCHAR_MAX, 0, 0, 0, 0, 0, 0, 0};

    vector unsigned short res = vec_vmuleub(v0, v1);

    assert(res[0] == (unsigned short)v0[0] * (unsigned short)v1[0]);
}

2. $ gcc -maltivec -mabi=altivec reproducer.c -o reproducer

3. $ ./reproducer 
reproducer: reproducer.c:12: main: Assertion `res[0] == (unsigned short)v0[0] * (unsigned short)v1[0]' failed.
Aborted (core dumped)


Actual results:
assertion fails


Expected results:
assertion succeeds


Additional info:
This affects build of libjpeg-turbo, making it generate broken images.

Comment 1 Nikola Forró 2017-05-18 14:11:18 UTC
This is fixed since gcc-7.0.1-0.15.fc26, right?

Comment 2 Jakub Jelinek 2017-05-23 13:22:07 UTC
Already since gcc-7.0.1-0.13.fc26.


Note You need to log in before you can comment on or make changes to this bug.