-
Notifications
You must be signed in to change notification settings - Fork 11.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[x86] Adding support for some missing intrinsics: _castf32_u32, _cas…
…tf64_u64, _castu32_f32, _castu64_f64 Summary: Adding support for some missing intrinsics: _castf32_u32, _castf64_u64, _castu32_f32, _castu64_f64 Reviewers: craig.topper, LuoYuanke, RKSimon, pengfei Reviewed By: RKSimon Subscribers: llvm-commits Patch by yubing (Bing Yu) Differential Revision: https://reviews.llvm.org/D67212 llvm-svn: 372802
- Loading branch information
1 parent
03f2a11
commit 1f3a15c
Showing
2 changed files
with
113 additions
and
0 deletions.
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,45 @@ | ||
// RUN: %clang_cc1 -ffreestanding %s -triple=x86_64-unknown-unknown -emit-llvm -o - -Wall -Werror | FileCheck %s -check-prefix=CHECK-64 | ||
// RUN: %clang_cc1 -ffreestanding %s -triple=i386-unknown-unknown -emit-llvm -o - -Wall -Werror | FileCheck %s -check-prefix=CHECK-32 | ||
|
||
#include <x86intrin.h> | ||
|
||
unsigned int test_castf32_u32 (float __A){ | ||
// CHECK-64-LABEL: @test_castf32_u32 | ||
// CHECK-64: call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 4 %{{.*}}, i8* align 4 %{{.*}}, i64 4, i1 false) | ||
// CHECK-64: %{{.*}} = load i32, i32* %{{.*}}, align 4 | ||
// CHECK-32-LABEL: @test_castf32_u32 | ||
// CHECK-32: call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 4 %{{.*}}, i8* align 4 %{{.*}}, i32 4, i1 false) | ||
// CHECK-32: %{{.*}} = load i32, i32* %{{.*}}, align 4 | ||
return _castf32_u32(__A); | ||
} | ||
|
||
unsigned long long test_castf64_u64 (double __A){ | ||
// CHECK-64-LABEL: @test_castf64_u64 | ||
// CHECK-64: call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 8 %{{.*}}, i8* align 8 %{{.*}}, i64 8, i1 false) | ||
// CHECK-64: %{{.*}} = load i64, i64* %{{.*}}, align 8 | ||
// CHECK-32-LABEL: @test_castf64_u64 | ||
// CHECK-32: call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 8 %{{.*}}, i8* align 8 %{{.*}}, i32 8, i1 false) | ||
// CHECK-32: %{{.*}} = load i64, i64* %{{.*}}, align 8 | ||
return _castf64_u64(__A); | ||
} | ||
|
||
float test_castu32_f32 (unsigned int __A){ | ||
// CHECK-64-LABEL: @test_castu32_f32 | ||
// CHECK-64: call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 4 %{{.*}}, i8* align 4 %{{.*}}, i64 4, i1 false) | ||
// CHECK-64: %{{.*}} = load float, float* %{{.*}}, align 4 | ||
// CHECK-32-LABEL: @test_castu32_f32 | ||
// CHECK-32: call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 4 %{{.*}}, i8* align 4 %{{.*}}, i32 4, i1 false) | ||
// CHECK-32: %{{.*}} = load float, float* %{{.*}}, align 4 | ||
return _castu32_f32(__A); | ||
} | ||
|
||
double test_castu64_f64 (unsigned long long __A){ | ||
// CHECK-64-LABEL: @test_castu64_f64 | ||
// CHECK-64: call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 8 %{{.*}}, i8* align 8 %{{.*}}, i64 8, i1 false) | ||
// CHECK-64: %{{.*}} = load double, double* %{{.*}}, align 8 | ||
// CHECK-32-LABEL: @test_castu64_f64 | ||
// CHECK-32: call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 8 %{{.*}}, i8* align 8 %{{.*}}, i32 8, i1 false) | ||
// CHECK-32: %{{.*}} = load double, double* %{{.*}}, align 8 | ||
return _castu64_f64(__A); | ||
} | ||
|