Bug 71785 - macro mmx_m2r in xineutils.h allows operation with regs/immediate not allowed really, this disallow extensive optimization
macro mmx_m2r in xineutils.h allows operation with regs/immediate not allowed...
Status: CLOSED WONTFIX
Product: Red Hat Linux
Classification: Retired
Component: xine (Show other bugs)
7.3
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Bastien Nocera
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2002-08-19 02:21 EDT by Sysoltsev Slawa
Modified: 2007-04-18 12:45 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2004-08-27 19:39:16 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)

  None (edit)
Description Sysoltsev Slawa 2002-08-19 02:21:48 EDT
From Bugzilla Helper:
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)

Description of problem:
Compiling xine source with my C/C++ compiler I got strange error:
/users/vsysoltx/tmp/icchH9Dzgas_: Assembler messages:
/users/vsysoltx/tmp/icchH9Dzgas_:225: Error: missing or invalid immediate 
expression `0x0271027102710271' taken as 0
/users/vsysoltx/tmp/icchH9Dzgas_:225: Error: suffix or operands invalid for 
`pmullw'
/users/vsysoltx/tmp/icchH9Dzgas_:233: Error: suffix or operands invalid for 
`pcmpgtw'
/users/vsysoltx/tmp/icchH9Dzgas_:460: Error: missing or invalid immediate 
expression `0x0258025802580258' taken as 0
/users/vsysoltx/tmp/icchH9Dzgas_:460: Error: suffix or operands invalid for 
`movq'

I've investigated the error. It arises because macro mmx_m2r defined 
into ./src/xine-utils/xine-utils.h allows all operands (X asm constraint) 
though real mmx instructions very limited and doesn't allow immediates and 
general registers for example.
In sources file ./src/video_out/deinterlace.c however that macro may be used 
with immediate value when constant promotion is done by smart compiler, here is 
code combined from real xine sources:

#define mmx_m2r(op,mem,reg) \
        __asm__ __volatile__ (#op " %0, %%" #reg \
                              : /* nothing */ \
                              : "X" (mem))
#define pcmpgtw_m2r(var,reg)    mmx_m2r (pcmpgtw, var, reg)
  long JaggieThreshold = 73;
  qwThreshold = JaggieThreshold;
  qwThreshold += (qwThreshold << 48) + (qwThreshold << 32) + (qwThreshold << 
16);
  pcmpgtw_m2r ( *&qwThreshold, mm6 );

As you see qwThreshold may be easy calculated and placed into some globally 
visible area with constant adress. So it's dereference also may be calculated 
and instantiated into intermediate language. As a result there will be 
instruction like "pcmpgtw $0x1234567812345678, %mm6" in assembler output and 
error will be emitted by assembler.
With this I can't use extensive optimization (which includes constant 
promotion) compiling xine and hence can't get highly optimized xine player.

Workaround: change 'X' constraint in mmx_r2m macro to something like 'm'.

Version-Release number of selected component (if applicable):


How reproducible:
Always

Steps to Reproduce:
Regrettably GNU C/C++ 2.96 doesn't conduct such deep const optimization but 
future version may do that.

Feel free to contact me via e-mail to experiment with source.
	

Actual Results:  Compilation error

Expected Results:  Extremely optimized for IA32 xine video player.

Additional info:
Comment 1 Bastien Nocera 2004-08-27 19:39:16 EDT
xine isn't part of Red Hat Enterprise Linux or Fedora Core anymore.

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