1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown | FileCheck %s
4 ; Check constant FP to signed integer conversions that overflow the integer type.
6 define i32 @constant_v2f64_to_i32() {
7 ; CHECK-LABEL: constant_v2f64_to_i32:
9 ; CHECK-NEXT: cvtsd2si {{.*}}(%rip), %eax
11 %r = call i32 @llvm.x86.sse2.cvtsd2si(<2 x double> <double 5.0e+09, double undef>)
15 define i32 @constant_v2f64_to_i32_round_to_zero() {
16 ; CHECK-LABEL: constant_v2f64_to_i32_round_to_zero:
18 ; CHECK-NEXT: cvttsd2si {{.*}}(%rip), %eax
20 %r = call i32 @llvm.x86.sse2.cvttsd2si(<2 x double> <double 5.0e+09, double undef>)
24 define i64 @constant_v2f64_to_i64() {
25 ; CHECK-LABEL: constant_v2f64_to_i64:
27 ; CHECK-NEXT: cvtsd2si {{.*}}(%rip), %rax
29 %r = call i64 @llvm.x86.sse2.cvtsd2si64(<2 x double> <double 5.0e+19, double undef>)
33 define i64 @constant_v2f64_to_i64_round_to_zero() {
34 ; CHECK-LABEL: constant_v2f64_to_i64_round_to_zero:
36 ; CHECK-NEXT: cvttsd2si {{.*}}(%rip), %rax
38 %r = call i64 @llvm.x86.sse2.cvttsd2si64(<2 x double> <double 5.0e+19, double undef>)
42 define <4 x i32> @constant_v2f64_to_v4i32() {
43 ; CHECK-LABEL: constant_v2f64_to_v4i32:
45 ; CHECK-NEXT: cvtpd2dq {{.*}}(%rip), %xmm0
47 %r = call <4 x i32> @llvm.x86.sse2.cvtpd2dq(<2 x double> <double 5.0e+09, double 5.0e+09>)
51 define <4 x i32> @constant_v2f64_to_v4i32_round_to_zero() {
52 ; CHECK-LABEL: constant_v2f64_to_v4i32_round_to_zero:
54 ; CHECK-NEXT: cvttpd2dq {{.*}}(%rip), %xmm0
56 %r = call <4 x i32> @llvm.x86.sse2.cvttpd2dq(<2 x double> <double 5.0e+09, double 5.0e+09>)
60 define i32 @constant_v4f32_to_i32() {
61 ; CHECK-LABEL: constant_v4f32_to_i32:
63 ; CHECK-NEXT: cvtss2si {{.*}}(%rip), %eax
65 %r = call i32 @llvm.x86.sse.cvtss2si(<4 x float> <float 5.0e+09, float undef, float undef, float undef>)
69 define i32 @constant_v4f32_to_i32_round_to_zero() {
70 ; CHECK-LABEL: constant_v4f32_to_i32_round_to_zero:
72 ; CHECK-NEXT: cvttss2si {{.*}}(%rip), %eax
74 %r = call i32 @llvm.x86.sse.cvttss2si(<4 x float> <float 5.0e+09, float undef, float undef, float undef>)
78 ; 9223372036854775808.0 = 0x8000000000000000
80 define i64 @constant_v4f32_to_i64() {
81 ; CHECK-LABEL: constant_v4f32_to_i64:
83 ; CHECK-NEXT: cvtss2si {{.*}}(%rip), %rax
85 %r = call i64 @llvm.x86.sse.cvtss2si64(<4 x float> <float 9223372036854775808.0, float undef, float undef, float undef>)
89 define i64 @constant_v4f32_to_i64_round_to_zero() {
90 ; CHECK-LABEL: constant_v4f32_to_i64_round_to_zero:
92 ; CHECK-NEXT: cvttss2si {{.*}}(%rip), %rax
94 %r = call i64 @llvm.x86.sse.cvttss2si64(<4 x float> <float 9223372036854775808.0, float undef, float undef, float undef>)
98 define <4 x i32> @constant_v4f32_to_v4i32() {
99 ; CHECK-LABEL: constant_v4f32_to_v4i32:
101 ; CHECK-NEXT: cvtps2dq {{.*}}(%rip), %xmm0
103 %r = call <4 x i32> @llvm.x86.sse2.cvtps2dq(<4 x float> <float 5.0e+09, float 5.0e+09, float 5.0e+09, float 5.0e+09>)
107 define <4 x i32> @constant_v4f32_to_v4i32_round_to_zero() {
108 ; CHECK-LABEL: constant_v4f32_to_v4i32_round_to_zero:
110 ; CHECK-NEXT: cvttps2dq {{.*}}(%rip), %xmm0
112 %r = call <4 x i32> @llvm.x86.sse2.cvttps2dq(<4 x float> <float 5.0e+09, float 5.0e+09, float 5.0e+09, float 5.0e+09>)
116 declare i32 @llvm.x86.sse2.cvtsd2si(<2 x double>)
117 declare i32 @llvm.x86.sse2.cvttsd2si(<2 x double>)
119 declare i64 @llvm.x86.sse2.cvtsd2si64(<2 x double>)
120 declare i64 @llvm.x86.sse2.cvttsd2si64(<2 x double>)
122 declare <4 x i32> @llvm.x86.sse2.cvtpd2dq(<2 x double>)
123 declare <4 x i32> @llvm.x86.sse2.cvttpd2dq(<2 x double>)
125 declare i32 @llvm.x86.sse.cvtss2si(<4 x float>)
126 declare i32 @llvm.x86.sse.cvttss2si(<4 x float>)
128 declare i64 @llvm.x86.sse.cvtss2si64(<4 x float>)
129 declare i64 @llvm.x86.sse.cvttss2si64(<4 x float>)
131 declare <4 x i32> @llvm.x86.sse2.cvtps2dq(<4 x float>)
132 declare <4 x i32> @llvm.x86.sse2.cvttps2dq(<4 x float>)