File tree Expand file tree Collapse file tree 2 files changed +26
-0
lines changed
Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -157,6 +157,14 @@ bool X86TargetInfo::initFeatureMap(
157157 if (getTriple ().getArch () == llvm::Triple::x86_64)
158158 setFeatureEnabled (Features, " sse2" , true );
159159
160+ // Enable SSE4.1 for Windows MSVC targets to support SIMD intrinsics like
161+ // _mm_mullo_epi32 without requiring explicit /arch: flags.
162+ if ((getTriple ().getArch () == llvm::Triple::x86_64 ||
163+ getTriple ().getArch () == llvm::Triple::x86) &&
164+ getTriple ().isWindowsMSVCEnvironment ()) {
165+ setFeatureEnabled (Features, " sse4.1" , true );
166+ }
167+
160168 using namespace llvm ::X86;
161169
162170 SmallVector<StringRef, 16 > CPUFeatures;
Original file line number Diff line number Diff line change 1+ // RUN: %clang_cc1 -triple x86_64-pc-windows-msvc -emit-llvm %s -o - | FileCheck %s
2+ // RUN: %clang_cc1 -triple i386-pc-windows-msvc -emit-llvm %s -o - | FileCheck %s
3+ // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-llvm %s -o - | FileCheck %s --check-prefix=LINUX
4+ // RUN: %clang_cc1 -triple i386-unknown-linux-gnu -emit-llvm %s -o - | FileCheck %s --check-prefix=LINUX
5+
6+ // This test verifies that SSE4.1 is enabled by default for Windows MSVC targets
7+ // to support SIMD intrinsics like _mm_mullo_epi32
8+
9+ #include <immintrin.h>
10+
11+ __m128i test_sse41 (void ) {
12+ __m128i a = _mm_set1_epi32 (5 );
13+ __m128i b = _mm_set1_epi32 (3 );
14+ return _mm_mullo_epi32 (a , b );
15+ }
16+
17+ // CHECK: "target-features"="+sse4.1"
18+ // LINUX-NOT: "target-features"="+sse4.1"
You can’t perform that action at this time.
0 commit comments