Merge from mainline (165734:167278).
[official-gcc/graphite-test-results.git] / gcc / testsuite / gcc.target / i386 / pr37191.c
blobb315ce072a4a8108e4614976de228f3df0332c31
1 /* { dg-do compile } */
2 /* { dg-options "-O1 -mmmx" } */
3 /* { dg-skip-if "no stdint" { vxworks_kernel } } */
5 #include <mmintrin.h>
6 #include <stddef.h>
7 #include <stdint.h>
9 extern const uint64_t ff_bone;
11 static inline void transpose4x4(uint8_t *dst, uint8_t *src, ptrdiff_t dst_stride, ptrdiff_t src_stride) {
12 __m64 row0 = _mm_cvtsi32_si64(*(unsigned*)(src + (0 * src_stride)));
13 __m64 row1 = _mm_cvtsi32_si64(*(unsigned*)(src + (1 * src_stride)));
14 __m64 row2 = _mm_cvtsi32_si64(*(unsigned*)(src + (2 * src_stride)));
15 __m64 row3 = _mm_cvtsi32_si64(*(unsigned*)(src + (3 * src_stride)));
16 __m64 tmp0 = _mm_unpacklo_pi8(row0, row1);
17 __m64 tmp1 = _mm_unpacklo_pi8(row2, row3);
18 __m64 row01 = _mm_unpacklo_pi16(tmp0, tmp1);
19 __m64 row23 = _mm_unpackhi_pi16(tmp0, tmp1);
20 *((unsigned*)(dst + (0 * dst_stride))) = _mm_cvtsi64_si32(row01);
21 *((unsigned*)(dst + (1 * dst_stride))) = _mm_cvtsi64_si32(_mm_unpackhi_pi32(row01, row01));
22 *((unsigned*)(dst + (2 * dst_stride))) = _mm_cvtsi64_si32(row23);
23 *((unsigned*)(dst + (3 * dst_stride))) = _mm_cvtsi64_si32(_mm_unpackhi_pi32(row23, row23));
26 static inline void h264_loop_filter_chroma_intra_mmx2(uint8_t *pix, int stride, int alpha1, int beta1)
28 asm volatile(
30 :: "r"(pix-2*stride), "r"(pix), "r"((long)stride),
31 "m"(alpha1), "m"(beta1), "m"(ff_bone)
35 void h264_h_loop_filter_chroma_intra_mmx2(uint8_t *pix, int stride, int alpha, int beta)
38 uint8_t trans[8*4] __attribute__ ((aligned (8)));
39 transpose4x4(trans, pix-2, 8, stride);
40 transpose4x4(trans+4, pix-2+4*stride, 8, stride);
41 h264_loop_filter_chroma_intra_mmx2(trans+2*8, 8, alpha-1, beta-1);
42 transpose4x4(pix-2, trans, stride, 8);
43 transpose4x4(pix-2+4*stride, trans+4, stride, 8);