Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MS] Zero out ECX in __cpuid in intrin.h
Summary: Some CPUID leafs depend on the value of ECX as well as EAX, but we left it uninitialized. Originally reported as https://crbug.com/901547 Reviewers: craig.topper, hans Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D54171 llvm-svn: 346265
- Loading branch information
Showing
2 changed files
with
19 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// RUN: %clang_cc1 -ffreestanding -fms-extensions -fms-compatibility -fms-compatibility-version=17.00 \ | ||
// RUN: -triple i686-windows-msvc -emit-llvm %s -o - | FileCheck %s | ||
// RUN: %clang_cc1 -ffreestanding -fms-extensions -fms-compatibility -fms-compatibility-version=17.00 \ | ||
// RUN: -triple x86_64-windows-msvc -emit-llvm %s -o - | FileCheck %s | ||
|
||
// intrin.h needs size_t, but -ffreestanding prevents us from getting it from | ||
// stddef.h. Work around it with this typedef. | ||
typedef __SIZE_TYPE__ size_t; | ||
|
||
#include <intrin.h> | ||
|
||
void test__cpuid(int *info, int level) { | ||
__cpuid(info, level); | ||
} | ||
// CHECK-LABEL: define {{.*}} @test__cpuid(i32* %{{.*}}, i32 %{{.*}}) | ||
// CHECK: call { i32, i32, i32, i32 } asm "cpuid", | ||
// CHECK-SAME: "={ax},={bx},={cx},={dx},{ax},{cx},~{dirflag},~{fpsr},~{flags}" | ||
// CHECK-SAME: (i32 %{{.*}}, i32 0) |