Bug 233485

Summary: __builtin_ia32_psllw128 causes internal compiler error
Product: [Fedora] Fedora Reporter: Ali Erol <ali.erol>
Component: gccAssignee: Jakub Jelinek <jakub>
Status: CLOSED NOTABUG QA Contact:
Severity: urgent Docs Contact:
Priority: medium    
Version: 6   
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2007-03-24 09:25:57 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:
Attachments:
Description Flags
Preprocessed source stored for the sample code provided in the report none

Description Ali Erol 2007-03-22 18:34:22 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686 (x86_64); en-US; rv:1.8.1.1) Gecko/20061208 Firefox/2.0.0.1

Description of problem:
The simplified code below and any other code containing built-in SSE shift instructions can not be compiled because of an internal compiler error. 

#include <xmmintrin.h>

main() {
  __v8hi x;
  __v8hi y = __builtin_ia32_psllw128(x, (__v2di){0LL, 1LL});
}

I get the following error message:

zain.C: In function ‘int main()’:
zain.C:5: internal compiler error: in ix86_expand_builtin, at config/i386/i386.c:16322
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://bugzilla.redhat.com/bugzilla> for instructions.
Preprocessed source stored into /tmp/ccEdZBso.out file, please attach this to your bugreport

The problem seems to be specific to the SSE2 shift instructions. Other shifts such as logical/arithmetric shift right  are causing the same error.

The log file mentioned in the error message is in the attachment.



Version-Release number of selected component (if applicable):
gcc-4.1.1-51.fc6

How reproducible:
Always


Steps to Reproduce:
Just compile any code containing built-in SSE2 shift instructions.
For example:
#include <xmmintrin.h>

main() {
  __v8hi x;
  __v8hi y = __builtin_ia32_psllw128(x, (__v2di){0LL, 1LL});
}


Actual Results:
zain.C: In function ‘int main()’:
zain.C:5: internal compiler error: in ix86_expand_builtin, at config/i386/i386.c:16322
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://bugzilla.redhat.com/bugzilla> for instructions.
Preprocessed source stored into /tmp/ccEdZBso.out file, please attach this to your bugreport

Expected Results:


Additional info:

Comment 1 Ali Erol 2007-03-22 18:39:29 UTC
Created attachment 150687 [details]
Preprocessed source stored for the sample code provided in the report

Comment 2 Jakub Jelinek 2007-03-23 20:16:42 UTC
Why do you use the builtins directly?  You should be using _mm_sll_epi16
(for 8xHI shifts or _mm_sll_epi32 for 4xSI or _mm_sll_epi64 for 2xDI shifts)
inline function, the builtins are an implementation detail.

Comment 3 Ali Erol 2007-03-24 09:25:57 UTC
Thanks a lot, using _mm_sll_epip16 solved our problem.  Our code was originally
written in assembly. Using builtins directly made the conversion a little bit
easier and as we did not have any problems with other instructions, we thought
it would be OK to use them directly.