Opened 11 years ago

Closed 11 years ago

#5997 closed defect (fixed)

soundtouch SSE ASM exposes GCC bug

Reported by: Nigel Owned by: Isaac Richards
Priority: minor Milestone: unknown
Component: mythtv Version: head
Severity: medium Keywords:
Cc: foobum@… Ticket locked: no


Mac gcc4.0.1 r19283 build does:

g++ -c -pipe -march=pentium4 -g -Wall -Wno-switch -Wpointer-arith -Wredundant-decls -Wno-non-virtual-dtor -funit-at-a-time -D__STDC_CONSTANT_MACROS -Wno-long-double -fPIC -DPIC -w -fPIC -DMMX -Di386 -DUSING_APPLEREMOTE -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -DALLOW_SSE2 -I/Volumes/MythBuild/.osx-packager/build/mkspecs/macx-g++ -I. -I/Volumes/MythBuild/.osx-packager/build/include -I/Volumes/MythBuild/.osx-packager/build/include -I../../libs/libavcodec -I../.. -I. -o sse_gcc.o sse_gcc.cpp
sse_gcc.cpp: In member function 'virtual void soundtouch::TDStretchSSE2::overlapMulti(short int*, const short int*) const':
sse_gcc.cpp:164: error: can't find a register in class 'GENERAL_REGS' while reloading 'asm'

We work around the bug in libavcodec by tweaking the compile flags, but since this ASM was recently developed for #5890, I'm wondering if we can rework it for less registers?

Attachments (1)

st-reg_c.diff (2.1 KB) - added by foobum@… 11 years ago.

Download all attachments as: .zip

Change History (6)

Changed 11 years ago by foobum@…

Attachment: st-reg_c.diff added

comment:1 Changed 11 years ago by foobum@…

Hmm, this does look like a gcc bug specific to your version; neither gcc 3.4.4, 4.1.1 or 4.2.4 do this for me. We only use 5 (of 8) regs from GENERAL_REGS and we could use less but at the cost of additional insns. Using -fomit-frame-pointer should help. The attached patch avoids using REG_c explicitly in case that helps too..

comment:2 Changed 11 years ago by Nigel

Thanks for the patch, Nick, but sadly neither it nor -fomit make any difference.

comment:3 Changed 11 years ago by foobum@…

Ok. Unfortunately this just seems to be gcc being silly - hesitant to patch the asm when versions either side compile it ok. What happens if you drop -fPIC and add -fomit - should give gcc 2 extra GP registers to fritter away..

comment:4 Changed 11 years ago by Nigel

Removing the -fPIC was too hard (.pro adds one, qmake adds one), but -O does the trick for now.

comment:5 Changed 11 years ago by Nigel

Resolution: fixed
Status: newclosed

(In [19322]) Work around lack of registers when compiling with some GCCs. Closes #5997

Note: See TracTickets for help on using tickets.