Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 229444 - gcc and sse2 intrins does not correctly compile with -O<1, 2, 3, s> optimization flags
Summary: gcc and sse2 intrins does not correctly compile with -O<1, 2, 3, s> optimizat...
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: gcc4
Version: 6
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2007-02-21 04:21 UTC by Steve
Modified: 2007-11-30 22:11 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2007-02-21 08:11:10 UTC


Attachments (Terms of Use)
a very very small c program with sse2 instructions (deleted)
2007-02-21 04:21 UTC, Steve
no flags Details

Description Steve 2007-02-21 04:21:39 UTC
Description of problem:
gcc and sse2 does not correctly compile with optimization flags of -O1, -O2,
-O3, -O or -Os

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

How reproducible:
Only tested on a real simple sse2 enabled c source code file, but always.

Steps to Reproduce:
1. Write small c program with sse2 (emmintrin.h) in this case
2. Compile program with optimization flags of -O1, -O2, -O3, -Os, -O
3. The compiled program will not contain sse2 instructions
4. if also compiled with -S and any of the mentioned flags the generated
assembly will not contain sse2 instructions
5. if compiled with -O0 or no flag compiled program contains sse2 instructions
  
Actual results:
Program when compiled with certain -O flags will not actually produce an sse2
enabled program

Expected results:
program should correctly compile with -O, -O1, -O2, -O3, and -Os even if 

Additional info:
Processor:
Intel Pentium M (with sse2)

attached will be a sse2 program
successfull comiled with
gcc -O0 -march=pentium-m -msse2 test.c -o test

Comment 1 Steve 2007-02-21 04:21:39 UTC
Created attachment 148465 [details]
a very very small c program with sse2 instructions

Comment 2 Jakub Jelinek 2007-02-21 08:11:10 UTC
They are optimized away as useless, as written in the testcase they don't have
any visible side effect, the results are stored into an automatic variable.
If you don't want them to be optimized away, you need to either store at least
the final result to a non-automatic variable, return from function, pass to
other function (e.g. print them).

Comment 3 Steve 2007-02-21 17:57:04 UTC
Oh, I didn't realize the compiler would automatically disregard the sse2 if they
are useless instructions, I guess that's a good thing then.


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