Skip to content

Commit 4f88f6b

Browse files
nicomemfrob
authored andcommitted
clang/win: Add __readfsdword to intrin.h
When using __readfsdword(), clang used to warn that one has to include <intrin.h> -- no matter if that was already included or not. Now it only warns if it's not yet included. To verify that this was the only intrin with this problem, I ran: $ for f in $(grep intrin.h clang/include/clang/Basic/BuiltinsX86* | egrep -o '\([^,]+,' | egrep -o '[^(,]*'); do if ! grep -q $f clang/lib/Headers/intrin.h; then echo $f; fi; done This printed 9 more functions, but those are all in emmintrin.h, xsaveintrin.h (which are included by intrin.h based on /arch: flags). So this is indeed the only built-in that was missing in intrin.h. Fixes PR51188. Differential Revision: https://reviews.llvm.org/D109085
1 parent 606a715 commit 4f88f6b

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

clang/lib/Headers/intrin.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,9 @@ unsigned long __readcr8(void);
9797
unsigned int __readdr(unsigned int);
9898
#ifdef __i386__
9999
unsigned char __readfsbyte(unsigned long);
100-
unsigned __int64 __readfsqword(unsigned long);
101100
unsigned short __readfsword(unsigned long);
101+
unsigned long __readfsdword(unsigned long);
102+
unsigned __int64 __readfsqword(unsigned long);
102103
#endif
103104
unsigned __int64 __readmsr(unsigned long);
104105
unsigned __int64 __readpmc(unsigned long);

clang/test/CodeGen/X86/ms-x86-intrinsics.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
// RUN: %clang_cc1 -ffreestanding -fms-extensions -fms-compatibility -fms-compatibility-version=17.00 \
1+
// RUN: %clang_cc1 -Werror -ffreestanding -fms-extensions -fms-compatibility -fms-compatibility-version=17.00 \
22
// RUN: -triple i686--windows -Oz -emit-llvm %s -o - \
33
// RUN: | FileCheck %s -check-prefix=CHECK -check-prefix=CHECK-I386
4-
// RUN: %clang_cc1 -ffreestanding -fms-extensions -fms-compatibility -fms-compatibility-version=17.00 \
4+
// RUN: %clang_cc1 -Werror -ffreestanding -fms-extensions -fms-compatibility -fms-compatibility-version=17.00 \
55
// RUN: -triple x86_64--windows -Oz -emit-llvm %s -o - \
66
// RUN: | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-X64
77

8+
#include <intrin.h>
9+
810
#if defined(__i386__)
911
char test__readfsbyte(unsigned long Offset) {
1012
return __readfsbyte(++Offset);

0 commit comments

Comments
 (0)