Bug 172117

Summary: Incorrect code using vector types
Product: Red Hat Enterprise Linux 4 Reporter: Hakon Bugge <hakon.bugge>
Component: gccAssignee: Jakub Jelinek <jakub>
Status: CLOSED ERRATA QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 4.0CC: aoliva, aostvold
Target Milestone: ---   
Target Release: ---   
Hardware: ia64   
OS: Linux   
Whiteboard:
Fixed In Version: RHBA-2006-0509 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2006-08-10 21:28:48 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 181409    
Attachments:
Description Flags
C source
none
Patch that fixes the bug none

Description Hakon Bugge 2005-10-31 17:05:40 UTC
From Bugzilla Helper:
User-Agent: Opera/8.50 (Windows NT 5.1; U; en)

Description of problem:
Using (or attempting to use) vector instructions generates incorrect code on 
ia64. In the sample program, every second element of the sum misses one of the 
operands.

Version-Release number of selected component (if applicable):
gcc version 3.4.3 20050227 (Red Hat 3.4.3-22.1)  

How reproducible:
Always

Steps to Reproduce:
1.gcc -O1 gcc_vector_ia64_bug.c
2../a.out
3.
  

Actual Results:  testing scalar version
testing vector version
dst[  1] a: 1.020000 e: 2.030000
dst[  3] a: 3.060000 e: 6.090000
dst[  5] a: 5.100000 e: 10.150000
dst[  7] a: 7.140000 e: 14.210000
dst[  9] a: 9.180000 e: 18.270000
dst[ 11] a: 11.220000 e: 22.330000
dst[ 13] a: 13.260000 e: 26.389999
dst[ 15] a: 15.300000 e: 30.450001


Expected Results:  testing scalar version
testing vector version

Additional info:

Works on other tested architectures (ia32, x86_64)

Comment 1 Hakon Bugge 2005-10-31 17:07:06 UTC
Created attachment 120577 [details]
C source

Comment 2 Alexandre Oliva 2005-12-18 20:48:20 UTC
Created attachment 122387 [details]
Patch that fixes the bug

The bug is in the way we open-code the vector addition.  When we see code such
as:

tmp0 += some_vector;

we emit code that writes to the first element of tmp0 with a subreg.  Since on
IA64 two floats fit in a word, the subreg has the effect of clobbering the
second element of the vector.  Oops.

The attached patch makes sure we do not use such a subreg as the output of the
open-coded instruction if the output matches any of the inputs.

This code is not present in mainline any more, as the open-coding was all moved
to the tree level, so this patch is not going upstream unless people tell me
it's a good idea to get it into upstream 3.4 or so.

Comment 6 Bob Johnson 2006-04-11 17:19:19 UTC
This issue is on Red Hat Engineering's list of planned work items 
for the upcoming Red Hat Enterprise Linux 4.4 release.  Engineering 
resources have been assigned and barring unforeseen circumstances, Red 
Hat intends to include this item in the 4.4 release.

Comment 11 Red Hat Bugzilla 2006-08-10 21:28:56 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on the solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2006-0509.html