]> git.sesse.net Git - x264/blob - tools/checkasm-32.asm
AQ now treats perfectly flat blocks as low energy, rather than retaining previous...
[x264] / tools / checkasm-32.asm
1 ;*****************************************************************************
2 ;* checkasm-32.asm
3 ;*****************************************************************************
4 ;* Copyright (C) 2008 Loren Merritt <lorenm@u.washington.edu>
5 ;*
6 ;* This program is free software; you can redistribute it and/or modify
7 ;* it under the terms of the GNU General Public License as published by
8 ;* the Free Software Foundation; either version 2 of the License, or
9 ;* (at your option) any later version.
10 ;*
11 ;* This program is distributed in the hope that it will be useful,
12 ;* but WITHOUT ANY WARRANTY; without even the implied warranty of
13 ;* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 ;* GNU General Public License for more details.
15 ;*
16 ;* You should have received a copy of the GNU General Public License
17 ;* along with this program; if not, write to the Free Software
18 ;* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
19 ;*****************************************************************************
20
21 %include "x86inc.asm"
22
23 SECTION_RODATA
24
25 error_message: db "failed to preserve register", 10, 0
26
27 SECTION .text
28
29 cextern printf
30
31 ; max number of args used by any x264 asm function.
32 %define max_args 8
33
34 ; just random numbers to reduce the chance of incidental match
35 %define n3 dword 0x6549315c
36 %define n4 dword 0xe02f3e23
37 %define n5 dword 0xb78d0d1d
38 %define n6 dword 0x33627ba7
39
40 ;-----------------------------------------------------------------------------
41 ; long x264_checkasm_call( long (*func)(), int *ok, ... )
42 ;-----------------------------------------------------------------------------
43 cglobal x264_checkasm_call, 1,7
44     mov  r3, n3
45     mov  r4, n4
46     mov  r5, n5
47     mov  r6, n6
48 %rep max_args
49     push dword [esp+24+max_args*4]
50 %endrep
51     call r0
52     add  esp, max_args*4
53     xor  r3, n3
54     xor  r4, n4
55     xor  r5, n5
56     xor  r6, n6
57     or   r3, r4
58     or   r5, r6
59     or   r3, r5
60     jz .ok
61     mov  r3, eax
62     picgetgot r1
63     lea  r1, [error_message GLOBAL]
64     push r1
65     xor  eax, eax
66     call printf
67     add  esp, 4
68     mov  r1, r1m
69     mov  dword [r1], 0
70     mov  eax, r3
71 .ok:
72     RET