can be compiled on Linux

This commit is contained in:
Heng Li
2019-01-01 10:04:03 -05:00
parent 58f4210dea
commit f2f425890d
2 changed files with 11 additions and 13 deletions

View File

@@ -3,6 +3,7 @@ CPPFLAGS= -DHAVE_KALLOC
INCLUDES=
OBJS= kthread.o kalloc.o misc.o bseq.o sketch.o sdust.o options.o index.o chain.o align.o hit.o map.o format.o pe.o esterr.o splitidx.o ksw2_ll_sse.o
OBJS_SSE= ksw2_extz2_sse41.o ksw2_extd2_sse41.o ksw2_exts2_sse41.o ksw2_extz2_sse2.o ksw2_extd2_sse2.o ksw2_exts2_sse2.o
DISPATCH_FLAG=-msse4.1
PROG= minimap2
PROG_EXTRA= sdust minimap2-lite
LIBS= -lm -lz -lpthread
@@ -14,9 +15,11 @@ ifeq ($(avx2),)
OBJS+=$(OBJS_SSE) ksw2_dispatch.o
else
OBJS+=ksw2_extd2_avx2.o $(OBJS_SSE) ksw2_dispatch.o
DISPATCH_FLAG=-mavx2
endif
else
OBJS+=ksw2_extd2_avx512.o ksw2_extd2_avx2.o $(OBJS_SSE) ksw2_dispatch.o
DISPATCH_FLAG=-mavx512bw
endif
else # if sse2only is defined
OBJS+=ksw2_extz2_sse.o ksw2_extd2_sse.o ksw2_exts2_sse.o
@@ -84,13 +87,8 @@ ksw2_exts2_sse41.o:ksw2_exts2_sse.c ksw2.h kalloc.h
ksw2_exts2_sse2.o:ksw2_exts2_sse.c ksw2.h kalloc.h
$(CC) -c $(CFLAGS) -msse2 -mno-sse4.1 $(CPPFLAGS) -DKSW_CPU_DISPATCH -DKSW_SSE2_ONLY $(INCLUDES) $< -o $@
ifeq ($(avx2),)
ksw2_dispatch.o:ksw2_dispatch.c ksw2.h
$(CC) -c $(CFLAGS) -msse4.1 $(CPPFLAGS) -DKSW_CPU_DISPATCH $(INCLUDES) $< -o $@
else
ksw2_dispatch.o:ksw2_dispatch.c ksw2.h
$(CC) -c $(CFLAGS) -mavx2 $(CPPFLAGS) -DKSW_CPU_DISPATCH $(INCLUDES) $< -o $@
endif
$(CC) -c $(CFLAGS) $(DISPATCH_FLAG) $(CPPFLAGS) -DKSW_CPU_DISPATCH $(INCLUDES) $< -o $@
# NEON-specific targets on ARM

View File

@@ -166,8 +166,8 @@ void ksw_extd2_avx512(void *km, int qlen, const uint8_t *query, int tlen, const
__dp_code_block2; // save u[] and v[]; update a, b, a2 and b2
_mm512_store_si512(&x[t], _mm512_sub_epi8(_mm512_max_epi8(a, zero_), qe_));
_mm512_store_si512(&y[t], _mm512_sub_epi8(_mm512_max_epi8(b, zero_), qe_));
_mm512_store_si512(&x2[t], _mm512_sub_epi8(_mm512_max_epi8(a2, zero_), qe_));
_mm512_store_si512(&y2[t], _mm512_sub_epi8(_mm512_max_epi8(b2, zero_), qe_));
_mm512_store_si512(&x2[t], _mm512_sub_epi8(_mm512_max_epi8(a2, zero_), qe2_));
_mm512_store_si512(&y2[t], _mm512_sub_epi8(_mm512_max_epi8(b2, zero_), qe2_));
}
} else if (!(flag&KSW_EZ_RIGHT)) { // gap left-alignment
__m512i *pr = p + (size_t)r * n_col_ - st_;
@@ -190,9 +190,9 @@ void ksw_extd2_avx512(void *km, int qlen, const uint8_t *query, int tlen, const
d = _mm512_or_si512(d, _mm512_maskz_set1_epi8(_mm512_cmpgt_epi8_mask(b, zero_), 0x10)); // d = b > 0? 1<<4 : 0
_mm512_store_si512(&y[t], _mm512_sub_epi8(_mm512_max_epi8(b, zero_), qe_));
d = _mm512_or_si512(d, _mm512_maskz_set1_epi8(_mm512_cmpgt_epi8_mask(a2, zero_), 0x20)); // d = a2 > 0? 1<<5 : 0
_mm512_store_si512(&x2[t], _mm512_sub_epi8(_mm512_max_epi8(a2, zero_), qe_));
_mm512_store_si512(&x2[t], _mm512_sub_epi8(_mm512_max_epi8(a2, zero_), qe2_));
d = _mm512_or_si512(d, _mm512_maskz_set1_epi8(_mm512_cmpgt_epi8_mask(b2, zero_), 0x40)); // d = b2 > 0? 1<<6 : 0
_mm512_store_si512(&y2[t], _mm512_sub_epi8(_mm512_max_epi8(b2, zero_), qe_));
_mm512_store_si512(&y2[t], _mm512_sub_epi8(_mm512_max_epi8(b2, zero_), qe2_));
_mm512_store_si512(&pr[t], d);
}
} else { // gap right-alignment
@@ -201,7 +201,7 @@ void ksw_extd2_avx512(void *km, int qlen, const uint8_t *query, int tlen, const
for (t = st_; t <= en_; ++t) {
__m512i d, z, a, b, a2, b2, xt1, x2t1, vt1, ut, tmp;
__dp_code_block1;
d = _mm512_mask_blend_epi8(_mm512_cmpgt_epi8_mask(z, a), _mm512_setzero(), _mm512_set1_epi8(1));
d = _mm512_mask_blend_epi8(_mm512_cmpgt_epi8_mask(z, a), zero_, _mm512_set1_epi8(1));
z = _mm512_max_epi8(z, a);
d = _mm512_mask_blend_epi8(_mm512_cmpgt_epi8_mask(z, b), d, _mm512_set1_epi8(2));
z = _mm512_max_epi8(z, b);
@@ -216,9 +216,9 @@ void ksw_extd2_avx512(void *km, int qlen, const uint8_t *query, int tlen, const
d = _mm512_or_si512(d, _mm512_maskz_set1_epi8(_mm512_cmpge_epi8_mask(b, zero_), 0x10)); // d = b >= 0? 1<<4 : 0
_mm512_store_si512(&y[t], _mm512_sub_epi8(_mm512_max_epi8(b, zero_), qe_));
d = _mm512_or_si512(d, _mm512_maskz_set1_epi8(_mm512_cmpge_epi8_mask(a2, zero_), 0x20)); // d = a2 >= 0? 1<<5 : 0
_mm512_store_si512(&x2[t], _mm512_sub_epi8(_mm512_max_epi8(a2, zero_), qe_));
_mm512_store_si512(&x2[t], _mm512_sub_epi8(_mm512_max_epi8(a2, zero_), qe2_));
d = _mm512_or_si512(d, _mm512_maskz_set1_epi8(_mm512_cmpge_epi8_mask(b2, zero_), 0x40)); // d = b2 >= 0? 1<<6 : 0
_mm512_store_si512(&y2[t], _mm512_sub_epi8(_mm512_max_epi8(b2, zero_), qe_));
_mm512_store_si512(&y2[t], _mm512_sub_epi8(_mm512_max_epi8(b2, zero_), qe2_));
_mm512_store_si512(&pr[t], d);
}
}