Skip to content

Commit 53e6f62

Browse files
committed
[clang][x86] _mm_movpi64_epi64 - convert to shufflevector pattern instead of bitcasting to i64
Don't bitcast a v1i64 to i64 as constant expressions will struggle to handle this - convert to a shufflevector concat pattern like _mm_move_epi64 instead
1 parent 3c3f19c commit 53e6f62

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

clang/lib/Headers/emmintrin.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4627,7 +4627,7 @@ _mm_movepi64_pi64(__m128i __a) {
46274627
/// \returns A 128-bit integer vector. The lower 64 bits contain the value from
46284628
/// the operand. The upper 64 bits are assigned zeros.
46294629
static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_movpi64_epi64(__m64 __a) {
4630-
return __extension__(__m128i)(__v2di){(long long)__a, 0};
4630+
return __builtin_shufflevector((__v1di)__a, _mm_setzero_si64(), 0, 1);
46314631
}
46324632

46334633
/// Moves the lower 64 bits of a 128-bit integer vector to a 128-bit

clang/test/CodeGen/X86/sse2-builtins.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -878,9 +878,7 @@ TEST_CONSTEXPR(match_m64(_mm_movepi64_pi64((__m128i){8, -8}), 8ULL));
878878
__m128i test_mm_movpi64_epi64(__m64 A)
879879
{
880880
// CHECK-LABEL: test_mm_movpi64_epi64
881-
// CHECK: [[CAST:%.*]] = bitcast <1 x i64> %{{.*}} to i64
882-
// CHECK: [[INS:%.*]] = insertelement <2 x i64> poison, i64 [[CAST]], i32 0
883-
// CHECK: insertelement <2 x i64> [[INS]], i64 0, i32 1
881+
// CHECK: shufflevector <1 x i64> %{{.*}}, <1 x i64> %{{.*}}, <2 x i32> <i32 0, i32 1>
884882
return _mm_movpi64_epi64(A);
885883
}
886884

0 commit comments

Comments
 (0)