[FFmpeg-devel] [PATCH/RFC] mathops/x86: work around inline asm miscompilation with GCC 4.8.1
Carl Eugen Hoyos
cehoyos at ag.or.at
Fri Jun 21 09:43:47 CEST 2013
Michael Niedermayer <michaelni <at> gmx.at> writes:
> > I pin-pointed the specific uses of the function in
> > question that cause it, but reading the generated
> > asm didn't show anything obvious yet, but it could
> > be the smallest thing.
> > Its the 4 mid_pred calls in vc1_pred_b_mv, if
> > anyone else wants to have a look.
(Only the two first ones.)
> can you post the generated asm? i mean the good one
> without volatile and the bad with ?
gcc 4.8.0, 32bit
The relevant parts of the source where the change
makes a difference for fate are lines 2156 and 2235
of libavcodec/vc1dec.c:
px = mid_pred(A[0], B[0], C[0]);
Following is the diff between the original
("notworking.txt") and the patched assembly
("working.txt"). I only changed the two
relevant function calls, not any other part
of the code:
--- notworking.txt 2013-06-21 09:31:13.065457215 +0200
+++ working.txt 2013-06-21 09:29:33.042439057 +0200
@@ -149,26 +149,26 @@
0x08557c88 <+552>: cmpl $0x1,0x28(%esp)
0x08557c8d <+557>: lea (%esi,%ebx,4),%esi
0x08557c90 <+560>: mov %esi,0x2c(%esp)
0x08557c94 <+564>: je 0x85581f8 <vc1_pred_b_mv+1944>
0x08557c9a <+570>: add %ebx,%ecx
0x08557c9c <+572>: mov 0x1c(%esp),%ebx
0x08557ca0 <+576>: lea (%ebx,%ecx,4),%ebx
0x08557ca3 <+579>: movswl (%ebx),%esi
0x08557ca6 <+582>: mov %ebx,0x30(%esp)
0x08557caa <+586>: mov 0x24(%esp),%ebx
- 0x08557cae <+590>: mov %esi,%edx
- 0x08557cb0 <+592>: mov %esi,%ecx
- 0x08557cb2 <+594>: mov 0x10(%esp),%esi
- 0x08557cb6 <+598>: movswl (%ebx),%ebx
- 0x08557cb9 <+601>: mov %ebx,0x10(%esp)
- 0x08557cbd <+605>: mov 0x2c(%esp),%ebx
+ 0x08557cae <+590>: mov %esi,%ecx
+ 0x08557cb0 <+592>: mov %esi,%edx
+ 0x08557cb2 <+594>: movswl (%ebx),%ebx
+ 0x08557cb5 <+597>: mov %ebx,0x10(%esp)
+ 0x08557cb9 <+601>: mov 0x2c(%esp),%ebx
+ 0x08557cbd <+605>: mov 0x10(%esp),%esi
0x08557cc1 <+609>: movswl (%ebx),%ebx
0x08557cc4 <+612>: cmp %ecx,%ebx
0x08557cc6 <+614>: cmovg %ebx,%edx
0x08557cc9 <+617>: cmovg %ecx,%ebx
0x08557ccc <+620>: cmp %esi,%ebx
0x08557cce <+622>: cmovl %esi,%ebx
0x08557cd1 <+625>: cmp %ebx,%edx
0x08557cd3 <+627>: cmovg %ebx,%edx
0x08557cd6 <+630>: mov 0x24(%esp),%esi
0x08557cda <+634>: mov 0x30(%esp),%ebx
@@ -302,26 +302,26 @@
0x08557e88 <+1064>: cmpl $0x1,0x1c(%esp)
0x08557e8d <+1069>: lea (%esi,%ebx,4),%esi
0x08557e90 <+1072>: mov %esi,0x24(%esp)
0x08557e94 <+1076>: je 0x8558222 <vc1_pred_b_mv+1986>
0x08557e9a <+1082>: add %ebx,%ecx
0x08557e9c <+1084>: mov 0x20(%esp),%ebx
0x08557ea0 <+1088>: lea (%ebx,%ecx,4),%ebx
0x08557ea3 <+1091>: movswl (%ebx),%esi
0x08557ea6 <+1094>: mov %ebx,0x28(%esp)
0x08557eaa <+1098>: mov 0x18(%esp),%ebx
- 0x08557eae <+1102>: mov %esi,%edx
- 0x08557eb0 <+1104>: mov %esi,%ecx
- 0x08557eb2 <+1106>: mov 0x14(%esp),%esi
- 0x08557eb6 <+1110>: movswl (%ebx),%ebx
- 0x08557eb9 <+1113>: mov %ebx,0x14(%esp)
- 0x08557ebd <+1117>: mov 0x24(%esp),%ebx
+ 0x08557eae <+1102>: mov %esi,%ecx
+ 0x08557eb0 <+1104>: mov %esi,%edx
+ 0x08557eb2 <+1106>: movswl (%ebx),%ebx
+ 0x08557eb5 <+1109>: mov %ebx,0x14(%esp)
+ 0x08557eb9 <+1113>: mov 0x24(%esp),%ebx
+ 0x08557ebd <+1117>: mov 0x14(%esp),%esi
0x08557ec1 <+1121>: movswl (%ebx),%ebx
0x08557ec4 <+1124>: cmp %ecx,%ebx
0x08557ec6 <+1126>: cmovg %ebx,%edx
0x08557ec9 <+1129>: cmovg %ecx,%ebx
0x08557ecc <+1132>: cmp %esi,%ebx
0x08557ece <+1134>: cmovl %esi,%ebx
0x08557ed1 <+1137>: cmp %ebx,%edx
0x08557ed3 <+1139>: cmovg %ebx,%edx
0x08557ed6 <+1142>: mov 0x18(%esp),%esi
0x08557eda <+1146>: mov 0x28(%esp),%ebx
Hope that helps, Carl Eugen
More information about the ffmpeg-devel
mailing list