]> git.sesse.net Git - x264/commitdiff
x86inc: Make cpuflag() and notcpuflag() return 0 or 1
authorHenrik Gramner <henrik@gramner.com>
Wed, 30 Sep 2015 21:17:00 +0000 (23:17 +0200)
committerHenrik Gramner <henrik@gramner.com>
Sun, 3 Jan 2016 16:15:47 +0000 (17:15 +0100)
Makes it possible to use them in arithmetic expressions.

common/x86/deblock-a.asm
common/x86/mc-a.asm
common/x86/mc-a2.asm
common/x86/quant-a.asm
common/x86/x86inc.asm

index 2c351c7d06576e4a46ed85883f1618e2e4687daf..a579e6da9e0f6b295a2fb0d3c0952a774df759d8 100644 (file)
@@ -1266,11 +1266,7 @@ cglobal deblock_h_luma, 5,9,0,0x60+16*WIN64
     lea    r8, [r1*3]
     lea    r6, [r0-4]
     lea    r5, [r0-4+r8]
-%if WIN64
-    %define pix_tmp rsp+0x30 ; shadow space + r4
-%else
-    %define pix_tmp rsp
-%endif
+    %xdefine pix_tmp rsp+0x30*WIN64 ; shadow space + r4
 
     ; transpose 6x16 -> tmp space
     TRANSPOSE6x8_MEM  PASS8ROWS(r6, r5, r1, r8), pix_tmp
index cd69c824a2e1ff165d4e100f18bc3c4e161436dd..7ce396f29ebadcb229792cb584c86bdbc65208bb 100644 (file)
@@ -1912,11 +1912,7 @@ ALIGN 4
 
 %macro MC_CHROMA_SSSE3 0
 cglobal mc_chroma
-%if cpuflag(avx2)
-    MC_CHROMA_START 9
-%else
-    MC_CHROMA_START 10
-%endif
+    MC_CHROMA_START 10-cpuflag(avx2)
     and       r5d, 7
     and       t2d, 7
     mov       t0d, r5d
index 727e9c8c51a06600f2fa960a1c50872d4383e413..c0a49e62c89036bf995601fc111e816a8ebf1b83 100644 (file)
@@ -2093,8 +2093,8 @@ MBTREE
 %endmacro
 
 ; FIXME: align loads to 16 bytes
-%macro MBTREE_AVX 1
-cglobal mbtree_propagate_cost, 6,6,%1
+%macro MBTREE_AVX 0
+cglobal mbtree_propagate_cost, 6,6,8-cpuflag(avx2)
     vbroadcastss m6, [r5]
     mov         r5d, r6m
     lea          r0, [r0+r5*2]
@@ -2165,9 +2165,9 @@ cglobal mbtree_propagate_cost, 6,6,%1
 %endmacro
 
 INIT_YMM avx
-MBTREE_AVX 8
+MBTREE_AVX
 INIT_YMM avx2
-MBTREE_AVX 7
+MBTREE_AVX
 
 %macro MBTREE_PROPAGATE_LIST 0
 ;-----------------------------------------------------------------------------
index 188f3c1780a78384ee426cfe15311067b52cdfe0..305ae26a31879f013ebaa1d1c7e68708b0f0e8f0 100644 (file)
@@ -841,14 +841,7 @@ DEQUANT_DC w, pmullw
 ;-----------------------------------------------------------------------------
 
 %macro OPTIMIZE_CHROMA_2x2_DC 0
-%assign %%regs 5
-%if cpuflag(sse4)
-    %assign %%regs %%regs-1
-%endif
-%if ARCH_X86_64 == 0
-    %assign %%regs %%regs+1      ; t0-t4 are volatile on x86-64
-%endif
-cglobal optimize_chroma_2x2_dc, 0,%%regs,7
+cglobal optimize_chroma_2x2_dc, 0,6-cpuflag(sse4),7
     movifnidn t0, r0mp
     movd      m2, r1m
     movq      m1, [t0]
index a0076ace4f1334f8ecee89d4ef559daa619f5550..c703e29b37870711c6d756755aac78e118c3c269 100644 (file)
@@ -761,8 +761,9 @@ BRANCH_INSTR jz, je, jnz, jne, jl, jle, jnl, jnle, jg, jge, jng, jnge, ja, jae,
 %assign cpuflags_bmi1     (1<<22)|cpuflags_lzcnt
 %assign cpuflags_bmi2     (1<<23)|cpuflags_bmi1
 
-%define    cpuflag(x) ((cpuflags & (cpuflags_ %+ x)) == (cpuflags_ %+ x))
-%define notcpuflag(x) ((cpuflags & (cpuflags_ %+ x)) != (cpuflags_ %+ x))
+; Returns a boolean value expressing whether or not the specified cpuflag is enabled.
+%define    cpuflag(x) (((((cpuflags & (cpuflags_ %+ x)) ^ (cpuflags_ %+ x)) - 1) >> 31) & 1)
+%define notcpuflag(x) (cpuflag(x) ^ 1)
 
 ; Takes an arbitrary number of cpuflags from the above list.
 ; All subsequent functions (up to the next INIT_CPUFLAGS) is built for the specified cpu.