From: Craig Topper Date: Fri, 30 Mar 2012 05:09:18 +0000 (+0000) Subject: Fix shuffle vector calculation for mm_permute_ps. Fixes PR 12401. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5629646711d9c748feb1043a7df2d5ca7d1bdfc4;p=clang Fix shuffle vector calculation for mm_permute_ps. Fixes PR 12401. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153724 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Headers/avxintrin.h b/lib/Headers/avxintrin.h index 6a2bee5d66..3fb1b1541a 100644 --- a/lib/Headers/avxintrin.h +++ b/lib/Headers/avxintrin.h @@ -274,7 +274,7 @@ _mm256_permutevar_ps(__m256 a, __m256i c) __m128 __A = (A); \ (__m128)__builtin_shufflevector((__v4sf)__A, (__v4sf) _mm_setzero_ps(), \ (C) & 0x3, ((C) & 0xc) >> 2, \ - ((C) & 0x30) >> 4, ((C) & 0xc0) >> 8); }) + ((C) & 0x30) >> 4, ((C) & 0xc0) >> 6); }) #define _mm256_permute_ps(A, C) __extension__ ({ \ __m256 __A = (A); \ diff --git a/test/CodeGen/avx-shuffle-builtins.c b/test/CodeGen/avx-shuffle-builtins.c index 18300bf3b6..538ae50c93 100644 --- a/test/CodeGen/avx-shuffle-builtins.c +++ b/test/CodeGen/avx-shuffle-builtins.c @@ -33,6 +33,13 @@ __m128 test_mm_permute_ps(__m128 a) { return _mm_permute_ps(a, 0x1b); } +// Test case for PR12401 +__m128 test_mm_permute_ps2(__m128 a) { + // Check if the mask is correct + // CHECK: shufflevector{{.*}} + return _mm_permute_ps(a, 0xe6); +} + __m256 test_mm256_permute_ps(__m256 a) { // Check if the mask is correct // CHECK: shufflevector{{.*}}